summaryrefslogtreecommitdiffstats
path: root/src/launch-appliance.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-07-20 12:37:53 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-07-20 13:43:55 +0100
commit52fa23d74f6308daf804c2330b0b27e0b4412594 (patch)
treeeb9a813234a45f564ba8844c9cb64d198fd12295 /src/launch-appliance.c
parent4df6beee54ca870faa92bcee346a671e19c80237 (diff)
downloadlibguestfs-52fa23d74f6308daf804c2330b0b27e0b4412594.tar.gz
libguestfs-52fa23d74f6308daf804c2330b0b27e0b4412594.tar.xz
libguestfs-52fa23d74f6308daf804c2330b0b27e0b4412594.zip
launch: Move guestfs_config API and build list of qemu parameters in handle.
Move and rewrite guestfs_config so it accumulates a list of qemu parameters in the handle. These are added to the appliance at launch time (with attach method == unix:... you'll now get an error).
Diffstat (limited to 'src/launch-appliance.c')
-rw-r--r--src/launch-appliance.c40
1 files changed, 8 insertions, 32 deletions
diff --git a/src/launch-appliance.c b/src/launch-appliance.c
index 6b4be356..d6ee3045 100644
--- a/src/launch-appliance.c
+++ b/src/launch-appliance.c
@@ -238,6 +238,7 @@ guestfs___launch_appliance (guestfs_h *g)
if (r == 0) { /* Child (qemu). */
char buf[256];
int virtio_scsi = qemu_supports_virtio_scsi (g);
+ struct qemu_param *qp;
/* Set up the full command line. Do this in the subprocess so we
* don't need to worry about cleaning up.
@@ -250,6 +251,13 @@ guestfs___launch_appliance (guestfs_h *g)
alloc_cmdline (g);
g->cmdline[0] = g->qemu;
+ /* Add any qemu parameters. */
+ for (qp = g->qemu_params; qp; qp = qp->next) {
+ add_cmdline (g, qp->qemu_param);
+ if (qp->qemu_value)
+ add_cmdline (g, qp->qemu_value);
+ }
+
/* CVE-2011-4127 mitigation: Disable SCSI ioctls on virtio-blk
* devices. The -global option must exist, but you can pass any
* strings to it so we don't need to check for the specific virtio
@@ -1018,35 +1026,3 @@ guestfs__max_disks (guestfs_h *g)
else
return 27; /* conservative estimate */
}
-
-int
-guestfs__config (guestfs_h *g,
- const char *qemu_param, const char *qemu_value)
-{
- if (qemu_param[0] != '-') {
- error (g, _("guestfs_config: parameter must begin with '-' character"));
- return -1;
- }
-
- /* A bit fascist, but the user will probably break the extra
- * parameters that we add if they try to set any of these.
- */
- if (STREQ (qemu_param, "-kernel") ||
- STREQ (qemu_param, "-initrd") ||
- STREQ (qemu_param, "-nographic") ||
- STREQ (qemu_param, "-serial") ||
- STREQ (qemu_param, "-full-screen") ||
- STREQ (qemu_param, "-std-vga") ||
- STREQ (qemu_param, "-vnc")) {
- error (g, _("guestfs_config: parameter '%s' isn't allowed"), qemu_param);
- return -1;
- }
-
- if (add_cmdline (g, qemu_param) != 0) return -1;
-
- if (qemu_value != NULL) {
- if (add_cmdline (g, qemu_value) != 0) return -1;
- }
-
- return 0;
-}