Ensure RBD resize has bytes appended

If this isn't, the resize will be interpreted as a MB value and result
in an absurdly big volume instead. This is the same consistency
validation that occurs on add.
This commit is contained in:
Joshua Boniface 2021-07-30 11:25:13 -04:00
parent c49351469b
commit 4a7246b8c0
1 changed files with 4 additions and 0 deletions

View File

@ -536,6 +536,10 @@ def resize_volume(zkhandler, pool, name, size):
if not verifyVolume(zkhandler, pool, name):
return False, 'ERROR: No volume with name "{}" is present in pool "{}".'.format(name, pool)
# Add 'B' if the volume is in bytes
if re.match(r'^[0-9]+$', size):
size = '{}B'.format(size)
# 1. Resize the volume
retcode, stdout, stderr = common.run_os_command('rbd resize --size {} {}/{}'.format(size, pool, name))
if retcode: