Add an API which allows querying of the core kernel arguments
required for the appliance kernel/initrd.
<fs> get-kernel-args
panic=1 console=ttyS0
udevtimeout=300 noapic acpi=off printk.time=1 cgroup_disable=memory
This does not include the vmchannel configuration parameter,
nor optional args such as selinux, or verbosity setting.
---
src/generator.ml | 10 ++++++++++
src/guestfs.c | 27 +++++++++++++++++----------
2 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/src/generator.ml b/src/generator.ml
index 41f8014..79619d7 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -689,6 +689,16 @@ Return the current appliance initrd path.
This is NULL if the initrd has not yet been located,
otherwise it returns the initrd path.");
+ ("get_kernel_args", (RConstString "append", []), -1, [],
+ [InitNone, Always, TestRun (
+ [["get_kernel_args"]])],
+ "get the appliance kernel arguments",
+ "\
+Return the basic appliance kernel arguments
+
+This returns the basic appliance kernel arguments
+without the guestfwd configuration parameter");
+
("set_path", (RErr, [OptString "searchpath"]), -1, [FishAlias
"path"],
[],
"set the search path",
diff --git a/src/guestfs.c b/src/guestfs.c
index 850dc9a..1463e1a 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -675,6 +675,21 @@ guestfs__get_initrd (guestfs_h *g)
return g->initrd;
}
+const char *
+guestfs__get_kernel_args (guestfs_h *g)
+{
+#define LINUX_CMDLINE \
+ "panic=1 " /* force kernel to panic if daemon exits */ \
+ "console=ttyS0 " /* serial console */ \
+ "udevtimeout=300 " /* good for very slow systems (RHBZ#480319) */ \
+ "noapic " /* workaround for RHBZ#502058 - ok if not SMP */ \
+ "acpi=off " /* we don't need ACPI, turn it off */ \
+ "printk.time=1 " /* display timestamp before kernel messages */ \
+ "cgroup_disable=memory " /* saves us about 5 MB of RAM */
+
+ return LINUX_CMDLINE;
+}
+
int
guestfs__set_qemu (guestfs_h *g, const char *qemu)
{
@@ -1475,23 +1490,15 @@ guestfs__launch_spawn (guestfs_h *g)
add_cmdline (g, "-net");
add_cmdline (g, "nic,model=" NET_IF ",vlan=0");
-#define LINUX_CMDLINE \
- "panic=1 " /* force kernel to panic if daemon exits */ \
- "console=ttyS0 " /* serial console */ \
- "udevtimeout=300 " /* good for very slow systems (RHBZ#480319) */ \
- "noapic " /* workaround for RHBZ#502058 - ok if not SMP */ \
- "acpi=off " /* we don't need ACPI, turn it off */ \
- "printk.time=1 " /* display timestamp before kernel messages */ \
- "cgroup_disable=memory " /* saves us about 5 MB of RAM */
-
/* Linux kernel command line. */
snprintf (buf, sizeof buf,
- LINUX_CMDLINE
+ "%s " /* Basic command line */
"%s " /* (selinux) */
"%s " /* (vmchannel) */
"%s " /* (verbose) */
"TERM=%s " /* (TERM environment variable) */
"%s", /* (append) */
+ guestfs__get_kernel_args (g),
g->selinux ? "selinux=1 enforcing=0" : "selinux=0",
vmchannel ? vmchannel : "",
g->verbose ? "guestfs_verbose=1" : "",
--
1.6.6.1