Closed zhuozh closed 6 years ago
If we create a 1500G image as a LUN. When rbd-target-gw restart, it will define luns from config object, convert lun size using utils.human_size() will convert it as 1T, which is will cause add_dev_to_lio fails:
Apr 19 18:49:48 sds-3-94 rbd-target-gw[111904]: (LUN.add_dev_to_lio) Adding image 'rbd.0' to LIO Apr 19 18:49:48 sds-3-94 tcmu-runner[2167]: 2018-04-19 18:49:48.663 2167 [WARN] tcmu_rbd_detect_device_class:277 rbd/rbd.0: Could not locate crush rule key Apr 19 18:49:48 sds-3-94 tcmu-runner[2167]: tcmu_rbd_detect_device_class:277 rbd/rbd.0: Could not locate crush rule key Apr 19 18:49:48 sds-3-94 tcmu-runner[2167]: 2018-04-19 18:49:48.671 2167 [ERROR] tcmu_rbd_check_image_size:710 rbd/rbd.0: Mismatched sizes. RBD image size 1610612736000. Requested new size 1099511627776. Apr 19 18:49:48 sds-3-94 tcmu-runner[2167]: tcmu_rbd_check_image_size:710 rbd/rbd.0: Mismatched sizes. RBD image size 1610612736000. Requested new size 1099511627776. Apr 19 18:49:48 sds-3-94 tcmu-runner[2167]: 2018-04-19 18:49:48.675 2167 [ERROR] add_device:568: handler open failed for uio0 Apr 19 18:49:48 sds-3-94 tcmu-runner[2167]: add_device:568: handler open failed for uio0 Apr 19 18:49:48 sds-3-94 rbd-target-gw[111904]: Removing iSCSI target from LIO Apr 19 18:49:48 sds-3-94 rbd-target-gw[111904]: Removing LUNs from LIO Apr 19 18:49:48 sds-3-94 rbd-target-gw[111904]: Active Ceph iSCSI gateway configuration removed Apr 19 18:49:48 sds-3-94 python[111904]: detected unhandled Python exception in '/usr/bin/rbd-target-gw' Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: Traceback (most recent call last): Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: File "/usr/bin/rbd-target-gw", line 5, in
Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: pkg_resources.run_script('ceph-iscsi-config==2.3', 'rbd-target-gw') Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 540, in run_script Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: self.require(requires)[0].run_script(script_name, ns) Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1462, in runscript Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: exec(script_code, namespace, namespace) Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: File "/usr/lib/python2.7/site-packages/pkgresources.py", line 41, in exec Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: exec("""exec code in globs, locs""") Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: File " ", line 1, in Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: File "/usr/lib/python2.7/site-packages/ceph_iscsi_config-2.3-py2.7.egg/EGG-INFO/scripts/rbd-target-gw", line 468, in Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: File "/usr/lib/python2.7/site-packages/ceph_iscsi_config-2.3-py2.7.egg/EGG-INFO/scripts/rbd-target-gw", line 419, in main Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: File "/usr/lib/python2.7/site-packages/ceph_iscsi_config-2.3-py2.7.egg/EGG-INFO/scripts/rbd-target-gw", line 391, in apply_config Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: File "/usr/lib/python2.7/site-packages/ceph_iscsi_config-2.3-py2.7.egg/EGG-INFO/scripts/rbd-target-gw", line 307, in define_luns Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: File "build/bdist.linux-x86_64/egg/ceph_iscsi_config/lun.py", line 470, in allocate Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: File "build/bdist.linux-x86_64/egg/ceph_iscsi_config/lun.py", line 615, in add_dev_to_lio Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: File "build/bdist.linux-x86_64/egg/rtslib_fb/tcm.py", line 815, in init Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: File "build/bdist.linux-x86_64/egg/rtslib_fb/tcm.py", line 831, in _configure Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: File "build/bdist.linux-x86_64/egg/rtslib_fb/tcm.py", line 172, in _enable Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: File "build/bdist.linux-x86_64/egg/rtslib_fb/utils.py", line 79, in fwrite Apr 19 18:49:51 sds-3-94 rbd-target-gw[111904]: IOError: [Errno 2] No such file or directory
convert lun size using utils.human_size() will convert it as 1T
Do you mean it will only convert it to 1T and not 1.5T?
Apr 19 11:34:33 node1 tcmu-runner[2139]: tcmu_rbd_check_image_size:710 rbd/vgpool.1: Mismatched sizes. RBD image size 1610612736000. Requested new s
You cut off the part that shows the truncated value.
convert lun size using utils.human_size() will convert it as 1T Do you mean it will only convert it to 1T and not 1.5T?
Oh yeah, the point of my comment was is there a bug in human_size()? If so we should fix it.
I think your patch is ok.
@mikechristie Sorry, I reedited the truncated part.
2018-01-23 11:57:22.309 2067 [ERROR] tcmu_rbd_check_image_size:708 rbd/bhh.4: Mismatched sizes. RBD image size 1099511627776. Requested new size 10995116277760
Yes, human_size() sometimes will lose of precision when converting size like 1200G/1230G/1234G, so we'd better do not do the conversion in case bits after a decimal point are more than 3.
Did you check out the human_size/convert_2_bytes calls in ceph-iscsi-cli? They look like they were copied over between repos, so I guess have the same bugs.
I think in some gwcli uses it is nicer for printing/display reasons so human_size is preferred, so I think we have to fix that there.
Yes, mike. human_size call in ceph-iscsi-cli has the same bug, but it is only used for printing/display, and not cause bugs.
Yes, mike. human_size call in ceph-iscsi-cli has the same bug, but it is only used for printing/display, and not cause bugs.
I think it can still cause bugs. It will print/return the truncated value and apps scraping that will get the wrong info right?
I updated the patches and fixed issues brought up in the review in these PRs
https://github.com/ceph/ceph-iscsi-config/pull/68 https://github.com/ceph/ceph-iscsi-cli/pull/107
Closing this PR.
When gateway restart and define luns from config object, convert image size from bytes to human readable size will lose of precision, which will cause add_dev_to_lio failed with "Mismatched sizes" checking error.
Signed-off-by: Zhuoyu Zhang zhangzhuoyu@cmss.chinamobile.com