From e91f19b171c15ee902e8e70d58031468fa589005 Mon Sep 17 00:00:00 2001 From: Andreas Scheuring Date: Thu, 18 Jan 2018 17:31:24 +0100 Subject: [PATCH] s390x fc: Fix device path for Ubuntu with ds8k The device path to a block device on Ubuntu using a ds8k LUN differs from the device path for other storage systems. This patch adds the new device path as third possibility. Change-Id: I92f1e5a2c7203af6c01c4742067ced16a840eb04 (cherry picked from commit f28bd8ea85264a668abfb30bec1e812bda2b75a5) --- os_brick/initiator/connectors/fibre_channel_s390x.py | 7 ++++++- .../tests/initiator/connectors/test_fibre_channel_s390x.py | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/os_brick/initiator/connectors/fibre_channel_s390x.py b/os_brick/initiator/connectors/fibre_channel_s390x.py index 64d48ca60..4d39b1b07 100644 --- a/os_brick/initiator/connectors/fibre_channel_s390x.py +++ b/os_brick/initiator/connectors/fibre_channel_s390x.py @@ -71,14 +71,19 @@ class FibreChannelConnectorS390X(fibre_channel.FibreChannelConnector): def _get_device_file_path(self, pci_num, target_wwn, lun): # NOTE(arne_r) - # Need to add two possible ways to resolve device paths, + # Need to add multiple possible ways to resolve device paths, # depending on OS. Since it gets passed to '_get_possible_volume_paths' # having a mismatch is not a problem host_device = [ + # RHEL based "/dev/disk/by-path/ccw-%s-zfcp-%s:%s" % ( pci_num, target_wwn, self._get_lun_string(lun)), + # Debian based (e.g. for storwize) "/dev/disk/by-path/ccw-%s-fc-%s-lun-%s" % ( pci_num, target_wwn, lun), + # Debian based (e.g. for ds8k) + "/dev/disk/by-path/ccw-%s-fc-%s-lun-%s" % ( + pci_num, target_wwn, self._get_lun_string(lun)), ] return host_device diff --git a/os_brick/tests/initiator/connectors/test_fibre_channel_s390x.py b/os_brick/tests/initiator/connectors/test_fibre_channel_s390x.py index e687a2ef7..0f3f16eac 100644 --- a/os_brick/tests/initiator/connectors/test_fibre_channel_s390x.py +++ b/os_brick/tests/initiator/connectors/test_fibre_channel_s390x.py @@ -37,11 +37,13 @@ class FibreChannelConnectorS390XTestCase(test_connector.ConnectorTestCase): devices = self.connector._get_host_devices(possible_devs, lun) mock_configure_scsi_device.assert_called_with(3, 5, "0x0002000000000000") - self.assertEqual(2, len(devices)) + self.assertEqual(3, len(devices)) device_path = "/dev/disk/by-path/ccw-3-zfcp-5:0x0002000000000000" self.assertEqual(devices[0], device_path) device_path = "/dev/disk/by-path/ccw-3-fc-5-lun-2" self.assertEqual(devices[1], device_path) + device_path = "/dev/disk/by-path/ccw-3-fc-5-lun-0x0002000000000000" + self.assertEqual(devices[2], device_path) def test_get_lun_string(self): lun = 1