RFE: serial port forwarding
Submitted by Zhou Zheng Sheng
Assigned to Spice Bug List
It will be very useful if we can do the following with the virtual machine serial port.
client local peripheral serial device
<=>VM serial port This means Spice client to forward data read from /dev/ttySX to the VM serial port and vice versa. This will enable us to attach a serial peripheral device to the virtual machine serial port.
client local process
<=>VM serial port This means Spice client to forward data read from an IPC mechanism with a local process to the VM serial port. This will enable us to record the data steam from VM serial port, run a script against the VM serial port or do other things like forwarding the data to socat. If the the guest start a agetty on the remote serial port, we can get access to the guest console from the client.
VM1 serial port
<=>VM2 serial port In the above 2), if the client local process is socat, then we can connect two VMs' serial ports using a pair of back-to-back Spice client like as follow. VM1 serial port
<=>client local process(socat)
<=>VM2 serial port This enables VMs communicate with each other via serial port just like they are connected with serial cable.
I had a look at QEMU and Spice server code, and find there is already support for spicevmc and char device VDI and there is a port channel concept at the client side. I think adding a channel at the client side to just forward serial port data stream may not be hard. If the Spice client can export an Unix socket at the client side and forward the data to the guest console. Then we can use socat to forward the data to /dev/ttySX which is 1) or to other process which is 2). Can we do this?