From 48a4433ce760bc6199b95814ba7b152ba99112bb Mon Sep 17 00:00:00 2001 From: Max Harmathy Date: Mon, 12 Jan 2026 15:12:36 +0100 Subject: [PATCH] Fix crash due to access to uninitialized variable The variable dev_alias is possibly not set in the code path which leads to the fallback and therefore might lead to a crash. The variable is now initialized in any case. Closes-Bug: #2120299 Change-Id: I5585c8b096916da20a849530dbbc78254c6492fc Signed-off-by: Max Harmathy --- nova/virt/libvirt/driver.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index e02f37bf3a0b..63572c4344c9 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -2885,6 +2885,7 @@ class LibvirtDriver(driver.ComputeDriver): on the nova-specified alias. If not, or we do not find it that way, fall back to the old way of using the disk_dev. """ + dev_alias = None if volume_uuid is not None: dev_alias = vconfig.make_libvirt_device_alias(volume_uuid) dev = guest.get_device_by_alias( @@ -2900,6 +2901,8 @@ class LibvirtDriver(driver.ComputeDriver): # worked. Since we call this method after detach is done to # ensure it is gone, we will always "fall back" to make sure it # is gone by the "old way" and thus shouldn't announce it. + if dev_alias is None: + dev_alias = "(no volume UUID given)" LOG.info('Device %s not found by alias %s, falling back', disk_dev, dev_alias) return dev