From 9063243af5e6674359a0ff7cec57f02eeacf0cea Mon Sep 17 00:00:00 2001 From: Ashley Yakeley Date: Sun, 12 Jan 2025 18:44:13 -0800 Subject: [PATCH] LXC: don't set undefine flags (#77) --- tool/nixvirt.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tool/nixvirt.py b/tool/nixvirt.py index 946dfee..f252c82 100644 --- a/tool/nixvirt.py +++ b/tool/nixvirt.py @@ -115,10 +115,17 @@ def _descriptionXML(self,lvobj): return lvobj.XMLDesc(flags=2) def _undefine(self,lvobj): # https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainUndefineFlagsValues - # VIR_DOMAIN_UNDEFINE_MANAGED_SAVE - # VIR_DOMAIN_UNDEFINE_KEEP_NVRAM - # VIR_DOMAIN_UNDEFINE_KEEP_TPM - lvobj.undefineFlags(flags=73) + match self.session.driver: + case "QEMU": + # VIR_DOMAIN_UNDEFINE_MANAGED_SAVE + # VIR_DOMAIN_UNDEFINE_KEEP_NVRAM + # VIR_DOMAIN_UNDEFINE_KEEP_TPM + flags=73 + case "LXC": + flags=0 # LXC doesn't support undefine flags + case _: + flags=73 # best guess, same as QEMU + lvobj.undefineFlags(flags=flags) def _fixDefinitionETree(self,objid,specDefETree): interfaces = specDefETree.xpath("/domain/devices/interface") index = 0