Commit 320a5dae authored by Bernardo Dal Seno's avatar Bernardo Dal Seno

Always_failover doesn't require --allow-failover anymore

If an administrator sets always_failover, it means that there is no need
for another explicit approval to failover instead of migrating.
Signed-off-by: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
(cherry picked from commit b5f0b5cc)
Signed-off-by: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent d163abf9
......@@ -8072,14 +8072,9 @@ class TLMigrateInstance(Tasklet):
# check if failover must be forced instead of migration
if (not self.cleanup and not self.failover and
i_be[constants.BE_ALWAYS_FAILOVER]):
if self.fallback:
self.lu.LogInfo("Instance configured to always failover; fallback"
" to failover")
self.failover = True
else:
raise errors.OpPrereqError("This instance has been configured to"
" always failover, please allow failover",
errors.ECODE_STATE)
self.lu.LogInfo("Instance configured to always failover; fallback"
" to failover")
self.failover = True
# check bridge existance
_CheckInstanceBridgesExist(self.lu, instance, node=target_node)
......
......@@ -1547,6 +1547,9 @@ The ``--no-runtime-changes`` option forbids migrate to alter an
instance's runtime before migrating it (eg. ballooning an instance
down because the target node doesn't have enough available memory).
If an instance has the backend parameter ``always\_failover`` set to
true, then the migration is automatically converted into a failover.
See **ganeti(7)** for a description of ``--submit`` and other common
options.
......
......@@ -236,10 +236,9 @@ def TestInstanceMigrate(instance):
(constants.BE_ALWAYS_FAILOVER, constants.VALUE_TRUE)),
instance["name"]])
AssertCommand(cmd, fail=True)
AssertCommand(cmd)
qa_utils.RunInstanceCheck(instance, True)
AssertCommand(["gnt-instance", "migrate", "--force", "--allow-failover",
instance["name"]])
# TODO: Verify that a failover has been done instead of a migration
# TODO: Verify whether the default value is restored here (not hardcoded)
AssertCommand(["gnt-instance", "modify", "-B",
......
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