ia64/xen-unstable

changeset 12812:26a3c7c10782

Added Xen-API implementations for xm pause, xm unpause, xm destroy, xm rename,
and fix xm suspend and xm delete.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Wed Dec 06 11:25:51 2006 +0000 (2006-12-06)
parents 795a87426e48
children 963a02c040f6
files tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xm/main.py	Wed Dec 06 11:24:37 2006 +0000
     1.2 +++ b/tools/python/xen/xm/main.py	Wed Dec 06 11:25:51 2006 +0000
     1.3 @@ -825,7 +825,7 @@ def xm_delete(args):
     1.4      arg_check(args, "delete", 1)
     1.5      dom = args[0]
     1.6      if serverType == SERVER_XEN_API:
     1.7 -        server.xenapi.VM.destroy(dom)
     1.8 +        server.xenapi.VM.destroy(get_single_vm(dom))
     1.9      else:
    1.10          server.xend.domain.delete(dom)
    1.11  
    1.12 @@ -858,7 +858,7 @@ def xm_resume(args):
    1.13  
    1.14      dom = params[0]
    1.15      if serverType == SERVER_XEN_API:
    1.16 -        server.xenapi.VM.resume(dom, paused)
    1.17 +        server.xenapi.VM.resume(get_single_vm(dom), paused)
    1.18      else:
    1.19          server.xend.domain.resume(dom, paused)
    1.20      
    1.21 @@ -876,13 +876,19 @@ def xm_pause(args):
    1.22      arg_check(args, "pause", 1)
    1.23      dom = args[0]
    1.24  
    1.25 -    server.xend.domain.pause(dom)
    1.26 +    if serverType == SERVER_XEN_API:
    1.27 +        server.xenapi.VM.pause(get_single_vm(dom))
    1.28 +    else:
    1.29 +        server.xend.domain.pause(dom)
    1.30  
    1.31  def xm_unpause(args):
    1.32      arg_check(args, "unpause", 1)
    1.33      dom = args[0]
    1.34  
    1.35 -    server.xend.domain.unpause(dom)
    1.36 +    if serverType == SERVER_XEN_API:
    1.37 +        server.xenapi.VM.unpause(get_single_vm(dom))
    1.38 +    else:
    1.39 +        server.xend.domain.unpause(dom)
    1.40  
    1.41  def xm_dump_core(args):
    1.42      live = False
    1.43 @@ -923,7 +929,10 @@ def xm_dump_core(args):
    1.44  def xm_rename(args):
    1.45      arg_check(args, "rename", 2)
    1.46          
    1.47 -    server.xend.domain.setName(args[0], args[1])
    1.48 +    if serverType == SERVER_XEN_API:
    1.49 +        server.xenapi.VM.set_name_label(get_single_vm(args[0]), args[1])
    1.50 +    else:
    1.51 +        server.xend.domain.setName(args[0], args[1])
    1.52  
    1.53  def xm_importcommand(command, args):
    1.54      cmd = __import__(command, globals(), locals(), 'xen.xm')
    1.55 @@ -981,7 +990,12 @@ def xm_vcpu_set(args):
    1.56  
    1.57  def xm_destroy(args):
    1.58      arg_check(args, "destroy", 1)
    1.59 -    server.xend.domain.destroy(args[0])
    1.60 +
    1.61 +    dom = args[0]
    1.62 +    if serverType == SERVER_XEN_API:
    1.63 +        server.xenapi.VM.hard_shutdown(get_single_vm(dom))
    1.64 +    else:
    1.65 +        server.xend.domain.destroy(dom)
    1.66  
    1.67  
    1.68  def xm_domid(args):