Revert "Verify WWN of connected iSCSI devices if passed"
This reverts commit 14be08d0b5
.
Change-Id: I1c99cdff5074180a09c315954c743b2bb0565f53
Related-Bug: #1819577
This commit is contained in:
parent
a22d316f79
commit
6adbce5ef7
@ -153,11 +153,6 @@ class InvalidIOHandleObject(BrickException):
|
|||||||
'type %(actual_type)s.')
|
'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):
|
class VolumeEncryptionNotSupported(Invalid):
|
||||||
message = _("Volume encryption is not supported for %(volume_type)s "
|
message = _("Volume encryption is not supported for %(volume_type)s "
|
||||||
"volume %(volume_id)s.")
|
"volume %(volume_id)s.")
|
||||||
|
@ -539,9 +539,6 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
|
|||||||
return symlink
|
return symlink
|
||||||
|
|
||||||
def _get_connect_result(self, con_props, wwn, devices_names, mpath=None):
|
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])
|
device = '/dev/' + (mpath or devices_names[0])
|
||||||
|
|
||||||
# NOTE(geguileo): This is only necessary because of the current
|
# NOTE(geguileo): This is only necessary because of the current
|
||||||
|
@ -154,16 +154,6 @@ class LinuxSCSI(executor.Executor):
|
|||||||
return udev_wwid
|
return udev_wwid
|
||||||
return ''
|
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):
|
def get_scsi_wwn(self, path):
|
||||||
"""Read the WWN from page 0x83 value for a SCSI device."""
|
"""Read the WWN from page 0x83 value for a SCSI device."""
|
||||||
|
|
||||||
|
@ -920,18 +920,6 @@ loop0 0"""
|
|||||||
open_mock.assert_has_calls([mock.call('/sys/block/sda/device/wwid'),
|
open_mock.assert_has_calls([mock.call('/sys/block/sda/device/wwid'),
|
||||||
mock.call('/sys/block/sdb/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.object(linuxscsi.priv_rootwrap, 'unlink_root')
|
||||||
@mock.patch('glob.glob')
|
@mock.patch('glob.glob')
|
||||||
@mock.patch('os.path.realpath', side_effect=['/dev/sda', '/dev/sdb',
|
@mock.patch('os.path.realpath', side_effect=['/dev/sda', '/dev/sdb',
|
||||||
|
@ -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.
|
|
Loading…
Reference in New Issue
Block a user