[PATCH] Enable virtio-serial in the daemon
Update the daemon to recognise a guestfs_vmchannel argument of the form "virtio-serial:<name>". The daemon will expect a virtio-serial device to be available locally at /dev/virtio-ports/<name>. --- daemon/guestfsd.c | 32 ++++++++++++++++++++++++++++++-- 1 files changed, 30 insertions(+), 2 deletions(-) diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index 49aca08..1417e50 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -345,10 +345,38 @@ main (int argc, char *argv[]) } } freeaddrinfo (res); - } else { + } + +#define VSPREFIX "virtio-serial:" +#define VSPREFIX_LEN sizeof(VSPREFIX) + + else if (STREQLEN (vmchannel, VSPREFIX, VSPREFIX_LEN)) { + char *name; + + if (asprintf(&name, "/dev/virtio-ports/%s", vmchannel + VSPREFIX_LEN) < 0) + { + perror ("malloc"); + exit (EXIT_FAILURE); + } + + fprintf (stderr, "Attempting to open virtio-serial device %s\n", name); + sock = open (name, O_RDWR); + if (sock == -1) { + fprintf (stderr, "open %s: %m\n", name); + } + + free(name); + } + +#undef VSPREFIX +#undef VSPREFIX_LEN + + else { fprintf (stderr, "unknown vmchannel connection type: %s\n" - "expecting \"tcp:<ip>:<port>\"\n", + "expecting one of:\n" + "\"tcp:<ip>:<port>\"\n" + "\"virtio-serial:<name>\"\n", vmchannel); exit (EXIT_FAILURE); } -- 1.7.2.2
On Mon, Aug 23, 2010 at 02:52:05PM +0100, Matthew Booth wrote:
Update the daemon to recognise a guestfs_vmchannel argument of the form "virtio-serial:<name>". The daemon will expect a virtio-serial device to be available locally at /dev/virtio-ports/<name>.
What I want to do here is to remove all the other methods and just use virtio-serial always. virtio-serial is now available on all the platforms we care about (possibly excluding RHEL 5, where it is being added). As you noted, it is also much faster than the current SLIRP-based network. If virtio-serial is the only supported option, then we can remove the guestfs_vmchannel= option entirely (and good riddance). Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
On 23/08/10 16:09, Richard W.M. Jones wrote:
On Mon, Aug 23, 2010 at 02:52:05PM +0100, Matthew Booth wrote:
Update the daemon to recognise a guestfs_vmchannel argument of the form "virtio-serial:<name>". The daemon will expect a virtio-serial device to be available locally at /dev/virtio-ports/<name>.
What I want to do here is to remove all the other methods and just use virtio-serial always. virtio-serial is now available on all the platforms we care about (possibly excluding RHEL 5, where it is being added). As you noted, it is also much faster than the current SLIRP-based network.
If virtio-serial is the only supported option, then we can remove the guestfs_vmchannel= option entirely (and good riddance).
Works for me. Matt -- Matthew Booth, RHCA, RHCSS Red Hat Engineering, Virtualisation Team GPG ID: D33C3490 GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
participants (2)
-
Matthew Booth -
Richard W.M. Jones