CA-142595: Non-block devices causing IndexError
CA-142595: Non-block devices causing IndexError

Some device (e.g. a scsi security manager device.) has no subdir
"block/" , this will cause _extract_dev_name "IndexError: list index
out of range" error.
The following is the traceback info:
run this cmd: xe sr-probe type=lvmohba
There was an SR backend failure.
status: non-zero exit
stdout:
stderr: Traceback (most recent call last):
File "/opt/xensource/sm/LVMoHBASR", line 239, in ?
SRCommand.run(LVHDoHBASR, DRIVER_INFO)
File "/opt/xensource/sm/SRCommand.py", line 343, in run
sr = driver(cmd, cmd.sr_uuid)
File "/opt/xensource/sm/SR.py", line 139, in init
self.load(sr_uuid)
File "/opt/xensource/sm/LVMoHBASR", line 98, in load
print >>sys.stderr,self.hbasr.print_devs()
File "/opt/xensource/sm/HBASR.py", line 242, in print_devs
self._init_hbadict()
File "/opt/xensource/sm/HBASR.py", line 63, in _init_hbadict
dict = devscan.adapters(filterstr=self.type)
File "/opt/xensource/sm/devscan.py", line 75, in adapters
(dev, entry) = _extract_dev(dir, proc, id, lun)
File "/opt/xensource/sm/devscan.py", line 235, in _extract_dev
dev = _extract_dev_name(device_dir)
File "/opt/xensource/sm/devscan.py", line 226, in _extract_dev_name
dev = glob.glob(os.path.join(device_dir, 'block/*'))[0]
IndexError: list index out of range

Signed-off-by: Wang Yanbin wangyanbin@dayang.com.cn
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>
Imported-by: Thanos Makatos <thanos.makatos@citrix.com>

(cherry picked from commit 426be113cccbc052c3baeccf382c61aba3a0252f)

chandrikas/sm,kostaslamda/sm,siddharthv/sm,geosharath/sm,robertbreker/sm,germanop/sm,geosharath/sm,djs55/sm,pritha-srivastava/sm,martinjorge/sm,martinjorge/sm,BobBall/sm,kostaslamda/sm,djs55/sm,martinjorge/sm,xapi-project/sm,robertbreker/sm,pritha-srivastava/sm,germanop/sm,xapi-project/sm,kostaslamda/sm,pritha-srivastava/sm,geosharath/sm,siddharthv/sm,germanop/sm,malcolmcrossley/sm,siddharthv/sm,chandrikas/sm,robertbreker/sm,malcolmcrossley/sm,xapi-project/sm,chandrikas/sm,BobBall/sm,djs55/sm,malcolmcrossley/sm,BobBall/sm