diff options
author | Alastair Tse <atse@xensource.com> | 2006-10-06 11:57:16 +0100 |
---|---|---|
committer | Alastair Tse <atse@xensource.com> | 2006-10-06 11:57:16 +0100 |
commit | 91c2dba33797118f45cdc5625029d2a1115abb5a (patch) | |
tree | 69537967d2fe8ad91a753a3e454ec911e9297935 /tools/python/scripts | |
parent | 901b309fb6f6abffb682055d3cf7d51b408a806f (diff) | |
download | xen-91c2dba33797118f45cdc5625029d2a1115abb5a.tar.gz xen-91c2dba33797118f45cdc5625029d2a1115abb5a.tar.bz2 xen-91c2dba33797118f45cdc5625029d2a1115abb5a.zip |
[XENAPI] Added hard shutdown (aka. vm-destroy)
Signed-off-by: Alastair Tse <atse@xensource.com>
Diffstat (limited to 'tools/python/scripts')
-rw-r--r-- | tools/python/scripts/xapi.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/python/scripts/xapi.py b/tools/python/scripts/xapi.py index 411600044e..41f10aca19 100644 --- a/tools/python/scripts/xapi.py +++ b/tools/python/scripts/xapi.py @@ -37,6 +37,7 @@ COMMANDS = { 'vbd-create': ('<domname> <pycfg>', 'Create VBD attached to domname'), 'vif-create': ('<domname> <pycfg>', 'Create VIF attached to domname'), 'vm-delete': ('<domname>', 'Delete VM'), + 'vm-destroy': ('<name>', 'Hard shutdown a VM with name'), } class OptionError(Exception): @@ -141,6 +142,16 @@ def xapi_vm_shutdown(*args): success = execute(server.VM.clean_shutdown, session, vm_uuid) print 'Done.' +def xapi_vm_destroy(*args): + if len(args) < 1: + raise OptionError("No Domain name specified.") + + server, session = _connect() + vm_uuid = execute(server.VM.get_by_label, session, args[0]) + print 'Shutting down VM with force %s (%s)' % (args[0], vm_uuid) + success = execute(server.VM.hard_shutdown, session, vm_uuid) + print 'Done.' + def xapi_vbd_create(*args): if len(args) < 2: raise OptionError("Configuration file not specified") |