Set C<LIBGUESTFS_DEBUG=1> to enable verbose messages. This has the
same effect as using the B<-v> option.
+=item LIBGUESTFS_KERNEL
+
+Override the ordinary selection of appliance kernel.
+
=item LIBGUESTFS_MEMSIZE
Set the memory allocated to the qemu process, in megabytes. For
Set C<LIBGUESTFS_DEBUG=1> to enable verbose messages. This
has the same effect as calling C<guestfs_set_verbose (handle, 1)>.
+=item LIBGUESTFS_KERNEL
+
+Override the ordinary selection of appliance kernel.
+
=item LIBGUESTFS_MEMSIZE
Set the memory allocated to the qemu process, in megabytes. For
If C<NULL> then no options are added.");
+ ("set_kernel", (RErr, [String "kernel"]), -1, [FishAlias "kernel"],
+ [],
+ "override the normal appliance kernel",
+ "\
+This function lets you override the ordinary selection
+of kernel used in the appliance.
+
+The default is C<NULL> unless overridden by setting
+C<LIBGUESTFS_KERNEL> environment variable.
+
+Setting C<kernel> to C<NULL> means the ordinary appliance
+kernel is selected by the usual means.");
+
+ ("get_kernel", (RConstString "kernel", []), -1, [],
+ (* This cannot be tested with the current framework. The
+ * function can return NULL in normal operations, which the
+ * test framework interprets as an error.
+ *)
+ [],
+ "get the override appliance kernel",
+ "\
+Return the override appliance kernel (see C<guestfs_set_kernel>).
+
+If C<NULL> then the ordinary appliance kernel is used.");
+
("set_autosync", (RErr, [Bool "autosync"]), -1, [FishAlias "autosync"],
[],
"set autosync mode",
char *path; /* Path to kernel, initrd. */
char *qemu; /* Qemu binary. */
char *append; /* Append to kernel command line. */
+ char *kernel; /* Override appliance kernel. */
int memsize; /* Size of RAM (megabytes). */
if (!g->append) goto error;
}
+ str = getenv ("LIBGUESTFS_KERNEL");
+ if (str) {
+ g->kernel = strdup (str);
+ if (!g->kernel) goto error;
+ }
+
/* Choose a suitable memory size. Previously we tried to choose
* a minimal memory size, but this isn't really necessary since
* recent QEMU and KVM don't do anything nasty like locking
}
int
+guestfs_set_kernel (guestfs_h *g, const char *kernel)
+{
+ free (g->kernel);
+ g->kernel = NULL;
+
+ g->kernel = kernel ? safe_strdup (g, kernel) : NULL;
+ return 0;
+}
+
+const char *
+guestfs_get_kernel (guestfs_h *g)
+{
+ return g->kernel;
+}
+
+int
guestfs_set_memsize (guestfs_h *g, int memsize)
{
g->memsize = memsize;
add_cmdline (g, memsize_str);
add_cmdline (g, "-no-reboot"); /* Force exit instead of reboot on panic */
add_cmdline (g, "-kernel");
- add_cmdline (g, (char *) kernel);
+ add_cmdline (g, g->kernel ? : (char *) kernel);
add_cmdline (g, "-initrd");
add_cmdline (g, (char *) initrd);
add_cmdline (g, "-append");