[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Merge
ChangeSet 1.1400, 2005/05/13 15:30:20+01:00, xenbk@xxxxxxxxxxxxxxxxxx Merge b/tools/python/xen/xend/XendClient.py | 5 b/tools/python/xen/xend/XendDomain.py | 11 b/tools/python/xen/xend/XendDomainInfo.py | 961 +++++++++++----------------- b/tools/python/xen/xend/server/SrvDomain.py | 3 b/tools/python/xen/xm/main.py | 67 + tools/python/xen/xend/server/SrvUsbif.py | 240 ------ 6 files changed, 476 insertions(+), 811 deletions(-) diff -Nru a/tools/python/xen/xend/XendClient.py b/tools/python/xen/xend/XendClient.py --- a/tools/python/xen/xend/XendClient.py 2005-05-13 16:07:13 -04:00 +++ b/tools/python/xen/xend/XendClient.py 2005-05-13 16:07:13 -04:00 @@ -236,10 +236,11 @@ 'live' : live, 'resource' : resource }) - def xend_domain_pincpu(self, id, cpu): + def xend_domain_pincpu(self, id, vcpu, cpumap): return self.xendPost(self.domainurl(id), {'op' : 'pincpu', - 'cpu' : cpu }) + 'vcpu' : vcpu, + 'cpumap' : cpumap }) def xend_domain_cpu_bvt_set(self, id, mcuadv, warpback, warpvalue, warpl, warpu): return self.xendPost(self.domainurl(id), diff -Nru a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py 2005-05-13 16:07:13 -04:00 +++ b/tools/python/xen/xend/XendDomain.py 2005-05-13 16:07:13 -04:00 @@ -675,15 +675,16 @@ xmigrate = XendMigrate.instance() return xmigrate.save_begin(dominfo, dst) - def domain_pincpu(self, id, cpu): - """Pin a domain to a cpu. + def domain_pincpu(self, id, vcpu, cpumap): + """Set which cpus vcpu can use - @param id: domain - @param cpu: cpu number + @param id: domain + @param vcpu: vcpu number + @param cpumap: bitmap of usbale cpus """ dominfo = self.domain_lookup(id) try: - return xc.domain_pincpu(int(dominfo.id), cpu) + return xc.domain_pincpu(int(dominfo.id), vcpu, cpumap) except Exception, ex: raise XendError(str(ex)) diff -Nru a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py 2005-05-13 16:07:13 -04:00 +++ b/tools/python/xen/xend/XendDomainInfo.py 2005-05-13 16:07:13 -04:00 @@ -4,41 +4,31 @@ Includes support for domain construction, using open-ended configurations. -Author: Mike Wray <mike.wray@xxxxxxxxxx> +Author: Mike Wray <mike.wray@xxxxxx> """ import string -import types -import re -import sys import os import time -from twisted.internet import defer - import xen.lowlevel.xc; xc = xen.lowlevel.xc.new() import xen.util.ip from xen.util.ip import _readline, _readlines -from xen.xend.server import channel +from xen.xend.server import channel, controller +from xen.util.blkif import blkdev_uname_to_file -import sxp +from server.channel import channelFactory +import server.SrvDaemon; xend = server.SrvDaemon.instance() +from server import messages -import XendConsole -xendConsole = XendConsole.instance() +from xen.xend.XendBootloader import bootloader +import sxp from XendLogging import log -from XendRoot import get_component - -import server.SrvDaemon -xend = server.SrvDaemon.instance() - from XendError import VmError +from XendRoot import get_component -"""The length of domain names that Xen can handle. -The names stored in Xen itself are not used for much, and -xend can handle domain names of any length. -""" -MAX_DOMAIN_NAME = 15 +from PrettyPrint import prettyprint """Flag for a block device backend domain.""" SIF_BLK_BE_DOMAIN = (1<<4) @@ -48,8 +38,10 @@ """Shutdown code for poweroff.""" DOMAIN_POWEROFF = 0 + """Shutdown code for reboot.""" DOMAIN_REBOOT = 1 + """Shutdown code for suspend.""" DOMAIN_SUSPEND = 2 @@ -59,6 +51,15 @@ DOMAIN_REBOOT : "reboot", DOMAIN_SUSPEND : "suspend" } +"""Map shutdown reasons to the message type to use. +""" +shutdown_messages = { + 'poweroff' : 'shutdown_poweroff_t', + 'reboot' : 'shutdown_reboot_t', + 'suspend' : 'shutdown_suspend_t', + 'sysrq' : 'shutdown_sysrq_t', + } + RESTART_ALWAYS = 'always' RESTART_ONREBOOT = 'onreboot' RESTART_NEVER = 'never' @@ -164,21 +165,12 @@ """ device_handlers = {} -def add_device_handler(name, h): - """Add a handler for a device type. - - @param name: device type - @param h: handler: fn(vm, dev) - """ - device_handlers[name] = h +def add_device_handler(name, type): + device_handlers[name] = type def get_device_handler(name): - """Get the handler for a device type. - - @param name : device type - @return; handler or None - """ - return device_handlers.get(name) + return device_handlers[name] + def vm_create(config): """Create a VM from a configuration. @@ -186,11 +178,11 @@ is destroyed. @param config configuration - @return: Deferred @raise: VmError for invalid configuration """ vm = XendDomainInfo() - return vm.construct(config) + vm.construct(config) + return vm def vm_recreate(savedinfo, info): """Create the VM object for an existing domain. @@ -199,37 +191,37 @@ @type savedinfo: sxpr @param info: domain info from xc @type info: xc domain dict - @return: deferred """ + print 'vm_recreate>' + print 'savedinfo=' ; prettyprint(savedinfo) + print 'info=', info vm = XendDomainInfo() - vm.recreate = 1 + vm.recreate = True vm.savedinfo = savedinfo vm.setdom(info['dom']) - #vm.name = info['name'] vm.memory = info['mem_kb']/1024 start_time = sxp.child_value(savedinfo, 'start_time') if start_time is not None: vm.start_time = float(start_time) vm.restart_state = sxp.child_value(savedinfo, 'restart_state') + vm.restart_count = int(sxp.child_value(savedinfo, 'restart_count', 0)) restart_time = sxp.child_value(savedinfo, 'restart_time') if restart_time is not None: vm.restart_time = float(restart_time) config = sxp.child_value(savedinfo, 'config') if config: - d = vm.construct(config) + vm.construct(config) else: vm.name = sxp.child_value(savedinfo, 'name', "Domain-%d" % info['dom']) - d = defer.succeed(vm) - vm.recreate = 0 + vm.recreate = False vm.savedinfo = None - return d + return vm -def vm_restore(src, progress=0): +def vm_restore(src, progress=False): """Restore a VM from a disk image. src saved state to restore progress progress reporting flag - returns deferred raises VmError for invalid configuration """ vm = XendDomainInfo() @@ -244,12 +236,9 @@ config = sxp.child_value(vmconfig, 'config') except Exception, ex: raise VmError('config error: ' + str(ex)) - deferred = vm.dom_construct(dom, config) - def vifs_cb(val, vm): - vif_up(vm.ipaddrs) - return vm - deferred.addCallback(vifs_cb, vm) - return deferred + vm.dom_construct(dom, config) + vif_up(vm.ipaddrs) + return vm def dom_get(dom): """Get info from xen for an existing domain. @@ -262,27 +251,6 @@ return domlist[0] return None -def append_deferred(dlist, v): - """Append a value to a deferred list if it is a deferred. - - @param dlist: list of deferreds - @param v: value to add - """ - if isinstance(v, defer.Deferred): - dlist.append(v) - -def dlist_err(val): - """Error callback suitable for a deferred list. - In a deferred list the error callback is called with with Failure((error, index)). - This callback extracts the error and returns it. - - @param val: Failure containing (error, index) - @type val: twisted.internet.failure.Failure - """ - - (error, index) = val.value _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |