diff options
Diffstat (limited to 'subplot')
-rw-r--r-- | subplot/vmadm.py | 16 | ||||
-rw-r--r-- | subplot/vmadm.yaml | 6 |
2 files changed, 22 insertions, 0 deletions
diff --git a/subplot/vmadm.py b/subplot/vmadm.py index 6997c5b..dcdcbb6 100644 --- a/subplot/vmadm.py +++ b/subplot/vmadm.py @@ -81,6 +81,22 @@ def delete_vm(ctx, config=None, filename=None): runcmd_exit_code_is_zero(ctx) +def shutdown_vm(ctx, config=None, filename=None): + runcmd_run = globals()["runcmd_run"] + runcmd_exit_code_is_zero = globals()["runcmd_exit_code_is_zero"] + + runcmd_run(ctx, ["vmadm", "shutdown", "--config", config, filename]) + runcmd_exit_code_is_zero(ctx) + + +def start_vm(ctx, config=None, filename=None): + runcmd_run = globals()["runcmd_run"] + runcmd_exit_code_is_zero = globals()["runcmd_exit_code_is_zero"] + + runcmd_run(ctx, ["vmadm", "start", "--config", config, filename]) + runcmd_exit_code_is_zero(ctx) + + def run_hostname_over_ssh(ctx, config=None, target=None, args=None): runcmd_run = globals()["runcmd_run"] runcmd_exit_code_is_zero = globals()["runcmd_exit_code_is_zero"] diff --git a/subplot/vmadm.yaml b/subplot/vmadm.yaml index 21662b6..76881e1 100644 --- a/subplot/vmadm.yaml +++ b/subplot/vmadm.yaml @@ -11,6 +11,12 @@ function: create_vm cleanup: delete_vm +- when: "I invoke vmadm shutdown --config {config} {filename}" + function: shutdown_vm + +- when: "I invoke vmadm start --config {config} {filename}" + function: start_vm + - when: "I invoke ssh -F {config} {target} {args:text}" function: run_hostname_over_ssh |