Blame SOURCES/libvirt-conf-Add-XML-parser-flag-that-will-allow-us-to-do-incompatible-updates.patch

7a3408
From fd2d738d9c12aeea42167e0de3662af5a64d93d5 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <fd2d738d9c12aeea42167e0de3662af5a64d93d5@dist-git>
7a3408
From: Peter Krempa <pkrempa@redhat.com>
7a3408
Date: Tue, 22 Sep 2015 16:59:41 +0200
7a3408
Subject: [PATCH] conf: Add XML parser flag that will allow us to do
7a3408
 incompatible updates
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1252685
7a3408
7a3408
Add a new parser flag that will mark code paths that parse XML files
7a3408
wich will not be used with existing VM state so that post parse
7a3408
callbacks can possibly do ABI incompatible changes if needed.
7a3408
7a3408
(cherry picked from commit 59173c3dd94fc090d2776be3986a1014ddbf2396)
7a3408
7a3408
Conflicts:
7a3408
	src/qemu/qemu_driver.c - context
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/conf/domain_conf.h    |  2 ++
7a3408
 src/qemu/qemu_driver.c    | 12 ++++++++----
7a3408
 src/qemu/qemu_migration.c |  3 ++-
7a3408
 3 files changed, 12 insertions(+), 5 deletions(-)
7a3408
7a3408
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
7a3408
index 63685c6..bac64b3 100644
7a3408
--- a/src/conf/domain_conf.h
7a3408
+++ b/src/conf/domain_conf.h
7a3408
@@ -2613,6 +2613,8 @@ typedef enum {
7a3408
     /* don't validate os.type and arch against capabilities. Prevents
7a3408
      * VMs from disappearing when qemu is removed and libvirtd is restarted */
7a3408
     VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS = 1 << 8,
7a3408
+    /* allow updates in post parse callback that would break ABI otherwise */
7a3408
+    VIR_DOMAIN_DEF_PARSE_ABI_UPDATE = 1 << 9,
7a3408
 } virDomainDefParseFlags;
7a3408
 
7a3408
 typedef enum {
7a3408
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
7a3408
index 0f3e987..f15b14a 100644
7a3408
--- a/src/qemu/qemu_driver.c
7a3408
+++ b/src/qemu/qemu_driver.c
7a3408
@@ -1714,7 +1714,8 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn,
7a3408
     unsigned int start_flags = VIR_QEMU_PROCESS_START_COLD;
7a3408
     virQEMUCapsPtr qemuCaps = NULL;
7a3408
     virCapsPtr caps = NULL;
7a3408
-    unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE;
7a3408
+    unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE |
7a3408
+                               VIR_DOMAIN_DEF_PARSE_ABI_UPDATE;
7a3408
 
7a3408
     virCheckFlags(VIR_DOMAIN_START_PAUSED |
7a3408
                   VIR_DOMAIN_START_AUTODESTROY |
7a3408
@@ -7179,7 +7180,8 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
7a3408
         goto cleanup;
7a3408
 
7a3408
     def = virDomainDefParseString(xmlData, caps, driver->xmlopt,
7a3408
-                                  VIR_DOMAIN_DEF_PARSE_INACTIVE);
7a3408
+                                  VIR_DOMAIN_DEF_PARSE_INACTIVE |
7a3408
+                                  VIR_DOMAIN_DEF_PARSE_ABI_UPDATE);
7a3408
     if (!def)
7a3408
         goto cleanup;
7a3408
 
7a3408
@@ -7494,7 +7496,8 @@ static virDomainPtr qemuDomainDefineXMLFlags(virConnectPtr conn, const char *xml
7a3408
     virQEMUCapsPtr qemuCaps = NULL;
7a3408
     virQEMUDriverConfigPtr cfg;
7a3408
     virCapsPtr caps = NULL;
7a3408
-    unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE;
7a3408
+    unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE |
7a3408
+                               VIR_DOMAIN_DEF_PARSE_ABI_UPDATE;
7a3408
 
7a3408
     virCheckFlags(VIR_DOMAIN_DEFINE_VALIDATE, NULL);
7a3408
 
7a3408
@@ -8449,7 +8452,8 @@ static int qemuDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
7a3408
     virDomainDefPtr vmdef = NULL;
7a3408
     virDomainDeviceDefPtr dev = NULL, dev_copy = NULL;
7a3408
     int ret = -1;
7a3408
-    unsigned int affect, parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE;
7a3408
+    unsigned int affect, parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE |
7a3408
+                                       VIR_DOMAIN_DEF_PARSE_ABI_UPDATE;
7a3408
     virQEMUCapsPtr qemuCaps = NULL;
7a3408
     qemuDomainObjPrivatePtr priv;
7a3408
     virQEMUDriverConfigPtr cfg = NULL;
7a3408
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
7a3408
index 93f561f..cb82687 100644
7a3408
--- a/src/qemu/qemu_migration.c
7a3408
+++ b/src/qemu/qemu_migration.c
7a3408
@@ -1257,7 +1257,8 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig,
7a3408
         }
7a3408
         mig->persistent = virDomainDefParseNode(doc, nodes[0],
7a3408
                                                 caps, driver->xmlopt,
7a3408
-                                                VIR_DOMAIN_DEF_PARSE_INACTIVE);
7a3408
+                                                VIR_DOMAIN_DEF_PARSE_INACTIVE |
7a3408
+                                                VIR_DOMAIN_DEF_PARSE_ABI_UPDATE);
7a3408
         if (!mig->persistent) {
7a3408
             /* virDomainDefParseNode already reported
7a3408
              * an error for us */
7a3408
-- 
7a3408
2.5.3
7a3408