debuggers.hg

changeset 22045:cd5b4135fe03

Fix "Error: Device 51952 not connected"?error when using pygrub

The following is the process of booting a DomU with 'mounted-blktap2' (VHD
for example) and 'pygrub' as bootloader:

1. Connect boot-device to Dom0 as '/dev/xpvd'
2. Pygrub get info for load DomU
3. Disconnect boot-device from Dom0
4. Boot DomU

During step 3 the created device is disconnected from Dom0, but
xenstore?does not?scrape away after the device is disconnected so you
get the following error:

?? ?"Error: Device /dev/xvdp (51952, tap2) is already connected."

During step 3 xend calls destroyDevice always with 'tap' as argument.

Signed-off-by: eXeC001er <execooler@gmail.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
author eXeC001er <execooler@gmail.com>
date Mon Aug 16 17:11:30 2010 +0100 (2010-08-16)
parents 2f1f35359317
children 4fc66044477d
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Aug 16 17:04:31 2010 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Aug 16 17:11:30 2010 +0100
     1.3 @@ -3261,6 +3261,7 @@ class XendDomainInfo:
     1.4  
     1.5              taptype = blkdev_uname_to_taptype(disk)
     1.6              mounted = devtype in ['tap', 'tap2'] and taptype != 'aio' and taptype != 'sync' and not os.stat(fn).st_rdev
     1.7 +            mounted_vbd_uuid = 0
     1.8              if mounted:
     1.9                  # This is a file, not a device.  pygrub can cope with a
    1.10                  # file if it's raw, but if it's QCOW or other such formats
    1.11 @@ -3276,7 +3277,8 @@ class XendDomainInfo:
    1.12  
    1.13                  from xen.xend import XendDomain
    1.14                  dom0 = XendDomain.instance().privilegedDomain()
    1.15 -                dom0._waitForDeviceUUID(dom0.create_vbd(vbd, disk))
    1.16 +                mounted_vbd_uuid = dom0.create_vbd(vbd, disk);
    1.17 +                dom0._waitForDeviceUUID(mounted_vbd_uuid)
    1.18                  fn = BOOTLOADER_LOOPBACK_DEVICE
    1.19  
    1.20              try:
    1.21 @@ -3286,8 +3288,9 @@ class XendDomainInfo:
    1.22                  if mounted:
    1.23                      log.info("Unmounting %s from %s." %
    1.24                               (fn, BOOTLOADER_LOOPBACK_DEVICE))
    1.25 -
    1.26 -                    dom0.destroyDevice('tap', BOOTLOADER_LOOPBACK_DEVICE)
    1.27 +                    _, vbd_info = dom0.info['devices'][mounted_vbd_uuid]
    1.28 +                    dom0.destroyDevice(dom0.getBlockDeviceClass(vbd_info['devid']), 
    1.29 +                                       BOOTLOADER_LOOPBACK_DEVICE, force = True)
    1.30  
    1.31              if blcfg is None:
    1.32                  msg = "Had a bootloader specified, but can't find disk"