bitkeeper revision 1.1159.187.81 (41cc934bUot13IO0-1LsmhYl0sW9Zw)

Add plan9 builder support.
This commit is contained in:
iap10@labyrinth.cl.cam.ac.uk committed 2004-12-24 22:08:11 +00:00
1 parent 28f33c5460
commit 5dc6acb5fd
7 files changed
+847

No files matched your search

+35
View File
@@ -366,6 +366,33 @@ static PyObject *pyxc_linux_build(PyObject *self,
return zero;
}
static PyObject *pyxc_plan9_build(PyObject *self,
PyObject *args,
PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
u32 dom;
char *image, *ramdisk = NULL, *cmdline = "";
int control_evtchn, flags = 0;
static char *kwd_list[] = { "dom", "control_evtchn",
"image", "ramdisk", "cmdline", "flags",
NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|ssi", kwd_list,
&dom, &control_evtchn,
&image, &ramdisk, &cmdline, &flags) )
return NULL;
if ( xc_plan9_build(xc->xc_handle, dom, image,
cmdline, control_evtchn, flags) != 0 )
return PyErr_SetFromErrno(xc_error);
Py_INCREF(zero);
return zero;
}
static PyObject *pyxc_bvtsched_global_set(PyObject *self,
PyObject *args,
PyObject *kwds)
@@ -889,6 +916,14 @@ static PyMethodDef pyxc_methods[] = {
" state_file [str]: Name of state file. Must not currently exist.\n"
" progress [int, 1]: Bool - display a running progress indication?\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "plan9_build",
(PyCFunction)pyxc_plan9_build,
METH_VARARGS | METH_KEYWORDS, "\n"
"Build a new Plan 9 guest OS.\n"
" dom [long]: Identifier of domain to build into.\n"
" image [str]: Name of kernel image file. May be gzipped.\n"
" cmdline [str, n/a]: Kernel parameters, if any.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "linux_restore",
(PyCFunction)pyxc_linux_restore,
+29
View File
@@ -1065,6 +1065,34 @@ def vm_image_linux(vm, image):
vm.create_domain("linux", kernel, ramdisk, cmdline)
return vm
def vm_image_plan9(vm, image):
"""Create a VM for a Plan 9 image.
name vm name
memory vm memory
image image config
returns vm
"""
#todo: Same as for linux. Is that right? If so can unify them.
kernel = sxp.child_value(image, "kernel")
cmdline = ""
ip = sxp.child_value(image, "ip", "dhcp")
if ip:
cmdline += "ip=" + ip
root = sxp.child_value(image, "root")
if root:
cmdline += "root=" + root
args = sxp.child_value(image, "args")
if args:
cmdline += " " + args
ramdisk = sxp.child_value(image, "ramdisk", '')
vifs = vm.config_devices("vif")
vm.create_domain("plan9", kernel, ramdisk, cmdline)
return vm
def vm_dev_vif(vm, val, index, change=0):
"""Create a virtual network interface (vif).
@@ -1186,6 +1214,7 @@ def vm_field_maxmem(vm, config, val, index):
# Register image handlers.
add_image_handler('linux', vm_image_linux)
add_image_handler('plan9', vm_image_plan9)
# Register device handlers.
add_device_handler('vif', vm_dev_vif)
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.