From ab05e0f3db9a968a31b8c00f60e39e68d6b23aa9 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 17 Feb 2021 11:37:36 -0500 Subject: [PATCH] Add B suffix back to bare bytes values --- daemon-common/ceph.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/daemon-common/ceph.py b/daemon-common/ceph.py index ba452ac6..7bef5952 100644 --- a/daemon-common/ceph.py +++ b/daemon-common/ceph.py @@ -477,11 +477,14 @@ def getVolumeInformation(zk_conn, pool, volume): def add_volume(zk_conn, pool, name, size): # 1. Verify the size of the volume pool_information = getPoolInformation(zk_conn, pool) - size_bytes = format_bytes_fromhuman(size) if size_bytes >= int(pool_information['stats']['free_bytes']): return False, 'ERROR: Requested volume size is greater than the available free space in the pool' + # Add 'B' if the volume is in bytes + if re.match(r'^[0-9]+$', size): + size = '{}B'.format(size) + # 2. Create the volume retcode, stdout, stderr = common.run_os_command('rbd create --size {} --image-feature layering,exclusive-lock {}/{}'.format(size, pool, name)) if retcode: