提交 896e6ac4 编写于 作者: P Peng Zhou 提交者: Osier Yang

qemu: spice agent-mouse support

spice agent-mouse support

Usage:
  <graphics type='spice'>
    <mouse mode='client'|'server'/>
  <graphics/>
Signed-off-by: NOsier Yang <jyang@redhat.com>
上级 1e31b835
...@@ -224,6 +224,7 @@ Patches have also been contributed by: ...@@ -224,6 +224,7 @@ Patches have also been contributed by:
Peter Robinson <pbrobinson@gmail.com> Peter Robinson <pbrobinson@gmail.com>
Benjamin Cama <benoar@dolka.fr> Benjamin Cama <benoar@dolka.fr>
Duncan Rance <libvirt@dunquino.com> Duncan Rance <libvirt@dunquino.com>
Peng Zhou <ailvpeng25@gmail.com>
[....send patches to get your name here....] [....send patches to get your name here....]
......
...@@ -2851,6 +2851,7 @@ qemu-kvm -net nic,model=? /dev/null ...@@ -2851,6 +2851,7 @@ qemu-kvm -net nic,model=? /dev/null
&lt;image compression='auto_glz'/&gt; &lt;image compression='auto_glz'/&gt;
&lt;streaming mode='filter'/&gt; &lt;streaming mode='filter'/&gt;
&lt;clipboard copypaste='no'/&gt; &lt;clipboard copypaste='no'/&gt;
&lt;mouse mode='client'/&gt;
&lt;/graphics&gt;</pre> &lt;/graphics&gt;</pre>
<p> <p>
Spice supports variable compression settings for audio, Spice supports variable compression settings for audio,
...@@ -2883,6 +2884,13 @@ qemu-kvm -net nic,model=? /dev/null ...@@ -2883,6 +2884,13 @@ qemu-kvm -net nic,model=? /dev/null
to <code>no</code>, <span class="since">since to <code>no</code>, <span class="since">since
0.9.3</span>. 0.9.3</span>.
</p> </p>
<p>
Mouse mode is set by the <code>mouse<code/> element,
setting it's <code>mode<code/> attribute to one of
<code>server</code> or <code>client</code> ,
<span class="since">since 0.9.11</span>. If no mode is
specified, the qemu default will be used (client mode).
</p>
</dd> </dd>
<dt><code>"rdp"</code></dt> <dt><code>"rdp"</code></dt>
<dd> <dd>
......
...@@ -1826,6 +1826,17 @@ ...@@ -1826,6 +1826,17 @@
<empty/> <empty/>
</element> </element>
</optional> </optional>
<optional>
<element name="mouse">
<attribute name="mode">
<choice>
<value>server</value>
<value>client</value>
</choice>
</attribute>
<empty/>
</element>
</optional>
</interleave> </interleave>
</group> </group>
<group> <group>
......
...@@ -465,6 +465,12 @@ VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression, ...@@ -465,6 +465,12 @@ VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression,
"on", "on",
"off"); "off");
VIR_ENUM_IMPL(virDomainGraphicsSpiceMouseMode,
VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST,
"default",
"server",
"client");
VIR_ENUM_IMPL(virDomainGraphicsSpiceStreamingMode, VIR_ENUM_IMPL(virDomainGraphicsSpiceStreamingMode,
VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST, VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST,
"default", "default",
...@@ -6180,6 +6186,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, ...@@ -6180,6 +6186,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
VIR_FREE(copypaste); VIR_FREE(copypaste);
def->data.spice.copypaste = copypasteVal; def->data.spice.copypaste = copypasteVal;
} else if (xmlStrEqual(cur->name, BAD_CAST "mouse")) {
const char *mode = virXMLPropString(cur, "mode");
int modeVal;
if (!mode) {
virDomainReportError(VIR_ERR_XML_ERROR, "%s",
_("spice mouse missing mode"));
goto error;
}
if ((modeVal = virDomainGraphicsSpiceMouseModeTypeFromString(mode)) <= 0) {
virDomainReportError(VIR_ERR_XML_ERROR,
_("unknown mouse mode value '%s'"),
mode);
VIR_FREE(mode);
goto error;
}
VIR_FREE(mode);
def->data.spice.mousemode = modeVal;
} }
} }
cur = cur->next; cur = cur->next;
...@@ -11896,7 +11922,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf, ...@@ -11896,7 +11922,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
} }
if (!children && (def->data.spice.image || def->data.spice.jpeg || if (!children && (def->data.spice.image || def->data.spice.jpeg ||
def->data.spice.zlib || def->data.spice.playback || def->data.spice.zlib || def->data.spice.playback ||
def->data.spice.streaming || def->data.spice.copypaste)) { def->data.spice.streaming || def->data.spice.copypaste ||
def->data.spice.mousemode)) {
virBufferAddLit(buf, ">\n"); virBufferAddLit(buf, ">\n");
children = 1; children = 1;
} }
...@@ -11915,6 +11942,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf, ...@@ -11915,6 +11942,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
if (def->data.spice.streaming) if (def->data.spice.streaming)
virBufferAsprintf(buf, " <streaming mode='%s'/>\n", virBufferAsprintf(buf, " <streaming mode='%s'/>\n",
virDomainGraphicsSpiceStreamingModeTypeToString(def->data.spice.streaming)); virDomainGraphicsSpiceStreamingModeTypeToString(def->data.spice.streaming));
if (def->data.spice.mousemode)
virBufferAsprintf(buf, " <mouse mode='%s'/>\n",
virDomainGraphicsSpiceMouseModeTypeToString(def->data.spice.mousemode));
if (def->data.spice.copypaste) if (def->data.spice.copypaste)
virBufferAsprintf(buf, " <clipboard copypaste='%s'/>\n", virBufferAsprintf(buf, " <clipboard copypaste='%s'/>\n",
virDomainGraphicsSpiceClipboardCopypasteTypeToString(def->data.spice.copypaste)); virDomainGraphicsSpiceClipboardCopypasteTypeToString(def->data.spice.copypaste));
......
...@@ -1135,6 +1135,14 @@ enum virDomainGraphicsSpicePlaybackCompression { ...@@ -1135,6 +1135,14 @@ enum virDomainGraphicsSpicePlaybackCompression {
VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_LAST VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_LAST
}; };
enum virDomainGraphicsSpiceMouseMode {
VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_DEFAULT = 0,
VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER,
VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_CLIENT,
VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST
};
enum virDomainGraphicsSpiceStreamingMode { enum virDomainGraphicsSpiceStreamingMode {
VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_DEFAULT = 0, VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_DEFAULT = 0,
VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_FILTER, VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_FILTER,
...@@ -1202,6 +1210,7 @@ struct _virDomainGraphicsDef { ...@@ -1202,6 +1210,7 @@ struct _virDomainGraphicsDef {
struct { struct {
int port; int port;
int tlsPort; int tlsPort;
int mousemode;
char *keymap; char *keymap;
virDomainGraphicsAuthDef auth; virDomainGraphicsAuthDef auth;
unsigned int autoport :1; unsigned int autoport :1;
...@@ -2124,6 +2133,7 @@ VIR_ENUM_DECL(virDomainGraphicsSpiceZlibCompression) ...@@ -2124,6 +2133,7 @@ VIR_ENUM_DECL(virDomainGraphicsSpiceZlibCompression)
VIR_ENUM_DECL(virDomainGraphicsSpicePlaybackCompression) VIR_ENUM_DECL(virDomainGraphicsSpicePlaybackCompression)
VIR_ENUM_DECL(virDomainGraphicsSpiceStreamingMode) VIR_ENUM_DECL(virDomainGraphicsSpiceStreamingMode)
VIR_ENUM_DECL(virDomainGraphicsSpiceClipboardCopypaste) VIR_ENUM_DECL(virDomainGraphicsSpiceClipboardCopypaste)
VIR_ENUM_DECL(virDomainGraphicsSpiceMouseMode)
VIR_ENUM_DECL(virDomainNumatuneMemMode) VIR_ENUM_DECL(virDomainNumatuneMemMode)
VIR_ENUM_DECL(virDomainSnapshotState) VIR_ENUM_DECL(virDomainSnapshotState)
/* from libvirt.h */ /* from libvirt.h */
......
...@@ -345,6 +345,8 @@ virDomainGraphicsSpiceImageCompressionTypeFromString; ...@@ -345,6 +345,8 @@ virDomainGraphicsSpiceImageCompressionTypeFromString;
virDomainGraphicsSpiceImageCompressionTypeToString; virDomainGraphicsSpiceImageCompressionTypeToString;
virDomainGraphicsSpiceJpegCompressionTypeFromString; virDomainGraphicsSpiceJpegCompressionTypeFromString;
virDomainGraphicsSpiceJpegCompressionTypeToString; virDomainGraphicsSpiceJpegCompressionTypeToString;
virDomainGraphicsSpiceMouseModeTypeFromString;
virDomainGraphicsSpiceMouseModeTypeToString;
virDomainGraphicsSpicePlaybackCompressionTypeFromString; virDomainGraphicsSpicePlaybackCompressionTypeFromString;
virDomainGraphicsSpicePlaybackCompressionTypeToString; virDomainGraphicsSpicePlaybackCompressionTypeToString;
virDomainGraphicsSpiceStreamingModeTypeFromString; virDomainGraphicsSpiceStreamingModeTypeFromString;
......
...@@ -5424,6 +5424,20 @@ qemuBuildCommandLine(virConnectPtr conn, ...@@ -5424,6 +5424,20 @@ qemuBuildCommandLine(virConnectPtr conn,
VIR_FREE(netAddr); VIR_FREE(netAddr);
int mm = def->graphics[0]->data.spice.mousemode;
if (mm) {
switch (mm) {
case VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER:
virBufferAsprintf(&opt, ",agent-mouse=off");
break;
case VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_CLIENT:
virBufferAsprintf(&opt, ",agent-mouse=on");
break;
default:
break;
}
}
/* In the password case we set it via monitor command, to avoid /* In the password case we set it via monitor command, to avoid
* making it visible on CLI, so there's no use of password=XXX * making it visible on CLI, so there's no use of password=XXX
* in this bit of the code */ * in this bit of the code */
......
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefconfig -nodefaults \
-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \
-hda /dev/HostVG/QEMUGuest1 -chardev spicevmc,id=charchannel0,name=vdagent \
-device virtserialport,bus=virtio-serial1.0,nr=3,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 \
-usb -spice port=5903,tls-port=5904,addr=127.0.0.1,agent-mouse=off,x509-dir=/etc/pki/libvirt-spice,tls-channel=main \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory>219136</memory>
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu</emulator>
<disk type='block' device='disk'>
<source dev='/dev/HostVG/QEMUGuest1'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='virtio-serial' index='1'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
</controller>
<graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'>
<mouse mode='server'/>
<channel name='main' mode='secure'/>
</graphics>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
<address type='virtio-serial' controller='1' bus='0' port='3'/>
</channel>
<memballoon model='virtio'/>
</devices>
</domain>
...@@ -511,6 +511,9 @@ mymain(void) ...@@ -511,6 +511,9 @@ mymain(void)
DO_TEST("graphics-spice", false, DO_TEST("graphics-spice", false,
QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE); QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE);
DO_TEST("graphics-spice-agentmouse", false,
QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE);
DO_TEST("graphics-spice-compression", false, DO_TEST("graphics-spice-compression", false,
QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE); QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册