Utility method to check SDRS enabled status

Adding a method to check whether vSphere Storage DRS is
enabled for a given datastore cluster.

Change-Id: Ib7441c8b2fe8a006d3eb5da70bf5b7230f4ae571
This commit is contained in:
Vipin Balachandran 2018-07-18 04:57:27 -07:00
parent 02192f7c30
commit 01e404f5c2
1 changed files with 14 additions and 0 deletions

View File

@ -111,6 +111,20 @@ def get_dsc_ref_and_name(session, dsc_val):
return None, None
def sdrs_enabled(session, dsc_ref):
"""Check if Storage DRS is enabled for the given datastore cluster.
:param session: VMwareAPISession object
:param dsc_ref: datastore cluster moref
"""
pod_sdrs_entry = session.invoke_api(vim_util,
'get_object_property',
session.vim,
dsc_ref,
'podStorageDrsEntry')
return pod_sdrs_entry.storageDrsConfig.podConfig.enabled
class Datastore(object):
def __init__(self, ref, name, capacity=None, freespace=None,