From 6adbce5ef7f1af3d62a9ef145baa13730f16fb87 Mon Sep 17 00:00:00 2001 From: Avishay Traeger Date: Tue, 12 Mar 2019 07:37:00 +0200 Subject: [PATCH] Revert "Verify WWN of connected iSCSI devices if passed" This reverts commit 14be08d0b53836963a530e2990a6db73901cbdac. Change-Id: I1c99cdff5074180a09c315954c743b2bb0565f53 Related-Bug: #1819577 --- os_brick/exception.py | 5 ----- os_brick/initiator/connectors/iscsi.py | 3 --- os_brick/initiator/linuxscsi.py | 10 ---------- os_brick/tests/initiator/test_linuxscsi.py | 12 ------------ .../notes/verify-iscsi-wwns-f6cb536a7fbd4b42.yaml | 9 --------- 5 files changed, 39 deletions(-) delete mode 100644 releasenotes/notes/verify-iscsi-wwns-f6cb536a7fbd4b42.yaml diff --git a/os_brick/exception.py b/os_brick/exception.py index 30ae498e1..294eb3751 100644 --- a/os_brick/exception.py +++ b/os_brick/exception.py @@ -153,11 +153,6 @@ class InvalidIOHandleObject(BrickException): 'type %(actual_type)s.') -class VolumeDeviceValidationFailed(BrickException): - message = _("Volume device validation failed for device %(device)s " - "(expected %(expected)s, found %(found)s.") - - class VolumeEncryptionNotSupported(Invalid): message = _("Volume encryption is not supported for %(volume_type)s " "volume %(volume_id)s.") diff --git a/os_brick/initiator/connectors/iscsi.py b/os_brick/initiator/connectors/iscsi.py index 45a474e46..238c88501 100644 --- a/os_brick/initiator/connectors/iscsi.py +++ b/os_brick/initiator/connectors/iscsi.py @@ -539,9 +539,6 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector): return symlink def _get_connect_result(self, con_props, wwn, devices_names, mpath=None): - if 'wwn' in con_props: - self._linuxscsi.verify_sysfs_wwns(devices_names, con_props['wwn']) - device = '/dev/' + (mpath or devices_names[0]) # NOTE(geguileo): This is only necessary because of the current diff --git a/os_brick/initiator/linuxscsi.py b/os_brick/initiator/linuxscsi.py index 891088f57..717878c84 100644 --- a/os_brick/initiator/linuxscsi.py +++ b/os_brick/initiator/linuxscsi.py @@ -154,16 +154,6 @@ class LinuxSCSI(executor.Executor): return udev_wwid return '' - def verify_sysfs_wwns(self, device_names, expected_wwn): - """Verify that all specified devices have the expected WWN.""" - - for device_name in device_names: - found_wwn = self.get_sysfs_wwn([device_name]) - if found_wwn != expected_wwn: - raise exception.VolumeDeviceValidationFailed( - device=device_name, expected=expected_wwn, - found=found_wwn) - def get_scsi_wwn(self, path): """Read the WWN from page 0x83 value for a SCSI device.""" diff --git a/os_brick/tests/initiator/test_linuxscsi.py b/os_brick/tests/initiator/test_linuxscsi.py index f7061a148..7493ecf35 100644 --- a/os_brick/tests/initiator/test_linuxscsi.py +++ b/os_brick/tests/initiator/test_linuxscsi.py @@ -920,18 +920,6 @@ loop0 0""" open_mock.assert_has_calls([mock.call('/sys/block/sda/device/wwid'), mock.call('/sys/block/sdb/device/wwid')]) - @mock.patch.object(linuxscsi.LinuxSCSI, 'get_sysfs_wwn') - def test_verify_sysfs_wwns_valid(self, get_wwn): - get_wwn.side_effect = ['123', '123', '123', '123'] - self.linuxscsi.verify_sysfs_wwns(['sda', 'sdb', 'sdc', 'sdd'], '123') - - @mock.patch.object(linuxscsi.LinuxSCSI, 'get_sysfs_wwn') - def test_verify_sysfs_wwns_invalid(self, get_wwn): - get_wwn.side_effect = ['123', '456', '123', '123'] - self.assertRaises(exception.VolumeDeviceValidationFailed, - self.linuxscsi.verify_sysfs_wwns, - ['sda', 'sdb', 'sdc', 'sdd'], '123') - @mock.patch.object(linuxscsi.priv_rootwrap, 'unlink_root') @mock.patch('glob.glob') @mock.patch('os.path.realpath', side_effect=['/dev/sda', '/dev/sdb', diff --git a/releasenotes/notes/verify-iscsi-wwns-f6cb536a7fbd4b42.yaml b/releasenotes/notes/verify-iscsi-wwns-f6cb536a7fbd4b42.yaml deleted file mode 100644 index e89c94227..000000000 --- a/releasenotes/notes/verify-iscsi-wwns-f6cb536a7fbd4b42.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -fixes: - - | - Adds verification that found iSCSI devices have the expected WWN - (must be provided in connection_properties). The attachment fails if - the WWNs do not match. This prevents cases where a device already - exists on the host from an old attachment that wasn't fully cleaned - up, and the new attachment got the same LUN. Using this old device - could lead to data corruption.