Add VM.migrate to XenAPI, add support to XM

signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
This commit is contained in:
Tom Wilkie committed 2007-04-13 13:55:10 +01:00
1 parent 266760426a
commit 4a507d9105
2 files changed
+26 -3

No files matched your search

+12
View File
@@ -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)
+14 -3
View File
@@ -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)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.