Added VM description field
This commit is contained in:
parent
945e6d6a3d
commit
82d2a412ab
@ -18,10 +18,11 @@ type CommonConfig struct {
|
||||
Password string `mapstructure:"remote_password"`
|
||||
HostIp string `mapstructure:"remote_host"`
|
||||
|
||||
VMName string `mapstructure:"vm_name"`
|
||||
SrName string `mapstructure:"sr_name"`
|
||||
FloppyFiles []string `mapstructure:"floppy_files"`
|
||||
NetworkName string `mapstructure:"network_name"`
|
||||
VMName string `mapstructure:"vm_name"`
|
||||
VMDescription string `mapstructure:"vm_description"`
|
||||
SrName string `mapstructure:"sr_name"`
|
||||
FloppyFiles []string `mapstructure:"floppy_files"`
|
||||
NetworkName string `mapstructure:"network_name"`
|
||||
|
||||
HostPortMin uint `mapstructure:"host_port_min"`
|
||||
HostPortMax uint `mapstructure:"host_port_max"`
|
||||
@ -135,6 +136,7 @@ func (c *CommonConfig) Prepare(t *packer.ConfigTemplate, pc *common.PackerConfig
|
||||
"remote_password": &c.Password,
|
||||
"remote_host": &c.HostIp,
|
||||
"vm_name": &c.VMName,
|
||||
"vm_description": &c.VMDescription,
|
||||
"sr_name": &c.SrName,
|
||||
"shutdown_command": &c.ShutdownCommand,
|
||||
"boot_wait": &c.RawBootWait,
|
||||
|
@ -62,6 +62,12 @@ func (self *stepCreateInstance) Run(state multistep.StateBag) multistep.StepActi
|
||||
return multistep.ActionHalt
|
||||
}
|
||||
|
||||
instance.SetDescription(config.VMDescription)
|
||||
if err != nil {
|
||||
ui.Error(fmt.Sprintf("Error setting VM description: %s", err.Error()))
|
||||
return multistep.ActionHalt
|
||||
}
|
||||
|
||||
// Create VDI for the instance
|
||||
|
||||
sr, err := config.GetSR(client)
|
||||
|
@ -140,8 +140,14 @@ func (self *stepImportInstance) Run(state multistep.StateBag) multistep.StepActi
|
||||
ui.Error(fmt.Sprintf("Unable to get VM UUID: %s", err.Error()))
|
||||
return multistep.ActionHalt
|
||||
}
|
||||
|
||||
state.Put("instance_uuid", instanceId)
|
||||
|
||||
instance.SetDescription(config.VMDescription)
|
||||
if err != nil {
|
||||
ui.Error(fmt.Sprintf("Error setting VM description: %s", err.Error()))
|
||||
return multistep.ActionHalt
|
||||
}
|
||||
|
||||
ui.Say(fmt.Sprintf("Imported instance '%s'", instanceId))
|
||||
|
||||
return multistep.ActionContinue
|
||||
|
@ -204,6 +204,9 @@ each category, the available options are alphabetized and described.
|
||||
* `tools_iso_name` (string) - The name of the XenServer Tools ISO. Defaults to
|
||||
"xs-tools.iso".
|
||||
|
||||
* `vm_description` (string) - The description of the new virtual
|
||||
machine. By default this is the empty string.
|
||||
|
||||
* `vm_name` (string) - This is the name of the new virtual
|
||||
machine, without the file extension. By default this is
|
||||
"packer-BUILDNAME-TIMESTAMP", where "BUILDNAME" is the name of the build.
|
||||
|
@ -20,7 +20,8 @@
|
||||
"ssh_username": "root",
|
||||
"ssh_password": "vmpassword",
|
||||
"ssh_wait_timeout": "10000s",
|
||||
"vm_name": "packer-centos-6.6-x86_64"
|
||||
"vm_name": "packer-centos-6.6-x86_64",
|
||||
"vm_description": "Build time: {{isotime}}"
|
||||
}
|
||||
],
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user