Linux:
在终端中输入:
xset -m 0
Windows:
进入控制面板 -> 鼠标 -> 指针选项,去掉“提高指针精确度”前面的勾。
最近在做固态存储加速产品对 KVM 虚拟技术在云环境的测试,单节点时时常会遇到客户机需要访问主机资源的问题。最简单的方法是在主机 Linux 端建立网桥 Bridge,将真实网卡与虚拟客户端网卡进行桥接。这样客户端和主机可以平等的存在于网段中,相当于相互独立的不同主机。通过网络共享,SCP 等方法都可以相互访问。总结如下:
资源共享
auto br0 iface br0 inet dhcp bridge_ports eth0 bridge_stp off bridge_fd 0 bridge_maxwait 0
rdesktop 10.83.108.150:3389 -r disk:share_folder=/mnt/share
fdisk /dev/sdb
mkfs.ext3 /dev/sdb1
mount /dev/sdb1 /mnt/share_lun
kvm -m 1024 -boot c -drive file=/image_lun/VM_HDDs/centos32_install_01.qcow2,if=ide,index=0,boot=on -drive file=/dev/sdb1,if=virtio,aio=native
图形界面访问
-vnc :0 # 指定虚拟桌面 -vnc 192.168.1.5:0 # 指定 IP + 桌面 -vnc 0.0.0.0:5 # 指定其他桌面 -vnc 0.0.0.0:1 -k en-us # 指定字符集 #### 带密码验证的访问 #### -vnc 0.0.0.0:1,password -k en-us
下边的启动代码将虚拟机桌面映射入 VNC 1 号端口。
kvm -vnc :1 -m 1024 -boot c -drive file=/image_lun/VM_HDDs/centos32_install_01.qcow2,if=ide,index=0,boot=on -drive file=/dev/sdb,if=virtio,aio=native -drive file=/dev/sdc,if=virtio,index=2
-redir 参数可以将虚拟桌面使用 RDP 映射到 TCP 的不同端口上。如下:
kvm -redir tcp:3389::3389 -m 1024 -boot c -drive file=/image_lun/VM_HDDs/centos32_install_01.qcow2,if=ide,index=0,boot=on -drive file=/dev/sdb,if=virtio,aio=native -drive file=/dev/sdc,if=virtio,index=2
这样就可以在 Windows 和 Linux 中通过 RDP 客户端访问了。Windows:使用图形化的 Remote Desktop Connection;Linux:rdesktop <IP地址>:<端口>
以上只是我使用 KVM 实现客户虚拟机与主机资源共享的方法。还有其他方法,希望大家补充。