1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Bug fixes for na_ontap_fcp (#48583)

This commit is contained in:
Chris Archibald 2018-11-28 12:03:44 -08:00 committed by John R Barker
parent 0b380b09bf
commit 6dc6538eef

View file

@ -111,9 +111,12 @@ class NetAppOntapFCP(object):
try:
self.server.invoke_successfully(netapp_utils.zapi.NaElement('fcp-service-start'), True)
except netapp_utils.zapi.NaApiError as error:
self.module.fail_json(msg='Error starting FCP %s' %
(to_native(error)),
exception=traceback.format_exc())
# Error 13013 denotes fcp service already started.
if to_native(error.code) == "13013":
return None
else:
self.module.fail_json(msg='Error starting FCP %s' % (to_native(error)),
exception=traceback.format_exc())
def stop_fcp(self):
"""
@ -164,6 +167,9 @@ class NetAppOntapFCP(object):
exception=traceback.format_exc())
def apply(self):
results = netapp_utils.get_cserver(self.server)
cserver = netapp_utils.setup_na_ontap_zapi(module=self.module, vserver=results)
netapp_utils.ems_log_event("na_ontap_fcp", cserver)
exists = self.get_fcp()
changed = False
if self.parameters['state'] == 'present':
@ -180,6 +186,8 @@ class NetAppOntapFCP(object):
self.create_fcp()
if self.parameters['status'] == 'up':
self.start_fcp()
elif self.parameters['status'] == 'down':
self.stop_fcp()
changed = True
else:
if exists: