Fix purefa_volume when used in check_mmode (#65825)

This commit is contained in:
Simon Dodsley 2019-12-13 21:54:04 -08:00 committed by Abhijeet Kasurde
parent 8d542edeae
commit eb2f2ad282

View file

@ -278,12 +278,12 @@ def check_pod(module, array):
def create_volume(module, array):
"""Create Volume"""
changed = True
volfact = []
if not module.check_mode:
if "/" in module.params['name'] and not check_vgroup(module, array):
module.fail_json(msg="Failed to create volume {0}. Volume Group does not exist.".format(module.params["name"]))
if "::" in module.params['name'] and not check_pod(module, array):
module.fail_json(msg="Failed to create volume {0}. Poid does not exist".format(module.params["name"]))
volfact = []
api_version = array._list_available_rest_versions()
if module.params['bw_qos'] or module.params['iops_qos']:
if module.params['bw_qos'] and QOS_API_VERSION in api_version or module.params['iops_qos'] and IOPS_API_VERSION in api_version:
@ -332,8 +332,8 @@ def create_volume(module, array):
def copy_from_volume(module, array):
"""Create Volume Clone"""
changed = True
volfact = []
if not module.check_mode:
volfact = []
tgt = get_target(module, array)
if tgt is None:
@ -358,9 +358,9 @@ def copy_from_volume(module, array):
def update_volume(module, array):
"""Update Volume size and/or QoS"""
changed = True
volfact = []
if not module.check_mode:
change = False
volfact = []
api_version = array._list_available_rest_versions()
vol = array.get_volume(module.params['name'])
vol_qos = array.get_volume(module.params['name'], qos=True)
@ -420,8 +420,8 @@ def update_volume(module, array):
def delete_volume(module, array):
""" Delete Volume"""
changed = True
volfact = []
if not module.check_mode:
volfact = []
try:
array.destroy_volume(module.params['name'])
if module.params['eradicate']:
@ -437,8 +437,8 @@ def delete_volume(module, array):
def eradicate_volume(module, array):
""" Eradicate Deleted Volume"""
changed = True
volfact = []
if not module.check_mode:
volfact = []
if module.params['eradicate']:
try:
array.eradicate_volume(module.params['name'])