vmware_web_service 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d49e55eae3c01b8a0ebcee6bc65ecd844d85873
4
- data.tar.gz: f54bfb9418377883d6cf70feeac750f915501f79
3
+ metadata.gz: f815f44db746241670dcf6aeccceb7ba06e5239f
4
+ data.tar.gz: ce92064c9ad563462157886144c386e79c07049d
5
5
  SHA512:
6
- metadata.gz: 5be8f46486ae02c49a400ac2578c490ea9f50111fd2f5f083f7d2c03cd1f5a5f0c728d1f2fc573776e66b23d13e8be95536b10286dfd57ed9c43a8a6d90b51c8
7
- data.tar.gz: 9c37afe5a3abd34a4163aa7459a96bf63bff558543d9cb7eac5b3f547225229336aaf2075748f009612b837cc212a736e448a889975b261e696c2ac001d4b260
6
+ metadata.gz: a04a387bb2cf576b16aa39ed3bddccdd161f63ec23b80e69164539970175b28b912855042d3be7e19fa66400c6a4c5867f228867b686716c7b07d61bab2d21dc
7
+ data.tar.gz: 0db6b7d78d2c31c63ed1a3b8542551cc0bfdd5b9fc63f8880d8760922e43a78becf7932a5a08430729c6bf8ba9d16f85a0127a602ad00c4f1ff6c87c2d75b915
@@ -21,8 +21,13 @@ class MiqVimVm
21
21
  VIRTUAL_SCSI_CONTROLLERS = %w( VirtualBusLogicController
22
22
  VirtualLsiLogicController
23
23
  VirtualLsiLogicSASController
24
- ParaVirtualSCSIController
25
- ).freeze
24
+ ParaVirtualSCSIController ).freeze
25
+ VIRTUAL_NICS = %w( VirtualE1000
26
+ VirtualE1000e
27
+ VirtualPCNet32
28
+ VirtualVmxnet
29
+ VirtualVmxnet2
30
+ VirtualVmxnet3 ).freeze
26
31
  MAX_SCSI_DEVICES = 15
27
32
  MAX_SCSI_CONTROLLERS = 4
28
33
 
@@ -915,15 +920,39 @@ class MiqVimVm
915
920
  # associated with the given backing file.
916
921
  #
917
922
  def getDeviceKeysByBacking(backingFile, hardware = nil)
918
- hardware ||= getHardware()
923
+ dev = getDeviceByBacking(backingFile, hardware)
924
+ return [nil, nil] if dev.nil?
925
+ [dev["controllerKey"], dev["key"]]
926
+ end
927
+
928
+ #
929
+ # Returns the device details
930
+ # associated with the given backing file.
931
+ #
932
+ def getDeviceByBacking(backingFile, hardware = nil)
933
+ hardware ||= getHardware
919
934
 
920
935
  hardware["device"].to_a.each do |dev|
921
936
  next if dev.xsiType != "VirtualDisk"
922
937
  next if dev["backing"]["fileName"] != backingFile
923
- return([dev["controllerKey"], dev["key"]])
938
+ return dev
924
939
  end
925
- ([nil, nil])
926
- end # def getDeviceKeysByBacking
940
+ nil
941
+ end
942
+
943
+ def getDeviceKeysByLabel(device_label)
944
+ hardware = getHardware
945
+ hardware["device"].to_a.each do |dev|
946
+ next unless VIRTUAL_NICS.include?(dev.xsiType)
947
+ next unless dev["deviceInfo"]["label"] == device_label
948
+ controller_key = dev["controllerKey"]
949
+ key = dev["key"]
950
+ unit_number = dev["unitNumber"]
951
+ return controller_key, key, unit_number
952
+ end
953
+ # controller_key, key, unit_number
954
+ [nil, nil, nil]
955
+ end
927
956
 
928
957
  #####################
929
958
  # Miq Alarm methods.
@@ -1,3 +1,3 @@
1
1
  module VMwareWebService
2
- VERSION = '0.2.4'.freeze
2
+ VERSION = '0.2.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmware_web_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - ManageIQ Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-23 00:00:00.000000000 Z
11
+ date: 2018-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport