Browse Source

Merge "libvirt: Use specific user when probing encrypted rbd disks during extend" into stable/victoria

changes/53/783653/1
Zuul 4 weeks ago
committed by Gerrit Code Review
parent
commit
4a807feb95
2 changed files with 9 additions and 2 deletions
  1. +4
    -1
      nova/tests/unit/virt/libvirt/test_driver.py
  2. +5
    -1
      nova/virt/libvirt/driver.py

+ 4
- 1
nova/tests/unit/virt/libvirt/test_driver.py View File

@ -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.


+ 5
- 1
nova/virt/libvirt/driver.py View File

@ -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…
Cancel
Save