From 6a0d86b63499858ee4eeb20b04bc71617c4a2c1b7bd07d5ce91bf9fb54d52e12 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Fri, 3 Aug 2007 19:42:24 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/xen?expand=0&rev=26 --- xen.changes | 7 ++ xen.spec | 8 ++- xend_dev_destroy_cleanup.patch | 117 +++++++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 xend_dev_destroy_cleanup.patch diff --git a/xen.changes b/xen.changes index 28c3369..ef6193f 100644 --- a/xen.changes +++ b/xen.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Aug 2 13:10:36 MDT 2007 - jfehlig@novell.com + +- Added patch to fix/cleanup destoryDevice code path in xend. + Patch was submitted upstream. Aids in fixing several bugs, e.g. + #217211 and #242953. + ------------------------------------------------------------------- Tue Jul 31 13:12:40 MDT 2007 - ccoffing@novell.com diff --git a/xen.spec b/xen.spec index f0f51df..49131f4 100644 --- a/xen.spec +++ b/xen.spec @@ -34,7 +34,7 @@ BuildRequires: glibc-32bit glibc-devel-32bit BuildRequires: kernel-source kernel-syms xorg-x11 %endif Version: 3.1.0_15042 -Release: 22 +Release: 23 License: GPL v2 or later Group: System/Kernel Autoreqprov: on @@ -129,6 +129,7 @@ Patch142: netfront_mac.patch Patch143: vnc-i18n-keys.diff Patch144: rpmlint.diff Patch145: cdrom-removable.patch +Patch146: xend_dev_destroy_cleanup.patch # Patches from Jan Patch180: inval-sh-ldt.patch Patch181: 32on64-cpuid.patch @@ -603,6 +604,7 @@ Authors: %patch143 -p1 %patch144 -p1 %patch145 -p1 +%patch146 -p1 %patch180 -p1 %patch181 -p1 %patch182 -p1 @@ -944,6 +946,10 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info /sbin/ldconfig %changelog +* Thu Aug 02 2007 - jfehlig@novell.com +- Added patch to fix/cleanup destoryDevice code path in xend. + Patch was submitted upstream. Aids in fixing several bugs, e.g. + [#217211] and #242953. * Tue Jul 31 2007 - ccoffing@novell.com - Update Ron Terry's network-multi script - Fix insserv diff --git a/xend_dev_destroy_cleanup.patch b/xend_dev_destroy_cleanup.patch new file mode 100644 index 0000000..3615db8 --- /dev/null +++ b/xend_dev_destroy_cleanup.patch @@ -0,0 +1,117 @@ +# HG changeset patch +# User Jim Fehlig +# Date 1186081049 21600 +# Node ID 430ae0d3a333ff4d212df7c2313caa03e8f4dd51 +# Parent 88bb0d305308a2cab31fd8559a6a2719db1ea55a +Fix/cleanup destroyDevice code path in xend. + +When calling destroyDevice code path (e.g. xm block-detach dom devid), +allow specifying an integer device id or a device name such as xvdN or +/dev/xvdN. Allowing the /dev/xvdN form is useful when detaching devices +from dom0. Bootloaders may do this to unmount a disk previously +mounted in dom0. + +Move examination of device ID format into the DevController, permitting +device controllers to determine a valid device ID instead of higher +level code. + +Signed-off-by: Jim Fehlig + +Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py +=================================================================== +--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -544,18 +544,8 @@ class XendDomainInfo: + self.getDeviceController(devclass).waitForDevices() + + def destroyDevice(self, deviceClass, devid, force = False): +- try: +- dev = int(devid) +- except ValueError: +- # 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) ++ log.debug("dev = %s", devid) ++ return self.getDeviceController(deviceClass).destroyDevice(devid, force) + + def getDeviceSxprs(self, deviceClass): + if self._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED): +Index: xen-3.1-testing/tools/python/xen/xend/server/DevController.py +=================================================================== +--- xen-3.1-testing.orig/tools/python/xen/xend/server/DevController.py ++++ xen-3.1-testing/tools/python/xen/xend/server/DevController.py +@@ -203,27 +203,32 @@ class DevController: + + The implementation here simply deletes the appropriate paths from the + store. This may be overridden by subclasses who need to perform other +- tasks on destruction. Further, the implementation here can only +- accept integer device IDs, or values that can be converted to +- integers. Subclasses may accept other values and convert them to +- integers before passing them here. ++ tasks on destruction. The implementation here accepts integer device ++ IDs or paths containg integer deviceIDs, e.g. vfb/0. Subclasses may ++ accept other values and convert them to integers before passing them ++ here. + """ + +- devid = int(devid) ++ try: ++ dev = int(devid) ++ except ValueError: ++ # Does devid contain devicetype/deviceid? ++ # Propogate exception if unable to find an integer devid ++ dev = int(type(devid) is str and devid.split('/')[-1] or None) + + # Modify online status /before/ updating state (latter is watched by + # drivers, so this ordering avoids a race). +- self.writeBackend(devid, 'online', "0") +- self.writeBackend(devid, 'state', str(xenbusState['Closing'])) ++ self.writeBackend(dev, 'online', "0") ++ self.writeBackend(dev, 'state', str(xenbusState['Closing'])) + + if force: +- frontpath = self.frontendPath(devid) ++ frontpath = self.frontendPath(dev) + backpath = xstransact.Read(frontpath, "backend") + if backpath: + xstransact.Remove(backpath) + xstransact.Remove(frontpath) + +- self.vm._removeVm("device/%s/%d" % (self.deviceClass, devid)) ++ self.vm._removeVm("device/%s/%d" % (self.deviceClass, dev)) + + def configurations(self): + return map(self.configuration, self.deviceIDs()) +Index: xen-3.1-testing/tools/python/xen/xend/server/blkif.py +=================================================================== +--- xen-3.1-testing.orig/tools/python/xen/xend/server/blkif.py ++++ xen-3.1-testing/tools/python/xen/xend/server/blkif.py +@@ -137,13 +137,16 @@ class BlkifController(DevController): + def destroyDevice(self, devid, force): + """@see DevController.destroyDevice""" + +- # If we are given a device name, then look up the device ID from it, +- # and destroy that ID instead. If what we are given is an integer, +- # then assume it's a device ID and pass it straight through to our +- # superclass's method. +- ++ # vbd device IDs can be either string or integer. Further, the ++ # following string values are possible: ++ # - devicetype/deviceid (vbd/51728) ++ # - devicetype/devicename (/dev/xvdb) ++ # - devicename (xvdb) ++ # Let our superclass handle integer or devicetype/deviceid forms. ++ # If we are given a device name form, then look up the device ID ++ # from it, and destroy that ID instead. + try: +- DevController.destroyDevice(self, int(devid), force) ++ DevController.destroyDevice(self, devid, force) + except ValueError: + devid_end = type(devid) is str and devid.split('/')[-1] or None +