vmware_web_service 1.0.8 → 2.1.0

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
  SHA256:
3
- metadata.gz: b73de1ee5f2d243a464a790d35752220e182e6f0fbe888707a35b2b5183c44f3
4
- data.tar.gz: 64f8c7d2b6643806068b2c4042fed7390f5905f59536e160f5633672b3eba215
3
+ metadata.gz: 4d5a7058d7db794775f6a27766ae62dc2e17b6334d3d69c3dce8dc73df888906
4
+ data.tar.gz: 2b1fc2a2d07776d19c995cdc56e271d9bf14303534960c5f60a2d9b3f85b7429
5
5
  SHA512:
6
- metadata.gz: 16a8effd7ef4615e017c543fc662f9a7eda22a74089f6a02518bc7a47687102d13e6fe3955c8b6b82d8b000c4db48ca0b176231f0d0e825f19be922370eb85cd
7
- data.tar.gz: 52bf388bc55afb1343e9d276812ee20b99c2d5b9e4250e62550b68ab73e150367ee3c43a3a46382a2ee65bf79577f8e52f4f2b94b89ca047c9c0759ad1d76594
6
+ metadata.gz: f6a4bfefe875d792e2020d087cb913f2a418515ebb5a05a8f60814781227405b58985bd33e091d856ac28777658675aa8507a57b4975ff87d48a3966b0255c9b
7
+ data.tar.gz: 93543cf64a0c43a43ea82b585418f9e95cb4e4c2f367b3aac5969b753b47a75799520734951aa38731b0a2f2f9dbbf3b69b72cae7c402aadb03313e15e3766eb
@@ -1,7 +1,6 @@
1
1
  require 'sync'
2
2
 
3
3
  require 'VMwareWebService/MiqVimInventory'
4
- require 'VMwareWebService/MiqPbmInventory'
5
4
  require 'VMwareWebService/MiqVimVm'
6
5
  require 'VMwareWebService/MiqVimVdlMod'
7
6
  require 'VMwareWebService/MiqVimFolder'
@@ -17,12 +16,11 @@ require 'VMwareWebService/MiqVimUpdate'
17
16
 
18
17
  class MiqVim < MiqVimInventory
19
18
  include MiqVimVdlConnectionMod
20
- include MiqPbmInventory
21
19
  include MiqVimUpdate
22
20
 
23
21
  attr_reader :updateThread, :monitor_updates
24
22
 
25
- # @param server [String] DNS name or IP address of the vCenter Server
23
+ # @param server [String] DNS name or IP address of the vCenter Server
26
24
  # @param username [String] Username to connect to the vCenter Server
27
25
  # @param password [String] Password to connect to the vCenter Server
28
26
  # @param cacheScope [Symbol] A pre-defined set of properties to cache (default: nil)
@@ -32,10 +30,11 @@ class MiqVim < MiqVimInventory
32
30
  # @param notifyMethod [Method] A optional method to call for each update (default: nil)
33
31
  # @param maxWait [Integer] How many seconds to wait before breaking out of WaitForUpdates (default: 60)
34
32
  # @param maxObjects [Integer] How many objects to return from each WaitForUpdates page (default: 250)
35
- def initialize(server, username, password, cacheScope = nil, monitor_updates = false, preLoad = false, debugUpdates = false, notifyMethod = nil, maxWait = 60, maxObjects = 250)
33
+ def initialize(server, username, password, cacheScope = nil, monitor_updates = nil, preLoad = nil, debugUpdates = false, notifyMethod = nil, maxWait = 60, maxObjects = 250)
36
34
  super(server, username, password, cacheScope)
37
35
 
38
- pbm_initialize(self)
36
+ monitor_updates = self.class.monitor_updates if monitor_updates.nil?
37
+ preLoad = self.class.pre_load if preLoad.nil?
39
38
 
40
39
  @monitor_updates = monitor_updates
41
40
  @updateMonitorReady = false
@@ -48,6 +47,25 @@ class MiqVim < MiqVimInventory
48
47
  start_monitor_updates_thread(preLoad) if @monitor_updates
49
48
  end
50
49
 
