SHA256
1
0
forked from pool/xen
OBS User unknown
2009-05-04 16:38:09 +00:00
committed by Git OBS Bridge
parent 4790095364
commit 0bb51565d6
187 changed files with 2454 additions and 20791 deletions

View File

@@ -1,7 +1,7 @@
Index: xen-3.3.1-testing/tools/python/xen/util/blkif.py
Index: xen-3.4.0-testing/tools/python/xen/util/blkif.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/util/blkif.py
+++ xen-3.3.1-testing/tools/python/xen/util/blkif.py
--- xen-3.4.0-testing.orig/tools/python/xen/util/blkif.py
+++ xen-3.4.0-testing/tools/python/xen/util/blkif.py
@@ -71,23 +71,24 @@ def blkdev_segment(name):
'type' : 'Disk' }
return val
@@ -12,7 +12,7 @@ Index: xen-3.3.1-testing/tools/python/xen/util/blkif.py
+ fn = typ = taptype = None
if uname.find(":") != -1:
(typ, fn) = uname.split(":", 1)
if typ == "phy" and not fn.startswith("/"):
if typ in ("phy", "drbd") and not fn.startswith("/"):
fn = "/dev/%s" %(fn,)
if typ == "tap":
(taptype, fn) = fn.split(":", 1)
@@ -32,11 +32,11 @@ Index: xen-3.3.1-testing/tools/python/xen/util/blkif.py
def mount_mode(name):
mode = None
Index: xen-3.3.1-testing/tools/python/xen/xend/server/DevController.py
Index: xen-3.4.0-testing/tools/python/xen/xend/server/DevController.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xend/server/DevController.py
+++ xen-3.3.1-testing/tools/python/xen/xend/server/DevController.py
@@ -620,6 +620,31 @@ class DevController:
--- xen-3.4.0-testing.orig/tools/python/xen/xend/server/DevController.py
+++ xen-3.4.0-testing/tools/python/xen/xend/server/DevController.py
@@ -593,6 +593,31 @@ class DevController:
return (Missing, None)
@@ -68,22 +68,20 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/server/DevController.py
def backendPath(self, backdom, devid):
"""Construct backend path given the backend domain and device id.
Index: xen-3.3.1-testing/tools/python/xen/xend/XendBootloader.py
Index: xen-3.4.0-testing/tools/python/xen/xend/XendBootloader.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xend/XendBootloader.py
+++ xen-3.3.1-testing/tools/python/xen/xend/XendBootloader.py
@@ -12,8 +12,9 @@
--- xen-3.4.0-testing.orig/tools/python/xen/xend/XendBootloader.py
+++ xen-3.4.0-testing/tools/python/xen/xend/XendBootloader.py
@@ -12,7 +12,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
-import os, select, errno, stat, signal, tty
+import os, select, errno, stat, signal, tty, time
import random
+import re
import shlex
from xen.xend import sxp
@@ -38,8 +39,25 @@ def bootloader(blexec, disk, dom, quiet
@@ -38,8 +38,25 @@ def bootloader(blexec, disk, dom, quiet
msg = "Bootloader isn't executable"
log.error(msg)
raise VmError(msg)
@@ -111,25 +109,10 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendBootloader.py
log.error(msg)
raise VmError(msg)
@@ -184,3 +202,14 @@ def bootloader_tidy(dom):
os.kill(pid, signal.SIGKILL)
+def bootfilter(bootloader, bootloader_args, vdisk):
+ """Is this virtual disk ok to boot from?"""
+ if vdisk.endswith(':disk'):
+ vdisk = vdisk[:-5] # temporary work-around for bug 237414
+ if bootloader.endswith('domUloader.py'):
+ for arg in bootloader_args.split():
+ if arg.startswith('--entry='):
+ m = re.match(r'^([hsx]v?d[a-z])[0-9]*:[^,]*(,[^,]*)?$', arg[8:])
+ if m:
+ return vdisk == m.group(1) or vdisk == m.group(2)
+ return True
Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
Index: xen-3.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
--- xen-3.4.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -35,7 +35,7 @@ from types import StringTypes
import xen.lowlevel.xc
@@ -139,16 +122,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
import xen.util.xsm.xsm as security
from xen.util import xsconstants
@@ -43,7 +43,7 @@ from xen.xend import balloon, sxp, uuid,
from xen.xend import XendOptions, XendNode, XendConfig
from xen.xend.XendConfig import scrub_password
-from xen.xend.XendBootloader import bootloader, bootloader_tidy
+from xen.xend.XendBootloader import bootloader, bootloader_tidy, bootfilter
from xen.xend.XendError import XendError, VmError
from xen.xend.XendDevices import XendDevices
from xen.xend.XendTask import XendTask
@@ -1878,6 +1878,10 @@ class XendDomainInfo:
@@ -2134,6 +2134,10 @@ class XendDomainInfo:
deviceClass, config = self.info['devices'].get(dev_uuid)
self._waitForDevice(deviceClass, config['devid'])
@@ -159,21 +133,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
def _waitForDevice_destroy(self, deviceClass, devid, backpath):
return self.getDeviceController(deviceClass).waitForDevice_destroy(
devid, backpath)
@@ -2569,8 +2573,11 @@ class XendDomainInfo:
blexec = osdep.pygrub_path
blcfg = None
- disks = [x for x in self.info['vbd_refs']
- if self.info['devices'][x][1]['bootable']]
+ disks = []
+ for x in self.info['vbd_refs']:
+ vdisk = self.info['devices'][x][1]['dev']
+ if bootfilter(blexec, bootloader_args, vdisk):
+ disks.append(x)
if not disks:
msg = "Had a bootloader specified, but no disks are bootable"
@@ -2581,13 +2588,10 @@ class XendDomainInfo:
@@ -2892,9 +2896,19 @@ class XendDomainInfo:
devtype = devinfo[0]
disk = devinfo[1]['uname']
@@ -181,16 +141,22 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
- taptype = blkdev_uname_to_taptype(disk)
- mounted = devtype == 'tap' and taptype != 'aio' and taptype != 'sync' and not os.stat(fn).st_rdev
+ (fn, types) = parse_uname(disk)
+ mounted = (types[0] not in ('file', 'phy'))
+
+ def _shouldMount(types):
+ if types[0] in ('file', 'phy'):
+ return False
+ if types[0] == 'tap':
+ if types[1] in ('aio', 'sync'):
+ return False
+ else:
+ return True
+ return os.access('/etc/xen/scripts/block-%s' % types[0], os.X_OK)
+
+ mounted = _shouldMount(types)
if mounted:
- # This is a file, not a device. pygrub can cope with a
- # file if it's raw, but if it's QCOW or other such formats
- # used through blktap, then we need to mount it first.
+ # This is not a raw file or device, so we need to mount it first.
log.info("Mounting %s on %s." %
(fn, BOOTLOADER_LOOPBACK_DEVICE))
@@ -2599,7 +2603,9 @@ class XendDomainInfo:
# This is a file, not a device. pygrub can cope with a
# file if it's raw, but if it's QCOW or other such formats
@@ -2910,7 +2924,9 @@ class XendDomainInfo:
from xen.xend import XendDomain
dom0 = XendDomain.instance().privilegedDomain()
@@ -201,12 +167,16 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
fn = BOOTLOADER_LOOPBACK_DEVICE
try:
@@ -2610,7 +2616,7 @@ class XendDomainInfo:
@@ -2920,8 +2936,10 @@ class XendDomainInfo:
if mounted:
log.info("Unmounting %s from %s." %
(fn, BOOTLOADER_LOOPBACK_DEVICE))
-
- dom0.destroyDevice('tap', BOOTLOADER_LOOPBACK_DEVICE)
+ dom0.destroyDevice('tap', BOOTLOADER_LOOPBACK_DEVICE, rm_cfg = True)
+ if devtype == 'tap':
+ dom0.destroyDevice('tap', BOOTLOADER_LOOPBACK_DEVICE)
+ else:
+ dom0.destroyDevice('vbd', BOOTLOADER_LOOPBACK_DEVICE)
if blcfg is None:
msg = "Had a bootloader specified, but can't find disk"