From 25f2e27b21d775709edc1958e2269d4df855dd36 Mon Sep 17 00:00:00 2001 From: Simon Dodsley Date: Thu, 28 Oct 2021 09:55:27 -0400 Subject: [PATCH] [Pure Storage] Add check for NVMe-FC capable array Recent arrays can handle both traditional FC and NVMe-FC ports. The FC (scsi) driver should not be touching NVMe-FC ports because that could create zones through FCZM that cross both FC types, so this check makes sure the driver only uses wwns that do not have an associated nqn. Change-Id: I189b556e1ca643635faae5eb5382bd6caa68aa4c --- cinder/tests/unit/volume/drivers/test_pure.py | 2 ++ cinder/volume/drivers/pure.py | 12 +++++++++++- .../pure-check-nvmefc-ports-cf2aec3952d8192f.yaml | 5 +++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/pure-check-nvmefc-ports-cf2aec3952d8192f.yaml diff --git a/cinder/tests/unit/volume/drivers/test_pure.py b/cinder/tests/unit/volume/drivers/test_pure.py index b5ac9190904..32be645d169 100644 --- a/cinder/tests/unit/volume/drivers/test_pure.py +++ b/cinder/tests/unit/volume/drivers/test_pure.py @@ -150,11 +150,13 @@ FC_PORTS = [{"name": name, "iqn": None, "portal": None, "wwn": wwn, + "nqn": None, } for name, wwn in zip(FC_PORT_NAMES, FC_WWNS)] AC_FC_PORTS = [{"name": name, "iqn": None, "portal": None, "wwn": wwn, + "nqn": None, } for name, wwn in zip(FC_PORT_NAMES, AC_FC_WWNS)] NON_ISCSI_PORT = { "name": "ct0.fc1", diff --git a/cinder/volume/drivers/pure.py b/cinder/volume/drivers/pure.py index 80a00f05a2a..5034ebccc85 100644 --- a/cinder/volume/drivers/pure.py +++ b/cinder/volume/drivers/pure.py @@ -2816,7 +2816,17 @@ class PureFCDriver(PureBaseVolumeDriver, driver.FibreChannelDriver): def _get_array_wwns(array): """Return list of wwns from the array""" ports = array.list_ports() - return [port["wwn"] for port in ports if port["wwn"]] + try: + valid_ports = [ + port["wwn"] + for port in ports + if port["wwn"] and not port["nqn"] + ] + except KeyError: # Older array code versions will not return nqn + valid_ports = [ + port["wwn"] for port in ports if port["wwn"] + ] + return valid_ports @pure_driver_debug_trace def initialize_connection(self, volume, connector): diff --git a/releasenotes/notes/pure-check-nvmefc-ports-cf2aec3952d8192f.yaml b/releasenotes/notes/pure-check-nvmefc-ports-cf2aec3952d8192f.yaml new file mode 100644 index 00000000000..dba8e1c995c --- /dev/null +++ b/releasenotes/notes/pure-check-nvmefc-ports-cf2aec3952d8192f.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Pure Storage Driver: Add internal check to allow for FlashArray with + joint FC and NVMe-FC support