ia64/xen-unstable

changeset 12106:858218d94516

[XENAPI] Added hard shutdown (aka. vm-destroy)

Signed-off-by: Alastair Tse <atse@xensource.com>
author Alastair Tse <atse@xensource.com>
date Fri Oct 06 11:57:16 2006 +0100 (2006-10-06)
parents 52f449c9dcc5
children 18506db37dc2
files tools/python/scripts/xapi.py
line diff
     1.1 --- a/tools/python/scripts/xapi.py	Fri Oct 06 11:56:36 2006 +0100
     1.2 +++ b/tools/python/scripts/xapi.py	Fri Oct 06 11:57:16 2006 +0100
     1.3 @@ -37,6 +37,7 @@ COMMANDS = {
     1.4      'vbd-create': ('<domname> <pycfg>', 'Create VBD attached to domname'),
     1.5      'vif-create': ('<domname> <pycfg>', 'Create VIF attached to domname'),
     1.6      'vm-delete': ('<domname>', 'Delete VM'),
     1.7 +    'vm-destroy': ('<name>', 'Hard shutdown a VM with name'),
     1.8  }
     1.9  
    1.10  class OptionError(Exception):
    1.11 @@ -141,6 +142,16 @@ def xapi_vm_shutdown(*args):
    1.12      success = execute(server.VM.clean_shutdown, session, vm_uuid)
    1.13      print 'Done.'
    1.14  
    1.15 +def xapi_vm_destroy(*args):
    1.16 +    if len(args) < 1:
    1.17 +        raise OptionError("No Domain name specified.")
    1.18 +
    1.19 +    server, session = _connect()
    1.20 +    vm_uuid = execute(server.VM.get_by_label, session, args[0])
    1.21 +    print 'Shutting down VM with force %s (%s)' % (args[0], vm_uuid)
    1.22 +    success = execute(server.VM.hard_shutdown, session, vm_uuid)
    1.23 +    print 'Done.'    
    1.24 +
    1.25  def xapi_vbd_create(*args):
    1.26      if len(args) < 2:
    1.27          raise OptionError("Configuration file not specified")