Merge "s390 FC device path fix for Ubuntu"

This commit is contained in:
Jenkins 2017-01-18 18:33:56 +00:00 committed by Gerrit Code Review
commit e1d39d6293
2 changed files with 20 additions and 10 deletions

View File

@ -49,14 +49,16 @@ class FibreChannelConnectorS390X(fibre_channel.FibreChannelConnector):
def _get_host_devices(self, possible_devs, lun):
host_devices = []
for pci_num, target_wwn in possible_devs:
target_lun = self._get_lun_string(lun)
host_device = self._get_device_file_path(
pci_num,
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,
target_lun)
host_devices.append(host_device)
self._get_lun_string(lun))
host_devices.extend(host_device)
return host_devices
def _get_lun_string(self, lun):
@ -67,11 +69,17 @@ class FibreChannelConnectorS390X(fibre_channel.FibreChannelConnector):
target_lun = "0x%08x00000000" % lun
return target_lun
def _get_device_file_path(self, pci_num, target_wwn, target_lun):
host_device = "/dev/disk/by-path/ccw-%s-zfcp-%s:%s" % (
pci_num,
target_wwn,
target_lun)
def _get_device_file_path(self, pci_num, target_wwn, lun):
# NOTE(arne_r)
# Need to add two 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 = [
"/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
def _remove_devices(self, connection_properties, devices):

View File

@ -37,9 +37,11 @@ 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(1, len(devices))
self.assertEqual(2, 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)
def test_get_lun_string(self):
lun = 1