[libvirt] [PATCH 2/2] snapshots: allow snapshot-edit to ignore validation

Christian Ehrhardt christian.ehrhardt at canonical.com
Mon Mar 18 15:21:19 UTC 2019


This allows users to actively ignore validadtion if needed e.g. when
changing metadata intentionally that does not pass the ABI checker.

It is utilizing EDIT_RELAX of virsh-edit.c to set the
VIR_DOMAIN_SNAPSHOT_CREATE_NOCHECK flag defined in the former patch.

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1802944

Signed-off-by: Christian Ehrhardt <christian.ehrhardt at canonical.com>
---
 tools/virsh-snapshot.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index a680d2b410..6177fc282d 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -563,7 +563,12 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd)
     (strstr(doc, "<state>disk-snapshot</state>") ? \
     define_flags |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY : 0), \
     edited = virDomainSnapshotCreateXML(dom, doc_edited, define_flags)
+#define EDIT_RELAX \
+    do { \
+        define_flags |= VIR_DOMAIN_SNAPSHOT_CREATE_NOCHECK; \
+    } while (0);
 #include "virsh-edit.c"
+#undef EDIT_RELAX
 
     edited_name = virDomainSnapshotGetName(edited);
     if (STREQ(name, edited_name)) {
-- 
2.17.1




More information about the libvir-list mailing list