ia64/xen-unstable

changeset 2015:140b3d8d1286

bitkeeper revision 1.1108.33.21 (410c1c1aMdLPxyK2NQOMHl2UnO986w)

Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into labyrinth.cl.cam.ac.uk:/auto/anfs/scratch/labyrinth/iap10/xeno-clone/xeno.bk
author iap10@labyrinth.cl.cam.ac.uk
date Sat Jul 31 22:24:26 2004 +0000 (2004-07-31)
parents cabecfa924ab c10963d13006
children ae1ea693453c
files BitKeeper/etc/ignore linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/common.h linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/vbd.c tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/server/blkif.py tools/python/xen/xm/opts.py
line diff
     1.1 --- a/BitKeeper/etc/ignore	Sat Jul 31 16:13:15 2004 +0000
     1.2 +++ b/BitKeeper/etc/ignore	Sat Jul 31 22:24:26 2004 +0000
     1.3 @@ -12,16 +12,13 @@ PENDING/*
     1.4  TAGS
     1.5  Twisted-1.3.0
     1.6  Twisted-1.3.0.tar.gz
     1.7 -docs/interface.aux
     1.8 -docs/interface.log
     1.9 -docs/interface.pdf
    1.10 -docs/interface.ps
    1.11 -docs/interface.toc
    1.12 -docs/user.aux
    1.13 -docs/user.log
    1.14 -docs/user.pdf
    1.15 -docs/user.ps
    1.16 -docs/user.toc
    1.17 +docs/*.aux
    1.18 +docs/*.log
    1.19 +docs/*.pdf
    1.20 +docs/*.ps
    1.21 +docs/*.toc
    1.22 +docs/interface/*
    1.23 +docs/user/*
    1.24  extras/mini-os/h/hypervisor-ifs
    1.25  install
    1.26  install/*
     2.1 --- a/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/common.h	Sat Jul 31 16:13:15 2004 +0000
     2.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/common.h	Sat Jul 31 22:24:26 2004 +0000
     2.3 @@ -26,6 +26,9 @@
     2.4  #define DPRINTK(_f, _a...) ((void)0)
     2.5  #endif
     2.6  
     2.7 +#define PRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
     2.8 +                           __FILE__ , __LINE__ , ## _a )
     2.9 +
    2.10  typedef struct blkif_st {
    2.11      /* Unique identifier for this interface. */
    2.12      domid_t          domid;
     3.1 --- a/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/vbd.c	Sat Jul 31 16:13:15 2004 +0000
     3.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/vbd.c	Sat Jul 31 22:24:26 2004 +0000
     3.3 @@ -18,7 +18,7 @@ void vbd_create(blkif_be_vbd_create_t *c
     3.4      blkif = blkif_find_by_handle(create->domid, create->blkif_handle);
     3.5      if ( unlikely(blkif == NULL) )
     3.6      {
     3.7 -        DPRINTK("vbd_create attempted for non-existent blkif (%u,%u)\n", 
     3.8 +        PRINTK("vbd_create attempted for non-existent blkif (%u,%u)\n", 
     3.9                  create->domid, create->blkif_handle); 
    3.10          create->status = BLKIF_BE_STATUS_INTERFACE_NOT_FOUND;
    3.11          return;
    3.12 @@ -41,7 +41,7 @@ void vbd_create(blkif_be_vbd_create_t *c
    3.13          }
    3.14          else
    3.15          {
    3.16 -            DPRINTK("vbd_create attempted for already existing vbd\n");
    3.17 +            PRINTK("vbd_create attempted for already existing vbd\n");
    3.18              create->status = BLKIF_BE_STATUS_VBD_EXISTS;
    3.19              goto out;
    3.20          }
    3.21 @@ -49,7 +49,7 @@ void vbd_create(blkif_be_vbd_create_t *c
    3.22  
    3.23      if ( unlikely((vbd = kmalloc(sizeof(vbd_t), GFP_KERNEL)) == NULL) )
    3.24      {
    3.25 -        DPRINTK("vbd_create: out of memory\n");
    3.26 +        PRINTK("vbd_create: out of memory\n");
    3.27          create->status = BLKIF_BE_STATUS_OUT_OF_MEMORY;
    3.28          goto out;
    3.29      }
    3.30 @@ -85,7 +85,7 @@ void vbd_grow(blkif_be_vbd_grow_t *grow)
    3.31      blkif = blkif_find_by_handle(grow->domid, grow->blkif_handle);
    3.32      if ( unlikely(blkif == NULL) )
    3.33      {
    3.34 -        DPRINTK("vbd_grow attempted for non-existent blkif (%u,%u)\n", 
    3.35 +        PRINTK("vbd_grow attempted for non-existent blkif (%u,%u)\n", 
    3.36                  grow->domid, grow->blkif_handle); 
    3.37          grow->status = BLKIF_BE_STATUS_INTERFACE_NOT_FOUND;
    3.38          return;
    3.39 @@ -107,7 +107,7 @@ void vbd_grow(blkif_be_vbd_grow_t *grow)
    3.40  
    3.41      if ( unlikely(vbd == NULL) || unlikely(vbd->vdevice != vdevice) )
    3.42      {
    3.43 -        DPRINTK("vbd_grow: attempted to append extent to non-existent VBD.\n");
    3.44 +        PRINTK("vbd_grow: attempted to append extent to non-existent VBD.\n");
    3.45          grow->status = BLKIF_BE_STATUS_VBD_NOT_FOUND;
    3.46          goto out;
    3.47      } 
    3.48 @@ -115,7 +115,7 @@ void vbd_grow(blkif_be_vbd_grow_t *grow)
    3.49      if ( unlikely((x = kmalloc(sizeof(blkif_extent_le_t), 
    3.50                                 GFP_KERNEL)) == NULL) )
    3.51      {
    3.52 -        DPRINTK("vbd_grow: out of memory\n");
    3.53 +        PRINTK("vbd_grow: out of memory\n");
    3.54          grow->status = BLKIF_BE_STATUS_OUT_OF_MEMORY;
    3.55          goto out;
    3.56      }
    3.57 @@ -127,7 +127,7 @@ void vbd_grow(blkif_be_vbd_grow_t *grow)
    3.58      
    3.59      if( !blk_size[MAJOR(x->extent.device)] )
    3.60      {
    3.61 -        DPRINTK("vbd_grow: device %08x doesn't exist.\n", x->extent.device);
    3.62 +        PRINTK("vbd_grow: device %08x doesn't exist.\n", x->extent.device);
    3.63  	grow->status = BLKIF_BE_STATUS_EXTENT_NOT_FOUND;
    3.64  	goto out;
    3.65      }
    3.66 @@ -135,9 +135,16 @@ void vbd_grow(blkif_be_vbd_grow_t *grow)
    3.67      /* convert blocks (1KB) to sectors */
    3.68      sz = blk_size[MAJOR(x->extent.device)][MINOR(x->extent.device)] * 2;    
    3.69      
    3.70 +    if ( sz == 0 )
    3.71 +    {
    3.72 +        PRINTK("vbd_grow: device %08x zero size!\n", x->extent.device);
    3.73 +	grow->status = BLKIF_BE_STATUS_EXTENT_NOT_FOUND;
    3.74 +	goto out;
    3.75 +    }
    3.76 +
    3.77      if ( x->extent.sector_start > 0 )
    3.78      {
    3.79 -        DPRINTK("vbd_grow: device %08x start not zero!\n", x->extent.device);
    3.80 +        PRINTK("vbd_grow: device %08x start not zero!\n", x->extent.device);
    3.81  	grow->status = BLKIF_BE_STATUS_EXTENT_NOT_FOUND;
    3.82  	goto out;
    3.83      }
    3.84 @@ -237,7 +244,7 @@ void vbd_destroy(blkif_be_vbd_destroy_t 
    3.85      blkif = blkif_find_by_handle(destroy->domid, destroy->blkif_handle);
    3.86      if ( unlikely(blkif == NULL) )
    3.87      {
    3.88 -        DPRINTK("vbd_destroy attempted for non-existent blkif (%u,%u)\n", 
    3.89 +        PRINTK("vbd_destroy attempted for non-existent blkif (%u,%u)\n", 
    3.90                  destroy->domid, destroy->blkif_handle); 
    3.91          destroy->status = BLKIF_BE_STATUS_INTERFACE_NOT_FOUND;
    3.92          return;
     4.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Sat Jul 31 16:13:15 2004 +0000
     4.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Sat Jul 31 22:24:26 2004 +0000
     4.3 @@ -83,9 +83,18 @@ def blkdev_name_to_number(name):
     4.4      'hda') and return the device number used by the OS. """
     4.5  
     4.6      if not re.match( '^/dev/', name ):
     4.7 -        name = '/dev/' + name
     4.8 +        n = '/dev/' + name
     4.9          
    4.10 -    return os.stat(name).st_rdev
    4.11 +    try:
    4.12 +	return os.stat(n).st_rdev
    4.13 +    except:
    4.14 +	pass
    4.15 +
    4.16 +    # see if this is a hex device number
    4.17 +    if re.match( '^(0x)?[0-9a-fA-F]+$', name ):
    4.18 +	return string.atoi(name,16)
    4.19 +	
    4.20 +    return None
    4.21  
    4.22  def lookup_raw_partn(name):
    4.23      """Take the given block-device name (e.g., '/dev/sda1', 'hda')
    4.24 @@ -97,27 +106,14 @@ def lookup_raw_partn(name):
    4.25          type:         'Disk' or identifying name for partition type
    4.26      """
    4.27  
    4.28 -    p = name
    4.29 -
    4.30 -    if not re.match( '^/dev/', name ):
    4.31 -        p = '/dev/' + name
    4.32 -	        
    4.33 -    fd = os.popen( '/sbin/sfdisk -s ' + p + ' 2>/dev/null' )
    4.34 -    line = _readline(fd)
    4.35 -    if line:
    4.36 -	return [ { 'device' : blkdev_name_to_number(p),
    4.37 +    n = blkdev_name_to_number(name)
    4.38 +    if n:
    4.39 +	return [ { 'device' : n,
    4.40  		   'start_sector' : long(0),
    4.41  		   'nr_sectors' : long(1L<<63),
    4.42  		   'type' : 'Disk' } ]
    4.43      else:
    4.44 -	# see if this is a hex device number
    4.45 -	if re.match( '^(0x)?[0-9a-fA-F]+$', name ):
    4.46 -	    return [ { 'device' : string.atoi(name,16),
    4.47 -		   'start_sector' : long(0),
    4.48 -		   'nr_sectors' : long(1L<<63),
    4.49 -		   'type' : 'Disk' } ]
    4.50 -	
    4.51 -    return None
    4.52 +	return None
    4.53  
    4.54  def lookup_disk_uname(uname):
    4.55      """Lookup a list of segments for a physical device.
     5.1 --- a/tools/python/xen/xend/server/blkif.py	Sat Jul 31 16:13:15 2004 +0000
     5.2 +++ b/tools/python/xen/xend/server/blkif.py	Sat Jul 31 22:24:26 2004 +0000
     5.3 @@ -194,6 +194,12 @@ class BlkifControllerFactory(controller.
     5.4          """
     5.5          val = unpackMsg('blkif_be_vbd_grow_t', msg)
     5.6          # Check status?
     5.7 +	status = val['status']
     5.8 +	if status != BLKIF_BE_STATUS_OKAY:
     5.9 +            log.debug("Error: Adding extent to vbd failed! (device %x)",
    5.10 +		      val['extent.device'])
    5.11 +            # what to do here to abort????
    5.12 +
    5.13          if self.attached:
    5.14              if d:
    5.15                  d.callback(dev)
     6.1 --- a/tools/python/xen/xm/opts.py	Sat Jul 31 16:13:15 2004 +0000
     6.2 +++ b/tools/python/xen/xm/opts.py	Sat Jul 31 22:24:26 2004 +0000
     6.3 @@ -273,10 +273,19 @@ class Opts:
     6.4          return remaining arguments
     6.5          """
     6.6          self.argv = argv
     6.7 +
     6.8          try:
     6.9              (vals, args) = getopt(argv[1:], self.short_opts(), self.long_opts())
    6.10          except GetoptError, err:
    6.11              self.err(str(err))
    6.12 +
    6.13 +	# hack to work around lack of gnu getopts parsing in python 2.2
    6.14 +	xargs = args
    6.15 +	while xargs[1:]:
    6.16 +	    (v,xargs) = getopt(xargs[1:], self.short_opts(), self.long_opts())
    6.17 +	    vals = vals + v
    6.18 +
    6.19 +	# back to the real work
    6.20          self.args = args
    6.21          for (k, v) in vals:
    6.22              for opt in self.options: