The oslo_vmware.pbm Module

VMware PBM service client and PBM related utility methods

PBM is used for policy based placement in VMware datastores. Refer http://goo.gl/GR2o6U for more details.

class oslo_vmware.pbm.Pbm(protocol='https', host='localhost', port=443, wsdl_url=None, cacert=None, insecure=True, pool_maxsize=10, connection_timeout=None)

Bases: oslo_vmware.service.Service

Service class that provides access to the Storage Policy API.

retrieve_service_content()

Set the specified vCenter session cookie in the SOAP header

Parameters:cookie – cookie to set
oslo_vmware.pbm.convert_datastores_to_hubs(pbm_client_factory, datastores)

Convert given datastore morefs to PbmPlacementHub morefs.

Parameters:
  • pbm_client_factory – Factory to create PBM API input specs
  • datastores – list of datastore morefs
Returns:

list of PbmPlacementHub morefs

oslo_vmware.pbm.filter_datastores_by_hubs(hubs, datastores)

Get filtered subset of datastores corresponding to the given hub list.

Parameters:
  • hubs – list of PbmPlacementHub morefs
  • datastores – all candidate datastores
Returns:

subset of datastores corresponding to the given hub list

oslo_vmware.pbm.filter_hubs_by_profile(session, hubs, profile_id)

Filter and return hubs that match the given profile.

Parameters:
  • hubs – PbmPlacementHub morefs
  • profile_id – profile ID
Returns:

subset of hubs that match the given profile

Raises:

VimException, VimFaultException, VimAttributeException, VimSessionOverLoadException, VimConnectionException

oslo_vmware.pbm.get_all_profiles(session)

Get all the profiles defined in VC server.

Returns:PbmProfile data objects
Raises:VimException, VimFaultException, VimAttributeException, VimSessionOverLoadException, VimConnectionException
oslo_vmware.pbm.get_pbm_wsdl_location(vc_version)

Return PBM WSDL file location corresponding to VC version.

Parameters:vc_version – a dot-separated version string. For example, “1.2”.
Returns:the pbm wsdl file location.
oslo_vmware.pbm.get_profile_id_by_name(session, profile_name)

Get the profile UUID corresponding to the given profile name.

Parameters:profile_name – profile name whose UUID needs to be retrieved
Returns:profile UUID string or None if profile not found
Raises:VimException, VimFaultException, VimAttributeException, VimSessionOverLoadException, VimConnectionException
oslo_vmware.pbm.get_profiles(session, vm)

Query storage profiles associated with the given vm.

Parameters:
  • session – VMwareAPISession instance
  • vm – vm reference
Returns:

profile IDs

oslo_vmware.pbm.get_profiles_by_ids(session, profile_ids)

Get storage profiles by IDs.

Parameters:
  • session – VMwareAPISession instance
  • profile_ids – profile IDs
Returns:

profile objects