Module: MiqPbmInventory
- Included in:
- MiqVim
- Defined in:
- lib/VMwareWebService/MiqPbmInventory.rb
Instance Method Summary collapse
- #pbm_initialize(vim) ⇒ Object
- #pbmProfilesByUid(_selspec = nil) ⇒ Object
- #pbmQueryAssociatedEntity(profile_ids) ⇒ Object
- #pbmQueryMatchingHub(profile_ids) ⇒ Object
Instance Method Details
#pbm_initialize(vim) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/VMwareWebService/MiqPbmInventory.rb', line 4 def pbm_initialize(vim) begin # SPBM endpoint was introduced in vSphere Management SDK 5.5 and # isn't supported by Hosts (only vCenters) @pbm_svc = PbmService.new(vim) if apiVersion >= '5.5' && isVirtualCenter rescue => err $vim_log.warn("MiqPbmInventory: Failed to connect to SPBM endpoint: #{err}") end end |
#pbmProfilesByUid(_selspec = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/VMwareWebService/MiqPbmInventory.rb', line 14 def pbmProfilesByUid(_selspec = nil) profiles = {} return profiles if @pbm_svc.nil? begin profile_ids = @pbm_svc.queryProfile @pbm_svc.retrieveContent(profile_ids).to_a.each do |pbm_profile| uid = pbm_profile.profileId.uniqueId profiles[uid] = pbm_profile end rescue => err $vim_log.warn("MiqPbmInventory: pbmProfilesByUid: #{err}") end profiles end |
#pbmQueryAssociatedEntity(profile_ids) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/VMwareWebService/MiqPbmInventory.rb', line 32 def pbmQueryAssociatedEntity(profile_ids) assoc_entities = {} return assoc_entities if @pbm_svc.nil? begin profile_ids.each do |profile_id| # If a string was passed in create a PbmProfileId object profile_id = RbVmomi::PBM::PbmProfileId(:uniqueId => profile_id) if profile_id.kind_of?(String) assoc_entities[profile_id.uniqueId] = @pbm_svc.queryAssociatedEntity(profile_id) end rescue => err $vim_log.warn("MiqPbmInventory: pbmQueryAssociatedEntity: #{err}") end assoc_entities end |
#pbmQueryMatchingHub(profile_ids) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/VMwareWebService/MiqPbmInventory.rb', line 50 def pbmQueryMatchingHub(profile_ids) hubs = {} return hubs if @pbm_svc.nil? begin profile_ids.each do |profile_id| # If a string was passed in create a PbmProfileId object profile_id = RbVmomi::PBM::PbmProfileId(:uniqueId => profile_id) if profile_id.kind_of?(String) hubs[profile_id.uniqueId] = @pbm_svc.queryMatchingHub(profile_id) end rescue => err $vim_log.warn("MiqPbmInventory: pbmQueryMatchingHub: #{err}") end hubs end |