From b194a9ad3ca83f690dec49e74727929987dc32a5 Mon Sep 17 00:00:00 2001 From: Ken Dreyer Date: Thu, 8 Sep 2022 10:03:55 -0400 Subject: [PATCH] kojivmd: cleanup VMs with UNDEFINE_NVRAM Newer virtual machines may use nvram, and libvirt needs a special flag to clean these up. Prior to this change (with libvirt-8.0.0-8.1.el9_0): File "/usr/sbin/kojivmd", line 1072, in cleanupVM vm.undefine() File "/usr/lib64/python3.9/site-packages/libvirt.py", line 3178, in undefine raise libvirtError('virDomainUndefine() failed') libvirt.libvirtError: Requested operation is not valid: cannot undefine domain with nvram RHEL 7 first introduced the libvirt.VIR_DOMAIN_UNDEFINE_NVRAM flag in libvirt-python-1.2.8-7.el7 (rhbz#1144284) --- vm/kojivmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/kojivmd b/vm/kojivmd index 21bf69ad..ce31e224 100755 --- a/vm/kojivmd +++ b/vm/kojivmd @@ -1069,7 +1069,7 @@ class VMTaskManager(TaskManager): return False else: # Removed all the disks successfully, so undefine the VM - vm.undefine() + vm.undefineFlags(libvirt.VIR_DOMAIN_UNDEFINE_NVRAM) self.logger.info('Cleaned up VM %s', vm_name) return True