Add 'usb_controller' option
This commit is contained in:
parent
39f1e4a394
commit
ba06b00e70
27
driver/vm.go
27
driver/vm.go
|
@ -41,15 +41,16 @@ type CreateConfig struct {
|
|||
DiskThinProvisioned bool
|
||||
DiskControllerType string // example: "scsi", "pvscsi"
|
||||
|
||||
Annotation string
|
||||
Name string
|
||||
Folder string
|
||||
Host string
|
||||
ResourcePool string
|
||||
Datastore string
|
||||
GuestOS string // example: otherGuest
|
||||
Network string // "" for default network
|
||||
NetworkCard string // example: vmxnet3
|
||||
Annotation string
|
||||
Name string
|
||||
Folder string
|
||||
Host string
|
||||
ResourcePool string
|
||||
Datastore string
|
||||
GuestOS string // example: otherGuest
|
||||
Network string // "" for default network
|
||||
NetworkCard string // example: vmxnet3
|
||||
USBController bool
|
||||
}
|
||||
|
||||
func (d *Driver) NewVM(ref *types.ManagedObjectReference) *VirtualMachine {
|
||||
|
@ -108,6 +109,14 @@ func (d *Driver) CreateVM(config *CreateConfig) (*VirtualMachine, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if config.USBController {
|
||||
t := true
|
||||
usb := &types.VirtualUSBController{
|
||||
EhciEnabled: &t,
|
||||
}
|
||||
devices = append(devices, usb)
|
||||
}
|
||||
|
||||
createSpec.DeviceChange, err = devices.ConfigSpec(types.VirtualDeviceConfigSpecOperationAdd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -14,14 +14,15 @@ type CreateConfig struct {
|
|||
DiskThinProvisioned bool `mapstructure:"disk_thin_provisioned"`
|
||||
DiskControllerType string `mapstructure:"disk_controller_type"`
|
||||
|
||||
VMName string `mapstructure:"vm_name"`
|
||||
Folder string `mapstructure:"folder"`
|
||||
Host string `mapstructure:"host"`
|
||||
ResourcePool string `mapstructure:"resource_pool"`
|
||||
Datastore string `mapstructure:"datastore"`
|
||||
GuestOSType string `mapstructure:"guest_os_type"`
|
||||
Network string `mapstructure:"network"`
|
||||
NetworkCard string `mapstructure:"network_card"`
|
||||
VMName string `mapstructure:"vm_name"`
|
||||
Folder string `mapstructure:"folder"`
|
||||
Host string `mapstructure:"host"`
|
||||
ResourcePool string `mapstructure:"resource_pool"`
|
||||
Datastore string `mapstructure:"datastore"`
|
||||
GuestOSType string `mapstructure:"guest_os_type"`
|
||||
Network string `mapstructure:"network"`
|
||||
NetworkCard string `mapstructure:"network_card"`
|
||||
USBController bool `mapstructure:"usb_controller"`
|
||||
}
|
||||
|
||||
func (c *CreateConfig) Prepare() []error {
|
||||
|
@ -79,6 +80,7 @@ func (s *StepCreateVM) Run(state multistep.StateBag) multistep.StepAction {
|
|||
GuestOS: s.Config.GuestOSType,
|
||||
Network: s.Config.Network,
|
||||
NetworkCard: s.Config.NetworkCard,
|
||||
USBController: s.Config.USBController,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue