summaryrefslogtreecommitdiffstats
path: root/src/guestfs.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@trick.home.annexia.org>2009-09-21 13:03:27 +0100
committerRichard Jones <rjones@trick.home.annexia.org>2009-09-22 10:26:58 +0100
commit8b217a87bf9175e7e02a5913e5617e0d12dfd09c (patch)
tree2b918b0c1c42ea44f95614bc60b03bb29fecf014 /src/guestfs.c
parent8b91ee5e2d951ae467ac08421db89af48a642086 (diff)
downloadlibguestfs-8b217a87bf9175e7e02a5913e5617e0d12dfd09c.tar.gz
libguestfs-8b217a87bf9175e7e02a5913e5617e0d12dfd09c.tar.xz
libguestfs-8b217a87bf9175e7e02a5913e5617e0d12dfd09c.zip
Flexible guestfs_vmchannel parameter for future appliances.
This reimplements parts of commit da0a4f8d1f6ddd302ceba028d87c6e009589e503 in a different, but compatible way. We pass guestfs_vmchannel=tcp:<ip>:<port> on the command line. This is intended to be used as follows (now and in future versions): tcp:10.0.2.4:6666 for guestfwd vmchannel tcp:10.0.2.2:<port> for future "no vmchannel" implementation /dev/vcon4 for future virtio-console vmchannel* It also accepts the old-style guestfs=10.0.2.4:6666 parameter which is sent by older libraries, and turns this transparently into the correct format above. If no guestfs_vmchannel is passed, then this defaults to the guestfwd vmchannel which older libraries would expect. * Maybe this last one should be dev:/dev/vcon4 or file:/dev/vcon4, but we don't need to decide that now.
Diffstat (limited to 'src/guestfs.c')
-rw-r--r--src/guestfs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/guestfs.c b/src/guestfs.c
index 55732f91..ec7473ea 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -984,6 +984,7 @@ guestfs__launch (guestfs_h *g)
if (r == 0) { /* Child (qemu). */
char buf[256];
+ const char *vmchannel = NULL;
/* Set up the full command line. Do this in the subprocess so we
* don't need to worry about cleaning up.
@@ -1045,6 +1046,7 @@ guestfs__launch (guestfs_h *g)
}
add_cmdline (g, "-net");
add_cmdline (g, "nic,model=" NET_IF ",vlan=0");
+ vmchannel = "guestfs_vmchannel=tcp:" GUESTFWD_ADDR ":" GUESTFWD_PORT " ";
#define LINUX_CMDLINE \
"panic=1 " /* force kernel to panic if daemon exits */ \
@@ -1058,9 +1060,11 @@ guestfs__launch (guestfs_h *g)
snprintf (buf, sizeof buf,
LINUX_CMDLINE
"%s" /* (selinux) */
+ "%s" /* (vmchannel) */
"%s" /* (verbose) */
"%s", /* (append) */
g->selinux ? "selinux=1 enforcing=0 " : "selinux=0 ",
+ vmchannel ? vmchannel : "",
g->verbose ? "guestfs_verbose=1 " : "",
g->append ? g->append : "");