[PATCH 8/8] xen: Allow to undefine a running domain (xm_internal)

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

 



---
 src/xen/xm_internal.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 95387c9..5c8a017 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -1218,8 +1218,6 @@ int xenXMDomainUndefine(virDomainPtr domain) {
         return (-1);
     }
 
-    if (domain->id != -1)
-        return (-1);
     if (domain->conn->flags & VIR_CONNECT_RO)
         return (-1);
 
@@ -1235,13 +1233,17 @@ int xenXMDomainUndefine(virDomainPtr domain) {
     if (unlink(entry->filename) < 0)
         goto cleanup;
 
-    /* Remove the name -> filename mapping */
-    if (virHashRemoveEntry(priv->nameConfigMap, domain->name) < 0)
-        goto cleanup;
+    if (virDomainObjIsActive(vm)) {
+        vm->persistent = 0;
+    } else {
+        /* Remove the name -> filename mapping */
+        if (virHashRemoveEntry(priv->nameConfigMap, domain->name) < 0)
+            goto cleanup;
 
-    /* Remove the config record itself */
-    if (virHashRemoveEntry(priv->configCache, entry->filename) < 0)
-        goto cleanup;
+        /* Remove the config record itself */
+        if (virHashRemoveEntry(priv->configCache, entry->filename) < 0)
+            goto cleanup;
+    }
 
     ret = 0;
 
-- 
1.7.6

--
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]