From: "Dube, Lutz" Subject: [PATCH] Exception in xen/util/vscsi_util.py while starting xend Date: Tue, 10 Aug 2010 11:08:28 +0200 Message-ID: <3958B14F314B884890EEE2F4CCDAB6A601122BF3FD5B@ABGEX73E.FSC.NET> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1390012252==" Return-path: Content-Language: de-DE List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --===============1390012252== Content-Language: de-DE Content-Type: multipart/alternative; boundary="_000_3958B14F314B884890EEE2F4CCDAB6A601122BF3FD5BABGEX73EFSC_" --_000_3958B14F314B884890EEE2F4CCDAB6A601122BF3FD5BABGEX73EFSC_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Exception in xen/util/vscsi_util.py while starting xend We have pscsi device with long scsi ids like 15:0:11:101. In this case lsscsi prints no "blank" between id and type (see example), so the following split of the string returns wrong output. The field physical_HCTL is set to 15:0:11:101]dis. The patch replaces char "]" by "] ", so split() will return the right physical_HTCL. [15:0:11:101]disk DGC RAID 10 0429 /dev/xsdmdr Snippet from Xend.log: [2010-07-21 12:35:03 14959] ERROR (SrvDaemon:349) Exception starting xend (= invalid literal for int() with base 10: '215]dis') Traceback (most recent call last): File "/usr/lib64/python2.6/site-packages/xen/xend/server/SrvDaemon.py", l= ine 341, in run servers =3D SrvServer.create() File "/usr/lib64/python2.6/site-packages/xen/xend/server/SrvServer.py", l= ine 261, in create root.putChild('xend', SrvRoot()) File "/usr/lib64/python2.6/site-packages/xen/xend/server/SrvRoot.py", lin= e 40, in __init__ self.get(name) File "/usr/lib64/python2.6/site-packages/xen/web/SrvDir.py", line 84, in = get val =3D val.getobj() File "/usr/lib64/python2.6/site-packages/xen/web/SrvDir.py", line 52, in = getobj self.obj =3D klassobj() File "/usr/lib64/python2.6/site-packages/xen/xend/server/SrvNode.py", lin= e 30, in __init__ self.xn =3D XendNode.instance() File "/usr/lib64/python2.6/site-packages/xen/xend/XendNode.py", line 1196= , in instance inst =3D XendNode() File "/usr/lib64/python2.6/site-packages/xen/xend/XendNode.py", line 161,= in __init__ self._init_PSCSIs() File "/usr/lib64/python2.6/site-packages/xen/xend/XendNode.py", line 367,= in _init_PSCSIs XendPSCSI(pscsi_uuid, pscsi_record) File "/usr/lib64/python2.6/site-packages/xen/xend/XendPSCSI.py", line 96,= in __init__ self.physical_lun =3D int(p_hctl[3]) ValueError: invalid literal for int() with base 10: '215]dis' Signed-off-by: Lutz Dube Lutz.Dube@ts.fujitsu.com diff -r e8dbc1262f52 -r fac9d58d3c8a tools/python/xen/util/vscsi_util.py --- a/tools/python/xen/util/vscsi_util.py Wed Jul 21 09:02:10 2010 +0= 100 +++ b/tools/python/xen/util/vscsi_util.py Wed Jul 21 13:15:33 2010 +0= 200 @@ -97,7 +97,7 @@ devices =3D [] for scsiinfo in os.popen('{ lsscsi -g %s; } 2>/dev/null' % option).rea= dlines(): - s =3D scsiinfo.split() + s =3D scsiinfo.replace(']', '] ').split() hctl =3D s[0][1:-1] try: devname =3D s[-2].split('/dev/')[1] --- Best regards Lutz Dube Softwareentwickler TSP ES&S SWE OS7 FUJITSU TECHNOLOGY SOLUTIONS GMBH Domagkstr. 28 D-80807 M=FCnchen Telefon: +49 (0)89 3222 2688 Telefax: +49 (0)89 3222 329 2688 Email: Lutz Dube@ts.fujitsu.com Internet: http://ts.fujitsu.com Firmenangaben: http://de.ts.fujitsu.com/imprint.html --_000_3958B14F314B884890EEE2F4CCDAB6A601122BF3FD5BABGEX73EFSC_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Exception in xen/util/vscsi_util.py while starting xend
 
