From 9c0256b54da69ddfeb39bf1ea4fac17e42523eb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= Date: Tue, 16 Jun 2015 16:48:21 +0200 Subject: [PATCH] Add cycle command --- cloudcontrol/cli/commands/vm.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cloudcontrol/cli/commands/vm.py b/cloudcontrol/cli/commands/vm.py index 8beda7e..bbee789 100644 --- a/cloudcontrol/cli/commands/vm.py +++ b/cloudcontrol/cli/commands/vm.py @@ -138,6 +138,23 @@ class Command_reset(TqlCommand): def remote_functions(self): return set(("reset",)) +class Command_cycle(TqlCommand): + '''Destroy and start a running vm''' + + def __init__(self, cli, argv0): + TqlCommand.__init__(self, cli, argv0) + self.tql_filter += "&r=vm&status=running" + + def __call__(self, argv): + # arg parse + self.parse_args(argv) + if len(self.args) != 1: + raise cmdBadArgument() + # rpc call + self.rpccall("cycle", self.args[0]) + + def remote_functions(self): + return set(("cycle",)) class Command_disablevirtiocache(TqlCommand): '''Set virtio cache to none on VMs disk devices''' -- GitLab