A frequently requested feature from customers and partners have been around the Storage Profile APIs and with the upcoming vSphere 5.5 release, it will now be possible to automate the management and consumption of Storage Profiles. In vSphere 5.5, Storage Profiles has been renamed to VM Storage Policy and they have been enhanced from the previous version of Storage Profile. VM Storage Policy introduces new concept of a rule set also known as a sub-profile or sub-policy from an API perspective.
A VM Storage Policy can contain multiple rule sets which describes a requirement for a virtual machine storage resource. Each rule can either be an underlying storage capability or a user defined vSphere Tag.
One important thing to note about the VM Storage Policy API (SOAP API), is that it is exposed as a separate API endpoint (similar to how the SMS API is exposed) on vCenter Server and it will not be accessible through the normal vSphere API. To consume this API, you will need to connect to the PBM (Policy Based Management) Server which requires an authenticated vCenter Server session. A great way to learn and explore the new SPBM API is to check out the SPBM MOB.
Here is the high level workflow for connecting to the PBM Server:
- Login to vCenter Server
- Extract the session cookie
- Add vCenter Server session cookie & connect to PBM Server
Once connected to the PBM Server, you will have access to PBM ServiceInstance with following three managed objects:
-
- ProfileProfileManager (not a typo, repeat of Profile for some reason)
- PlacementSolver
- ComplianceManager
As mentioned earlier, a VM Storage Policy can be made up of several rule sets and each rule set contains a property rule. Here is the specification for what the VM Storage Policy looks like from an API perspective:
For managing and creating VM Storage Policies, you will need use the new VM Storage Policy API and for consuming and assigning VM Storage Policies to a virtual machine, you will need to use the vSphere API. When provisioning or cloning a virtual machine, there is a new profile property that denotes the MoRef ID for a particular VM Storage Policy.
As part of the VM Storage Policy API, there will be a Java SDK that includes a programming guide that goes over the VM Storage Policy API in greater detail as well as several sample programs exercising the various API methods. Since the VM Storage Policy API is a SOAP API similar to the vSphere API, the WSDL will also be available if you wish to generate your own language binding to the API.
Here is a screenshot of the available sample programs leveraging the new VM Storage Policy API:
Here is an example of one of the sample programs which lists all the VM Storage Policies for a given vCenter Server:
run.bat ListProfiles --vcurl https://[VC-IP]/sdk/vimService --ssourl https://[VC-IP]:7444/ims/STSService --spbmurl https://[VC-IP]/pbm --username *protected email* --password vmware --ignorecert
In the screenshot, you will see four VM Storage Policy being shown, one which I had created earlier and there others which are VM Storage Policies created by VSAN. You will notice that you will need three pieces of information when connecting: vCenter Server endpoint, SSO Server endpoint and PBM Server endpoint. You can find more details by referring to the VM Storage Policy Programming Guide and VM Storage Policy API reference.