From: "Jan Beulich" Subject: [PATCH, v2] fix "xm block-detach 0 ..." for extended-ID devices Date: Wed, 24 Nov 2010 16:01:38 +0000 Message-ID: <4CED44F202000078000241E9@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part0D20A1F2.1__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part0D20A1F2.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Simply taking stat()'s st_rdev doesn't work here, as the minor is split into two parts, the major is present, and the "extended" bit isn't set. Rather than fixing this in a way that would likely be OS-dependent, simply remove the access to the device file, and instead just parse the provided string (as is done e.g. for block-attach). Signed-off-by: Jan Beulich --- a/tools/python/xen/util/blkif.py +++ b/tools/python/xen/util/blkif.py @@ -19,11 +19,6 @@ def blkdev_name_to_number(name): devname =3D 'virtual-device' devnum =3D None =20 - try: - return (devname, os.stat(n).st_rdev) - except Exception, ex: - pass - scsi_major =3D [ 8, 65, 66, 67, 68, 69, 70, 71, 128, 129, 130, 131, = 132, 133, 134, 135 ] if re.match( '/dev/sd[a-z]([1-9]|1[0-5])?$', n): major =3D scsi_major[(ord(n[7:8]) - ord('a')) / 16] --=__Part0D20A1F2.1__= Content-Type: text/plain; name="blkif-dev-to-num.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="blkif-dev-to-num.patch" Simply taking stat()'s st_rdev doesn't work here, as the minor is=0Asplit = into two parts, the major is present, and the "extended" bit=0Aisn't = set.=0A=0ARather than fixing this in a way that would likely be OS-dependen= t,=0Asimply remove the access to the device file, and instead just = parse=0Athe provided string (as is done e.g. for block-attach).=0A=0ASigned= -off-by: Jan Beulich =0A=0A--- a/tools/python/xen/util= /blkif.py=0A+++ b/tools/python/xen/util/blkif.py=0A@@ -19,11 +19,6 @@ def = blkdev_name_to_number(name):=0A devname =3D 'virtual-device'=0A = devnum =3D None=0A =0A- try:=0A- return (devname, os.stat(n).st_r= dev)=0A- except Exception, ex:=0A- pass=0A-=0A scsi_major = =3D [ 8, 65, 66, 67, 68, 69, 70, 71, 128, 129, 130, 131, 132, 133, 134, = 135 ]=0A if re.match( '/dev/sd[a-z]([1-9]|1[0-5])?$', n):=0A = major =3D scsi_major[(ord(n[7:8]) - ord('a')) / 16]=0A --=__Part0D20A1F2.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part0D20A1F2.1__=--