Project

General

Profile

Bug #36283

Updated by Alfredo Deza over 5 years ago

If the @--journal-size@ @@--journal-size@@ for @lvm batch@ @@lvm batch@@ is used with less than 1GB the command breaks: 

 <pre> 
 TASK [ceph-osd : use ceph-volume lvm batch to create filestore osds] *********** 
 task path: /home/jenkins-build/build/workspace/ceph-ansible-scenario/roles/ceph-osd/tasks/scenarios/lvm-batch.yml:3 
 Monday 01 October 2018    19:03:56 +0000 (0:00:00.093)         0:09:41.832 ********  
 fatal: [osd0]: FAILED! => { 
     "changed": true,  
     "cmd": [ 
         "ceph-volume",  
         "--cluster",  
         "ceph",  
         "lvm",  
         "batch",  
         "--filestore",  
         "--yes",  
         "--crush-device-class",  
         "test",  
         "--journal-size",  
         "100",  
         "/dev/sdb",  
         "/dev/sdc" 
     ],  
     "delta": "0:00:00.692538",  
     "end": "2018-10-01 19:03:59.096335",  
     "rc": 1,  
     "start": "2018-10-01 19:03:58.403797" 
 } 

 STDOUT: 

 Running command: /usr/sbin/vgcreate --force --yes ceph-filestore-3d39ac0e-7fae-40d8-9c75-2d8fad08a94b /dev/sdb 
  stdout: Physical volume "/dev/sdb" successfully created. 
  stdout: Volume group "ceph-filestore-3d39ac0e-7fae-40d8-9c75-2d8fad08a94b" successfully created 
 Running command: /usr/sbin/vgcreate --force --yes ceph-filestore-fb33b35a-d836-48f7-9a69-5095f86892a1 /dev/sdc 
  stdout: Physical volume "/dev/sdc" successfully created. 
  stdout: Volume group "ceph-filestore-fb33b35a-d836-48f7-9a69-5095f86892a1" successfully created 


 STDERR: 

 Traceback (most recent call last): 
   File "/sbin/ceph-volume", line 6, in <module> 
     main.Volume() 
   File "/usr/lib/python2.7/site-packages/ceph_volume/main.py", line 40, in __init__ 
     self.main(self.argv) 
   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 151, 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 265, in main 
     self.execute(args) 
   File "/usr/lib/python2.7/site-packages/ceph_volume/devices/lvm/batch.py", line 151, in execute 
     strategy.execute() 
   File "/usr/lib/python2.7/site-packages/ceph_volume/devices/lvm/strategies/filestore.py", line 147, in execute 
     journal_lv_extents = device_vg.sizing(size=self.journal_size.gb.as_int())['extents'] 
   File "/usr/lib/python2.7/site-packages/ceph_volume/api/lvm.py", line 1057, in sizing 
     size = int(self.free / parts) 
 TypeError: unsupported operand type(s) for /: 'int' and 'NoneType' 
 </pre> 

 Because @self.journal_size.gb.as_int()@ @@self.journal_size.gb.as_int()@@ would return something like 0.097 (for 100 megabytes) which would make the "if" clause 
 not execute because Python treats @0@ @@0@@ as a false. 

 That "if" condition should be changed to an @if @@if size is not None@ None@@ 

 

Back