Francesco Romani has uploaded a new change for review.
Change subject: vm: spice support to clipboard copypaste disable
......................................................................
vm: spice support to clipboard copypaste disable
since version 0.9.3, libvirt allows to optionally disable copy and paste
in the spice protocolol:
http://libvirt.org/formatdomain.html#elementsGraphics
this patch expose this capability in VDSM, in the VM definition.
The new parameter is optional and enabled by default for backward
compatibility.
No XML changes are produced at all unless the new parameter is
specified.
Change-Id: I1f8195da0c3ba2663027b77ea8a858e5ba17c48e
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M tests/vmTests.py
M vdsm/vm.py
M vdsm_api/vdsmapi-schema.json
3 files changed, 38 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/22646/1
diff --git a/tests/vmTests.py b/tests/vmTests.py
index f9f2785..be1c6c1 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -229,6 +229,20 @@
<channel mode="secure" name="playback"/>
<channel mode="secure" name="record"/>
<channel mode="secure" name="display"/>
+ </graphics>""",
+
+ """
+ <graphics autoport="yes" listen="0"
passwd="*****"
+ passwdValidTo="1970-01-01T00:00:01" port="-1"
+ tlsPort="-1" type="spice">
+ <clipboard copypaste="no"/>
+ </graphics>""",
+
+ """
+ <graphics autoport="yes" listen="0"
passwd="*****"
+ passwdValidTo="1970-01-01T00:00:01" port="-1"
+ tlsPort="-1" type="spice">
+ <channel mode="secure" name="main"/>
</graphics>"""]
spiceChannelXML = """
@@ -242,7 +256,13 @@
{'display': 'qxl', 'displayPort': '-1',
'displaySecurePort': '-1',
'spiceSecureChannels':
- "smain,sinputs,scursor,splayback,srecord,sdisplay"}]
+ "smain,sinputs,scursor,splayback,srecord,sdisplay"},
+
+ {'display': 'qxl', 'displayPort': '-1',
'displaySecurePort': '-1',
+ 'copyPasteEnable': 'false'},
+
+ {'display': 'qxl', 'displayPort': '-1',
'displaySecurePort': '-1',
+ 'copyPasteEnable': 'true', 'spiceSecureChannels':
"smain"}]
for vmConf, xml in zip(vmConfs, expectedXMLs):
vmConf.update(self.conf)
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 0a602cb..306ceb3 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -1108,6 +1108,12 @@
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
</channel>
+
+ or
+
+ <graphics autoport="yes" port="5910"
tlsPort="5890" type="spice">
+ <clipboard copypaste='no'/>
+ </graphics>
"""
graphicsAttrs = {'port': self.conf['displayPort'],
'autoport': 'yes'}
if self.conf['display'] == 'vnc':
@@ -1129,6 +1135,9 @@
for channel in
self.conf['spiceSecureChannels'].split(','):
graphics.appendChildWithArgs('channel', name=channel[1:],
mode='secure')
+ if not utils.tobool(self.conf.get('copyPasteEnable', True)):
+ clipboard = XMLElement('clipboard', copypaste='no')
+ graphics.appendChild(clipboard)
vmc = XMLElement('channel', type='spicevmc')
vmc.appendChildWithArgs('target', type='virtio',
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index ce9204f..f813e77 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -2781,6 +2781,10 @@
#
# @clientIp: The IP address of the client connected to the display
#
+# @copyPasteEnable: #optional Specify if copy and paste is enabled.
+# Currently relevant for @qxl devices only.
+# (new in version 4.13.0)
+#
# @cpuShares: #optional The host scheduling priority (relative to
# other VMs). In case both cpuShares and nice are
# present, cpuShares will be used.
@@ -2847,10 +2851,10 @@
# Since: 4.10.0
##
{'type': 'VmDefinition',
- 'data': {'acpiEnable': 'bool', 'clientIp':
'str', 'cpuShares': 'str',
- '*cpuType': 'str', '*custom': 'StringMap',
'*devices': ['VmDevice'],
- 'display': 'VmDisplayType', 'displayIp':
'str',
- 'displayPort': 'int', 'displaySecurePort':
'int',
+ 'data': {'acpiEnable': 'bool', 'clientIp':
'str', '*copyPasteEnable': 'bool',
+ 'cpuShares': 'str', '*cpuType': 'str',
'*custom': 'StringMap',
+ '*devices': ['VmDevice'], 'display':
'VmDisplayType',
+ 'displayIp': 'str', 'displayPort': 'int',
'displaySecurePort': 'int',
'*emulatedMachine': 'str', '*keyboardLayout':
'str',
'kvmEnable': 'bool', 'memSize': 'uint',
'memGuaranteedSize': 'uint',
'nicModel': 'str', 'nice': 'int',
'*pauseCode': 'str',
--
To view, visit
http://gerrit.ovirt.org/22646
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f8195da0c3ba2663027b77ea8a858e5ba17c48e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>