diff -r 53dc1cf50506 tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Wed Nov 21 09:12:06 2007 -0700 +++ b/tools/python/xen/lowlevel/xc/xc.c Mon Dec 03 13:26:44 2007 +0800 @@ -23,6 +23,7 @@ #include #include +#define MAX_NODES (uint16_t)1<<15 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) /* Needed for Python versions earlier than 2.3. */ @@ -98,15 +99,16 @@ static PyObject *pyxc_domain_create(XcOb { uint32_t dom = 0, ssidref = 0, flags = 0; int ret, i, hvm = 0; + int node = 0; PyObject *pyhandle = NULL; xen_domain_handle_t handle = { 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef }; - static char *kwd_list[] = { "domid", "ssidref", "handle", "hvm", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOi", kwd_list, - &dom, &ssidref, &pyhandle, &hvm)) + static char *kwd_list[] = { "domid", "ssidref", "handle", "hvm", "node", NULL }; + + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOii", kwd_list, + &dom, &ssidref, &pyhandle, &hvm, &node)) return NULL; if ( pyhandle != NULL ) @@ -126,7 +128,11 @@ static PyObject *pyxc_domain_create(XcOb if ( hvm ) flags |= XEN_DOMCTL_CDF_hvm_guest; - + if ( node < 0 || node > MAX_NODES) + node = MAX_NODES; + flags |= node << DOMAIN_NODE_SHIFT; + fprintf(stderr,"node=%#x\n",node); + fprintf(stderr,"flags=%#x\n",flags); if ( (ret = xc_domain_create(self->xc_handle, ssidref, handle, flags, &dom)) < 0 ) return pyxc_error_to_exception(); diff -r 53dc1cf50506 tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Wed Nov 21 09:12:06 2007 -0700 +++ b/tools/python/xen/xend/XendConfig.py Fri Nov 30 14:38:05 2007 +0800 @@ -129,7 +129,8 @@ XENAPI_PLATFORM_CFG = [ 'acpi', 'apic', 'nographic', 'pae', 'rtc_timeoffset', 'serial', 'sdl', 'soundhw','stdvga', 'usb', 'usbdevice', 'vnc', 'vncconsole', 'vncdisplay', 'vnclisten', 'timer_mode', - 'vncpasswd', 'vncunused', 'xauthority', 'pci', 'vhpt'] + 'vncpasswd', 'vncunused', 'xauthority', 'pci', + 'vhpt','node'] # Xen API console 'other_config' keys. XENAPI_CONSOLE_OTHER_CFG = ['vncunused', 'vncdisplay', 'vnclisten', diff -r 53dc1cf50506 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Wed Nov 21 09:12:06 2007 -0700 +++ b/tools/python/xen/xend/XendDomainInfo.py Mon Dec 03 13:15:00 2007 +0800 @@ -1604,7 +1604,6 @@ class XendDomainInfo: log.debug('XendDomainInfo.constructDomain') self.shutdownStartTime = None - hvm = self.info.is_hvm() if hvm: info = xc.xeninfo() @@ -1625,13 +1624,13 @@ class XendDomainInfo: ssidref = security.calc_dom_ssidref_from_info(self.info) if security.has_authorization(ssidref) == False: raise VmError("VM is not authorized to run.") - try: self.domid = xc.domain_create( domid = 0, ssidref = ssidref, handle = uuid.fromString(self.info['uuid']), - hvm = int(hvm)) + hvm = int(hvm), + node = int(self.info["platform"].get("node"))) except Exception, e: # may get here if due to ACM the operation is not permitted if security.on(): diff -r 53dc1cf50506 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Wed Nov 21 09:12:06 2007 -0700 +++ b/tools/python/xen/xend/image.py Mon Dec 03 08:49:54 2007 +0800 @@ -426,7 +426,6 @@ class HVMImageHandler(ImageHandler): self.apic = int(vmConfig['platform'].get('apic', 0)) self.acpi = int(vmConfig['platform'].get('acpi', 0)) - # Return a list of cmd line args to the device models based on the # xm config file def parseDeviceModelArgs(self, vmConfig): diff -r 53dc1cf50506 tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Wed Nov 21 09:12:06 2007 -0700 +++ b/tools/python/xen/xm/create.py Mon Dec 03 12:58:34 2007 +0800 @@ -206,6 +206,9 @@ gopts.var('apic', val='APIC', gopts.var('apic', val='APIC', fn=set_int, default=1, use="Disable or enable APIC mode.") +gopts.var('node', val='NODE', + fn=set_int, default=-1, + use="Set Node to bind domain.") gopts.var('vcpus', val='VCPUS', fn=set_int, default=1, @@ -733,7 +736,7 @@ def configure_hvm(config_image, vals): 'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw', 'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten', 'sdl', 'display', 'xauthority', 'rtc_timeoffset', 'monitor', - 'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci' ] + 'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci', 'node' ] for a in args: if a in vals.__dict__ and vals.__dict__[a] is not None: config_image.append([a, vals.__dict__[a]]) diff -r 53dc1cf50506 tools/python/xen/xm/xenapi_create.py --- a/tools/python/xen/xm/xenapi_create.py Wed Nov 21 09:12:06 2007 -0700 +++ b/tools/python/xen/xm/xenapi_create.py Mon Dec 03 12:44:59 2007 +0800 @@ -818,7 +818,7 @@ class sxp2xml: def extract_platform(self, image, document): - platform_keys = ['acpi', 'apic', 'pae', 'vhpt', 'timer_mode'] + platform_keys = ['acpi', 'apic', 'pae', 'vhpt', 'timer_mode', 'node'] def extract_platform_key(key): platform = document.createElement("platform") diff -r 53dc1cf50506 xen/common/domain.c --- a/xen/common/domain.c Wed Nov 21 09:12:06 2007 -0700 +++ b/xen/common/domain.c Mon Dec 03 14:08:51 2007 +0800 @@ -29,7 +29,7 @@ #include #include #include - +#include /* Protect updates/reads (resp.) of domain_list and domain_hash. */ DEFINE_SPINLOCK(domlist_update_lock); DEFINE_RCU_READ_LOCK(domlist_read_lock); @@ -191,13 +191,16 @@ struct domain *domain_create( struct domain *d, **pd; enum { INIT_evtchn = 1, INIT_gnttab = 2, INIT_arch = 8 }; int init_status = 0; - + nodeid_t node; if ( (d = alloc_domain(domid)) == NULL ) return NULL; if ( domcr_flags & DOMCRF_hvm ) d->is_hvm = 1; - + node = (domcr_flags & DOMAIN_NODE_MASK) >> DOMAIN_NODE_SHIFT; + if (!node_online(node) || node > MAX_NUMNODES) + node = MAX_NUMNODES; + d->node_id = node; rangeset_domain_initialise(d); if ( !is_idle_domain(d) ) diff -r 53dc1cf50506 xen/common/domctl.c --- a/xen/common/domctl.c Wed Nov 21 09:12:06 2007 -0700 +++ b/xen/common/domctl.c Mon Dec 03 13:01:56 2007 +0800 @@ -319,9 +319,8 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc ret = -EINVAL; if ( supervisor_mode_kernel || - (op->u.createdomain.flags & ~XEN_DOMCTL_CDF_hvm_guest) ) - break; - + (op->u.createdomain.flags & DOMAIN_FLAGS_MASK & ~XEN_DOMCTL_CDF_hvm_guest) ) + break; dom = op->domain; if ( (dom > 0) && (dom < DOMID_FIRST_RESERVED) ) { @@ -349,6 +348,7 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc domcr_flags = 0; if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_hvm_guest ) domcr_flags |= DOMCRF_hvm; + domcr_flags |= op->u.createdomain.flags & DOMAIN_NODE_MASK; ret = -ENOMEM; d = domain_create(dom, domcr_flags, op->u.createdomain.ssidref); diff -r 53dc1cf50506 xen/include/public/domctl.h --- a/xen/include/public/domctl.h Wed Nov 21 09:12:06 2007 -0700 +++ b/xen/include/public/domctl.h Mon Dec 03 13:27:45 2007 +0800 @@ -53,6 +53,9 @@ struct xen_domctl_createdomain { /* Is this an HVM guest (as opposed to a PV guest)? */ #define _XEN_DOMCTL_CDF_hvm_guest 0 #define XEN_DOMCTL_CDF_hvm_guest (1U<<_XEN_DOMCTL_CDF_hvm_guest) +#define DOMAIN_NODE_SHIFT 16 +#define DOMAIN_FLAGS_MASK (uint32_t)(1U<= DOMID_FIRST_RESERVED cannot be used for ordinary domains. */ #define DOMID_FIRST_RESERVED (0x7FF0U) diff -r 53dc1cf50506 xen/include/xen/sched.h --- a/xen/include/xen/sched.h Wed Nov 21 09:12:06 2007 -0700 +++ b/xen/include/xen/sched.h Fri Nov 30 10:28:09 2007 +0800 @@ -144,6 +144,7 @@ struct domain struct domain { domid_t domain_id; + nodeid_t node_id; shared_info_t *shared_info; /* shared data area */