50
+ @@monitor_updates = false
51
+ @@pre_load = false
52
+
53
+ def self.monitor_updates
54
+ @@monitor_updates
55
+ end
56
+
57
+ def self.monitor_updates=(val)
58
+ @@monitor_updates = val
59
+ end
60
+
61
+ def self.pre_load
62
+ @@pre_load
63
+ end
64
+
65
+ def self.pre_load=(val)
66
+ @@pre_load = val
67
+ end
68
+
51
69
  def getVimVm(path)
52
70
  $vim_log.info "MiqVimMod.getVimVm: called"
53
71
  miqVimVm = nil
@@ -34,7 +34,7 @@ class MiqVimCustomizationSpecManager
34
34
  specs = info
35
35
  return [] if specs.nil?
36
36
 
37
- specs = Array.wrap(specs.dup)
37
+ specs = Array(specs.dup)
38
38
  specs.each { |s| s['spec'] = getCustomizationSpec(s['name'].to_s).spec }
39
39
  specs
40
40
  end
@@ -909,7 +909,7 @@ class MiqVimVm
909
909
  scsi_controllers.sort_by { |s| s["key"].to_i }.each do |scsi_controller|
910
910
  # Skip if all controller units are populated
911
911
  # Bus has 16 units, controller takes up 1 unit itself
912
- device = Array.wrap(scsi_controller["device"])
912
+ device = Array(scsi_controller["device"])
913
913
  next if device.count >= MAX_SCSI_DEVICES
914
914
 
915
915
  # We've found the lowest scsi controller with an available unit
@@ -1,3 +1,3 @@
1
1
  module VMwareWebService
2
- VERSION = '1.0.8'.freeze
2
+ VERSION = '2.1.0'.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: 1.0.8
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ManageIQ Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-06 00:00:00.000000000 Z
11
+ date: 2021-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: 5.2.4.3
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.3'
22
+ version: '6.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '5.0'
29
+ version: 5.2.4.3
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.3'
32
+ version: '6.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: ffi-vix_disk_lib
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -92,20 +92,6 @@ dependencies:
92
92
  - - "<"
93
93
  - !ruby/object:Gem::Version
94
94
  version: '5'
95
- - !ruby/object:Gem::Dependency
96
- name: rbvmomi
97
- requirement: !ruby/object:Gem::Requirement
98
- requirements:
99
- - - "~>"
100
- - !ruby/object:Gem::Version
101
- version: '2.0'
102
- type: :runtime
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- requirements:
106
- - - "~>"
107
- - !ruby/object:Gem::Version
108
- version: '2.0'
109
95
  - !ruby/object:Gem::Dependency
110
96
  name: bundler
111
97
  requirement: !ruby/object:Gem::Requirement
@@ -221,7 +207,6 @@ files:
221
207
  - lib/VMwareWebService/MiqHostSnmpSystem.rb
222
208
  - lib/VMwareWebService/MiqHostStorageSystem.rb
223
209
  - lib/VMwareWebService/MiqHostVirtualNicManager.rb
224
- - lib/VMwareWebService/MiqPbmInventory.rb
225
210
  - lib/VMwareWebService/MiqVim.rb
226
211
  - lib/VMwareWebService/MiqVimAlarmManager.rb
227
212
  - lib/VMwareWebService/MiqVimBroker.rb
@@ -242,7 +227,6 @@ files:
242
227
  - lib/VMwareWebService/MiqVimUpdate.rb
243
228
  - lib/VMwareWebService/MiqVimVdlMod.rb
244
229
  - lib/VMwareWebService/MiqVimVm.rb
245
- - lib/VMwareWebService/PbmService.rb
246
230
  - lib/VMwareWebService/VimConstants.rb
247
231
  - lib/VMwareWebService/VimMappingRegistry.rb
248
232
  - lib/VMwareWebService/VimPropMaps.rb
@@ -4476,7 +4460,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
4476
4460
  - !ruby/object:Gem::Version
4477
4461
  version: '0'
4478
4462
  requirements: []
4479
- rubygems_version: 3.1.3
4463
+ rubygems_version: 3.2.0.rc.2
4480
4464
  signing_key:
4481
4465
  specification_version: 4
4482
4466
  summary: A ruby interface to Vmware Web Services SDK
