Add the device_id parameter to discover_hdisk

LUA recovery, the job that tells the VIOS to discover a specific
hdisk, may find multiple disks at the same ITL. Without the device ID
LUA recovery will return an error when this happens.

For most volume backed storages the device ID is the base 64 encoded
value of the pg83 identifier. This change enables the passing of the
deviceID to discover_hdisk to avoid the multiple hdisks at the same
ITL error. It also bumps the pypowervm version for the device_id
support in discover_hdisk.

Change-Id: I86c273bf1d1c5753ce68ab51f6922c323d720cb2
This commit is contained in:
Matt Rabe 2019-01-15 12:24:35 -05:00
parent 2000340c4a
commit b3f9b9a5c2
4 changed files with 20 additions and 5 deletions

View File

@ -120,7 +120,7 @@ PyNaCl==1.2.1
pyOpenSSL==17.5.0 pyOpenSSL==17.5.0
pyparsing==2.2.0 pyparsing==2.2.0
pyperclip==1.6.0 pyperclip==1.6.0
pypowervm==1.1.18 pypowervm==1.1.20
pyroute2==0.4.21 pyroute2==0.4.21
pytest==3.4.2 pytest==3.4.2
python-barbicanclient==4.5.2 python-barbicanclient==4.5.2

View File

@ -71,6 +71,7 @@ class BaseVSCSITest(test_vol.TestVolumeAdapter):
}, },
'target_lun': '1', 'target_lun': '1',
'volume_id': 'a_volume_identifier', 'volume_id': 'a_volume_identifier',
'pg83NAA': '4567'
}, },
} }
mock_inst = mock.MagicMock() mock_inst = mock.MagicMock()
@ -542,16 +543,18 @@ class TestVSCSIAdapterMultiVIOS(BaseVSCSITest):
self.slot_mgr = mock.Mock() self.slot_mgr = mock.Mock()
self.slot_mgr.build_map.get_vscsi_slot.return_value = 62, 'the_lua' self.slot_mgr.build_map.get_vscsi_slot.return_value = 62, 'the_lua'
@mock.patch('pypowervm.tasks.hdisk.build_itls')
@mock.patch('pypowervm.tasks.scsi_mapper.add_map') @mock.patch('pypowervm.tasks.scsi_mapper.add_map')
@mock.patch('pypowervm.tasks.scsi_mapper.build_vscsi_mapping') @mock.patch('pypowervm.tasks.scsi_mapper.build_vscsi_mapping')
@mock.patch('pypowervm.tasks.hdisk.discover_hdisk') @mock.patch('pypowervm.tasks.hdisk.discover_hdisk')
@mock.patch('nova_powervm.virt.powervm.vm.get_vm_id') @mock.patch('nova_powervm.virt.powervm.vm.get_vm_id')
def test_connect_volume_multi_vio(self, mock_vm_id, mock_discover_hdisk, def test_connect_volume_multi_vio(self, mock_vm_id, mock_discover_hdisk,
mock_build_map, mock_add_map): mock_build_map, mock_add_map, mock_itls):
# The mock return values # The mock return values
mock_discover_hdisk.return_value = ( mock_discover_hdisk.return_value = (
hdisk.LUAStatus.DEVICE_AVAILABLE, 'devname', 'udid') hdisk.LUAStatus.DEVICE_AVAILABLE, 'devname', 'udid')
mock_vm_id.return_value = 'partition_id' mock_vm_id.return_value = 'partition_id'
mock_itls.return_value = 'fake_itls'
def build_map_func(host_uuid, vios_w, lpar_uuid, pv, def build_map_func(host_uuid, vios_w, lpar_uuid, pv,
lpar_slot_num=None, lua=None, target_name=None): lpar_slot_num=None, lua=None, target_name=None):
@ -568,6 +571,13 @@ class TestVSCSIAdapterMultiVIOS(BaseVSCSITest):
# Run the method # Run the method
self.vol_drv.connect_volume(self.slot_mgr) self.vol_drv.connect_volume(self.slot_mgr)
# Assert the discover_hdisk call parameters
mock_discover_hdisk.assert_has_calls([
mock.call(
self.adpt, vio.uuid, 'fake_itls',
device_id='NDU2Nw=='.encode())
for vio in self.feed], any_order=True)
# As initialized above, remove_maps returns True to trigger update. # As initialized above, remove_maps returns True to trigger update.
self.assertEqual(2, mock_add_map.call_count) self.assertEqual(2, mock_add_map.call_count)
self.assertEqual(2, mock_build_map.call_count) self.assertEqual(2, mock_build_map.call_count)

View File

@ -29,9 +29,9 @@ from pypowervm.tasks import partition as pvm_tpar
from pypowervm.utils import transaction as tx from pypowervm.utils import transaction as tx
from pypowervm.wrappers import virtual_io_server as pvm_vios from pypowervm.wrappers import virtual_io_server as pvm_vios
import base64
import six import six
CONF = cfg.CONF CONF = cfg.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -189,8 +189,13 @@ class PVVscsiFCVolumeAdapter(volume.VscsiVolumeAdapter,
instance=self.instance) instance=self.instance)
return None, None, None return None, None, None
device_id = self.connection_info.get('data', {}).get('pg83NAA')
if device_id:
device_id = base64.b64encode(device_id.encode())
status, device_name, udid = hdisk.discover_hdisk(self.adapter, status, device_name, udid = hdisk.discover_hdisk(self.adapter,
vios_w.uuid, itls) vios_w.uuid, itls,
device_id=device_id)
if hdisk.good_discovery(status, device_name): if hdisk.good_discovery(status, device_name):
LOG.info('Discovered %(hdisk)s on vios %(vios)s for volume ' LOG.info('Discovered %(hdisk)s on vios %(vios)s for volume '

View File

@ -8,7 +8,7 @@ oslo.config>=5.2.0 # Apache-2.0
oslo.log>=3.36.0 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0 oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
oslo.utils>=3.37.0 # Apache-2.0 oslo.utils>=3.37.0 # Apache-2.0
pypowervm>=1.1.18 # Apache-2.0 pypowervm>=1.1.20 # Apache-2.0
python-swiftclient>=3.2.0 # Apache-2.0 python-swiftclient>=3.2.0 # Apache-2.0
taskflow>=2.16.0 # Apache-2.0 taskflow>=2.16.0 # Apache-2.0
setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,!=36.2.0,>=21.0.0 # PSF/ZPL setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,!=36.2.0,>=21.0.0 # PSF/ZPL