Merge "Fix detaching devices by alias with mdevs"
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
# under the License.
|
||||
|
||||
from nova.tests.fixtures import libvirt as fakelibvirt
|
||||
from nova.tests.functional.api import client
|
||||
from nova.tests.functional.libvirt import test_vgpu
|
||||
|
||||
|
||||
@@ -61,13 +60,7 @@ class VGPUTestVolumeOPs(test_vgpu.VGPUTestBase):
|
||||
# Detach the volume from the instance
|
||||
# DELETE /servers/{server_id}/os-volume_attachments/{volume_id} is
|
||||
# async but as we are using CastAsCall it's sync in our func tests
|
||||
# FIXME(sean-k-mooney): This test is currently broken because of
|
||||
# bug 2074219
|
||||
# self.api.delete_server_volume(
|
||||
# server_id, self.cinder.IMAGE_BACKED_VOL)
|
||||
# self._wait_for_volume_detach(
|
||||
# server_id, self.cinder.IMAGE_BACKED_VOL)
|
||||
error = self.assertRaises(
|
||||
client.OpenStackApiException, self.api.delete_server_volume,
|
||||
self.api.delete_server_volume(
|
||||
server_id, self.cinder.IMAGE_BACKED_VOL)
|
||||
self._wait_for_volume_detach(
|
||||
server_id, self.cinder.IMAGE_BACKED_VOL)
|
||||
self.assertEqual(500, error.response.status_code)
|
||||
|
||||
@@ -308,6 +308,11 @@ class GuestTestCase(test.NoDBTestCase):
|
||||
<address domain='0x0000' bus='0x06' slot='0x12' function='0x6'/>
|
||||
</source>
|
||||
</hostdev>
|
||||
<hostdev mode='subsystem' type='mdev' model='vfio-pci'>
|
||||
<source>
|
||||
<address uuid='c2177883-f1bb-47f0-914d-32a22e3a8804'/>
|
||||
</source>
|
||||
</hostdev>
|
||||
<interface type="bridge">
|
||||
<mac address="fa:16:3e:f9:af:ae"/>
|
||||
<model type="virtio"/>
|
||||
|
||||
@@ -414,7 +414,7 @@ class Guest(object):
|
||||
def get_device_by_alias(self, devalias, devtype=None,
|
||||
from_persistent_config=False):
|
||||
for dev in self.get_all_devices(devtype):
|
||||
if dev.alias == devalias:
|
||||
if hasattr(dev, 'alias') and dev.alias == devalias:
|
||||
return dev
|
||||
|
||||
def get_all_devices(
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
During the Caracal cycle the libvirt driver was enhanced to support using
|
||||
device aliases to detach devices from a domain.
|
||||
I1dfe4ad3df81bc810835af9b09cfc6c06e9a5388
|
||||
This introduced a regression for instance with vgpus.
|
||||
A prior bugfix https://bugs.launchpad.net/nova/+bug/1942345
|
||||
addressed the symptom without correcting the underlying problem.
|
||||
A related bug for mdev devices was later reported.
|
||||
https://bugs.launchpad.net/nova/+bug/2074219
|
||||
When this feature was added nova introduced a helper method
|
||||
to get device via the alias because the libvirt api does not provide one
|
||||
natively. That helper function assumed all devices would have an alias
|
||||
attribute. That assumption was not valid and had now been corrected.
|
||||
As a result detaching a volume from an instance with vgpus should now
|
||||
be possible and this class of bug should no longer happen.
|
||||
Reference in New Issue
Block a user