diff --git a/nova/tests/functional/regressions/test_bug_2074219.py b/nova/tests/functional/regressions/test_bug_2074219.py
index cbc672ed1e..36ccfbbb9e 100644
--- a/nova/tests/functional/regressions/test_bug_2074219.py
+++ b/nova/tests/functional/regressions/test_bug_2074219.py
@@ -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)
diff --git a/nova/tests/unit/virt/libvirt/test_guest.py b/nova/tests/unit/virt/libvirt/test_guest.py
index 49ba7c87ae..6d9eb6ede5 100644
--- a/nova/tests/unit/virt/libvirt/test_guest.py
+++ b/nova/tests/unit/virt/libvirt/test_guest.py
@@ -308,6 +308,11 @@ class GuestTestCase(test.NoDBTestCase):
+
+
+
+
+
diff --git a/nova/virt/libvirt/guest.py b/nova/virt/libvirt/guest.py
index c8d9611587..44bb7daf7e 100644
--- a/nova/virt/libvirt/guest.py
+++ b/nova/virt/libvirt/guest.py
@@ -416,7 +416,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(
diff --git a/releasenotes/notes/bug-2074219-937d6404c1cbb04c.yaml b/releasenotes/notes/bug-2074219-937d6404c1cbb04c.yaml
new file mode 100644
index 0000000000..d823fb9bad
--- /dev/null
+++ b/releasenotes/notes/bug-2074219-937d6404c1cbb04c.yaml
@@ -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.