Adding static memory config to the template.

Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
This commit is contained in:
Rob Dobson 2014-11-21 13:48:57 +00:00
parent 74cfea407d
commit 1daab4ef1a
2 changed files with 7 additions and 1 deletions

View File

@ -26,6 +26,7 @@ type config struct {
IsoUrl string `mapstructure:"iso_url"`
InstanceName string `mapstructure:"instance_name"`
InstanceMemory string `mapstructure:"instance_memory"`
RootDiskSize string `mapstructure:"root_disk_size"`
CloneTemplate string `mapstructure:"clone_template"`
IsoName string `mapstructure:"iso_name"`
@ -125,6 +126,7 @@ func (self *Builder) Prepare (raws ...interface{}) (params []string, retErr erro
"host_ip": &self.config.HostIp,
"iso_url": &self.config.IsoUrl,
"instance_name": &self.config.InstanceName,
"instance_memory": &self.config.InstanceMemory,
"root_disk_size": &self.config.RootDiskSize,
"clone_template": &self.config.CloneTemplate,
"iso_name": &self.config.IsoName,
@ -212,6 +214,10 @@ func (self *Builder) Prepare (raws ...interface{}) (params []string, retErr erro
errs, errors.New("An insatnce name must be specified."))
}
if self.config.InstanceMemory == "" {
self.config.InstanceMemory = "1024000000"
}
if self.config.RootDiskSize == "" {
errs = packer.MultiErrorAppend(
errs, errors.New("A root disk size must be specified."))

View File

@ -39,7 +39,7 @@ func (self *stepCreateInstance) Run(state multistep.StateBag) multistep.StepActi
// Clone that VM template
instance, _ := template.Clone(config.InstanceName)
instance.SetIsATemplate(false)
instance.SetStaticMemoryRange("1024000000", "1024000000")
instance.SetStaticMemoryRange(config.InstanceMemory, config.InstanceMemory)
instance.SetPlatform(config.PlatformArgs)
// Create VDI for the instance