From 8b217a87bf9175e7e02a5913e5617e0d12dfd09c Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Mon, 21 Sep 2009 13:03:27 +0100 Subject: Flexible guestfs_vmchannel parameter for future appliances. This reimplements parts of commit da0a4f8d1f6ddd302ceba028d87c6e009589e503 in a different, but compatible way. We pass guestfs_vmchannel=tcp:: 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: 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. --- src/guestfs.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') 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 : ""); -- cgit