From 4a7246b8c08fc0ba71e28434790ca793c03a4bfa Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 30 Jul 2021 11:25:13 -0400 Subject: [PATCH] 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. --- daemon-common/ceph.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/daemon-common/ceph.py b/daemon-common/ceph.py index 4b93622c..fb04b732 100644 --- a/daemon-common/ceph.py +++ b/daemon-common/ceph.py @@ -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: