Add 'usb_controller' option
This commit is contained in:
parent
39f1e4a394
commit
ba06b00e70
|
@ -50,6 +50,7 @@ type CreateConfig struct {
|
|||
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
|
||||
|
|
|
@ -22,6 +22,7 @@ type CreateConfig struct {
|
|||
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