mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
Add support for configuring feature flags when starting guests.
Guest configuration files may now contain a features= declaration listing the features which should be enabled in a | separated list. Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
This commit is contained in:
1 parent
9d77d697b1
commit
a6f599555c
5 files changed
+142
-16
No files matched your search
@@ -326,27 +326,29 @@ static PyObject *pyxc_linux_build(XcObject *self,
|
||||
PyObject *kwds)
|
||||
{
|
||||
uint32_t dom;
|
||||
char *image, *ramdisk = NULL, *cmdline = "";
|
||||
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;
|
||||
|
||||
static char *kwd_list[] = { "dom", "store_evtchn",
|
||||
"console_evtchn", "image",
|
||||
static char *kwd_list[] = { "dom", "store_evtchn",
|
||||
"console_evtchn", "image",
|
||||
/* optional */
|
||||
"ramdisk", "cmdline", "flags", NULL };
|
||||
"ramdisk", "cmdline", "flags",
|
||||
"features", NULL };
|
||||
|
||||
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|ssi", kwd_list,
|
||||
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|ssis", kwd_list,
|
||||
&dom, &store_evtchn,
|
||||
&console_evtchn, &image,
|
||||
&console_evtchn, &image,
|
||||
/* optional */
|
||||
&ramdisk, &cmdline, &flags) )
|
||||
&ramdisk, &cmdline, &flags,
|
||||
&features) )
|
||||
return NULL;
|
||||
|
||||
if ( xc_linux_build(self->xc_handle, dom, image,
|
||||
ramdisk, cmdline, flags,
|
||||
store_evtchn, &store_mfn,
|
||||
ramdisk, cmdline, features, flags,
|
||||
store_evtchn, &store_mfn,
|
||||
console_evtchn, &console_mfn) != 0 ) {
|
||||
if (!errno)
|
||||
errno = EINVAL;
|
||||
|
||||
@@ -68,6 +68,7 @@ class ImageHandler:
|
||||
self.kernel = None
|
||||
self.ramdisk = None
|
||||
self.cmdline = None
|
||||
self.features = None
|
||||
|
||||
self.configure(imageConfig, deviceConfig)
|
||||
|
||||
@@ -89,6 +90,7 @@ class ImageHandler:
|
||||
if args:
|
||||
self.cmdline += " " + args
|
||||
self.ramdisk = get_cfg("ramdisk", '')
|
||||
self.features = get_cfg("features", '')
|
||||
|
||||
self.vm.storeVm(("image/ostype", self.ostype),
|
||||
("image/kernel", self.kernel),
|
||||
@@ -175,13 +177,15 @@ class LinuxImageHandler(ImageHandler):
|
||||
log.debug("cmdline = %s", self.cmdline)
|
||||
log.debug("ramdisk = %s", self.ramdisk)
|
||||
log.debug("vcpus = %d", self.vm.getVCpuCount())
|
||||
log.debug("features = %s", self.features)
|
||||
|
||||
return xc.linux_build(dom = self.vm.getDomid(),
|
||||
image = self.kernel,
|
||||
store_evtchn = store_evtchn,
|
||||
console_evtchn = console_evtchn,
|
||||
cmdline = self.cmdline,
|
||||
ramdisk = self.ramdisk)
|
||||
ramdisk = self.ramdisk,
|
||||
features = self.features)
|
||||
|
||||
class HVMImageHandler(ImageHandler):
|
||||
|
||||
|
||||
@@ -137,6 +137,10 @@ gopts.var('ramdisk', val='FILE',
|
||||
fn=set_value, default='',
|
||||
use="Path to ramdisk.")
|
||||
|
||||
gopts.var('features', val='FEATURES',
|
||||
fn=set_value, default='',
|
||||
use="Features to enable in guest kernel")
|
||||
|
||||
gopts.var('builder', val='FUNCTION',
|
||||
fn=set_value, default='linux',
|
||||
use="Function to use to build the domain.")
|
||||
@@ -445,6 +449,8 @@ def configure_image(vals):
|
||||
config_image.append(['root', cmdline_root])
|
||||
if vals.extra:
|
||||
config_image.append(['args', vals.extra])
|
||||
if vals.features:
|
||||
config_image.append(['features', vals.features])
|
||||
|
||||
if vals.builder == 'hvm':
|
||||
configure_hvm(config_image, vals)
|
||||
|
||||