[TOOLS][POWERPC] Add Prose Domain Builder

The following patch addes a Prose domain builder.  For the moment it
is a clone of the linux ppc64 builder but will diverge quickly.
Signed-off-by: Jonathan Appavoo <jappavoo@us.ibm.com>
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
This commit is contained in:
Jimi Xenidis committed 2006-10-18 06:43:33 -04:00
1 parent db11654fcc
commit 6d0d1bff96
5 files changed
+587 -1

No files matched your search

+53
View File
@@ -369,6 +369,47 @@ static PyObject *pyxc_linux_build(XcObject *self,
"console_mfn", console_mfn);
}
static PyObject *pyxc_prose_build(XcObject *self,
PyObject *args,
PyObject *kwds)
{
uint32_t dom;
char *image, *ramdisk = NULL, *cmdline = "", *features = NULL;
int flags = 0;
int store_evtchn, console_evtchn;
unsigned long store_mfn = 0;
unsigned long console_mfn = 0;
void *arch_args = NULL;
int unused;
static char *kwd_list[] = { "dom", "store_evtchn",
"console_evtchn", "image",
/* optional */
"ramdisk", "cmdline", "flags",
"features", "arch_args", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|ssiss#", kwd_list,
&dom, &store_evtchn,
&console_evtchn, &image,
/* optional */
&ramdisk, &cmdline, &flags,
&features, &arch_args, &unused) )
return NULL;
if ( xc_prose_build(self->xc_handle, dom, image,
ramdisk, cmdline, features, flags,
store_evtchn, &store_mfn,
console_evtchn, &console_mfn,
arch_args) != 0 ) {
if (!errno)
errno = EINVAL;
return PyErr_SetFromErrno(xc_error);
}
return Py_BuildValue("{s:i,s:i}",
"store_mfn", store_mfn,
"console_mfn", console_mfn);
}
static PyObject *pyxc_hvm_build(XcObject *self,
PyObject *args,
PyObject *kwds)
@@ -1003,6 +1044,18 @@ static PyMethodDef pyxc_methods[] = {
" vcpus [int, 1]: Number of Virtual CPUS in domain.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "prose_build",
(PyCFunction)pyxc_prose_build,
METH_VARARGS | METH_KEYWORDS, "\n"
"Build a new Linux guest OS.\n"
" dom [int]: Identifier of domain to build into.\n"
" 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" },
{ "hvm_build",
(PyCFunction)pyxc_hvm_build,
METH_VARARGS | METH_KEYWORDS, "\n"
+42
View File
@@ -246,6 +246,47 @@ class PPC_LinuxImageHandler(LinuxImageHandler):
features = self.vm.getFeatures(),
arch_args = devtree.to_bin())
class PPC_ProseImageHandler(LinuxImageHandler):
ostype = "prose"
def configure(self, imageConfig, deviceConfig):
LinuxImageHandler.configure(self, imageConfig, deviceConfig)
self.imageConfig = imageConfig
def buildDomain(self):
store_evtchn = self.vm.getStorePort()
console_evtchn = self.vm.getConsolePort()
log.debug("dom = %d", self.vm.getDomid())
log.debug("image = %s", self.kernel)
log.debug("store_evtchn = %d", store_evtchn)
log.debug("console_evtchn = %d", console_evtchn)
log.debug("cmdline = %s", self.cmdline)
log.debug("ramdisk = %s", self.ramdisk)
log.debug("vcpus = %d", self.vm.getVCpuCount())
log.debug("features = %s", self.vm.getFeatures())
devtree = FlatDeviceTree.build(self)
return xc.prose_build(dom = self.vm.getDomid(),
image = self.kernel,
store_evtchn = store_evtchn,
console_evtchn = console_evtchn,
cmdline = self.cmdline,
ramdisk = self.ramdisk,
features = self.vm.getFeatures(),
arch_args = devtree.to_bin())
def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb):
"""@param shadow_mem_kb The configured shadow memory, in KiB.
@param maxmem_kb The configured maxmem, in KiB.
@return The corresponding required amount of shadow memory, also in
KiB.
PowerPC currently uses "shadow memory" to refer to the hash table."""
return max(maxmem_kb / 64, shadow_mem_kb)
class HVMImageHandler(ImageHandler):
def __init__(self, vm, imageConfig, deviceConfig):
@@ -512,6 +553,7 @@ class X86_HVM_ImageHandler(HVMImageHandler):
_handlers = {
"powerpc": {
"linux": PPC_LinuxImageHandler,
"prose": PPC_ProseImageHandler,
},
"ia64": {
"linux": LinuxImageHandler,
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.