利用spice-vdagent实现文本拷贝、鼠标非陷入

本文详细介绍了spice-vdagent-0.10.1的功能,包括客户端鼠标模式、自动调整X会话分辨率和复制粘贴支持。阐述了其在不同配置下的多显示器支持,并提供了启动KVM实例的命令行参数示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最新版本的spice-vdagent-0.10.1经过自己实验,是可用的,确实解决了一些问题,先看一下官方的说法:

Spice agent for Linux
=====================

The spice agent for Linux consists of 2 parts, a daemon spice-vdagentd and
a per X-session process spice-vdagent. The daemon gets started in Spice guests
through a Sys-V initscript. The per X-session gets automatically started in
desktop environments which honor /etc/xdg/autostart, and under gdm.

The main daemon needs to know which X-session daemon is the currently
active X-session (think switch user functionality) for this console kit is
used. spice-vdagent can be compiled without console kit support for use with
older distributions, in this case only one active X session is allowed.

Features:
* Client mouse mode (no need to grab mouse by client, no mouse lag)
  this is handled by the daemon by feeding mouse events into the kernel
  via uinput. This will only work if the active X-session is running a
  spice-vdagent process so that its resolution can be determined.
* Automatic adjustment of the X-session resolution to the client resolution
  for single monitor configurations.
* Support of copy and paste (text and images) between the active X-session
  and the client. This supports both the primary selection and the clipboard.
* Limited support for multiple displays, prerequisites:
  * A new enough Xorg-server. For Fedora atleast Fedora-17, for RHEL-6 atleast
    xorg-x11-server-1.10.4-6.el6_2.3
  * A vm configured with multiple qxl devices
  * A guest running the latest spice-vdagent
  Then connect to the vm with the multiple monitor client which you want to
  use it with using: "spicec --full-screen=auto-config" (or the user portal
  equivalent). At this point the agent will write out a:
  /var/run/spice-vdagentd/xorg.conf.spice file. With all the necessary magic
  to get Xinerama working. Move this file to /etc/X11/xorg.conf, then kill
  Xorg so that it will get restarted and you should be good to go.

All vdagent communications on the guest side run over a single pipe which
gets presented to the guest os as a virtio serial port.

 

概括一下它的功能:

  • Copy & Paste between guest and client
  • Automatic guest resolution adjustment while entering fullscreen mode
  • Guest side mouse which allows you to move mouse continuously within guest and client without pressing Sihft + F12

利用正常的kvm命令进行启动,加入以下选项:

For qemu < 0.14.0:
-device spicevmc

For qemu >= 0.14.0:
-device virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0,addr=0x5 \
-chardev spicevmc,name=vdagent,id=vdagent \
-device \
virtserialport,nr=1,bus=virtio-serial0.0,chardev=vdagent,name=com.redhat.spice.0

 

qemu-kvm -device virtio-serial -chardev spicevmc,id=vdagent,debug=0,name=vdagent -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -spice port=3001,disable-ticketing -vga qxl -soundhw ac97 /path/to/your/guest.img

If you're facing -chardev issue (Then you're probably using older qemu-kvm from RHEL6) then use following arguments instead.

qemu-kvm -device virtio-serial -device spicevmc -device virtserialport -spice port=3001,disable-ticketing -vga qxl -soundhw ac97 /path/to/your/guest.img

 或kvm -m 1024 -name rhel6 -drive file=rhel6.img,if=virtio -vga qxl  -spice port=5900,addr=127.0.0.1,disable-ticketing -device virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0,addr=0x5 -chardev spicevmc,name=vdagent,id=vdagent -device virtserialport,nr=1,bus=virtio-serial0.0,chardev=vdagent,name=com.redhat.spice.0

通过实验,文本双向拷贝可行,但images不可行。

大家的实验结果如何呢,相互交流。

转载于:https://www.cnblogs.com/chinacloud/archive/2012/04/26/2471696.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值