[vfio-users] Thinking about managing VMs with a macro pad & scripts

Kyle Marek psppsn96 at gmail.com
Mon Oct 29 13:44:19 UTC 2018


On 10/29/2018 12:41 AM, Daniel Browne wrote:
> My host OS is Ubuntu server running headless with a Win7 VM and a Xubuntu
> VM as desktops (both have a dedicated GPU). Mouse and keyboard are passed
> through to Windows so that I can use the logitech software to configure
> them. I use Synergy to share the kb/mouse with the Linux VM. Generally this
> works fine, but leaves me in a situation where my Windows VM has to be
> running 100% of the time. Also, if something happens to my windows VM or if
> synergy crashes on the Linux guest I'm left with no ability to control my
> system other then grabbing a laptop and connecting to the host remotely.
>
> I've been thinking about the best way to deal with this particular pain
> point lately and I think I want to try getting a macro pad (basically a
> tiny keyboard with 4-8 buttons), hooking it up to the host, and binding the
> keys to various libvirt scripts/commands. I have a few different ideas in
> mind for the scripts such as moving the kb/mouse to the Linux VM or
> rebooting one of the VMs.
>
> My question is, has anyone else tried something like this? If so, how well
> did it work and do you have any particular recommendations for a macro pad?
>
> On a side topic, I added a HDMI switch to my configuration a little while
> back with the goal of being able to dedicate both of my monitors to one or
> the other of my VMs (or maybe even swapping the screens) without having to
> move cables around. Unfortunately, neither of my guests do well with having
> the monitors switched around like that. I have issues where the guest just
> plain won't detect the monitor, or it won't set the resolution to something
> sane. If anyone has any tips that might help with this issue, it would be
> appreciated.

So, it might be a "known fact" that you usually cannot use QEMU's SPICE
or VNC server with GPU passthrough unless you're using an IGD to
accelerate one of the emulated GPUs. However, what I'm observing is that
the only reason the standard SPICE client cannot still send input to a
VM is because it depends on the server providing a framebuffer.

I've had success using SPICE for "blind" input by applying the following
patch to QEMU to make it provide "non-graphical" framebuffers such as
the "vc" chardev used for serial consoles:

diff --git a/ui/spice-display.c b/ui/spice-display.c
index b353445f58..c296dd497e 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -1057,7 +1057,7 @@ void qemu_spice_display_init(void)
 
     for (i = 0;; i++) {
         con = qemu_console_lookup_by_index(i);
-        if (!con || !qemu_console_is_graphic(con)) {
+        if (!con) {
             break;
         }
         if (qemu_spice_have_display_interface(con)) {



This also gives the other benefits of SPICE such as the WebDAV share,
and dynamic USB passthrough. In your case, this patch might be useful
since you have a laptop. You may connect to QEMU's SPICE server on your
laptop and use your laptop to provide input to the VM until you have
synergy working again.

I figured this might be a little more convenient than trying to run
commands to re-bind your VM peripherals and such.

-Kyle





More information about the vfio-users mailing list