Commit 61be6ba4 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix gnt-instance modify with beparams

The gnt-instance modify didn't work correctly w.r.t the be parameters.
There was also a typo in the corresponding LU.

Reviewed-by: imsnah
parent dcd7cbaf
......@@ -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
......
......@@ -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"),
......
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