You are not logged in.

#1 2014-08-21 12:35:56

zir_blazer
Member
Registered: 2013-12-12
Posts: 35

Switching between multiple VMs with one Keyboard + Mouse with Xen

These days I find that one of the things that annoys me the most in my day-to-day use of Xen and some VMs, is switching between them. So far, I have the following:

Reelevant Hardware:

Two Video Cards (The integrated one for Dom0 & VMs with emulated GPU, and a Raden 5570 given to a Windows XP DomU guest via VGA Passthrough)
Two Monitors (One connected to each Video Card)
One Keyboard and Mouse set (Shared between Dom0 and all VMs)

Reelevant Software:
Dom0 with Arch Linux and Gnome for GUI
Gaming VM with Windows XP, which receives its own Video Card and Monitor
Rarely, another VM if I want to do something that I'm not going to do on the gaming VM


So far, it looks like this:
http://i.imgur.com/ejl9mtg.png
The black box is the VM that has the other Video Card, it only outputs video during the BIOS POST and Windows XP splash screen, then fully switchs to the other Monitor as soon as the GPU Driver loads. However, it leaves that empty black window there, which I can't close without closing the VM.


Now, the problem lies in where the Mouse and Keyboard are active at a given time, and how to change them to be active on another VM: If I am on the Windows XP VM, I can easily switch input to Dom0 by pressing Alt + Ctrl, so both Keyboard and Mouse now are active on Dom0. However, to change back to the VM, I have to left-click somewhere inside the black box, which also has the annoying behavior than that left-click to change the focus of the Mouse and Keyboard to that VM, is also a left-click on the relative position in the actual VM, which depending on where that click falls may have unintended consequences (For example, harmless on Windows Desktop, but shoots a gun if I am playing a FPS and didn't paused it). If I have another VM open like on the screenshot, is even worse, because I can't directly switch from one to another, I have to Alt + Ctrl out of it to Dom0, then left-click inside the other VM. This means that switching between VMs is highly inefficient, and even annoying, because Gnome likes to rearrange minimized windows when I open more things on Dom0, so I can't memorize locations to click.

As I'm intending on downgrading my next Arch Linux reinstall from a full blown Desktop Enviroment to just a text console (I installed Gnome because there were things that couldn't comfortably do on pure console, but I'm ready for another round), my idea is having each VM in a tty console, so I can switch between them with Alt + Ctrl + Fx. This should apply to Dom0 and all VMs but the one that has its own GPU/Monitor, where Alt + Ctrl + Fing into it should just make Keyboard and Mouse active in that VM, yet I should simultaneously see the last VM that I switched to in the other Monitor. I'm pretty confident than doing something like that should be possible, however, did anyone actually tried and knows what is needed?

So far, I had decent results opening another tty and starting startx, which looks similar to this:
http://pconstantino.files.wordpress.com … startx.png
Just that it looks like on a very fresh X.org install without Windows Managers or anything, as the three white consoles don't even have a window title bar. I can close two of them using exit command, and on the last one I can use use xl create to open a VM in there.
While this comes extremely close to accomplish what I want because I can then switch back to Dom0 with Alt + Ctrl + F1, the input on the tty2 VM is extremely buggy, because the Mouse doesn't seem to stick inside the VM and instead I have the default X.org cursor, as if the VM wasn't the active window. Also, the Enter key inside the VM doesn't work for some reason that I can't figure, through other keys like the Windows key and Arrows key do (So I can at least navigate the Start Menu, even through I can't do anything else due lack of both Enter key and functional Mouse). I suppose that I would need to tinker a bit with X.org configuration to see if I can fix the input issue, and maybe I will have to install a Window Manager, but overally this part looks entirely doable.
There is a BIG issue, through: The VM with VGA Passthrough. This one would need something more special, like a shortcut that just changes the active window to that VM so I can get working input into it, as the SDL window needs to be hided from view, otherwise it would be drawn on top of the first Monitor screen, as it will simply be a black screen wasting space like on the screenshot.

If I can solve both things, this would pretty much be the solution I want.


Is there anyone that can share experience, ideas, etc, about this? So far, two things that have been suggested on xen-users Mailing List but don't cut it for me is a Hardware KVM switch (Needs money and physical space) and Synergy (Because its purpose fix a part of the sharing input issue by making input act like if I was using Extended Desktop on Windows with a Dual Monitor setup, but doesn't allows me to switch the VM that's on the first Monitor.

Offline

Board footer

Powered by FluxBB