diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 458e5b79b052f52acc8ed562dd05386d97f5aa4e..2ae2c97ea627c8bb1e337f7297d1c4b33e4620fc 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -4557,7 +4557,7 @@ class LUSetInstanceParams(LogicalUnit): if constants.BE_MEMORY in self.be_new: args['memory'] = self.be_new[constants.BE_MEMORY] if constants.BE_VCPUS in self.be_new: - args['vcpus'] = self.be_bnew[constants.BE_VCPUS] + args['vcpus'] = self.be_new[constants.BE_VCPUS] if self.do_ip or self.do_bridge or self.mac: if self.do_ip: ip = self.ip diff --git a/scripts/gnt-instance b/scripts/gnt-instance index 61605d5603ee545be68298f6f028a2f2b7b510ef..ffcbcf24f8375cf100220be987b27fc5e40a7866 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -899,11 +899,15 @@ def SetInstanceParams(opts, args): mac - the new MAC address of the instance """ - if not (opts.mem or opts.vcpus or opts.ip or opts.bridge or opts.mac or - opts.hypervisor): + if not (opts.ip or opts.bridge or opts.mac or + opts.hypervisor or opts.beparams): logger.ToStdout("Please give at least one of the parameters.") return 1 + if constants.BE_MEMORY in opts.beparams: + opts.beparams[constants.BE_MEMORY] = utils.ParseUnit( + opts.beparams[constants.BE_MEMORY]) + op = opcodes.OpSetInstanceParams(instance_name=args[0], ip=opts.ip, bridge=opts.bridge, mac=opts.mac, @@ -1109,12 +1113,6 @@ commands = { "Replaces all disks for the instance"), 'modify': (SetInstanceParams, ARGS_ONE, [DEBUG_OPT, FORCE_OPT, - cli_option("-m", "--memory", dest="mem", - help="Memory size", - default=None, type="unit", metavar="<mem>"), - make_option("-p", "--cpu", dest="vcpus", - help="Number of virtual CPUs", - default=None, type="int", metavar="<PROC>"), make_option("-i", "--ip", dest="ip", help="IP address ('none' or numeric IP)", default=None, type="string", metavar="<ADDRESS>"), @@ -1127,6 +1125,9 @@ commands = { keyval_option("-H", "--hypervisor", type="keyval", default={}, dest="hypervisor", help="Change hypervisor parameters"), + keyval_option("-B", "--backend", type="keyval", + default={}, dest="beparams", + help="Change backend parameters"), SUBMIT_OPT, ], "<instance>", "Alters the parameters of an instance"),