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,
|
'serial': uuids.volume_id,
|
||||||
'driver_volume_type': 'rbd',
|
'driver_volume_type': 'rbd',
|
||||||
'data': {'name': 'pool/volume',
|
'data': {'name': 'pool/volume',
|
||||||
|
'auth_enabled': 'true',
|
||||||
|
'auth_username': 'username',
|
||||||
'access_mode': 'rw'}
|
'access_mode': 'rw'}
|
||||||
}
|
}
|
||||||
disk_1 = mock.Mock(spec=vconfig.LibvirtConfigGuestDisk,
|
disk_1 = mock.Mock(spec=vconfig.LibvirtConfigGuestDisk,
|
||||||
|
@ -10058,7 +10060,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||||
|
|
||||||
mock_get_encryption_metadata.assert_called_once_with(
|
mock_get_encryption_metadata.assert_called_once_with(
|
||||||
self.context, drvr._volume_api, uuids.volume_id, connection_info)
|
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
|
# Assert that the Libvirt call to resize the device within the instance
|
||||||
# is called with the LUKSv1 payload offset taken into account.
|
# 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']:
|
if 'device_path' in connection_info['data']:
|
||||||
path = connection_info['data']['device_path']
|
path = connection_info['data']['device_path']
|
||||||
elif connection_info['driver_volume_type'] == 'rbd':
|
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:
|
else:
|
||||||
path = 'unknown'
|
path = 'unknown'
|
||||||
raise exception.DiskNotFound(location='unknown')
|
raise exception.DiskNotFound(location='unknown')
|
||||||
|
|
Loading…
Reference in New Issue