mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Added salt.modules.vsphere.list_default_vsan_policy that retrieves dict representation of the default storage policies
This commit is contained in:
parent
6bb0111b32
commit
f9f84fde9a
@ -4676,6 +4676,33 @@ def list_storage_policies(policy_names=None, service_instance=None):
|
||||
return [_get_policy_dict(p) for p in policies]
|
||||
|
||||
|
||||
@depends(HAS_PYVMOMI)
|
||||
@supports_proxies('esxdatacenter', 'vcenter')
|
||||
@gets_service_instance_via_proxy
|
||||
def list_default_vsan_policy(service_instance=None):
|
||||
'''
|
||||
Returns the default vsan storage policy.
|
||||
|
||||
service_instance
|
||||
Service instance (vim.ServiceInstance) of the vCenter.
|
||||
Default is None.
|
||||
|
||||
.. code-block:: bash
|
||||
salt '*' vsphere.list_storage_policies
|
||||
|
||||
salt '*' vsphere.list_storage_policy policy_names=[policy_name]
|
||||
'''
|
||||
profile_manager = salt.utils.pbm.get_profile_manager(service_instance)
|
||||
policies = salt.utils.pbm.get_storage_policies(profile_manager,
|
||||
get_all_policies=True)
|
||||
def_policies = [p for p in policies
|
||||
if p.systemCreatedProfileType == 'VsanDefaultProfile']
|
||||
if not def_policies:
|
||||
raise excs.VMwareObjectRetrievalError('Default VSAN policy was not '
|
||||
'retrieved')
|
||||
return _get_policy_dict(def_policies[0])
|
||||
|
||||
|
||||
@depends(HAS_PYVMOMI)
|
||||
@supports_proxies('esxdatacenter', 'esxcluster')
|
||||
@gets_service_instance_via_proxy
|
||||
|
Loading…
Reference in New Issue
Block a user