All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Fehlig <jfehlig@novell.com>
To: xen-devel@lists.xensource.com
Cc: Mats.Petersson@amd.com
Subject: [PATCH][xend] cs 15157 breaks block-detach
Date: Thu, 07 Jun 2007 18:30:47 -0600	[thread overview]
Message-ID: <4668A337.3060707@novell.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 765 bytes --]

c/s 15157 introduced a regression in block-detach.  Prior to this c/s,
user was able to specify device name or id, e.g.

xm block-detach dom xvdb
xm block-detach dom 15728

Now, 'xm block-detach dom xvdb' silently fails.  xend.log does contain
the following

[2007-06-07 11:39:18 xend.XendDomainInfo 3775] DEBUG
(XendDomainInfo:519) devName=vbd/51712
[2007-06-07 11:39:18 xend.XendDomainInfo 3775] DEBUG
(XendDomainInfo:527) Could not find the device xvdb

This patch restores the previous behavior but retains the bug originally
fixed by c/s 15571.

  Signed-off-by: Jim Fehlig <jfehlig@novell.com>

Mats - you may want to give this a spin through your save/restore test,
but my initial testing shows no accumulated, orphaned entries in xenstore.

Regards,
Jim




[-- Attachment #2: xend_destroy_device.patch --]
[-- Type: text/x-patch, Size: 2205 bytes --]

diff -r bd3d6b4c52ec tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py	Fri Jun 01 14:50:52 2007 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Jun 07 18:05:23 2007 -0600
@@ -546,31 +546,18 @@ class XendDomainInfo:
             self.getDeviceController(devclass).waitForDevices()
 
     def destroyDevice(self, deviceClass, devid, force = False):
-        found = True                    # Assume devid is an integer.
         try:
-            devid = int(devid)
+            dev = int(devid)
         except ValueError:
-            # devid is not a number, let's search for it in xenstore.
-            devicePath = '%s/device/%s' % (self.dompath, deviceClass)
-            found = False
-            for entry in xstransact.List(devicePath):
-                log.debug("Attempting to find devid at %s/%s", devicePath, entry)
-                backend = xstransact.Read('%s/%s' % (devicePath, entry),
-                                          "backend")
-                if backend != None:
-                    devName = '%s/%s' % (deviceClass, entry)
-                    log.debug("devName=%s", devName)
-                    if devName == devid:
-                        # We found the integer matching our devid, use it instead
-                        devid = int(entry)
-                        found = True
-                        break
-
-        if not found:
-            log.debug("Could not find the device %s", devid)
-            return None
-        log.debug("devid = %s", devid)
-        return self.getDeviceController(deviceClass).destroyDevice(devid, force)
+            # devid is not a number but a string containing either device
+            # name (e.g. xvda) or device_type/device_id (e.g. vbd/51728)
+            dev = type(devid) is str and devid.split('/')[-1] or None
+            if dev == None:
+                log.debug("Could not find the device %s", devid)
+                return None
+
+        log.debug("dev = %s", dev)
+        return self.getDeviceController(deviceClass).destroyDevice(dev, force)
 
     def getDeviceSxprs(self, deviceClass):
         if self._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2007-06-08  0:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4668A337.3060707@novell.com \
    --to=jfehlig@novell.com \
    --cc=Mats.Petersson@amd.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.