The call to create_nic_backing requires the datacenter (silently) to be provided, otherwise the network will not be found an a nil error will be thrown from #list_container_view.
def update_vm_interface(vmid, options = {})
raise ArgumentError, 'instance id is a required parameter' unless vmid
interface = get_interface_from_options(vmid, options)
raw_interface = get_raw_interface(vmid, key: interface.key)
if options[:network]
interface.network = options[:network]
backing = create_nic_backing(interface, {})
raw_interface.backing = backing
end
apply_options_to_raw_interface(raw_interface, options)
spec = {
operation: :edit,
device: raw_interface
}
vm_reconfig_hardware('instance_uuid' => vmid, 'hardware_spec' => { 'deviceChange' => [spec] })
end
The current implementation of
#update_vm_interface
at https://github.com/fog/fog-vsphere/blob/master/lib/fog/vsphere/requests/compute/modify_vm_interface.rb#L19 is not functioning.The call to
create_nic_backing
requires the datacenter (silently) to be provided, otherwise the network will not be found an a nil error will be thrown from#list_container_view
.