Merge "libvirt: Use specific user when probing encrypted rbd disks during extend" into stable/victoria
This commit is contained in:
commit
4a807feb95
|
@ -10017,6 +10017,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|||
'serial': uuids.volume_id,
|
||||
'driver_volume_type': 'rbd',
|
||||
'data': {'name': 'pool/volume',
|
||||
'auth_enabled': 'true',
|
||||
'auth_username': 'username',
|
||||
'access_mode': 'rw'}
|
||||
}
|
||||
disk_1 = mock.Mock(spec=vconfig.LibvirtConfigGuestDisk,
|
||||
|
@ -10058,7 +10060,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|||
|
||||
mock_get_encryption_metadata.assert_called_once_with(
|
||||
self.context, drvr._volume_api, uuids.volume_id, connection_info)
|
||||
mock_qemu_img_info.assert_called_once_with('rbd:pool/volume')
|
||||
mock_qemu_img_info.assert_called_once_with(
|
||||
'rbd:pool/volume:id=username')
|
||||
|
||||
# Assert that the Libvirt call to resize the device within the instance
|
||||
# is called with the LUKSv1 payload offset taken into account.
|
||||
|
|
|
@ -2150,7 +2150,11 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
if 'device_path' in connection_info['data']:
|
||||
path = connection_info['data']['device_path']
|
||||
elif connection_info['driver_volume_type'] == 'rbd':
|
||||
path = 'rbd:%s' % (connection_info['data']['name'])
|
||||
volume_name = connection_info['data']['name']
|
||||
path = f"rbd:{volume_name}"
|
||||
if connection_info['data'].get('auth_enabled'):
|
||||
username = connection_info['data']['auth_username']
|
||||
path = f"rbd:{volume_name}:id={username}"
|
||||
else:
|
||||
path = 'unknown'
|
||||
raise exception.DiskNotFound(location='unknown')
|
||||
|
|
Loading…
Reference in New Issue