[PATCH v2 34/36] lxc, libxl: save domain status after reconnect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The various steps involved in reconnecting to a domain may cause updates
to the virDomainObj struct that need to be reflected in the saved status
file.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 src/libxl/libxl_driver.c | 3 +++
 src/lxc/lxc_process.c    | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 68587db303..84a1cb44c5 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -454,6 +454,9 @@ libxlReconnectDomain(virDomainObjPtr vm,
 
     libxlReconnectNotifyNets(vm->def);
 
+    if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0)
+        VIR_WARN("Cannot update XML for running Xen guest %s", vm->def->name);
+
     /* now that we know it's reconnected call the hook if present */
     if (virHookPresent(VIR_HOOK_DRIVER_LIBXL) &&
         STRNEQ("Domain-0", vm->def->name)) {
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 49776fba3a..a08c3c6a72 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -1676,6 +1676,7 @@ virLXCProcessReconnectDomain(virDomainObjPtr vm,
 {
     virLXCDriverPtr driver = opaque;
     virLXCDomainObjPrivatePtr priv;
+    virLXCDriverConfigPtr cfg = virLXCDriverGetConfig(driver);
     int ret = -1;
 
     virObjectLock(vm);
@@ -1718,6 +1719,9 @@ virLXCProcessReconnectDomain(virDomainObjPtr vm,
 
         virLXCProcessReconnectNotifyNets(vm->def);
 
+        if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
+            VIR_WARN("Cannot update XML for running LXC guest %s", vm->def->name);
+
         /* now that we know it's reconnected call the hook if present */
         if (virHookPresent(VIR_HOOK_DRIVER_LXC)) {
             char *xml = virDomainDefFormat(vm->def, driver->caps, 0);
@@ -1738,6 +1742,7 @@ virLXCProcessReconnectDomain(virDomainObjPtr vm,
 
     ret = 0;
  cleanup:
+    virObjectUnref(cfg);
     virObjectUnlock(vm);
     return ret;
 
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux