[libvirt] [PATCH 0/8] Make loading domains with invalid XML possible

Martin Kletzander mkletzan at redhat.com
Thu Nov 26 13:21:45 UTC 2015


The RFC version [1] was ACKed, but I have found out that we could then
cause inconsistency by calling virDomainCreateXML() or Restore() calls
etc.  This series is basically the same apart from the fact that it is
rebased on current master and then one simple diff [2] is added to
PATCH 5/8.

[1] https://www.redhat.com/archives/libvir-list/2015-September/msg00698.html

[2] diff to the previous version:

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 16f26acf4839..c8291be2b7b5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2875,6 +2875,14 @@ virDomainObjListAddLocked(virDomainObjListPtr doms,
             }
         }

+        if (vm->def->parseError) {
+            virReportError(VIR_ERR_XML_ERROR,
+                           _("domain '%s' was not loaded due to an XML error "
+                             "(%s), please redefine it"),
+                           vm->def->name, vm->def->parseError);
+            virDomainObjEndAPI(&vm);
+        }
+
         virDomainObjAssignDef(vm,
                               def,
                               !!(flags & VIR_DOMAIN_OBJ_LIST_ADD_LIVE),
--

Martin Kletzander (8):
  conf, virsh: Add new domain shutoff reason
  qemu: Few whitespace cleanups
  conf: Extract name-parsing into its own function
  conf: Extract UUID parsing into its own function
  conf: Optionally keep domains with invalid XML, but don't allow
    starting them
  qemu: Don't lookup invalid domains unless specified otherwise
  qemu: Prepare basic APIs to handle invalid defs
  qemu: Load domains with invalid XML on start

 include/libvirt/libvirt-domain.h |   2 +
 src/bhyve/bhyve_driver.c         |   2 +
 src/conf/domain_conf.c           | 191 +++++++++++++++++++++++++++++++++------
 src/conf/domain_conf.h           |   5 +
 src/libxl/libxl_driver.c         |   3 +
 src/lxc/lxc_driver.c             |   3 +
 src/qemu/qemu_driver.c           |  64 ++++++++++---
 src/uml/uml_driver.c             |   2 +
 tools/virsh-domain-monitor.c     |   3 +-
 9 files changed, 234 insertions(+), 41 deletions(-)

--
2.6.3




More information about the libvir-list mailing list