Fix potential NameError of rc_id

In create_relationship, if VolumeBackendAPIException is caught and
'CMMVC5959E' is in e, then the exception will not be raised, and
then the next state of "if rc_id" will raise NameError exception,
so rc_id should be initialized to avoid this potential risk.

Change-Id: If8d214c205196c76125a6581c85cbfeee6b4dfbd
This commit is contained in:
zhufl 2019-09-04 17:00:03 +08:00
parent 0023c2b58b
commit 2c67d2938f
2 changed files with 2 additions and 0 deletions

View File

@ -2124,6 +2124,7 @@ class StorwizeHelpers(object):
rc_id = self.ssh.mkrcrelationship(master, aux, system,
asyncmirror, cyclingmode)
except exception.VolumeBackendAPIException as e:
rc_id = None
# CMMVC5959E is the code in Stowize storage, meaning that
# there is a relationship that already has this name on the
# master cluster.

View File

@ -2902,6 +2902,7 @@ class InStorageAssistant(object):
rc_id = self.ssh.mkrcrelationship(master, aux, system,
asynccopy)
except exception.VolumeBackendAPIException as e:
rc_id = None
# CMMVC5959E is the code in InStorage, meaning that
# there is a relationship that already has this name on the
# master cluster.