Commit 2ea64524 authored by Guido Trotter's avatar Guido Trotter
Browse files

Merge branch 'devel-2.5'



* devel-2.5:
  Migrate: don't check for free memory on cleanup
  Revert "cli: Disable abbreviation matching for options"

Conflicts:
	lib/cli.py
          - trivial
	lib/cmdlib.py
          - merge new condition
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parents c1f19851 72dc3fb3
......@@ -45,7 +45,7 @@ from ganeti import compat
from ganeti import netutils
from ganeti import qlang
from optparse import (TitledHelpFormatter,
from optparse import (OptionParser, TitledHelpFormatter,
Option, OptionValueError)
......@@ -1481,10 +1481,10 @@ def _ParseArgs(argv, commands, aliases, env_override):
argv = utils.InsertAtPos(argv, 1, shlex.split(env_args))
func, args_def, parser_opts, usage, description = commands[cmd]
parser = CustomOptionParser(option_list=parser_opts + COMMON_OPTS,
description=description,
formatter=TitledHelpFormatter(),
usage="%%prog %s %s" % (cmd, usage))
parser = OptionParser(option_list=parser_opts + COMMON_OPTS,
description=description,
formatter=TitledHelpFormatter(),
usage="%%prog %s %s" % (cmd, usage))
parser.disable_interspersed_args()
options, args = parser.parse_args(args=argv[1:])
......@@ -1494,21 +1494,6 @@ def _ParseArgs(argv, commands, aliases, env_override):
return func, options, args
class CustomOptionParser(optparse.OptionParser):
def _match_long_opt(self, opt):
"""Override C{OptionParser}'s function for matching long options.
The default implementation does prefix-based abbreviation matching. We
disable such behaviour as it can can lead to confusing conflicts (e.g.
C{--force} and C{--force-multi}).
"""
if opt in self._long_opt:
return opt
else:
raise optparse.BadOptionError(opt)
def _CheckArguments(cmd, args_def, args):
"""Verifies the arguments using the argument definition.
......
......@@ -7781,7 +7781,8 @@ class TLMigrateInstance(Tasklet):
i_be = cluster.FillBE(instance)
 
# check memory requirements on the secondary node
if not self.failover or instance.admin_state == constants.ADMINST_UP:
if (not self.cleanup and
(not self.failover or instance.admin_state == constants.ADMINST_UP)):
_CheckNodeFreeMemory(self.lu, target_node, "migrating instance %s" %
instance.name, i_be[constants.BE_MAXMEM],
instance.hypervisor)
......
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