xend/pvscsi: recognize also SCSI CDROM devices
authorOlaf Hering <olaf@aepfle.de>
Tue, 11 Feb 2014 14:27:24 +0000 (15:27 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 27 Mar 2014 15:05:52 +0000 (15:05 +0000)
Attaching a CDROM device with 'xm scsi-attach domU /dev/sr0 0:0:0:0'
fails because for some reason the sr driver was not handled at all in
the match list. With the change the above command succeeds and the
device is attached.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Matt Wilson <msw@amazon.com>
tools/python/xen/util/vscsi_util.py

index 5872e65916f79dc1ef9ecfcdfd10d292aa80c72c..a4f5ad3ce8abb6f2c1e5939f3922c8ba1bd52b43 100644 (file)
@@ -66,6 +66,9 @@ def _vscsi_get_hctl_by(phyname, scsi_devices):
     if re.match('/dev/sd[a-z]+([1-9]|1[0-5])?$', phyname):
         # sd driver
         name = re.sub('(^/dev/)|([1-9]|1[0-5])?$', '', phyname)
+    elif re.match('/dev/sr[0-9]+$', phyname):
+        # sr driver
+        name = re.sub('^/dev/', '', phyname)
     elif re.match('/dev/sg[0-9]+$', phyname):
         # sg driver
         name = re.sub('^/dev/', '', phyname)