diff --git a/README.md b/README.md index d3ecc43..934c10e 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,8 @@ A brief explanation of what the config parameters mean: * `ssh_username` - the username set by the installer for the instance. * `ssh_password` - the password set by the installer for the instance. * `boot_command` - a list of commands to be sent to the instance over VNC. + * `vm_other_config` - a map of string to string for setting vm's other-config. + * `network_names` - a list of network name for the VIFs to connect with. Note, the `http_directory` parameter is only required if you want Packer to serve up files over HTTP. In this example, the templated variables diff --git a/builder/xenserver/common/common_config.go b/builder/xenserver/common/common_config.go index f505705..1de91b7 100644 --- a/builder/xenserver/common/common_config.go +++ b/builder/xenserver/common/common_config.go @@ -18,11 +18,11 @@ type CommonConfig struct { Password string `mapstructure:"remote_password"` HostIp string `mapstructure:"remote_host"` - VMName string `mapstructure:"vm_name"` - VMDescription string `mapstructure:"vm_description"` - SrName string `mapstructure:"sr_name"` - FloppyFiles []string `mapstructure:"floppy_files"` - NetworkNames map[string]string `mapstructure:"network_names"` + VMName string `mapstructure:"vm_name"` + VMDescription string `mapstructure:"vm_description"` + SrName string `mapstructure:"sr_name"` + FloppyFiles []string `mapstructure:"floppy_files"` + NetworkNames []string `mapstructure:"network_names"` HostPortMin uint `mapstructure:"host_port_min"` HostPortMax uint `mapstructure:"host_port_max"` diff --git a/builder/xenserver/xva/step_import_instance.go b/builder/xenserver/xva/step_import_instance.go index 68b284c..0a734b7 100644 --- a/builder/xenserver/xva/step_import_instance.go +++ b/builder/xenserver/xva/step_import_instance.go @@ -53,88 +53,6 @@ func (self *stepImportInstance) Run(state multistep.StateBag) multistep.StepActi instance := xsclient.VM(*result) - /* - err = instance.SetStaticMemoryRange(config.VMMemory*1024*1024, config.VMMemory*1024*1024) - if err != nil { - ui.Error(fmt.Sprintf("Error setting VM memory=%d: %s", config.VMMemory*1024*1024, err.Error())) - return multistep.ActionHalt - } - - instance.SetPlatform(config.PlatformArgs) - if err != nil { - ui.Error(fmt.Sprintf("Error setting VM platform: %s", err.Error())) - return multistep.ActionHalt - } - - // Connect Network - - var network *xscommon.Network - - if config.NetworkName == "" { - // No network has be specified. Use the management interface - network = new(xscommon.Network) - network.Ref = "" - network.Client = &client - - pifs, err := client.GetPIFs() - - if err != nil { - ui.Error(fmt.Sprintf("Error getting PIFs: %s", err.Error())) - return multistep.ActionHalt - } - - for _, pif := range pifs { - pif_rec, err := pif.GetRecord() - - if err != nil { - ui.Error(fmt.Sprintf("Error getting PIF record: %s", err.Error())) - return multistep.ActionHalt - } - - if pif_rec["management"].(bool) { - network.Ref = pif_rec["network"].(string) - } - - } - - if network.Ref == "" { - ui.Error("Error: couldn't find management network. Aborting.") - return multistep.ActionHalt - } - - } else { - // Look up the network by it's name label - - networks, err := client.GetNetworkByNameLabel(config.NetworkName) - - if err != nil { - ui.Error(fmt.Sprintf("Error occured getting Network by name-label: %s", err.Error())) - return multistep.ActionHalt - } - - switch { - case len(networks) == 0: - ui.Error(fmt.Sprintf("Couldn't find a network with the specified name-label '%s'. Aborting.", config.NetworkName)) - return multistep.ActionHalt - case len(networks) > 1: - ui.Error(fmt.Sprintf("Found more than one network with the name '%s'. The name must be unique. Aborting.", config.NetworkName)) - return multistep.ActionHalt - } - - network = networks[0] - } - - if err != nil { - ui.Say(err.Error()) - } - _, err = instance.ConnectNetwork(network, "0") - - if err != nil { - ui.Say(err.Error()) - } - - */ - instanceId, err := instance.GetUuid() if err != nil { ui.Error(fmt.Sprintf("Unable to get VM UUID: %s", err.Error()))