Try/except undefineFlags() as this operation is not supported on bhyve

(cherry picked from commit 29a44aceb1)
This commit is contained in:
Jeroen Schutrup 2018-08-12 19:43:22 +02:00 committed by Cédric Bosdonnat
parent e91240b439
commit 6ca8f4b978

View file

@ -3189,7 +3189,10 @@ def purge(vm_, dirs=False, removables=None, **kwargs):
shutil.rmtree(dir_)
if getattr(libvirt, 'VIR_DOMAIN_UNDEFINE_NVRAM', False):
# This one is only in 1.2.8+
dom.undefineFlags(libvirt.VIR_DOMAIN_UNDEFINE_NVRAM)
try:
dom.undefineFlags(libvirt.VIR_DOMAIN_UNDEFINE_NVRAM)
except Exception:
dom.undefine()
else:
dom.undefine()
conn.close()