Re: [Libguestfs] supermin appliances and host connectivity
On Wed, Jun 1, 2011 at 3:06 PM, Joel Uckelman <joel@lightboxtechnologies.com> wrote:
On Tue, May 31, 2011 at 10:39 PM, Richard W.M. Jones <rjones@redhat.com> wrote:
On Tue, May 31, 2011 at 10:28:04PM +0200, Joel Uckelman wrote:
What I'm having trouble with, and the reason I'm writing you, is that it's not clear to me how much needs to be added to a supermin appliance built following your instructions to either (1) enable networking, or (2) create a bidirectional pipe with the host. (Really all we need is a pipe, networking is actually overkill.)
Is this making sense? Is there a straightforward way to do this?
Yes, that's what we do in libguestfs. In fact both things: we create a bi-directional pipe, and we optionally enable full IP networking. I suggest TBH you just look at the code, as that's simpler than me explaining it:
http://git.annexia.org/?p=libguestfs.git;a=blob;f=src/launch.c;h=0b15ce98d79...
The key words are "virtio serial" and "user networking".
I think I've fished out the command-line options you send to qemu-kvm:
qemu-kvm -kernel kernel -initrd initrd -hda root -device virtio-serial -serial stdio -chardev socket,path=/home/uckelman/projects/lightbox/supermin/foo,id=channel0,name=org.libguestfs.channel.0
Thanks for that.
I can definitely run my appliance this way if I already have something listening on that FIFO before launching qemu. (E.g.: socat UNIX-LISTEN:foo STDOUT) The piece of the puzzle I'm still missing is how to connect to the socket from the guest side. I was expecting to find something in the guest's /dev, but I have the same entries there as before.
I think I've fished out the command-line options you send to qemu-kvm: qemu-kvm -kernel kernel -initrd initrd -hda root -device virtio-serial -serial stdio -chardev socket,path=/home/uckelman/projects/lightbox/supermin/foo,id=channel0,name=org.libguestfs.channel.0 Thanks for that. I can definitely run my appliance this way if I already have something listening on that FIFO before launching qemu. (E.g.: socat UNIX-LISTEN:foo STDOUT) The piece of the puzzle I'm still missing is how to connect to the socket from the guest side. I was expecting to find something in the guest's /dev, but I have the same entries there as before.
On Wed, Jun 01, 2011 at 03:10:20PM +0200, Joel Uckelman wrote:
I think I've fished out the command-line options you send to qemu-kvm:
qemu-kvm -kernel kernel -initrd initrd -hda root -device virtio-serial -serial stdio -chardev socket,path=/home/uckelman/projects/lightbox/supermin/foo,id=channel0,name=org.libguestfs.channel.0
Thanks for that.
I can definitely run my appliance this way if I already have something listening on that FIFO before launching qemu. (E.g.: socat UNIX-LISTEN:foo STDOUT) The piece of the puzzle I'm still missing is how to connect to the socket from the guest side. I was expecting to find something in the guest's /dev, but I have the same entries there as before.
It seems likely that you either don't have udev running in the guest or your guest kernel is too old. IIRC it has to be >= 2.6.36 in order to support virtio-serial. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
On Wed, Jun 1, 2011 at 6:45 PM, Richard W.M. Jones <rjones@redhat.com>wrote:
On Wed, Jun 01, 2011 at 03:10:20PM +0200, Joel Uckelman wrote:
I think I've fished out the command-line options you send to qemu-kvm:
qemu-kvm -kernel kernel -initrd initrd -hda root -device virtio-serial -serial stdio -chardev
socket,path=/home/uckelman/projects/lightbox/supermin/foo,id=channel0,name=org.libguestfs.channel.0
Thanks for that.
I can definitely run my appliance this way if I already have something listening on that FIFO before launching qemu. (E.g.: socat UNIX-LISTEN:foo STDOUT) The piece of the puzzle I'm still missing is how to connect to the socket from the guest side. I was expecting to find something in the guest's /dev, but I have the same entries there as before.
It seems likely that you either don't have udev running in the guest or your guest kernel is too old. IIRC it has to be >= 2.6.36 in order to support virtio-serial.
Rich.
Yes, I don't have udev running. Adding udev to the package list for building the appliance seems not to be enough, as there's apparently nothing starting it. What's the proper way to start udev in this situation?
On Thu, Jun 09, 2011 at 08:26:38PM +0200, Joel Uckelman wrote:
On Wed, Jun 1, 2011 at 6:45 PM, Richard W.M. Jones <rjones@redhat.com>wrote:
On Wed, Jun 01, 2011 at 03:10:20PM +0200, Joel Uckelman wrote:
I think I've fished out the command-line options you send to qemu-kvm:
qemu-kvm -kernel kernel -initrd initrd -hda root -device virtio-serial -serial stdio -chardev
socket,path=/home/uckelman/projects/lightbox/supermin/foo,id=channel0,name=org.libguestfs.channel.0
Thanks for that.
I can definitely run my appliance this way if I already have something listening on that FIFO before launching qemu. (E.g.: socat UNIX-LISTEN:foo STDOUT) The piece of the puzzle I'm still missing is how to connect to the socket from the guest side. I was expecting to find something in the guest's /dev, but I have the same entries there as before.
It seems likely that you either don't have udev running in the guest or your guest kernel is too old. IIRC it has to be >= 2.6.36 in order to support virtio-serial.
Rich.
Yes, I don't have udev running. Adding udev to the package list for building the appliance seems not to be enough, as there's apparently nothing starting it. What's the proper way to start udev in this situation?
Have a look at how libguestfs does it: http://git.annexia.org/?p=libguestfs.git;a=blob;f=appliance/init;hb=HEAD The rest of the code in the appliance/ subdirectory is useful to look at too. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
On Fri, Jun 10, 2011 at 10:41 AM, Richard W.M. Jones <rjones@redhat.com>wrote:
Yes, I don't have udev running. Adding udev to the package list for
building
the appliance seems not to be enough, as there's apparently nothing starting it. What's the proper way to start udev in this situation?
Have a look at how libguestfs does it:
http://git.annexia.org/?p=libguestfs.git;a=blob;f=appliance/init;hb=HEAD
The rest of the code in the appliance/ subdirectory is useful to look at too.
Rich.
I started udev with /sbin/start_udev, as in the init script, but that seems to have no effect ("ps aux | grep udev" gives me no output.) If I start the guest with qemu-kvm -kernel kernel -initrd initrd -hda root -device virtio-serial -serial stdio -chardev socket,path=/home/uckelman/projects/lightbox/supermin/foo,id=channel0 -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 what should I expect the device connected to the pipe on the guest side to be called?
On Fri, Jun 10, 2011 at 12:55:26PM +0200, Joel Uckelman wrote:
On Fri, Jun 10, 2011 at 10:41 AM, Richard W.M. Jones <rjones@redhat.com>wrote:
Yes, I don't have udev running. Adding udev to the package list for
building
the appliance seems not to be enough, as there's apparently nothing starting it. What's the proper way to start udev in this situation?
Have a look at how libguestfs does it:
http://git.annexia.org/?p=libguestfs.git;a=blob;f=appliance/init;hb=HEAD
The rest of the code in the appliance/ subdirectory is useful to look at too.
Rich.
I started udev with /sbin/start_udev, as in the init script, but that seems to have no effect ("ps aux | grep udev" gives me no output.)
The fact that /sbin/start_udev doesn't work is obviously a problem. Does the script exist? Does it run? Does it give errors? Are you capturing all the errors when the init script runs? Have you tried adding 'set +x' to your init script? Are you using the full start up method shown in libguestfs's appliance/init?
If I start the guest with
qemu-kvm -kernel kernel -initrd initrd -hda root -device virtio-serial -serial stdio -chardev socket,path=/home/uckelman/projects/lightbox/supermin/foo,id=channel0 -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0
what should I expect the device connected to the pipe on the guest side to be called?
/dev/virtio-ports/<name> See: http://fedoraproject.org/wiki/Features/VirtioSerial 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://libguestfs.org
On Fri, Jun 10, 2011 at 1:01 PM, Richard W.M. Jones <rjones@redhat.com>wrote:>
I started udev with /sbin/start_udev, as in the init script, but that seems to have no effect ("ps aux | grep udev" gives me no output.)
The fact that /sbin/start_udev doesn't work is obviously a problem.
Does the script exist? Does it run? Does it give errors?
It exists, it runs, it fails silently. The only output from "/sbin/start_udev || echo foo" is "foo".
Are you capturing all the errors when the init script runs? Have you tried adding 'set +x' to your init script?Are you using the full start up method shown in libguestfs's appliance/init?
No, I have exactly the init that you had in your blog post. I'm mounting /sys and then running /sbin/start_udev manually.
If I start the guest with
qemu-kvm -kernel kernel -initrd initrd -hda root -device virtio-serial -serial stdio -chardev socket,path=/home/uckelman/projects/lightbox/supermin/foo,id=channel0 -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0
what should I expect the device connected to the pipe on the guest side to be called?
/dev/virtio-ports/<name>
See: http://fedoraproject.org/wiki/Features/VirtioSerial
Rich.
/sys/class/virtio-ports/vport0p1 and its contents are there after I mount /sys, so that's a good sign, I guess.
On Fri, Jun 10, 2011 at 01:15:40PM +0200, Joel Uckelman wrote:
On Fri, Jun 10, 2011 at 1:01 PM, Richard W.M. Jones <rjones@redhat.com>wrote:>
I started udev with /sbin/start_udev, as in the init script, but that seems to have no effect ("ps aux | grep udev" gives me no output.)
The fact that /sbin/start_udev doesn't work is obviously a problem.
Does the script exist? Does it run? Does it give errors?
It exists, it runs, it fails silently. The only output from "/sbin/start_udev || echo foo" is "foo".
Your basic problem if you need to get udev running. Anything else doesn't matter, because nothing much is going to work unless udev is running. So there you are: look inside that shell script and work out why it doesn't run, or use the udev commands directly to start udev. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
On Fri, Jun 10, 2011 at 1:47 PM, Richard W.M. Jones <rjones@redhat.com>wrote:
On Fri, Jun 10, 2011 at 01:15:40PM +0200, Joel Uckelman wrote:
On Fri, Jun 10, 2011 at 1:01 PM, Richard W.M. Jones <rjones@redhat.com wrote:>
I started udev with /sbin/start_udev, as in the init script, but that seems to have no effect ("ps aux | grep udev" gives me no output.)
The fact that /sbin/start_udev doesn't work is obviously a problem.
Does the script exist? Does it run? Does it give errors?
It exists, it runs, it fails silently. The only output from "/sbin/start_udev || echo foo" is "foo".
Your basic problem if you need to get udev running. Anything else doesn't matter, because nothing much is going to work unless udev is running. So there you are: look inside that shell script and work out why it doesn't run, or use the udev commands directly to start udev.
Rich.
Aha! I hadn't realized that udev depends on having /sys and /proc mounted first. Once I do that, I can start udev and my pipe is created as /dev/vport0p1. Thanks for you help!
On Fri, Jun 10, 2011 at 2:16 PM, Joel Uckelman <joel@lightboxtechnologies.com> wrote:
Aha! I hadn't realized that udev depends on having /sys and /proc mounted first. Once I do that, I can start udev and my pipe is created as /dev/vport0p1.
Thanks for you help!
I've run into one further problem here: It seems that the socket attached to the pipe is already bound when the appliance comes up, because I get an "Address already in use error" when I call bind(2) on /dev/vport0p1 from the appliance side. I'd been planing to listen on the appiance end of the pipe, and have clients connect from the host end. Is that not possible?
On Mon, Jun 20, 2011 at 03:20:16PM +0200, Joel Uckelman wrote:
On Fri, Jun 10, 2011 at 2:16 PM, Joel Uckelman <joel@lightboxtechnologies.com> wrote:
Aha! I hadn't realized that udev depends on having /sys and /proc mounted first. Once I do that, I can start udev and my pipe is created as /dev/vport0p1.
Thanks for you help!
I've run into one further problem here: It seems that the socket attached to the pipe is already bound when the appliance comes up, because I get an "Address already in use error" when I call bind(2) on /dev/vport0p1 from the appliance side.
You're better off looking at the source and/or asking the qemu developers. As you can see, we just open the device file. Whether that is the correct thing to do is another matter: http://git.annexia.org/?p=libguestfs.git;a=blob;f=daemon/guestfsd.c;h=eb1e82...
I'd been planing to listen on the appiance end of the pipe, and have clients connect from the host end. Is that not possible?
virtio-serial is like a serial port, and AFAIK there is no connection control (or there didn't used to be). Anyway I strongly recommend you ask the qemu developers or experiment yourself. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
participants (2)
-
Joel Uckelman -
Richard W.M. Jones