-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CA-142595: Non-block devices causing IndexError #203
Conversation
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.
Can one of the admins verify this patch? |
1 similar comment
Can one of the admins verify this patch? |
@wangyanbn - could you cover the new code with unit tests? |
@matelakat , the current unit tests can cover the normal code execute path, but not the special path. |
@matelakat , providing unit tests is a plus. Especially when the code is touching internal parts of a function, |
@matelakat and @germanop , I am using Creedence alpha4. Today I found that special LUN is a security manager device, not a block device. It is in the "/sys/class/fc_transport" dir and has no 'block' subdir : |
@wangyanbn - Thanks for the info. Is there any chance that you have the traceback with the IndexError in it? If so, could you please add it as a comment here? Thanks. |
@wangyanbn - regarding to the unit tests, let me help you by doing some refactoring on the framework, so you can easily unit test the changes. Will get back to you soon. |
@matelakat , here is the traceback info; |
@wangyanbn - thanks for your work, again. I prepared the changes that will let us unit test your changes, see them in #209 and #208 Other than that, could you please amend your commit for me:
Thank you for your cooperation and good work, if you need some guidance on how to write the actual test cases, let me know. |
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 [email protected]
@matelakat , I have amended the commit and pushed into the repository. It became a new commit , and I must make a merge before push it. Is it right? |
@wangyanbn , we are currently reviewing our code to check that there is no side effect. |
@wangyanbn - Thank you for your contribution, your changes have been merged to xs64bit via 41aeac9 |
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: wangyanbn [email protected]