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

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

 



On 08/19/2011 08:03 AM, Osier Yang wrote:
---
  src/xen/xm_internal.c |   18 ++++++++++--------
  1 files changed, 10 insertions(+), 8 deletions(-)

Aargh, again I spoke too soon.


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;

There is no vm in scope. Furthermore, xm_internal is used solely for management of inactive domains - see this code in xen_driver.c for xenUnifiedDomainIsPersistent:

    if (priv->opened[XEN_UNIFIED_XM_OFFSET]) {
        /* Old Xen, pre-inactive domain management.
* If the XM driver can see the guest, it is definitely persistent */
        currdom = xenXMDomainLookupByUUID(dom->conn, dom->uuid);
        if (currdom)
            ret = 1;
        else
            ret = 0;
    } else {
        /* New Xen with inactive domain management */
        if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
            currdom = xenDaemonLookupByUUID(dom->conn, dom->uuid);
            if (currdom) {
                if (currdom->id == -1) {
/* If its inactive, then trivially, it must be persistent */
                    ret = 1;
                } else {
                    char *path;
                    char uuidstr[VIR_UUID_STRING_BUFLEN];

/* If its running there's no official way to tell, so we
                     * go behind xend's back & look at the config dir */
...

I think we need to revert this patch, and instead fix things so that xm_internal fails on running domains (that is, if the domain is running, the xm driver has nothing to do with it, but by returning failure, the unified driver then knows to fall back to the xend driver), and it is the xend driver that should be managing a transition from running persistent to transient.

--
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

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