mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
bitkeeper revision 1.1159.1.60 (411de531r3zspsa5WRoqFKGtfCbuAg)
Marge to the xc_linux_restore.c file
This commit is contained in:
commit
903335eb04
7 files changed
+96
-20
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 cpu_weight = 1;
|
||||
u32 dom = 0;
|
||||
int ret;
|
||||
|
||||
static char *kwd_list[] = { "dom", "mem_kb", "name", "cpu", NULL };
|
||||
static char *kwd_list[] = { "dom", "mem_kb", "name",
|
||||
"cpu", "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, &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, cpu_weight, &dom)) < 0 )
|
||||
return PyErr_SetFromErrno(xc_error);
|
||||
|
||||
return PyInt_FromLong(dom);
|
||||
|
||||
@@ -475,8 +475,6 @@ class XendDomainInfo:
|
||||
if not dominfo:
|
||||
return
|
||||
print 'check_name>', 'dom=', dominfo.name, dominfo.dom, 'self=', name, self.dom
|
||||
if dominfo.is_terminated():
|
||||
return
|
||||
if not self.dom or (dominfo.dom != self.dom):
|
||||
raise VmError('vm name clash: ' + name)
|
||||
|
||||
@@ -492,8 +490,7 @@ class XendDomainInfo:
|
||||
try:
|
||||
self.name = sxp.child_value(config, 'name')
|
||||
self.check_name(self.name)
|
||||
if self.restore and self.dom:
|
||||
xc.domain_setname(self.dom, self.name)
|
||||
self.cpu_weight = float(sxp.child_value(config, 'cpu_weight'))
|
||||
self.memory = int(sxp.child_value(config, 'memory'))
|
||||
if self.memory is None:
|
||||
raise VmError('missing memory size')
|
||||
@@ -633,7 +630,6 @@ class XendDomainInfo:
|
||||
if self.restart_pending():
|
||||
self.console.deregisterChannel()
|
||||
else:
|
||||
log.debug('Closing console, domain %s', self.id)
|
||||
self.console.close()
|
||||
chan = xend.getDomChannel(self.dom)
|
||||
if chan:
|
||||
@@ -714,8 +710,9 @@ class XendDomainInfo:
|
||||
memory = self.memory
|
||||
name = self.name
|
||||
cpu = int(sxp.child_value(self.config, 'cpu', '-1'))
|
||||
cpu_weight = self.cpu_weight
|
||||
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, cpu_weight= cpu_weight)
|
||||
if dom <= 0:
|
||||
raise VmError('Creating domain failed: name=%s memory=%d'
|
||||
% (name, memory))
|
||||
@@ -1142,12 +1139,13 @@ add_device_handler('vbd', vm_dev_vbd)
|
||||
add_device_handler('pci', vm_dev_pci)
|
||||
|
||||
# Ignore the fields we already handle.
|
||||
add_config_handler('name', vm_field_ignore)
|
||||
add_config_handler('memory', vm_field_ignore)
|
||||
add_config_handler('cpu', vm_field_ignore)
|
||||
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('name', vm_field_ignore)
|
||||
add_config_handler('memory', vm_field_ignore)
|
||||
add_config_handler('cpu', vm_field_ignore)
|
||||
add_config_handler('cpu_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)
|
||||
add_config_handler('backend', vm_field_ignore)
|
||||
|
||||
# Register other config handlers.
|
||||
@@ -101,6 +101,10 @@ gopts.var('memory', val='MEMORY',
|
||||
fn=set_value, default=128,
|
||||
use="Domain memory in MB.")
|
||||
|
||||
gopts.var('cpu_weight', val='CPU_WEIGHT',
|
||||
fn=set_value, default=1,
|
||||
use="CPU weight.")
|
||||
|
||||
gopts.var('console', val='PORT',
|
||||
fn=set_int, default=None,
|
||||
use="Console port to use. Default is 9600 + domain id.")
|
||||
@@ -299,7 +303,8 @@ def make_config(vals):
|
||||
|
||||
config = ['vm',
|
||||
['name', vals.name ],
|
||||
['memory', vals.memory ] ]
|
||||
['memory', vals.memory ],
|
||||
['cpu_weight', vals.cpu_weight] ]
|
||||
if vals.cpu:
|
||||
config.append(['cpu', vals.cpu])
|
||||
if vals.blkif:
|
||||
|
||||