The Storage Policy API includes several methods that you can use to query for profiles and vSphere entities, such as datastores, virtual machines, and virtual disks.

The following table provides an overview of these methods. For more information, see the Storage Policy API Reference.

Table 1. Storage Profile API Query Methods
Method Description
PbmQueryAssociatedEntities Returns the virtual machine and disks that are associated with the given storage policies. With empty parameter, returns all virtual machine and disks that are associated with a storage policy.
PbmQueryAssociatedEntity Returns references to entities associated with the specified profile.
PbmQueryAssociatedProfile Returns profiles associated with the specified entity. The type of profile is determined by the type of entity that you specify.
  • If you specify a datastore, the method returns one or more capability (resource) profiles.
  • If you specify a virtual machine or virtual disk, the method returns one or more requirement profiles.
PbmQueryAssociatedProfiles Returns PbmQueryProfileResult objects. Each result objet identifies an entity and one or more profiles. Profile type is determined by entity type.
  • If the entity is a datastore, the result object contains one or more capability (resource) profiles.
  • If the entity is a virtual machine or virtual disk, the result object contains one or more requirement profiles.
PbmQueryByRollupComplianceStatus Returns all virtual machines for the given rollup compliance status.
PbmQueryDefaultRequirementProfile Returns the default requirement profile ID for the given datastore. For legacy hubs, returns null.
PbmQueryDefaultRequirementProfiles Returns the default profiles for the given datastores. For legacy datastores, the defaultProfile is set to null.
PbmQueryMatchingHub (deprecated) Finds matching placement hubs for the specified requirements profile. Returns only hubs that match the profile. If this method is called for VVolDefaultProfile, then all VVol containers are returned as matching.
PbmQueryMatchingHubWithSpec (deprecated) Finds matching placement hubs based on a profile creation specification. This method returns only those hubs that match the specification.
PbmQueryProfile Returns requirement profiles or resource profiles, or both.
PbmQueryReplicationGroups Returns identifiers for replication groups associated with virtual machines, virtual disks, or virtual machines and all their disks. If the query is performed for a virtual machine and all its disks are virtualMachineAndDisks, an entry per disk and one for the virtual machine configuration are returned.
PbmQuerySpaceStatsForStorageContainer Retrieves space statistics of a datastore.