The following code fragment shows the example function getPbmProfileSpec that uses the PbmQueryProfile and PbmRetrieveContent methods to retrieve storage profiles. In the context of the Storage Policy SDK example VMCreate.java, the function returns a VirtualMachineDefinedProfileSpec to be used to configure storage for a virtual machine.
2 Calls the PbmQueryProfile method to obtain the list of storage profile identifiers.
3 Calls the PbmRetrieveContent method to obtain the list of storage profiles.
5 Creates a VirtualMachineDefinedProfileSpec and assigns the identifier from the named profile to the VirtualMachineDefinedProfileSpec. You use the VirtualMachineDefinedProfileSpec when you configure the virtual machine. See Apply the Storage Profile to a Virtual Machine.Example: Retrieving a Storage Profile