Signed-off-by: David Mohr <[email protected]>
---
lib/storage/bdev.py | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/lib/storage/bdev.py b/lib/storage/bdev.py
index 4892ec2..94ded76 100644
--- a/lib/storage/bdev.py
+++ b/lib/storage/bdev.py
@@ -887,9 +887,8 @@ class RADOSBlockDevice(base.BlockDev):
@classmethod
def MakeRbdCmd(cls, params, cmd):
- if constants.RBD_USER_ID in params and params[constants.RBD_USER_ID]:
- cmd.append("--id")
- cmd.append("%s" % params[constants.RBD_USER_ID])
+ if params.get(constants.RBD_USER_ID, ""):
+ cmd.extend(["--id", str(params[constants.RBD_USER_ID])])
return [constants.RBD_CMD] + cmd
@classmethod
@@ -911,7 +910,7 @@ class RADOSBlockDevice(base.BlockDev):
# Provision a new rbd volume (Image) inside the RADOS cluster.
cmd = cls.MakeRbdCmd(params, ["create", "-p", rbd_pool, rbd_name,
- "--size", "%s" % size])
+ "--size", str(size)])
result = utils.RunCmd(cmd)
if result.failed:
base.ThrowError("rbd creation failed (%s): %s",
@@ -1174,7 +1173,7 @@ class RADOSBlockDevice(base.BlockDev):
if rbd_dev:
# The mapping exists. Unmap the rbd device.
- unmap_cmd = self.__class__.MakeRbdCmd(self.params, ["unmap", "%s" %
rbd_dev])
+ unmap_cmd = self.__class__.MakeRbdCmd(self.params, ["unmap",
str(rbd_dev)])
result = utils.RunCmd(unmap_cmd)
if result.failed:
base.ThrowError("rbd unmap failed (%s): %s",
@@ -1219,7 +1218,7 @@ class RADOSBlockDevice(base.BlockDev):
# Resize the rbd volume (Image) inside the RADOS cluster.
cmd = self.__class__.MakeRbdCmd(self.params, ["resize", "-p", rbd_pool,
- rbd_name, "--size", "%s" % new_size])
+ rbd_name, "--size", str(new_size)])
result = utils.RunCmd(cmd)
if result.failed:
base.ThrowError("rbd resize failed (%s): %s",
--
1.7.9.5