libvirt: Undefine NVRAM when undefining domain

This is apparently necessary on aarch64, we get an error from
libvirt otherwise.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2018-03-14 13:42:01 -07:00
parent a886b9f4a9
commit 14abb9b3e1

View File

@ -248,7 +248,7 @@ class VirtInstallImage(object):
except libvirt.libvirtError: except libvirt.libvirtError:
# domain may not be running, so this is fine # domain may not be running, so this is fine
pass pass
dom.undefine() dom.undefineFlags(libvirt.VIR_DOMAIN_UNDEFINE_NVRAM)
except libvirt.libvirtError: except libvirt.libvirtError:
# domain may not exist, so this is fine # domain may not exist, so this is fine
pass pass
@ -321,7 +321,7 @@ class VirtInstallImage(object):
# maybe it died already # maybe it died already
pass pass
try: try:
dom.undefine() dom.undefineFlags(libvirt.VIR_DOMAIN_UNDEFINE_NVRAM)
except libvirt.libvirtError: except libvirt.libvirtError:
pass pass
conn.close() conn.close()
@ -351,7 +351,7 @@ class VirtInstallImage(object):
# the domain # the domain
os.rename(tmpfile, self.filename) os.rename(tmpfile, self.filename)
os.chmod(self.filename, 0o644) os.chmod(self.filename, 0o644)
dom.undefine() dom.undefineFlags(libvirt.VIR_DOMAIN_UNDEFINE_NVRAM)
conn.close() conn.close()
except: except:
# if anything went wrong, we want to wipe the temp file # if anything went wrong, we want to wipe the temp file