[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Make xm save / restore talk XenAPI; add save / restore to VM class.
# HG changeset patch # User Ewan Mellor <ewan@xxxxxxxxxxxxx> # Date 1174647589 0 # Node ID 8b0be0ddc2234997aefe3f180d27df2b0f345d67 # Parent fd0b109501afdbb14dd862ee1cb944689ac5f8c3 Make xm save / restore talk XenAPI; add save / restore to VM class. Signed-off-by: Tom Wilkie <tom.wilkie@xxxxxxxxx> --- tools/python/xen/xend/XendAPI.py | 15 ++++++++++++++- tools/python/xen/xm/main.py | 32 +++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 12 deletions(-) diff -r fd0b109501af -r 8b0be0ddc223 tools/python/xen/xend/XendAPI.py --- a/tools/python/xen/xend/XendAPI.py Fri Mar 23 10:46:39 2007 +0000 +++ b/tools/python/xen/xend/XendAPI.py Fri Mar 23 10:59:49 2007 +0000 @@ -1095,9 +1095,11 @@ class XendAPI(object): ('remove_from_platform', None), ('add_to_other_config', None), ('remove_from_other_config', None), + ('save', None), ('send_trigger', None)] VM_funcs = [('create', 'VM'), + ('restore', None), ('get_by_name_label', 'Set(VM)')] # parameters required for _create() @@ -1584,7 +1586,18 @@ class XendAPI(object): xeninfo = xendom.get_vm_by_uuid(vm_ref) xendom.domain_send_trigger(xeninfo.getDomid(), trigger, vcpu) return xen_api_success_void() - + + def VM_save(self, _, vm_ref, dest, checkpoint): + xendom = XendDomain.instance() + xeninfo = xendom.get_vm_by_uuid(vm_ref) + xendom.domain_save(xeninfo.getDomid(), dest, checkpoint) + return xen_api_success_void() + + def VM_restore(self, _, src, paused): + xendom = XendDomain.instance() + xendom.domain_restore(src, bool(paused)) + return xen_api_success_void() + # Xen API: Class VM_metrics # ---------------------------------------------------------------- diff -r fd0b109501af -r 8b0be0ddc223 tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Fri Mar 23 10:46:39 2007 +0000 +++ b/tools/python/xen/xm/main.py Fri Mar 23 10:59:49 2007 +0000 @@ -637,14 +637,18 @@ def xm_shell(args): ######################################################################### def xm_save(args): + arg_check(args, "save", 2, 3) - + try: (options, params) = getopt.gnu_getopt(args, 'c', ['checkpoint']) except getopt.GetoptError, opterr: err(opterr) sys.exit(1) + dom = params[0] + savefile = params[1] + checkpoint = False for (k, v) in options: if k in ['-c', '--checkpoint']: @@ -655,19 +659,22 @@ def xm_save(args): usage('save') sys.exit(1) - try: - dominfo = parse_doms_info(server.xend.domain(params[0])) - except xmlrpclib.Fault, ex: - raise ex - - domid = dominfo['domid'] - savefile = os.path.abspath(params[1]) + savefile = os.path.abspath(savefile) if not os.access(os.path.dirname(savefile), os.W_OK): err("xm save: Unable to create file %s" % savefile) sys.exit(1) - - server.xend.domain.save(domid, savefile, checkpoint) + + if serverType == SERVER_XEN_API: + server.xenapi.VM.save(get_single_vm(dom), savefile, checkpoint) + else: + try: + dominfo = parse_doms_info(server.xend.domain(dom)) + except xmlrpclib.Fault, ex: + raise ex + + domid = dominfo['domid'] + server.xend.domain.save(domid, savefile, checkpoint) def xm_restore(args): arg_check(args, "restore", 1, 2) @@ -693,7 +700,10 @@ def xm_restore(args): err("xm restore: Unable to read file %s" % savefile) sys.exit(1) - server.xend.domain.restore(savefile, paused) + if serverType == SERVER_XEN_API: + server.xenapi.VM.restore(savefile, paused) + else: + server.xend.domain.restore(savefile, paused) def getDomains(domain_names, state, full = 0): _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |