jonathanvh
Enthusiast
Enthusiast

Get all available VM Storage Policies

Jump to solution

Hi,

I am trying to find all the available VM Storage Policies in a certain vCenter.

(our Orchestrator is connected to multiple vCenters)

I have a way for finding all the VM Storage Policies:

pbmProfiles = Server.findAllForType("VC:PbmProfile");

Now I want it from one vCenter only.

I suspect to do it something like this?

But I'm stuck here...

var storageService = vcenter.storageManagement;

var profileManager = storageService.pbmProfileManager;

profileManager.pbmQueryProfile(???)??

Any help is appreciated.

Thanks!

Orchestrator 7.5

vCenter 6.5 and 6.7

0 Kudos
1 Solution

Accepted Solutions
jonathanvh
Enthusiast
Enthusiast

I managed to find it myself!

var storageService = vcenter.storageManagement;

var profileManager = storageService.pbmProfileManager;

var myPbmProfileResourceType = new PbmProfileResourceType() ;

myPbmProfileResourceType.resourceType = "STORAGE"

pbmProfileIds = profileManager.pbmQueryProfile(myPbmProfileResourceType);

for each (pbmProfileId in pbmProfileIds) {

     var pbmId = pbmProfileId.uniqueId;

     var myPbmProfileId = new PbmProfileId() ;

     myPbmProfileId.uniqueId = pbmId;

     var pbmProfileIds = [];

     pbmProfileIds.push(myPbmProfileId);

     System.log ("Storage Policy id: " + pbmId);

     var pbmProfiles = profileManager.pbmRetrieveContent(pbmProfileIds);

     System.log ("Storage Policy Name: " + pbmProfiles[0].name)

}

Output:

[2019-12-18 14:54:06.772] [I] Storage Policy id: aa6d5a82-1c88-45da-85d3-3d74b91a5bad

[2019-12-18 14:54:06.784] [I] Storage Policy Name: vSAN Default Storage Policy

[2019-12-18 14:54:06.785] [I] Storage Policy id: f4e5bade-15a2-4805-bf8e-52318c4ce443

[2019-12-18 14:54:06.795] [I] Storage Policy Name: VVol No Requirements Policy

[2019-12-18 14:54:06.796] [I] Storage Policy id: c268da1b-b343-49f7-a468-b1deeb7078e0

[2019-12-18 14:54:06.805] [I] Storage Policy Name: Host-local PMem Default Storage Policy

[2019-12-18 14:54:06.807] [I] Storage Policy id: 4d5f673c-536f-11e6-beb8-9e71128cae77

[2019-12-18 14:54:06.819] [I] Storage Policy Name: VM Encryption Policy

....

View solution in original post

0 Kudos
1 Reply
jonathanvh
Enthusiast
Enthusiast

I managed to find it myself!

var storageService = vcenter.storageManagement;

var profileManager = storageService.pbmProfileManager;

var myPbmProfileResourceType = new PbmProfileResourceType() ;

myPbmProfileResourceType.resourceType = "STORAGE"

pbmProfileIds = profileManager.pbmQueryProfile(myPbmProfileResourceType);

for each (pbmProfileId in pbmProfileIds) {

     var pbmId = pbmProfileId.uniqueId;

     var myPbmProfileId = new PbmProfileId() ;

     myPbmProfileId.uniqueId = pbmId;

     var pbmProfileIds = [];

     pbmProfileIds.push(myPbmProfileId);

     System.log ("Storage Policy id: " + pbmId);

     var pbmProfiles = profileManager.pbmRetrieveContent(pbmProfileIds);

     System.log ("Storage Policy Name: " + pbmProfiles[0].name)

}

Output:

[2019-12-18 14:54:06.772] [I] Storage Policy id: aa6d5a82-1c88-45da-85d3-3d74b91a5bad

[2019-12-18 14:54:06.784] [I] Storage Policy Name: vSAN Default Storage Policy

[2019-12-18 14:54:06.785] [I] Storage Policy id: f4e5bade-15a2-4805-bf8e-52318c4ce443

[2019-12-18 14:54:06.795] [I] Storage Policy Name: VVol No Requirements Policy

[2019-12-18 14:54:06.796] [I] Storage Policy id: c268da1b-b343-49f7-a468-b1deeb7078e0

[2019-12-18 14:54:06.805] [I] Storage Policy Name: Host-local PMem Default Storage Policy

[2019-12-18 14:54:06.807] [I] Storage Policy id: 4d5f673c-536f-11e6-beb8-9e71128cae77

[2019-12-18 14:54:06.819] [I] Storage Policy Name: VM Encryption Policy

....

View solution in original post

0 Kudos