ia64/xen-unstable

changeset 14474:09f2e758a198

Don't mount raw blktap disks for pygrub
Currently, we mount all blktap disks for pygrub so that it can boot
from e.g. QCOW images. However, since pygrub will handle a raw image
just fine without mounting through blktap, we shouldn't bother in that
case.

Also, it looks like XendDomainInfo.create_vbd() takes the full disk
uname rather than the image path.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
author Mark McLoughlin <markmc@redhat.com>
date Tue Mar 20 11:10:52 2007 +0000 (2007-03-20)
parents 4e380c769774
children 61a4a4795be5
files tools/python/xen/util/blkif.py tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/util/blkif.py	Mon Mar 19 16:55:21 2007 +0000
     1.2 +++ b/tools/python/xen/util/blkif.py	Tue Mar 20 11:10:52 2007 +0000
     1.3 @@ -66,16 +66,23 @@ def blkdev_segment(name):
     1.4                  'type'         : 'Disk' }
     1.5      return val
     1.6  
     1.7 -def blkdev_uname_to_file(uname):
     1.8 -    """Take a blkdev uname and return the corresponding filename."""
     1.9 -    fn = None
    1.10 +def _parse_uname(uname):
    1.11 +    fn = taptype = None
    1.12      if uname.find(":") != -1:
    1.13          (typ, fn) = uname.split(":", 1)
    1.14          if typ == "phy" and not fn.startswith("/"):
    1.15              fn = "/dev/%s" %(fn,)
    1.16          if typ == "tap":
    1.17 -            (typ, fn) = fn.split(":", 1)
    1.18 -    return fn
    1.19 +            (taptype, fn) = fn.split(":", 1)
    1.20 +    return (fn, taptype)
    1.21 +
    1.22 +def blkdev_uname_to_file(uname):
    1.23 +    """Take a blkdev uname and return the corresponding filename."""
    1.24 +    return _parse_uname(uname)[0]
    1.25 +
    1.26 +def blkdev_uname_to_taptype(uname):
    1.27 +    """Take a blkdev uname and return the blktap type."""
    1.28 +    return _parse_uname(uname)[1]
    1.29  
    1.30  def mount_mode(name):
    1.31      mode = None
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Mar 19 16:55:21 2007 +0000
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Mar 20 11:10:52 2007 +0000
     2.3 @@ -34,7 +34,7 @@ from types import StringTypes
     2.4  
     2.5  import xen.lowlevel.xc
     2.6  from xen.util import asserts
     2.7 -from xen.util.blkif import blkdev_uname_to_file
     2.8 +from xen.util.blkif import blkdev_uname_to_file, blkdev_uname_to_taptype
     2.9  from xen.util import security
    2.10  
    2.11  from xen.xend import balloon, sxp, uuid, image, arch, osdep
    2.12 @@ -1786,7 +1786,8 @@ class XendDomainInfo:
    2.13              disk = devinfo[1]['uname']
    2.14  
    2.15              fn = blkdev_uname_to_file(disk)
    2.16 -            mounted = devtype == 'tap' and not os.stat(fn).st_rdev
    2.17 +            taptype = blkdev_uname_to_taptype(disk)
    2.18 +            mounted = devtype == 'tap' and taptype != 'aio' and taptype != 'sync' and not os.stat(fn).st_rdev
    2.19              if mounted:
    2.20                  # This is a file, not a device.  pygrub can cope with a
    2.21                  # file if it's raw, but if it's QCOW or other such formats
    2.22 @@ -1802,7 +1803,7 @@ class XendDomainInfo:
    2.23  
    2.24                  from xen.xend import XendDomain
    2.25                  dom0 = XendDomain.instance().privilegedDomain()
    2.26 -                dom0._waitForDeviceUUID(dom0.create_vbd(vbd, fn))
    2.27 +                dom0._waitForDeviceUUID(dom0.create_vbd(vbd, disk))
    2.28                  fn = BOOTLOADER_LOOPBACK_DEVICE
    2.29  
    2.30              try: