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)
This commit is contained in:
Ken Dreyer 2022-09-08 10:03:55 -04:00 committed by Tomas Kopecek
parent 041bbc3502
commit b194a9ad3c

View file

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