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 2 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
21 changes: 21 additions & 0 deletions lib/VMwareWebService/MiqVimVm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ class MiqVimVm
VirtualLsiLogicSASController
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 +932,20 @@ def getDeviceKeysByBacking(backingFile, hardware = nil)
([nil, nil])
end # def getDeviceKeysByBacking

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

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