Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: xapi-project/sm
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: wangyanbn/sm
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 3 commits
  • 1 file changed
  • 1 contributor

Commits on Aug 8, 2014

  1. Update devscan.py

    Fix _extract_dev_name(device_dir) bug:
    some device dir has no subdir "block/" , this will cause "IndexError: list index out of range".
    In my test environment, LUN 0 has no "block/" subdir, but other LUNs are OK.
    wangyanbn committed Aug 8, 2014
    Copy the full SHA
    7cd0e74 View commit details

Commits on Aug 18, 2014

  1. 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
    wangyanbn committed Aug 18, 2014
    Copy the full SHA
    4aeecf3 View commit details
  2. Copy the full SHA
    e2ce98a View commit details
Showing with 10 additions and 4 deletions.
  1. +10 −4 drivers/devscan.py
14 changes: 10 additions & 4 deletions drivers/devscan.py
Original file line number Diff line number Diff line change
@@ -73,7 +73,8 @@ def adapters(filterstr="any"):
else:
dir = os.path.join(sysfs,lun,"device")
(dev, entry) = _extract_dev(dir, proc, id, lun)
devs[dev] = entry
if dev != "":
devs[dev] = entry
# for new qlogic sysfs layout (rport under device, then target)
for i in filter(match_rport,os.listdir(path)):
newpath = os.path.join(path, i)
@@ -223,9 +224,14 @@ def _extract_dev_name(device_dir):
return dev.lstrip('block:')
elif kernel_version.startswith('3.'):
# directory for device name lives inside block directory e.g. block/sdx
dev = glob.glob(os.path.join(device_dir, 'block/*'))[0]
# prune path to extract the device name
return os.path.basename(dev)

#bug fixed: some device dir has no subdir "block/" , e.g. LUN 0 has no "block/" subdir, but other LUNs are OK
devs = glob.glob(os.path.join(device_dir, 'block/*'))
if len(devs):
# prune path to extract the device name
return os.path.basename(devs[0])
else:
return ""
else:
msg = 'Kernel version detected: %s' % kernel_version
raise xs_errors.XenError('UnsupportedKernel', msg)