s390 FC device path fix for Ubuntu
This fix solves a LUN attachment error for Ubuntu on s390 host setups. Fiber Channel requires a path for discovery of new devices, and Ubuntu uses a different format than previously assumed. This can be solved by simply adding the Ubuntu-style path to the list of possible paths, since they get quietly dropped if they lead nowhere in FibreChannelConnector._get_possible_volume_paths anyways. Change-Id: I0b07572903263122213f2ea5dc42151a7b69d99f Closes-Bug: #1655047
This commit is contained in:
parent
58956d7c86
commit
df634a5fde
@ -49,14 +49,16 @@ class FibreChannelConnectorS390X(fibre_channel.FibreChannelConnector):
|
|||||||
def _get_host_devices(self, possible_devs, lun):
|
def _get_host_devices(self, possible_devs, lun):
|
||||||
host_devices = []
|
host_devices = []
|
||||||
for pci_num, target_wwn in possible_devs:
|
for pci_num, target_wwn in possible_devs:
|
||||||
target_lun = self._get_lun_string(lun)
|
|
||||||
host_device = self._get_device_file_path(
|
host_device = self._get_device_file_path(
|
||||||
pci_num,
|
pci_num,
|
||||||
target_wwn,
|
target_wwn,
|
||||||
target_lun)
|
lun)
|
||||||
|
# NOTE(arne_r)
|
||||||
|
# LUN driver path is the same on all distros, so no need to have
|
||||||
|
# multiple calls here
|
||||||
self._linuxfc.configure_scsi_device(pci_num, target_wwn,
|
self._linuxfc.configure_scsi_device(pci_num, target_wwn,
|
||||||
target_lun)
|
self._get_lun_string(lun))
|
||||||
host_devices.append(host_device)
|
host_devices.extend(host_device)
|
||||||
return host_devices
|
return host_devices
|
||||||
|
|
||||||
def _get_lun_string(self, lun):
|
def _get_lun_string(self, lun):
|
||||||
@ -67,11 +69,17 @@ class FibreChannelConnectorS390X(fibre_channel.FibreChannelConnector):
|
|||||||
target_lun = "0x%08x00000000" % lun
|
target_lun = "0x%08x00000000" % lun
|
||||||
return target_lun
|
return target_lun
|
||||||
|
|
||||||
def _get_device_file_path(self, pci_num, target_wwn, target_lun):
|
def _get_device_file_path(self, pci_num, target_wwn, lun):
|
||||||
host_device = "/dev/disk/by-path/ccw-%s-zfcp-%s:%s" % (
|
# NOTE(arne_r)
|
||||||
pci_num,
|
# Need to add two possible ways to resolve device paths,
|
||||||
target_wwn,
|
# depending on OS. Since it gets passed to '_get_possible_volume_paths'
|
||||||
target_lun)
|
# having a mismatch is not a problem
|
||||||
|
host_device = [
|
||||||
|
"/dev/disk/by-path/ccw-%s-zfcp-%s:%s" % (
|
||||||
|
pci_num, target_wwn, self._get_lun_string(lun)),
|
||||||
|
"/dev/disk/by-path/ccw-%s-fc-%s-lun-%s" % (
|
||||||
|
pci_num, target_wwn, lun),
|
||||||
|
]
|
||||||
return host_device
|
return host_device
|
||||||
|
|
||||||
def _remove_devices(self, connection_properties, devices):
|
def _remove_devices(self, connection_properties, devices):
|
||||||
|
@ -37,9 +37,11 @@ class FibreChannelConnectorS390XTestCase(test_connector.ConnectorTestCase):
|
|||||||
devices = self.connector._get_host_devices(possible_devs, lun)
|
devices = self.connector._get_host_devices(possible_devs, lun)
|
||||||
mock_configure_scsi_device.assert_called_with(3, 5,
|
mock_configure_scsi_device.assert_called_with(3, 5,
|
||||||
"0x0002000000000000")
|
"0x0002000000000000")
|
||||||
self.assertEqual(1, len(devices))
|
self.assertEqual(2, len(devices))
|
||||||
device_path = "/dev/disk/by-path/ccw-3-zfcp-5:0x0002000000000000"
|
device_path = "/dev/disk/by-path/ccw-3-zfcp-5:0x0002000000000000"
|
||||||
self.assertEqual(devices[0], device_path)
|
self.assertEqual(devices[0], device_path)
|
||||||
|
device_path = "/dev/disk/by-path/ccw-3-fc-5-lun-2"
|
||||||
|
self.assertEqual(devices[1], device_path)
|
||||||
|
|
||||||
def test_get_lun_string(self):
|
def test_get_lun_string(self):
|
||||||
lun = 1
|
lun = 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user