WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 4/4]: python blkdev_name_to_number fixes

To: Chris Lalancette <clalance@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 4/4]: python blkdev_name_to_number fixes
From: Brendan Cully <brendan@xxxxxxxxx>
Date: Mon, 23 Jun 2008 11:40:20 -0700
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 23 Jun 2008 11:40:48 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <485FEB00.8050307@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: clalance@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx
References: <485FEB00.8050307@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.18 (2008-05-19)
On Monday, 23 June 2008 at 20:27, Chris Lalancette wrote:
> This patch reworks blkdev_name_to_number to allow the tools to attach xvd 
> disks
> beyond xvdp.  Once this patch is applied, the whole system should work 
> together
> and allow disks xvdq onwards.  The patch does 2 things:
> 
> 1.  Adds the handling for the /dev/xvd[q-z] and /dev/xvd[a-i][a-z] extended 
> devices
> 
> 2.  Changes blkdev_name_to_number() to return a tuple of (xenbus, devnum), and
> then deals with the resulting fallout.
> 
> I freely admit that the change to tools/python/xen/xm/main.py is horrible, but
> my python is not very good.  If someone can suggest a better way to do it, I
> would appreciate it.

...

> diff -r dedfadeadf86 tools/python/xen/xm/main.py
> --- a/tools/python/xen/xm/main.py     Fri Jun 20 18:42:45 2008 +0100
> +++ b/tools/python/xen/xm/main.py     Mon Jun 23 17:47:49 2008 +0200
> @@ -2022,8 +2022,11 @@ def xm_block_list(args):
>              map(server.xenapi.VBD.get_runtime_properties, vbd_refs)
>          vbd_devs = \
>              map(server.xenapi.VBD.get_device, vbd_refs)
> -        vbd_devids = \
> +        tmp_devids = \
>              map(blkdev_name_to_number, vbd_devs)
> +        vbd_devids = []
> +        for dev in tmp_devids:
> +            vbd_devids.append(dev[1])
>          devs = map(lambda (devid, prop): [devid, map2sxp(prop)],
>                     zip(vbd_devids, vbd_properties))
>      else:

vbd_devids = [blkdev_name_to_number(x)[1] for x in vbd_devs]

is probably more idiomatic.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>