]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Ensure libvirt_lxc process loads the live XML config
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 30 Apr 2012 14:48:57 +0000 (15:48 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 1 May 2012 15:05:02 +0000 (16:05 +0100)
Currently the libvirt_lxc process uses VIR_DOMAIN_XML_INACTIVE
when loading the XML for the container. This means it loses
any dynamic data such as the, just allocated, SELinux label.

Further there is an inconsistency in the libvirt LXC driver
whereby it saves the live config XML and then later overwrites
the file with the live status XML instead. Add a comment about
this for future reference.

* src/lxc/lxc_controller.c: Remove VIR_DOMAIN_XML_INACTIVE
  when loading XML
* src/lxc/lxc_driver.c: Add comment about inconsistent
  config file formats

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/lxc/lxc_controller.c
src/lxc/lxc_driver.c

index 26174232daf50ec915696e52a2c5ac67167a8c2e..1e3ec30d56074b377318f528bfd70f8c4abdb545 100644 (file)
@@ -1781,7 +1781,7 @@ int main(int argc, char *argv[])
 
     if ((def = virDomainDefParseFile(caps, configFile,
                                      1 << VIR_DOMAIN_VIRT_LXC,
-                                     VIR_DOMAIN_XML_INACTIVE)) == NULL)
+                                     0)) == NULL)
         goto cleanup;
 
     if (def->nnets != nveths) {
index 7e7affd75ae63e4f875cb4794335c6eced1f5711..ffdd4ac5ac1bc4f4415570e994ef3a07f99b2464 100644 (file)
@@ -1955,17 +1955,15 @@ static int lxcVmStart(virConnectPtr conn,
         lxcProcessAutoDestroyAdd(driver, vm, conn) < 0)
         goto error;
 
-    /*
-     * Again, need to save the live configuration, because the function
-     * requires vm->def->id != -1 to save tty info surely.
-     */
-    if (virDomainSaveConfig(driver->stateDir, vm->def) < 0)
-        goto error;
-
     if (virDomainObjSetDefTransient(driver->caps, vm, false) < 0)
         goto error;
 
-    /* Write domain status to disk. */
+    /* Write domain status to disk.
+     *
+     * XXX: Earlier we wrote the plain "live" domain XML to this
+     * location for the benefit of libvirt_lxc. We're now overwriting
+     * it with the live status XML instead. This is a (currently
+     * harmless) inconsistency we should fix one day */
     if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
         goto error;