def create_storage_policy(policy_name, policy_dict, service_instance=None):
    '''
    Creates a storage policy.

    Supported capability types: scalar, set, range.

    policy_name
        Name of the policy to create.
        The value of the argument will override any existing name in
        ``policy_dict``.

    policy_dict
        Dictionary containing the changes to apply to the policy.
        (example in salt.states.pbm)

    service_instance
        Service instance (vim.ServiceInstance) of the vCenter.
        Default is None.

    .. code-block:: bash

        salt '*' vsphere.create_storage_policy policy_name='policy name'
            policy_dict="$policy_dict"
    '''
    log.trace('create storage policy \'%s\', dict = %s', policy_name, policy_dict)
    profile_manager = salt.utils.pbm.get_profile_manager(service_instance)
    policy_create_spec = pbm.profile.CapabilityBasedProfileCreateSpec()
    # Hardcode the storage profile resource type
    policy_create_spec.resourceType = pbm.profile.ResourceType(
        resourceType=pbm.profile.ResourceTypeEnum.STORAGE)
    # Set name argument
    policy_dict['name'] = policy_name
    log.trace('Setting policy values in policy_update_spec')
    _apply_policy_config(policy_create_spec, policy_dict)
    salt.utils.pbm.create_storage_policy(profile_manager, policy_create_spec)
    return {'create_storage_policy': True}
def create_storage_policy ( policy_name , policy_dict , service_instance = None ) : log . trace ( 'create storage policy \'%s\', dict = %s' , policy_name , policy_dict ) profile_manager = salt . utils . pbm . get_profile_manager ( service_instance ) policy_create_spec = pbm . profile . CapabilityBasedProfileCreateSpec ( ) policy_create_spec . resourceType = pbm . profile . ResourceType ( resourceType = pbm . profile . ResourceTypeEnum . STORAGE ) policy_dict [ 'name' ] = policy_name log . trace ( 'Setting policy values in policy_update_spec' ) _apply_policy_config ( policy_create_spec , policy_dict ) salt . utils . pbm . create_storage_policy ( profile_manager , policy_create_spec ) return { 'create_storage_policy' : True }
Creates a storage policy.

    Supported capability types: scalar, set, range.

    policy_name
        Name of the policy to create.
        The value of the argument will override any existing name in
        ``policy_dict``.

    policy_dict
        Dictionary containing the changes to apply to the policy.
        (example in salt.states.pbm)

    service_instance
        Service instance (vim.ServiceInstance) of the vCenter.
        Default is None.

    .. code-block:: bash

        salt '*' vsphere.create_storage_policy policy_name='policy name'
            policy_dict="$policy_dict"