您的位置:首页 > 其它

Xen/KVM中解决鼠标移动问题 <VNC>

2013-09-06 17:38 567 查看
原文:http://smilejay.com/2012/06/xen-kvm-cursor-movement/

听同事提起,某云计算公司前阵子在上线云服务,他们用Xen,有用到usbdevice=tablet来解决虚拟机中所谓“鼠标漂移”问题;特别是在vnc连接到Windows guest中时,这种现象特别明显,通过移动鼠标,里面的实际光标移动非常的缓慢和不协调,看起来像有两个鼠标,而且这两个鼠标的焦点距离还比较远。我也在平时遇到过这样的问题,不过由于用Windows guest的情况比较少,所以也就没有去解决这个问题了。今天听到这个,倒是好好研究了一下。

在Xen中,启动guest中,配置上如下两个配置选项,即可解决虚拟机里鼠标移动问题。

View
Code BASH

1
2

usb=1
usbdevice='tablet'

看下,XL中对这两个选项的解释吧:

usb=BOOLEAN

Enables or disables a USB bus in the guest.

usbdevice=DEVICE

Adds DEVICE to the USB bus. The USB bus must also be enabled using usb=1. The most common use for this option is usbdevice=tablet which adds pointer device using absolute coordinates. Such devices function better than relative coordinate devices (such as a
standard mouse) since many methods of exporting guest graphics (such as VNC) work better in this mode. Note that this is independent of the actual pointer device you are using on the host/client side. XXX should/could be a list of devices.


经过查看Xen启动guest的qemu进程发现,qemu加上了这样的参数“-usb –usbdevice tablet”,所以我就看了下KVM中解决方法,其实就是在qemu命令行加这个参数即可。如下是一个创建一个Windows KVM guest的命令:

View
Code BASH

1

qemu-kvm -smp 4 -m 2048 -hda /images/Win7.img -usb -usbdevice tablet

通过这样的解决方法,通过VNC连接Guest(特别是Windows)后,光标的使用就比较平滑、比较正常了,比不加这样的选项好太多了。

对Windows和Linux(e.g. RHEL6.2)都是有效的,解决他们的鼠标移动问题。

另外,如果是CentOS使用这个方法遇到啥问题,可以考虑参考这篇文章:http://netessays.blogbus.com/logs/149032714.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