2011-05-31 19:35:29 +02:00
|
|
|
Index: xen-4.1.1-testing/tools/python/xen/xend/server/DevController.py
|
2008-01-12 02:32:53 +01:00
|
|
|
===================================================================
|
2011-05-31 19:35:29 +02:00
|
|
|
--- xen-4.1.1-testing.orig/tools/python/xen/xend/server/DevController.py
|
|
|
|
+++ xen-4.1.1-testing/tools/python/xen/xend/server/DevController.py
|
2010-01-16 01:12:54 +01:00
|
|
|
@@ -592,6 +592,31 @@ class DevController:
|
2008-07-19 01:04:37 +02:00
|
|
|
return (Missing, None)
|
2008-01-12 02:32:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
+ def waitForFrontend(self, devid):
|
|
|
|
+ def frontendStatusCallback(statusPath, ev, result):
|
|
|
|
+ status = xstransact.Read(statusPath)
|
|
|
|
+ log.debug("frontendStatusCallback %s = %s" % (statusPath, status))
|
|
|
|
+ try:
|
|
|
|
+ status = int(status)
|
|
|
|
+ if status == xenbusState['Connected']:
|
|
|
|
+ result['status'] = Connected
|
|
|
|
+ elif status == xenbusState['Closed']:
|
|
|
|
+ result['status'] = Error
|
|
|
|
+ else:
|
|
|
|
+ raise
|
|
|
|
+ except:
|
|
|
|
+ return 1
|
|
|
|
+ ev.set()
|
|
|
|
+ return 0
|
|
|
|
+ frontpath = self.frontendPath(devid)
|
|
|
|
+ statusPath = frontpath + '/state'
|
|
|
|
+ ev = Event()
|
|
|
|
+ result = { 'status': Timeout }
|
|
|
|
+ xswatch(statusPath, frontendStatusCallback, ev, result)
|
|
|
|
+ ev.wait(5)
|
|
|
|
+ return result['status']
|
|
|
|
+
|
|
|
|
+
|
|
|
|
def backendPath(self, backdom, devid):
|
|
|
|
"""Construct backend path given the backend domain and device id.
|
|
|
|
|
2011-05-31 19:35:29 +02:00
|
|
|
Index: xen-4.1.1-testing/tools/python/xen/xend/XendBootloader.py
|
2007-02-11 11:48:10 +01:00
|
|
|
===================================================================
|
2011-05-31 19:35:29 +02:00
|
|
|
--- xen-4.1.1-testing.orig/tools/python/xen/xend/XendBootloader.py
|
|
|
|
+++ xen-4.1.1-testing/tools/python/xen/xend/XendBootloader.py
|
2009-05-04 18:38:09 +02:00
|
|
|
@@ -12,7 +12,7 @@
|
2008-01-12 02:32:53 +01:00
|
|
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
#
|
2007-02-11 11:48:10 +01:00
|
|
|
|
2008-07-19 01:04:37 +02:00
|
|
|
-import os, select, errno, stat, signal, tty
|
|
|
|
+import os, select, errno, stat, signal, tty, time
|
2007-02-11 11:48:10 +01:00
|
|
|
import random
|
|
|
|
import shlex
|
|
|
|
from xen.xend import sxp
|
2010-01-16 01:12:54 +01:00
|
|
|
@@ -38,8 +38,25 @@ def bootloader(blexec, disk, dom, quiet
|
2008-01-12 02:32:53 +01:00
|
|
|
msg = "Bootloader isn't executable"
|
|
|
|
log.error(msg)
|
|
|
|
raise VmError(msg)
|
|
|
|
- if not os.access(disk, os.R_OK):
|
|
|
|
- msg = "Disk isn't accessible"
|
|
|
|
+
|
|
|
|
+ # domUloader requires '--entry=foo' in blargs, which is derived from
|
|
|
|
+ # 'bootargs' entry in domain configuration file. Ensure it exists
|
|
|
|
+ # here so a reasonable error message can be returned.
|
|
|
|
+ if blexec.find('domUloader.py') != -1:
|
|
|
|
+ if blargs.find('entry') == -1:
|
|
|
|
+ msg = "domUloader requires specification of bootargs"
|
|
|
|
+ log.error(msg)
|
|
|
|
+ raise VmError(msg)
|
|
|
|
+
|
|
|
|
+ avail = False
|
2010-09-28 00:07:21 +02:00
|
|
|
+ for i in xrange(1, 100):
|
2008-01-12 02:32:53 +01:00
|
|
|
+ avail = os.access(disk, os.R_OK)
|
|
|
|
+ if avail:
|
|
|
|
+ break
|
2010-09-28 00:07:21 +02:00
|
|
|
+ time.sleep(.1)
|
2008-01-12 02:32:53 +01:00
|
|
|
+
|
|
|
|
+ if not avail:
|
|
|
|
+ msg = "Disk '%s' isn't accessible" % disk
|
|
|
|
log.error(msg)
|
|
|
|
raise VmError(msg)
|
|
|
|
|
2011-05-31 19:35:29 +02:00
|
|
|
Index: xen-4.1.1-testing/tools/python/xen/xend/XendDomainInfo.py
|
2007-03-06 09:12:51 +01:00
|
|
|
===================================================================
|
2011-05-31 19:35:29 +02:00
|
|
|
--- xen-4.1.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
|
|
|
|
+++ xen-4.1.1-testing/tools/python/xen/xend/XendDomainInfo.py
|
2011-03-21 17:47:37 +01:00
|
|
|
@@ -2332,6 +2332,10 @@ class XendDomainInfo:
|
2008-01-12 02:32:53 +01:00
|
|
|
deviceClass, config = self.info['devices'].get(dev_uuid)
|
|
|
|
self._waitForDevice(deviceClass, config['devid'])
|
|
|
|
|
|
|
|
+ def _waitForDeviceFrontUUID(self, dev_uuid):
|
|
|
|
+ deviceClass, config = self.info['devices'].get(dev_uuid)
|
|
|
|
+ self.getDeviceController(deviceClass).waitForFrontend(config['devid'])
|
|
|
|
+
|
|
|
|
def _waitForDevice_destroy(self, deviceClass, devid, backpath):
|
|
|
|
return self.getDeviceController(deviceClass).waitForDevice_destroy(
|
|
|
|
devid, backpath)
|
2011-03-21 17:47:37 +01:00
|
|
|
@@ -3277,7 +3281,8 @@ class XendDomainInfo:
|
2008-01-12 02:32:53 +01:00
|
|
|
from xen.xend import XendDomain
|
|
|
|
dom0 = XendDomain.instance().privilegedDomain()
|
2011-02-04 22:19:54 +01:00
|
|
|
mounted_vbd_uuid = dom0.create_vbd(vbd, disk);
|
|
|
|
- dom0._waitForDeviceUUID(mounted_vbd_uuid)
|
2008-01-12 02:32:53 +01:00
|
|
|
+ vbd_uuid = dom0.create_vbd(vbd, disk)
|
|
|
|
+ dom0._waitForDeviceFrontUUID(vbd_uuid)
|
|
|
|
fn = BOOTLOADER_LOOPBACK_DEVICE
|
|
|
|
|
|
|
|
try:
|
2011-03-21 17:47:37 +01:00
|
|
|
@@ -3287,10 +3292,10 @@ class XendDomainInfo:
|
2009-05-04 18:38:09 +02:00
|
|
|
if mounted:
|
2008-03-06 02:36:51 +01:00
|
|
|
log.info("Unmounting %s from %s." %
|
|
|
|
(fn, BOOTLOADER_LOOPBACK_DEVICE))
|
2011-02-04 22:19:54 +01:00
|
|
|
- _, vbd_info = dom0.info['devices'][mounted_vbd_uuid]
|
|
|
|
- dom0.destroyDevice(dom0.getBlockDeviceClass(vbd_info['devid']),
|
|
|
|
- BOOTLOADER_LOOPBACK_DEVICE, force = True)
|
2009-05-04 18:38:09 +02:00
|
|
|
-
|
2010-01-16 01:12:54 +01:00
|
|
|
+ if devtype in ['tap', 'tap2']:
|
|
|
|
+ dom0.destroyDevice('tap', BOOTLOADER_LOOPBACK_DEVICE, rm_cfg = True)
|
2009-05-04 18:38:09 +02:00
|
|
|
+ else:
|
2010-01-16 01:12:54 +01:00
|
|
|
+ dom0.destroyDevice('vbd', BOOTLOADER_LOOPBACK_DEVICE, rm_cfg = True)
|
2008-03-06 02:36:51 +01:00
|
|
|
if blcfg is None:
|
|
|
|
msg = "Had a bootloader specified, but can't find disk"
|
2011-02-04 22:19:54 +01:00
|
|
|
log.error(msg)
|