mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
bitkeeper revision 1.1159.217.20 (41ebdda5ZO9YBU_VHuSh0IwgcQe0Ng)
Merge arcadians.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-unstable.bk into arcadians.cl.cam.ac.uk:/local/scratch-2/cl349/xen-unstable.bk-merge
This commit is contained in:
commit
6df77776ad
7 files changed
+41
-17
No files matched your search
@@ -348,19 +348,19 @@ static PyObject *pyxc_linux_build(PyObject *self,
|
||||
|
||||
u32 dom;
|
||||
char *image, *ramdisk = NULL, *cmdline = "";
|
||||
int control_evtchn, flags = 0;
|
||||
int control_evtchn, flags = 0, vcpus = 1;
|
||||
|
||||
static char *kwd_list[] = { "dom", "control_evtchn",
|
||||
"image", "ramdisk", "cmdline", "flags",
|
||||
"image", "ramdisk", "cmdline", "flags", "vcpus",
|
||||
NULL };
|
||||
|
||||
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|ssi", kwd_list,
|
||||
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|ssii", kwd_list,
|
||||
&dom, &control_evtchn,
|
||||
&image, &ramdisk, &cmdline, &flags) )
|
||||
&image, &ramdisk, &cmdline, &flags, &vcpus) )
|
||||
return NULL;
|
||||
|
||||
if ( xc_linux_build(xc->xc_handle, dom, image,
|
||||
ramdisk, cmdline, control_evtchn, flags) != 0 )
|
||||
ramdisk, cmdline, control_evtchn, flags, vcpus) != 0 )
|
||||
return PyErr_SetFromErrno(xc_error);
|
||||
|
||||
Py_INCREF(zero);
|
||||
@@ -1023,6 +1023,7 @@ static PyMethodDef pyxc_methods[] = {
|
||||
" image [str]: Name of kernel image file. May be gzipped.\n"
|
||||
" ramdisk [str, n/a]: Name of ramdisk file, if any.\n"
|
||||
" cmdline [str, n/a]: Kernel parameters, if any.\n\n"
|
||||
" vcpus [int, 1]: Number of Virtual CPUS in domain.\n\n"
|
||||
"Returns: [int] 0 on success; -1 on error.\n" },
|
||||
|
||||
{ "vmx_build",
|
||||
|
||||
@@ -321,6 +321,7 @@ class XendDomainInfo:
|
||||
self.console_port = None
|
||||
self.savedinfo = None
|
||||
self.is_vmx = 0
|
||||
self.vcpus = 1
|
||||
|
||||
def setdom(self, dom):
|
||||
"""Set the domain id.
|
||||
@@ -448,6 +449,11 @@ class XendDomainInfo:
|
||||
cpu = sxp.child_value(config, 'cpu')
|
||||
if self.recreate and self.dom and cpu is not None:
|
||||
xc.domain_pincpu(self.dom, int(cpu))
|
||||
try:
|
||||
image = sxp.child_value(self.config, 'image')
|
||||
self.vcpus = int(sxp.child_value(image, 'vcpus'))
|
||||
except:
|
||||
raise VmError('invalid vcpus value')
|
||||
|
||||
self.init_domain()
|
||||
self.configure_console()
|
||||
@@ -746,12 +752,14 @@ class XendDomainInfo:
|
||||
ramdisk = ramdisk,
|
||||
flags = flags)
|
||||
else:
|
||||
log.warning('building dom with %d vcpus', self.vcpus)
|
||||
err = buildfn(dom = dom,
|
||||
image = kernel,
|
||||
control_evtchn = self.console.getRemotePort(),
|
||||
cmdline = cmdline,
|
||||
ramdisk = ramdisk,
|
||||
flags = flags)
|
||||
flags = flags,
|
||||
vcpus = self.vcpus)
|
||||
if err != 0:
|
||||
raise VmError('Building domain failed: type=%s dom=%d err=%d'
|
||||
% (ostype, dom, err))
|
||||
@@ -1280,6 +1288,7 @@ add_config_handler('console', vm_field_ignore)
|
||||
add_config_handler('image', vm_field_ignore)
|
||||
add_config_handler('device', vm_field_ignore)
|
||||
add_config_handler('backend', vm_field_ignore)
|
||||
add_config_handler('vcpus', vm_field_ignore)
|
||||
|
||||
# Register other config handlers.
|
||||
add_config_handler('maxmem', vm_field_maxmem)
|
||||
@@ -109,6 +109,10 @@ gopts.var('cpu', val='CPU',
|
||||
fn=set_int, default=None,
|
||||
use="CPU to run the domain on.")
|
||||
|
||||
gopts.var('vcpus', val='VCPUS',
|
||||
fn=set_int, default=1,
|
||||
use="# of Virtual CPUS in domain.")
|
||||
|
||||
gopts.var('cpu_weight', val='WEIGHT',
|
||||
fn=set_float, default=None,
|
||||
use="""Set the new domain's cpu weight.
|
||||
@@ -245,7 +249,10 @@ def configure_image(config, vals):
|
||||
config_image.append(['root', cmdline_root])
|
||||
if vals.extra:
|
||||
config_image.append(['args', vals.extra])
|
||||
if vals.vcpus:
|
||||
config_image.append(['vcpus', vals.vcpus])
|
||||
config.append(['image', config_image ])
|
||||
|
||||
|
||||
def configure_disks(config_devs, vals):
|
||||
"""Create the config for disks (virtual block devices).
|
||||
|
||||