[XEN] Implement XENMEM_set_memory_map, which specifies memory map to

be returned by XENMEM_memory_map. Hook this into the domain builder.

Based on a patch by Glauber de Oliveira Costa <gcosta@redhat.com>

Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
kfraser@localhost.localdomain committed 2006-12-08 11:30:30 +00:00
1 parent a3b9408baf
commit 43ff8f0aef
7 files changed
+149 -8

No files matched your search

+23
View File
@@ -758,6 +758,21 @@ static PyObject *pyxc_domain_setmaxmem(XcObject *self, PyObject *args)
return zero;
}
static PyObject *pyxc_domain_set_memmap_limit(XcObject *self, PyObject *args)
{
uint32_t dom;
unsigned int maplimit_kb;
if ( !PyArg_ParseTuple(args, "ii", &dom, &maplimit_kb) )
return NULL;
if ( xc_domain_set_memmap_limit(self->xc_handle, dom, maplimit_kb) != 0 )
return pyxc_error_to_exception();
Py_INCREF(zero);
return zero;
}
static PyObject *pyxc_domain_memory_increase_reservation(XcObject *self,
PyObject *args,
PyObject *kwds)
@@ -1141,6 +1156,14 @@ static PyMethodDef pyxc_methods[] = {
" maxmem_kb [int]: .\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "domain_set_memmap_limit",
(PyCFunction)pyxc_domain_set_memmap_limit,
METH_VARARGS, "\n"
"Set a domain's physical memory mappping limit\n"
" dom [int]: Identifier of domain.\n"
" map_limitkb [int]: .\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "domain_memory_increase_reservation",
(PyCFunction)pyxc_domain_memory_increase_reservation,
METH_VARARGS | METH_KEYWORDS, "\n"
+9 -1
View File
@@ -548,6 +548,14 @@ class X86_HVM_ImageHandler(HVMImageHandler):
return max(4 * (256 * self.vm.getVCpuCount() + 2 * (maxmem_kb / 1024)),
shadow_mem_kb)
class X86_Linux_ImageHandler(LinuxImageHandler):
def buildDomain(self):
# set physical mapping limit
# add an 8MB slack to balance backend allocations.
mem_kb = self.getRequiredInitialReservation() + (8 * 1024)
xc.domain_set_memmap_limit(self.vm.getDomid(), mem_kb)
return LinuxImageHandler.buildDomain(self)
_handlers = {
"powerpc": {
@@ -558,7 +566,7 @@ _handlers = {
"hvm": IA64_HVM_ImageHandler,
},
"x86": {
"linux": LinuxImageHandler,
"linux": X86_Linux_ImageHandler,
"hvm": X86_HVM_ImageHandler,
},
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.