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: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
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,