mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
bitkeeper revision 1.1159.17.1 (4118f0d483Vmdw5e5g0BuoQ37QULyg)
Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk into labyrinth.cl.cam.ac.uk:/auto/anfs/scratch/labyrinth/iap10/xeno-clone/xeno.bk
This commit is contained in:
commit
29ab24c974
20 files changed
+64
-32
No files matched your search
@@ -44,16 +44,19 @@ static PyObject *pyxc_domain_create(PyObject *self,
|
||||
unsigned int mem_kb = 0;
|
||||
char *name = "(anon)";
|
||||
int cpu = -1;
|
||||
float weight;
|
||||
u32 dom = 0;
|
||||
int ret;
|
||||
|
||||
static char *kwd_list[] = { "dom", "mem_kb", "name", "cpu", NULL };
|
||||
static char *kwd_list[] = { "dom", "mem_kb", "name", "cpu", "weight",
|
||||
NULL };
|
||||
|
||||
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iisi", kwd_list,
|
||||
&dom, &mem_kb, &name, &cpu) )
|
||||
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iisif", kwd_list,
|
||||
&dom, &mem_kb, &name, &cpu, &weight) )
|
||||
return NULL;
|
||||
|
||||
if ( (ret = xc_domain_create(xc->xc_handle, mem_kb, name, cpu, &dom)) < 0 )
|
||||
|
||||
if ( (ret = xc_domain_create(xc->xc_handle, mem_kb, name, cpu,
|
||||
weight, &dom)) < 0 )
|
||||
return PyErr_SetFromErrno(xc_error);
|
||||
|
||||
return PyInt_FromLong(dom);
|
||||
|
||||
@@ -486,6 +486,7 @@ class XendDomainInfo:
|
||||
self.config = config
|
||||
try:
|
||||
self.name = sxp.child_value(config, 'name')
|
||||
self.weight = float(sxp.child_value(config, 'weight'))
|
||||
self.check_name(self.name)
|
||||
self.memory = int(sxp.child_value(config, 'memory'))
|
||||
if self.memory is None:
|
||||
@@ -705,9 +706,10 @@ class XendDomainInfo:
|
||||
return
|
||||
memory = self.memory
|
||||
name = self.name
|
||||
weight = self.weight
|
||||
cpu = int(sxp.child_value(self.config, 'cpu', '-1'))
|
||||
dom = self.dom or 0
|
||||
dom = xc.domain_create(dom= dom, mem_kb= memory * 1024, name= name, cpu= cpu)
|
||||
dom = xc.domain_create(dom= dom, mem_kb= memory * 1024, name= name, cpu= cpu, weight= weight)
|
||||
if dom <= 0:
|
||||
raise VmError('Creating domain failed: name=%s memory=%d'
|
||||
% (name, memory))
|
||||
@@ -1137,6 +1139,7 @@ add_device_handler('pci', vm_dev_pci)
|
||||
add_config_handler('name', vm_field_ignore)
|
||||
add_config_handler('memory', vm_field_ignore)
|
||||
add_config_handler('cpu', vm_field_ignore)
|
||||
add_config_handler('weight', vm_field_ignore)
|
||||
add_config_handler('console', vm_field_ignore)
|
||||
add_config_handler('image', vm_field_ignore)
|
||||
add_config_handler('device', vm_field_ignore)
|
||||
|
||||
@@ -97,6 +97,10 @@ gopts.var('memory', val='MEMORY',
|
||||
fn=set_value, default=128,
|
||||
use="Domain memory in MB.")
|
||||
|
||||
gopts.var('weight', val='WEIGHT',
|
||||
fn=set_value, default=1,
|
||||
use="Domain cpu weight (default=1).")
|
||||
|
||||
gopts.var('console', val='PORT',
|
||||
fn=set_int, default=None,
|
||||
use="Console port to use. Default is 9600 + domain id.")
|
||||
@@ -295,7 +299,8 @@ def make_config(vals):
|
||||
|
||||
config = ['vm',
|
||||
['name', vals.name ],
|
||||
['memory', vals.memory ] ]
|
||||
['memory', vals.memory ],
|
||||
['weight', vals.weight] ]
|
||||
if vals.cpu:
|
||||
config.append(['cpu', vals.cpu])
|
||||
if vals.blkif:
|
||||
|
||||