From ef3e542b45612c9b10ddc58e8da47632c368fd65 Mon Sep 17 00:00:00 2001 From: Antoine Millet Date: Wed, 22 Jul 2015 11:48:54 +0200 Subject: [PATCH] Added migrate2 command (new style migrations) --- cloudcontrol/cli/commands/migrate.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/cloudcontrol/cli/commands/migrate.py b/cloudcontrol/cli/commands/migrate.py index cd2e4c7..2baa64c 100644 --- a/cloudcontrol/cli/commands/migrate.py +++ b/cloudcontrol/cli/commands/migrate.py @@ -97,3 +97,30 @@ class Command_migrate(TqlCommand): '''Print a list of migration type''' for t in self.etypes.keys(): self.printer.out("migrate -t %s -a %s"%(t, ",".join(self.etypes[t]))) + + +class Command_migrate2(TqlCommand): + '''New generation VM migration.''' + + def __init__(self, cli, argv0): + TqlCommand.__init__(self, cli, argv0) + self.set_usage("%prog [options] ") + self.add_option("-l", "--live", action="store_true", default=False, + help="Do a live migration") + self.add_option("-b", "--batch", help="Name of this batch") + self.add_option("-f", "--flag", action="append", + help="Migration or allocation flags") + + def __call__(self, argv): + self.parse_args(argv) + if self.options.live: + self.tql_filter += "&r=vm&status=running" + else: + self.tql_filter += "&r=vm&status=stopped" + if len(self.args) != 2: + raise cmdBadArgument() + self.rpccall("migrate2", self.args[0], self.args[1], + live=self.options.live, flags=self.options.flag) + + def remote_functions(self): + return set(("migrate2",)) -- GitLab