diff --git a/cloudcontrol/cli/commands/vm.py b/cloudcontrol/cli/commands/vm.py index 8beda7e1c32f9d8065903cb1eb5ecc448d344d20..bbee789952fab8d695589121f1ae7def36622785 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'''