Commit c8bde61e authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix grow-disk handling of invalid units



The reason why grow-disk was doing:

$ gnt-instance grow-disk instance3 0 -64
Unhandled Ganeti error: Invalid format

Is because it does it's own ParseUnit call, and doesn't transform that
into a nicer message.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 59e67682
......@@ -660,7 +660,11 @@ def GrowDisk(opts, args):
except (TypeError, ValueError), err:
raise errors.OpPrereqError("Invalid disk index: %s" % str(err),
errors.ECODE_INVAL)
amount = utils.ParseUnit(args[2])
try:
amount = utils.ParseUnit(args[2])
except errors.UnitParseError:
raise errors.OpPrereqError("Can't parse the given amount '%s'" % args[2],
errors.ECODE_INVAL)
op = opcodes.OpInstanceGrowDisk(instance_name=instance,
disk=disk, amount=amount,
wait_for_sync=opts.wait_for_sync,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment