Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconfigure VM: Add / Remove Network Adapters #25

Merged
merged 3 commits into from
Jan 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions lib/VMwareWebService/MiqVimVm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ class MiqVimVm
VIRTUAL_SCSI_CONTROLLERS = %w( VirtualBusLogicController
VirtualLsiLogicController
VirtualLsiLogicSASController
ParaVirtualSCSIController
).freeze
ParaVirtualSCSIController ).freeze
VIRTUAL_NICS = %w( VirtualE1000
VirtualE1000e
VirtualPCNet32
VirtualVmxnet
VirtualVmxnet2
VirtualVmxnet3 ).freeze
MAX_SCSI_DEVICES = 15
MAX_SCSI_CONTROLLERS = 4

Expand Down Expand Up @@ -925,6 +930,20 @@ def getDeviceKeysByBacking(backingFile, hardware = nil)
([nil, nil])
end # def getDeviceKeysByBacking

def getDeviceKeysByLabel(device_label)
hardware = getHardware
hardware["device"].to_a.each do |dev|
next unless VIRTUAL_NICS.include?(dev.xsiType)
next unless dev["deviceInfo"]["label"] == device_label
controller_key = dev["controllerKey"]
key = dev["key"]
unit_number = dev["unitNumber"]
return controller_key, key, unit_number
end
# controller_key, key, unit_number
[nil, nil, nil]
end

#####################
# Miq Alarm methods.
#####################
Expand Down