@@ -1,67 +0,0 @@
1
- require 'VMwareWebService/PbmService'
2
-
3
- module MiqPbmInventory
4
- def pbm_initialize(vim)
5
- begin
6
- # SPBM endpoint was introduced in vSphere Management SDK 5.5 and
7
- # isn't supported by Hosts (only vCenters)
8
- @pbm_svc = PbmService.new(vim) if apiVersion >= '5.5' && isVirtualCenter
9
- rescue => err
10
- $vim_log.warn("MiqPbmInventory: Failed to connect to SPBM endpoint: #{err}")
11
- end
12
- end
13
-
14
- def pbmProfilesByUid(_selspec = nil)
15
- profiles = {}
16
- return profiles if @pbm_svc.nil?
17
-
18
- begin
19
- profile_ids = @pbm_svc.queryProfile
20
- @pbm_svc.retrieveContent(profile_ids).to_a.each do |pbm_profile|
21
- uid = pbm_profile.profileId.uniqueId
22
-
23
- profiles[uid] = pbm_profile
24
- end
25
- rescue => err
26
- $vim_log.warn("MiqPbmInventory: pbmProfilesByUid: #{err}")
27
- end
28
-
29
- profiles
30
- end
31
-
32
- def pbmQueryAssociatedEntity(profile_ids)
33
- assoc_entities = {}
34
- return assoc_entities if @pbm_svc.nil?
35
-
36
- begin
37
- profile_ids.each do |profile_id|
38
- # If a string was passed in create a PbmProfileId object
39
- profile_id = RbVmomi::PBM::PbmProfileId(:uniqueId => profile_id) if profile_id.kind_of?(String)
40
-
41
- assoc_entities[profile_id.uniqueId] = @pbm_svc.queryAssociatedEntity(profile_id)
42
- end
43
- rescue => err
44
- $vim_log.warn("MiqPbmInventory: pbmQueryAssociatedEntity: #{err}")
45
- end
46
-
47
- assoc_entities
48
- end
49
-
50
- def pbmQueryMatchingHub(profile_ids)
51
- hubs = {}
52
- return hubs if @pbm_svc.nil?
53
-
54
- begin
55
- profile_ids.each do |profile_id|
56
- # If a string was passed in create a PbmProfileId object
57
- profile_id = RbVmomi::PBM::PbmProfileId(:uniqueId => profile_id) if profile_id.kind_of?(String)
58
-
59
- hubs[profile_id.uniqueId] = @pbm_svc.queryMatchingHub(profile_id)
60
- end
61
- rescue => err
62
- $vim_log.warn("MiqPbmInventory: pbmQueryMatchingHub: #{err}")
63
- end
64
-
65
- hubs
66
- end
67
- end
@@ -1,36 +0,0 @@
1
- require 'rbvmomi'
2
- require 'rbvmomi/pbm'
3
-
4
- PbmVimConnection = Struct.new(:host, :cookie)
5
-
6
- class PbmService
7
- def initialize(vim)
8
- # RbVmomi::PBM#connect expects a RbVmomi::VIM object, use a struct
9
- # to fake it out into using our vim Handsoap connection
10
- pbm_vim_conn = PbmVimConnection.new(vim.server.dup, vim.session_cookie.dup)
11
-
12
- @pbm = RbVmomi::PBM.connect(pbm_vim_conn, :insecure => true)
13
- @sic = @pbm.serviceContent
14
- end
15
-
16
- def queryAssociatedEntity(profileId)
17
- @sic.profileManager.PbmQueryAssociatedEntity(:profile => profileId)
18
- end
19
-
20
- def queryMatchingHub(profileId, hubsToSearch = nil)
21
- @sic.placementSolver.PbmQueryMatchingHub(
22
- :profile => profileId,
23
- :hubsToSearch => hubsToSearch
24
- )
25
- end
26
-
27
- def queryProfile
28
- @sic.profileManager.PbmQueryProfile(
29
- :resourceType => RbVmomi::PBM::PbmProfileResourceType(:resourceType => "STORAGE")
30
- )
31
- end
32
-
33
- def retrieveContent(profileIds)
34
- @sic.profileManager.PbmRetrieveContent(:profileIds => profileIds)
35
- end
36
- end