We have pscsi device with long scsi ids like 15:0:11:101.
In this case lsscsi prints no "blank" between id and type (s= ee example),
so the following split of the string returns wrong output.
The field physical_HCTL is set to 15:0:11:101]dis.
The patch replaces char "]" by "] ", so split() wi= ll return the right
physical_HTCL.
 
[15:0:11:101]disk    DGC      = RAID 10          0429  /d= ev/xsdmdr
 
Snippet from Xend.log:
[2010-07-21 12:35:03 14959] ERROR (SrvDaemon:349) Exception starting x= end (invalid literal for int() with base 10: '215]dis')
Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/xen/xend/server/S= rvDaemon.py", line 341, in run
    servers =3D SrvServer.create()
  File "/usr/lib64/python2.6/site-packages/xen/xend/server/S= rvServer.py", line 261, in create
    root.putChild('xend', SrvRoot())
  File "/usr/lib64/python2.6/site-packages/xen/xend/server/S= rvRoot.py", line 40, in __init__
    self.get(name)
  File "/usr/lib64/python2.6/site-packages/xen/web/SrvDir.py= ", line 84, in get
    val =3D val.getobj()
  File "/usr/lib64/python2.6/site-packages/xen/web/SrvDir.py= ", line 52, in getobj
    self.obj =3D klassobj()
  File "/usr/lib64/python2.6/site-packages/xen/xend/server/S= rvNode.py", line 30, in __init__
    self.xn =3D XendNode.instance()
  File "/usr/lib64/python2.6/site-packages/xen/xend/XendNode= .py", line 1196, in instance
    inst =3D XendNode()
  File "/usr/lib64/python2.6/site-packages/xen/xend/XendNode= .py", line 161, in __init__
     self._init_PSCSIs()
  File "/usr/lib64/python2.6/site-packages/xen/xend/XendNode= .py", line 367, in _init_PSCSIs
     XendPSCSI(pscsi_uuid, pscsi_record)
  File "/usr/lib64/python2.6/site-packages/xen/xend/XendPSCS= I.py", line 96, in __init__
     self.physical_lun =3D int(p_hctl[3])
  ValueError: invalid literal for int() with base 10: '215]dis'
 
 
 
diff -r e8dbc1262f52 -r fac9d58d3c8a tools/python/xen/util/vscsi_util.= py
--- a/tools/python/xen/util/vscsi_util.py     = ;  Wed Jul 21 09:02:10 2010 +0100
+++ b/tools/python/xen/util/vscsi_util.py   = ;    Wed Jul 21 13:15:33 2010 +0200
@@ -97,7 +97,7 @@
     devices =3D []
 
     for scsiinfo in os.popen('{ lsscsi -g %s; } 2= >/dev/null' % option).readlines():
-        s =3D scsiinfo.split()
+        s =3D scsiinfo.replace= (']', '] ').split()
         hctl =3D s[0][1:-1]
         try:
           &nbs= p; devname =3D s[-2].split('/dev/')[1]
 
---
Best regards
 
Lutz Dube
Softwareentwickler
TSP ES&S SWE OS7
 
FUJITSU TECHNOLOGY SOLUTIONS GMBH
Domagkstr. 28
D-80807 M=FCnchen
 
Telefon:        +49 (0)89 3222 = 2688
Telefax:        +49 (0)89 3222 = 329 2688
Email:          Lutz Dube= @ts.fujitsu.com
 
Internet:        http://ts.fujitsu.com
Firmenangaben: http://de.ts.fujitsu.com/imprint.html<= /div>
 
 
 
 
--_000_3958B14F314B884890EEE2F4CCDAB6A601122BF3FD5BABGEX73EFSC_-- --===============1390012252== 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 --===============1390012252==--