[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Add VM.migrate to XenAPI, add support to XM



# HG changeset patch
# User Tom Wilkie <tom.wilkie@xxxxxxxxx>
# Date 1176468910 -3600
# Node ID d51b3bc40ca54d8690080e661e250f21ad0fc23b
# Parent  5f6b31335cdaee6a5ac8e93743e5fbad0109cfd2
Add VM.migrate to XenAPI, add support to XM

signed-off-by: Tom Wilkie <tom.wilkie@xxxxxxxxx>
---
 tools/python/xen/xend/XendAPI.py |   12 ++++++++++++
 tools/python/xen/xm/migrate.py   |   17 ++++++++++++++---
 2 files changed, 26 insertions(+), 3 deletions(-)

diff -r 5f6b31335cda -r d51b3bc40ca5 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Fri Apr 13 12:30:04 2007 +0100
+++ b/tools/python/xen/xend/XendAPI.py  Fri Apr 13 13:55:10 2007 +0100
@@ -1304,6 +1304,7 @@ class XendAPI(object):
                   ('set_memory_dynamic_max_live', None),
                   ('set_memory_dynamic_min_live', None),
                   ('send_trigger', None),
+                  ('migrate', None),
                   ('destroy', None)]
     
     VM_funcs  = [('create', 'VM'),
@@ -1823,6 +1824,17 @@ class XendAPI(object):
         xendom.domain_send_trigger(xeninfo.getDomid(), trigger, vcpu)
         return xen_api_success_void()
 
+    def VM_migrate(self, _, vm_ref, destination_url, live, other_config):
+        xendom = XendDomain.instance()
+        xeninfo = xendom.get_vm_by_uuid(vm_ref)
+
+        resource = other_config.get("resource", 0)
+        port = other_config.get("port", 0)
+        
+        xendom.domain_migrate(xeninfo.getDomid(), destination_url,
+                              bool(live), resource, port)
+        return xen_api_success_void()
+
     def VM_save(self, _, vm_ref, dest, checkpoint):
         xendom = XendDomain.instance()
         xeninfo = xendom.get_vm_by_uuid(vm_ref)
diff -r 5f6b31335cda -r d51b3bc40ca5 tools/python/xen/xm/migrate.py
--- a/tools/python/xen/xm/migrate.py    Fri Apr 13 12:30:04 2007 +0100
+++ b/tools/python/xen/xm/migrate.py    Fri Apr 13 13:55:10 2007 +0100
@@ -23,7 +23,7 @@ import sys
 
 from xen.xm.opts import *
 
-from main import server
+from main import server, serverType, get_single_vm, SERVER_XEN_API
 
 gopts = Opts(use="""[options] DOM HOST
 
@@ -60,5 +60,16 @@ def main(argv):
 
     dom = args[0]
     dst = args[1]
-    server.xend.domain.migrate(dom, dst, opts.vals.live, opts.vals.resource,
-                               opts.vals.port)
+
+    if serverType == SERVER_XEN_API:
+        vm_ref = get_single_vm(dom)
+        other_config = {
+            "port":     opts.vals.port,
+            "resource": opts.vals.resource
+            }
+        server.xenapi.VM.migrate(vm_ref, dst, bool(opts.vals.live),
+                                 other_config)
+    else:
+        server.xend.domain.migrate(dom, dst, opts.vals.live,
+                                   opts.vals.resource,
+                                   opts.vals.port)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.