Project

General

Profile

Bug #37442

ceph-volume: Unable to convert to integer

Added by Kilian Ries 9 months ago. Updated 25 days ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
11/28/2018
Due date:
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:

Description

Hi,

just tried to manually provision my ceph osds, but got an error:

# ceph-volume lvm batch --bluestore --block-db-size=26843545600 /dev/sdb /dev/sdc /dev/nvme0n1 /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh /dev/sdi

...

--> do you want to proceed? (yes/no) yes
Running command: /usr/sbin/vgcreate --force --yes ceph-block-dbs-628034e8-6796-4cd7-8f45-a912bf6b9d23 /dev/nvme0n1
 stdout: Physical volume "/dev/nvme0n1" successfully created.
 stdout: Volume group "ceph-block-dbs-628034e8-6796-4cd7-8f45-a912bf6b9d23" successfully created
Running command: /usr/sbin/vgcreate --force --yes ceph-block-3457e663-99f4-48d0-85a6-ec84b8e20ca9 /dev/sdb
 stdout: Physical volume "/dev/sdb" successfully created.
 stdout: Volume group "ceph-block-3457e663-99f4-48d0-85a6-ec84b8e20ca9" successfully created
Running command: /usr/sbin/vgcreate --force --yes ceph-block-cb1132f6-2885-4bc8-bbc0-8561cd71a66c /dev/sdc
 stdout: Physical volume "/dev/sdc" successfully created.
 stdout: Volume group "ceph-block-cb1132f6-2885-4bc8-bbc0-8561cd71a66c" successfully created
Running command: /usr/sbin/vgcreate --force --yes ceph-block-8a58569e-89de-4424-84c4-27e8c0320811 /dev/sdd
 stdout: Physical volume "/dev/sdd" successfully created.
 stdout: Volume group "ceph-block-8a58569e-89de-4424-84c4-27e8c0320811" successfully created
Running command: /usr/sbin/vgcreate --force --yes ceph-block-68caac00-49e8-4f7a-88ca-398fbfb59f5b /dev/sde
 stdout: Physical volume "/dev/sde" successfully created.
 stdout: Volume group "ceph-block-68caac00-49e8-4f7a-88ca-398fbfb59f5b" successfully created
Running command: /usr/sbin/vgcreate --force --yes ceph-block-80752d35-d6c8-4384-bb7c-40314061a443 /dev/sdf
 stdout: Physical volume "/dev/sdf" successfully created.
 stdout: Volume group "ceph-block-80752d35-d6c8-4384-bb7c-40314061a443" successfully created
Running command: /usr/sbin/vgcreate --force --yes ceph-block-ea478d7d-90be-4105-83bf-65685f2141eb /dev/sdg
 stdout: Physical volume "/dev/sdg" successfully created.
 stdout: Volume group "ceph-block-ea478d7d-90be-4105-83bf-65685f2141eb" successfully created
Running command: /usr/sbin/vgcreate --force --yes ceph-block-baa9c455-dd0e-4941-847d-04be17fbc011 /dev/sdh
 stdout: Physical volume "/dev/sdh" successfully created.
 stdout: Volume group "ceph-block-baa9c455-dd0e-4941-847d-04be17fbc011" successfully created
Running command: /usr/sbin/vgcreate --force --yes ceph-block-3d5d8c6c-920b-428b-bfa5-dfad64ee1f80 /dev/sdi
 stdout: Physical volume "/dev/sdi" successfully created.
 stdout: Volume group "ceph-block-3d5d8c6c-920b-428b-bfa5-dfad64ee1f80" successfully created
-->  RuntimeError: Unable to convert to integer: '5588,50'

OS (e.g. from /etc/os-release): centos7
Kernel (e.g. uname -a): 3.10.0-862.14.4.el7.x86_64
Ceph version (e.g. ceph -v): mimic 13.2.2

History

#1 Updated by Alfredo Deza 9 months ago

That looks unexpected for sure... could you re-run (or reproduce) with:

CEPH_VOLUME_DEBUG=1

