WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / vSphere 5.5 / VM Storage Policy APIs aka Storage Profile APIs will be available in vSphere 5.5

VM Storage Policy APIs aka Storage Profile APIs will be available in vSphere 5.5

09.12.2013 by William Lam // 17 Comments

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:

  1. Login to vCenter Server
  2. Extract the session cookie
  3. 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.

More from my site

  • Exploring VSAN APIs Part 6 – Modifying Virtual Machine VM Storage Policy
  • SPBM (Storage Policy Based Management) MOB in vSphere 5.5
  • Feedback on default behavior for VM Storage Policy
  • Minimum permissions to view VM Storage Policies
  • SPBM APIs are now included in pyvmomi (vSphere SDK for Python)

Categories // vSphere 5.5 Tags // spbm, vm storage policy, vm storage profile, vSphere 5.5

Comments

  1. *protectedjorg gray says

    11/22/2013 at 4:34 pm

    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. http://www.paylessforstorage.co.uk/

    Reply
  2. *protectedShahar says

    12/25/2014 at 9:03 am

    hi
    first of all,Thanks, very helpful article.
    However, i tried to connect to the pbm service as suggested (but with c# code).
    I manged to get the token from the ssl service
    I manged to connect with it to the vimService and retrieve the cookie.
    When i tried to connect (Retrieve service) to the pbm service with the cookie, i'm getting "vim25:SecurityErrorr".

    Any ideas?

    Thanks in advanced.
    Shahar

    Reply
    • *protectedKenny says

      01/28/2015 at 11:49 pm

      Did you ever get this to work Shahar? I am having the same issue... been trying for awhile now.

      Reply
      • *protectedShahar says

        01/29/2015 at 10:04 am

        yes, i did...
        the problem was with where I set the cookie.
        my first assumption was:

        _pbmService.CookieContainer = new CookieContainer();
        _pbmService.CookieContainer.Add(cookie);

        However, this is not the only place we need to add the cookie.
        we need to add the cookie to the header.
        to do so, we need to add custom header to the c# class we generate from the wsdl

        see: http://dotnetslackers.com/articles/aspnet/Securing-ASP-Net-Web-Services-with-Forms-Authentication.aspx

        and then use it in our code:
        vcSessionCookieCustomHeader header = new vcSessionCookieCustomHeader();
        header.cookie = cookie.Value;
        _pbmservice.vcSessionHeader = header;

        Reply
        • *protectedKenny says

          01/29/2015 at 2:54 pm

          Thank you very much for the quick reply! and of course the solution!!! I had tried each individually but not together. So happy I can stop banging my head on this... thank you again!

          Reply
        • *protectedKenny says

          01/29/2015 at 5:42 pm

          One more question if have the time, I must be missing something... how are you applying the custom soap header in the class generated from the wsdl? Also, for the cookie being added did you have to change the key from vmware_soap_session to vcSessionCookie as they did in the java samples?

          var pbmService = new PbmService() { Url = url };
          var cookieContainer = new CookieContainer();
          cookie.Name = "vcSessionCookie"; // change from vmware_soap_session to vcSessionCookie
          cookieContainer.Add(cookie);
          pbmService.CookieContainer = cookieContainer;

          var header = new VcSessionCookieCustomHeader();
          header.cookie = cookie.Value;
          pbmService.vcSessionHeader = header;

          public class VcSessionCookieCustomHeader : System.Web.Services.Protocols.SoapHeader
          {
          public string cookie;
          }

          public partial class PbmService : Microsoft.Web.Services3.WebServicesClientProtocol
          {
          public VcSessionCookieCustomHeader vcSessionHeader { get; set; }

          Are you using the SoapHeader attribute? For example...
          [System.Web.Services.Protocols.SoapHeader("vcSessionHeader", Direction = SoapHeaderDirection.Out)]
          public PbmServiceInstanceContent PbmRetrieveServiceContent(ManagedObjectReference _this)

          Thank you!

          Reply
          • *protectedfeng.zhang says

            07/23/2018 at 10:11 pm

            Hi, did you change the key from vmware_soap_session to vcSessionCookie as they did in the java samples?
            and Are you using the SoapHeader attribute? [System.Web.Services.Protocols.SoapHeader(“vcSessionHeader”, Direction = SoapHeaderDirection.Out)]

            i got vim25:NoPermission for PbmQueryProfile after pbmService.PbmRetrieveServiceContent finished,
            do you have some ideas?

        • *protectedKenny says

          01/29/2015 at 7:27 pm

          I figured it out, thanks for the help. For anyone else that may run across this...

          [XmlRootAttribute(ElementName = "vcSessionCookie", DataType = "string", IsNullable = false)]
          public class vcSessionCookieCustomHeader : System.Web.Services.Protocols.SoapHeader
          {
          [System.Xml.Serialization.XmlTextAttribute()]
          public string cookie;
          }

          Reply
          • *protectedShahar says

            02/01/2015 at 9:55 am

            sorry, i wasn't working the last two days.
            you are right, the XmlTextAttribute() will do the trick.

          • *protectedShahar says

            02/17/2015 at 2:58 pm

            hi Kenny.

            Did you ever get the next exception:
            "the session is not authenticated"

            i tried to reconnect to vim service (and succeeded), and add the new cookie, but it didn't help...

            any thought?

            Thanks
            Shahar.

          • *protectedKenny says

            02/17/2015 at 3:25 pm

            Hi,

            I have not ran across that yet, though I am still developing so haven't had the vSphere(vimservice) session open long enough at this point for the session to time out. Is your session timing out to vSphere and the pbmService session is still active during that time the scenario, or are you opening up a new pbmService after the vSphere session was reconnected?

            Ken

  3. *protectedAtoka Sema says

    05/02/2015 at 5:54 am

    Hi,

    Thank you for this helpful article. I have couple of questions related to VM Storage Policy that I would like to ask.

    Is there a way to list all the VM Storage Policies using vSphere API?
    As you mentioned, we can do it using VM Storage Policy API, but what I am trying to do is to use vSphere SDK to get the Id of already created profile and assign it to a VM's Virtual Disk.

    Also can we create a VM Storage Policy with Rule-Set using VM Storage Policy API? I don't PbmProfileProfileManager.PbmCreate API taking any Rule-Set related parameter.

    Thanks.

    Reply
  4. *protectedJ Xu says

    03/13/2019 at 1:51 pm

    For vsphere 6.7, the command used should be -

    run.bat ListProfiles --vcurl https://[VC-IP]/sdk/vimService --ssourl https://[VC-IP]/sts/STSService --spbmurl https://[VC-IP]/pbm --username *protected email* --password vmware --ignorecert

    Reply

Trackbacks

  1. VMware VSAN APIs | virtuallyGhetto says:
    03/04/2014 at 4:32 pm

    […] capabilities such as performance and reliability that can then be applied to a Virtual Machine. The SPBM API is exposed as a separate API endpoint in vCenter Server and will be required if you wish to create […]

    Reply
  2. Exploring VSAN APIs Part 6 – Modifying Virtual Machine VM Storage Policy | virtuallyGhetto says:
    03/21/2014 at 2:34 am

    […] Machine config spec called vmProfile which accepts the VM Storage Policy ID extracted from the SPBM API. To modify the VM Storage Policy for an individual Virtual Disk, you will need to set the profile […]

    Reply
  3. VMware Link Collection | Life says:
    10/31/2014 at 4:12 am

    […] New in VMware vSphere 5.5: Management APIs (Double Cloud) VM Storage Policy APIs aka Storage Profile APIs will be available in vSphere 5.5 (Virtually Ghetto) Exploring the vSphere Flash Read Cache (vFRC) APIs Part 1 (Virtually Ghetto) […]

    Reply
  4. Restoring VSAN VM Storage Policies without vCenter Part 1: Using cmmds-tool | virtuallyGhetto says:
    05/28/2016 at 6:04 am

    […] which is the unique identifier for VM Storage Policy which you can query if you are using the VM Storage Policy APIs that were introduced in vSphere […]

    Reply

Thanks for the comment!Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025