LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   How do I pass more keystrokes to the guest via VNC? (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/how-do-i-pass-more-keystrokes-to-the-guest-via-vnc-932796/)

KenJackson 03-05-2012 06:03 AM

How do I pass more keystrokes to the guest via VNC?
 
I'm experimenting running various guests in KVM on a Fedora host using tightvnc to view the guest desktop. But a lot of keystrokes I would like to pass to the guests are consumed by the host's window manager.

Of course, I could go through the window manager's control application and tell it to not use each key combination I want to pass, but then I couldn't use it on the host.

It sure would be nice if I could press a modifier key that would cause the next key combination to be passed to the host application with the focus (VNC). Does anyone know of any such mechanism, or any other solution?

dyasny 03-05-2012 06:48 AM

try virsh send-key $combo

KenJackson 03-05-2012 11:41 AM

Quote:

Originally Posted by dyasny (Post 4618850)
try virsh send-key $combo

That's not the kind of solution I'm looking for, because it would require executing a command in a shell outside the VNC window instead of operating directly in the VNC window.

However, it's an interesting lesser-preferable possibility. But I can't use it because virsh seems to require a domain-id, which I don't have.

dyasny 03-05-2012 12:39 PM

domain-id is simply the name or number of the VM in question. Run `virsh list` to see the available running VMs

As for VNC... well, it's imperfect, try to use SDL or SPICE instead.

KenJackson 03-05-2012 09:38 PM

Code:

$ virsh list
 Id Name                State
----------------------------------

Like I said, I don't have any domain-ids, even though I do have one VM running:

Code:

$ ps auxww | grep qemu
ken      31741  7.2  4.0 1379596 249160 ?      Sl  22:16  0:14 qemu-kvm -boot c -hda /vm/ArchLinux.qemu -vnc :1 -m 1G -name ArchLinux -net nic -net tap,script=no,downscript=no,ifname=tap1 -usbdevice tablet


dyasny 03-07-2012 12:45 AM

The VM you have running seems to not have been started using libvirt. You're probably using qemu-kvm directly to run it, and this is why libvirt cannot keep track of it.

What you need to do is create a VM definition for this VM using virsh/virt-manager/virt-install, and then start it using virsh or virt-manager.

When the VM is operated this way, it will appear in the virsh list output

KenJackson 03-07-2012 05:36 AM

libvirt is one of those things I've been meaning to investigate to see if it's worth the effort to use. And apparently this capability to pass key combination could be one convenience it offers.

But how does it do it? Wouldn't it be simpler to just do whatever it does to pass the combination? I know a monitor port can be used to send commands to qemu-kvm. That's another thing I've been meaning to look into. I'm guessing that's the mechanism libvirt uses to pass the key combination.

My experience is that software packages (and government entities) that try to take control and do things for you often get in the way and make it awkward to do some things. I'm suspicious libvirt is one of those.

dyasny 03-07-2012 08:05 AM

libvirt is the de-facto standard for managing kvm VM instances. You can do everything libvirt does through qemu-kvm command line, but it's not scale-able - you have no means of maintaining consistent VM definitions, consistent APIs to perform tasks, and have to do absolutely everything manually.

Not to mention all the tools around libvirt, like guestfish and virt-v2v, and all the higher end management platforms. If you stick to a single VM and never are going to go any higher, it doesn't matter much, but if this is a growing setup and not just something to play with, you definitely need a management framework.


All times are GMT -5. The time now is 10:55 AM.