WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Make xm save / restore talk XenAPI; add s

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Make xm save / restore talk XenAPI; add save / restore to VM class.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 23 Mar 2007 11:10:08 -0700
Delivery-date: Fri, 23 Mar 2007 11:09:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Make xm save / restore talk XenAPI; add save / restore to VM class., Xen patchbot-unstable <=