So that we can see the traceback, or if that is not possible, add the log file from that run (from /var/log/ceph/ceph-volume.log)

#2 Updated by Kilian Ries 9 months ago

here are the last lines from the logfile you requested:

[2018-11-28 17:33:52,038][ceph_volume.process][INFO  ] stdout Physical volume "/dev/sdi" successfully created.
[2018-11-28 17:33:52,040][ceph_volume.process][INFO  ] stdout Volume group "ceph-block-3d5d8c6c-920b-428b-bfa5-dfad64ee1f80" successfully created
[2018-11-28 17:33:52,042][ceph_volume.process][INFO  ] Running command: /usr/sbin/vgs --noheadings --readonly --units=g --separator=";" -o vg_name,pv_count,lv_count,snap_count,vg_attr,vg_size,vg_free,vg_free_count
[2018-11-28 17:33:52,065][ceph_volume.process][INFO  ] stdout ceph-block-3457e663-99f4-48d0-85a6-ec84b8e20ca9";"1";"0";"0";"wz--n-";"5588,50g";"5588,50g";"1430655
[2018-11-28 17:33:52,066][ceph_volume.process][INFO  ] stdout ceph-block-3d5d8c6c-920b-428b-bfa5-dfad64ee1f80";"1";"0";"0";"wz--n-";"5588,50g";"5588,50g";"1430655
[2018-11-28 17:33:52,066][ceph_volume.process][INFO  ] stdout ceph-block-68caac00-49e8-4f7a-88ca-398fbfb59f5b";"1";"0";"0";"wz--n-";"5588,50g";"5588,50g";"1430655
[2018-11-28 17:33:52,066][ceph_volume.process][INFO  ] stdout ceph-block-80752d35-d6c8-4384-bb7c-40314061a443";"1";"0";"0";"wz--n-";"5588,50g";"5588,50g";"1430655
[2018-11-28 17:33:52,066][ceph_volume.process][INFO  ] stdout ceph-block-8a58569e-89de-4424-84c4-27e8c0320811";"1";"0";"0";"wz--n-";"5588,50g";"5588,50g";"1430655
[2018-11-28 17:33:52,066][ceph_volume.process][INFO  ] stdout ceph-block-baa9c455-dd0e-4941-847d-04be17fbc011";"1";"0";"0";"wz--n-";"5588,50g";"5588,50g";"1430655
[2018-11-28 17:33:52,066][ceph_volume.process][INFO  ] stdout ceph-block-cb1132f6-2885-4bc8-bbc0-8561cd71a66c";"1";"0";"0";"wz--n-";"5588,50g";"5588,50g";"1430655
[2018-11-28 17:33:52,066][ceph_volume.process][INFO  ] stdout ceph-block-dbs-628034e8-6796-4cd7-8f45-a912bf6b9d23";"1";"0";"0";"wz--n-";"260,83g";"260,83g";"66772
[2018-11-28 17:33:52,066][ceph_volume.process][INFO  ] stdout ceph-block-ea478d7d-90be-4105-83bf-65685f2141eb";"1";"0";"0";"wz--n-";"5588,50g";"5588,50g";"1430655
[2018-11-28 17:33:52,066][ceph_volume.util][ERROR ] Unable to convert to integer: '5588,50'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ceph_volume/util/__init__.py", line 36, in str_to_int
    integer = float(string)
ValueError: invalid literal for float(): 5588,50
[2018-11-28 17:33:52,067][ceph_volume][ERROR ] exception caught by decorator
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ceph_volume/decorators.py", line 59, in newfunc
    return f(*a, **kw)
  File "/usr/lib/python2.7/site-packages/ceph_volume/main.py", line 156, in main
    terminal.dispatch(self.mapper, subcommand_args)
  File "/usr/lib/python2.7/site-packages/ceph_volume/terminal.py", line 182, in dispatch
    instance.main()
  File "/usr/lib/python2.7/site-packages/ceph_volume/devices/lvm/main.py", line 40, in main
    terminal.dispatch(self.mapper, self.argv)
  File "/usr/lib/python2.7/site-packages/ceph_volume/terminal.py", line 182, in dispatch
    instance.main()
  File "/usr/lib/python2.7/site-packages/ceph_volume/decorators.py", line 16, in is_root
    return func(*a, **kw)
  File "/usr/lib/python2.7/site-packages/ceph_volume/devices/lvm/batch.py", line 238, in main
    self.execute(args)
  File "/usr/lib/python2.7/site-packages/ceph_volume/devices/lvm/batch.py", line 149, in execute
    strategy.execute()
  File "/usr/lib/python2.7/site-packages/ceph_volume/devices/lvm/strategies/bluestore.py", line 272, in execute
    data_lv_extents = data_vg.sizing(size=data_lv_size)['extents']
  File "/usr/lib/python2.7/site-packages/ceph_volume/api/lvm.py", line 1051, in sizing
    extents = int(size * vg_free_count / self.free)
  File "/usr/lib/python2.7/site-packages/ceph_volume/api/lvm.py", line 998, in free
    return self._parse_size(self.vg_free)
  File "/usr/lib/python2.7/site-packages/ceph_volume/api/lvm.py", line 984, in _parse_size
    return util.str_to_int(integer)
  File "/usr/lib/python2.7/site-packages/ceph_volume/util/__init__.py", line 39, in str_to_int
    raise RuntimeError(error_msg)
RuntimeError: Unable to convert to integer: '5588,50'

Just let me know if you need any further information.

#3 Updated by Alfredo Deza 9 months ago

  • Status changed from New to Verified

This looks like a valid issue. If you are comfortable editing on the fly, could you try the following patch?

diff --git a/src/ceph-volume/ceph_volume/util/__init__.py b/src/ceph-volume/ceph_volume/util/__init__.py
index dfa83fc46d..6c34d7fd97 100644
--- a/src/ceph-volume/ceph_volume/util/__init__.py
+++ b/src/ceph-volume/ceph_volume/util/__init__.py
@@ -32,11 +32,19 @@ def str_to_int(string, round_down=True):
     and rounding down.
     """ 
     error_msg = "Unable to convert to integer: '%s'" % str(string)
-    try:
-        integer = float(string)
-    except (TypeError, ValueError):
-        logger.exception(error_msg)
-        raise RuntimeError(error_msg)
+    if ',' in string:
+        try:
+            integer = float(string.split(',')[0])
+        except (TypeError, ValueError):
+            logger.exception(error_msg)
+            raise RuntimeError(error_msg)
+
+    else:
+        try:
+            integer = float(string)
+        except (TypeError, ValueError):
+            logger.exception(error_msg)
+            raise RuntimeError(error_msg)

     if round_down:
         integer = floor(integer)

#4 Updated by Kilian Ries 9 months ago

Injected your patch and tried it again, command finishes now without errors! Thanks for your help ;)

#5 Updated by Jan Fajerski 9 months ago

@Alfredo: wouldn't this be easier:

diff --git a/src/ceph-volume/ceph_volume/util/__init__.py b/src/ceph-volume/ceph_volume/util/__init__.py
index dfa83fc46d..c12d5658ae 100644
--- a/src/ceph-volume/ceph_volume/util/__init__.py
+++ b/src/ceph-volume/ceph_volume/util/__init__.py
@@ -33,7 +33,7 @@ def str_to_int(string, round_down=True):
     """ 
     error_msg = "Unable to convert to integer: '%s'" % str(string)
     try:
-        integer = float(string)
+        integer = float(string.replace(',', '.'))
     except (TypeError, ValueError):
         logger.exception(error_msg)
         raise RuntimeError(error_msg)

Your code might introduce a rounding error iiuc.

#6 Updated by Alfredo Deza 8 months ago

  • Status changed from Verified to In Progress

#7 Updated by Alfredo Deza 25 days ago

  • Status changed from In Progress to Closed

All PRs linked were merged

Also available in: Atom PDF