
On Tue, Jul 14, 2015 at 05:58:05PM +0200, Martin Kletzander wrote:
On Tue, Jul 14, 2015 at 08:25:27AM -0300, Marcelo Ricardo Leitner wrote:
Hi,
On Tue, Jul 14, 2015 at 09:52:12AM +0200, Martin Kletzander wrote:
On Fri, Jul 10, 2015 at 04:28:46PM -0300, Marcelo Ricardo Leitner wrote:
Hi,
(I'm not subscribed to the list, please keep me on Cc)
I'm attempting to get a serial link between two guests, same hypervisor. The only practical way I could find is to add a serial port using a pty to a guest and then manually connecting to the serial (console in my case) of the other guest using socat in the hypervisor.
Then it made me think.. we could have this implemented at libvirt level. We could have a serial port on which we choose pty, udp, tcp, etc, and also a serial port from another guest, so that libvirt would handle socat start/stop automatically as both guests come up/down. Maybe libvirt could even do something smarter than that, maybe it can avoid socat somehow.
You can have one domain with serial port that will listen on some interface (unix socket, ip and port, whatever) and then have the second one connect to it. That could be done for example like this:
XML snippet of device for domain A: <serial type='file'> <source mode='bind' path='/tmp/tahi.sock'/> <target port='1'/> </serial>
XML snippet of device for domain B: <serial type='file'> <source mode='connect' path='/tmp/tahi.sock'/> <target port='1'/> </serial>
This way you need to make sure domain A is started when you are starting domain B, so it can connect to the socket that was created by domain A. If you don't want to depend on the order of domains being
I'd like to avoid that as much as possible. (though I failed to connect the serial interfaces through libvirt with any of the configs, tcp, unix, etc..) perhaps due to the console thing you mentioned below.
started, you can use for example socat for that:
XML snippet of device for domain A: <serial type='file'> <source mode='bind' path='/tmp/tahi-domA.sock'/> <target port='1'/> </serial>
XML snippet of device for domain B: <serial type='file'> <source mode='bind' path='/tmp/tahi-domB.sock'/> <target port='1'/> </serial>
And then run socat as: socat unix:/tmp/tahi-domA.sock unix:/tmp/tahi-domB.sock
That's what I was doing in the end. It also allows me to change the connection on the fly if needed, but I have to keep an eye on socat. I was thinking if we could have something more automatic for it.
Like, if I have domA and domB connected through a serial link using socat, and I reboot the hypervisor, I wanted the socat to come back automatically. Same if it dies..
You can use hook for that, probably
Looks very interesting, thanks! Marcelo