Humble Devassy Chirammal has uploaded a new change for review.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
hook: spiceoptions: To provide spice option attributes to vm
This hook goes through VM definitions xml file and manipulate its graphics device if the protocol type is spice. This can be used to configure spice options. This hook script will be really useful to configure some of the spice optimization attributes and values like image, streaming, clipboard..etc
For ex:
<graphics type='spice' port='-1' tlsPort='-1' autoport='yes'> ****** <image compression='auto_glz'/> <streaming mode='filter'/> <clipboard copypaste='no'/> <mouse mode='client'/> </graphics>
Change-Id: I7761aab98cdc3a0d37bed7984ae540278e6bbf70 Signed-off-by: Humble Chirammal hchiramm@redhat.com --- M configure.ac M vdsm.spec.in M vdsm_hooks/Makefile.am A vdsm_hooks/spiceoptions/Makefile.am A vdsm_hooks/spiceoptions/README A vdsm_hooks/spiceoptions/before_vm_start.py 6 files changed, 248 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/78/22178/1
diff --git a/configure.ac b/configure.ac index ce05834..253fc90 100644 --- a/configure.ac +++ b/configure.ac @@ -295,6 +295,7 @@ vdsm_hooks/qos/Makefile vdsm_hooks/scratchpad/Makefile vdsm_hooks/smbios/Makefile + vdsm_hooks/spiceoptions/Makefile vdsm_hooks/sriov/Makefile vdsm_hooks/vhostmd/Makefile vdsm_hooks/vmdisk/Makefile diff --git a/vdsm.spec.in b/vdsm.spec.in index 385a29b..166ff3d 100644 --- a/vdsm.spec.in +++ b/vdsm.spec.in @@ -528,6 +528,15 @@ sr-iov hook enable to add virtual functions exposed by the device directly to a virtual machine.
+ +%package hook-spiceoptions +Summary: To configure spice options for vm +BuildArch: noarch + +%description hook-spiceoptions +This vdsm hook can be used to configure some of +the spice optimization attributes and values.. + %package hook-vmfex Summary: vmfex support for VDSM BuildArch: noarch @@ -1225,6 +1234,11 @@ %{_libexecdir}/%{vdsm_name}/hooks/after_vm_destroy/50_sriov %{_libexecdir}/%{vdsm_name}/hooks/before_vm_migrate_source/50_sriov
+ +%files hook-spiceoptions +%defattr(-, root, root, -) +%{_libexecdir}/%{vdsm_name}/hooks/before_vm_start/60_spiceoptions + %files hook-vmdisk %defattr(-, root, root, -) %{_libexecdir}/%{vdsm_name}/hooks/before_vm_start/50_vmdisk diff --git a/vdsm_hooks/Makefile.am b/vdsm_hooks/Makefile.am index 8d446bb..d8b213c 100644 --- a/vdsm_hooks/Makefile.am +++ b/vdsm_hooks/Makefile.am @@ -41,6 +41,7 @@ scratchpad \ smbios \ sriov \ + spiceoptions \ vmdisk \ vmfex endif diff --git a/vdsm_hooks/spiceoptions/Makefile.am b/vdsm_hooks/spiceoptions/Makefile.am new file mode 100644 index 0000000..0aa5486 --- /dev/null +++ b/vdsm_hooks/spiceoptions/Makefile.am @@ -0,0 +1,30 @@ +# +# Copyright 2013 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# Refer to the README and COPYING files for full details of the license +# +# +EXTRA_DIST = \ + before_vm_start.py + +install-data-local: + $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start + $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ + $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_spiceoptions + +uninstall-local: + $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_spiceoptions diff --git a/vdsm_hooks/spiceoptions/README b/vdsm_hooks/spiceoptions/README new file mode 100644 index 0000000..2bef8cc --- /dev/null +++ b/vdsm_hooks/spiceoptions/README @@ -0,0 +1,62 @@ +spiceoptions vdsm hook: +=============================== + +This hook goes through VM definitions xml file and manipulate its +graphics device if the protocol type is spice. This can be used to +configure spice options on the fly. That said, this hook script +will be really useful to configure some of the spice optimization +attributes and values.. + +For ex: + + <graphics type='spice' port='-1' tlsPort='-1' autoport='yes'> + ****** + <image compression='auto_glz'/> + <streaming mode='filter'/> + <clipboard copypaste='no'/> + <mouse mode='client'/> + </graphics> + +Spice supports variable compression settings for audio, images +and streaming. These settings are accessible via the compression +attribute in all following elements: image to set image compression +(accepts auto_glz, auto_lz, quic, glz, lz, off),jpeg for JPEG +compression for images over wan (accepts auto, never, always), +zlib for configuring wan image compression (accepts auto, never, always) +..etc. + +Streaming mode is set by the streaming element, settings its mode +attribute to one of filter, all or off. + +Copy & Paste functionality (via Spice agent) is set by the clipboard +element.It is enabled by default, and can be disabled by setting +the copypaste property to no. + +Mouse mode is set by the mouse element, setting its mode attribute +to one of server or client.If no mode is specified, the qemu default +will be used (client mode). + +Syntax: + spiceoptions={'element': {'attribute': 'value'},.. + +For ex: + spiceoptions={'image': {'compression': 'auto_glz'}, + 'jpeg': {'compressions': 'never'}, + 'streaming':{'mode':'filter'}, + 'clipboard':{'copypaste':'yes'}}..etc + + +Installation: +* Use the engine-config to append the appropriate custom property as such: + sudo engine-config -s UserDefinedVMProperties= + 'previousProperties;spiceoptions=^.*$' --cver=3.2 + +* Verify that the spiceoptions custom property was properly added: + sudo engine-config -g UserDefinedVMProperties + +Usage: +In the VM configuration window, open the custom properites tab +and add spiceoptions= + +NOTE: Live migration is **not** tested. + diff --git a/vdsm_hooks/spiceoptions/before_vm_start.py b/vdsm_hooks/spiceoptions/before_vm_start.py new file mode 100755 index 0000000..4b95742 --- /dev/null +++ b/vdsm_hooks/spiceoptions/before_vm_start.py @@ -0,0 +1,140 @@ +#!/usr/bin/python + +import os +import sys +import hooking +import traceback +import ast + +''' +Hook to configure spice options on a vm + +For ex: + +Syntax: + spiceoptions={'element': {'attribute': 'value'},.. + +For ex: + spiceoptions={'image': {'compression': 'auto_glz'}, + 'jpeg': {'compressions': 'never'}, + 'streaming':{'mode':'filter'}, + 'clipboard':{'copypaste':'yes'}}..etc + + + <graphics type='spice' port='-1' tlsPort='-1' autoport='yes'> + ****** + <image compression='auto_glz'/> + <streaming mode='filter'/> + <clipboard copypaste='no'/> + <mouse mode='client'/> + </graphics> +''' + + +imageCompList = ['auto_glz', 'auto_lz', 'quic', 'glz', 'lz', 'off'] + +jpegCompList = ['auto', 'never', 'always'] + +zlibCompList = ['auto', 'never', 'always'] + +copyPaste = ['yes', 'no'] + +strModeList = ['filter', 'all', 'off'] + +mouseModeList = ['server', 'client'] + +spiceDict = {'image': {'compression': imageCompList}, + 'jpeg': {'compression': jpegCompList}, + 'streaming': {'mode': strModeList}, + 'mouse': {'mode': mouseModeList}, + 'clipboard': {'copypaste': copyPaste}} + + +def createOptionElement(domxml, attrname, attroption, attrvalue): + if attrname == "jpeg": + jpegEle = domxml.createElement(attrname) + if attrvalue in jpegCompList: + jpegEle.setAttribute(attroption, attrvalue) + return jpegEle + else: + sys.stderr.write("\n InValid option:%s \t Available options are %s" + % (attrvalue, jpegCompList)) + elif attrname == "zlib": + zlibEle = domxml.createElement(attrname) + if attrvalue in zlibCompList: + zlibEle.setAttribute(attroption, attrvalue) + return zlibEle + else: + sys.stderr.write("\n InValid option:%s \t Available options are %s" + % (attrvalue, zlibCompList)) + elif attrname == "image": + imageEle = domxml.createElement(attrname) + if attrvalue in imageCompList: + imageEle.setAttribute(attroption, attrvalue) + return imageEle + else: + sys.stderr.write("\n InValid option:%s \t Available options are %s" + % (attrvalue, imageCompList)) + elif attrname == "streaming": + streamEle = domxml.createElement(attrname) + if attrvalue in strModeList: + streamEle.setAttribute(attroption, attrvalue) + return streamEle + else: + sys.stderr.write("\n InValid option:%s \t Available options are %s" + % (attrvalue, strModeList)) + elif attrname == "mouse": + mouseEle = domxml.createElement(attrname) + if attrvalue in mouseModeList: + mouseEle.setAttribute(attroption, attrvalue) + return mouseEle + else: + sys.stderr.write("\n InValid option:%s \t Available options are %s" + % (attrvalue, mouseModeList)) + + elif attrname == "clipboard": + clipEle = domxml.createElement(attrname) + if attrvalue in copyPaste: + clipEle.setAttribute(attroption, attrvalue) + return clipEle + else: + sys.stderr.write("\n InValid option:%s \t Available options are %s" + % (attrvalue, copyPaste)) + else: + sys.stderr.write('\n No Valid Element created for graphic device :%s\n' + % (attrname)) + + +if 'spiceoptions' in os.environ: + try: + attrName = '' + attrVal = '' + attrOpt = '' + domxml = hooking.read_domxml() + spiceOpt = ast.literal_eval(os.environ['spiceoptions']) + spiceOpt = dict((k.lower(), v) for k, v in spiceOpt.iteritems()) + for graphDev in domxml.getElementsByTagName('graphics'): + graphType = graphDev.getAttribute('type') + if graphType == 'spice': + for key, value in spiceOpt.items(): + if key not in spiceDict.keys(): + sys.stderr.write('\n Invalid KEY:%s \n' % (key,)) + else: + for ak, bk in value.items(): + if ak not in spiceDict[key].keys(): + sys.stderr.write("\n Invalid KEY in :%s[%s] " + "options are:%s \n" + % (key, ak, + spiceDict[key].keys())) + + else: + returnEle = createOptionElement( + domxml, key, ak, value[ak]) + if returnEle: + graphDev.appendChild(returnEle) + + hooking.write_domxml(domxml) + except: + sys.stderr.write('spiceoptions: [unexpected error]: %s\n' % + traceback.format_exc()) + sys.exit(2)
oVirt Jenkins CI Server has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/5976/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5180/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6068/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_install_rpm_sanity_gerrit/104/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/5977/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5181/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6069/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_install_rpm_sanity_gerrit/105/ : SUCCESS
Timothy Asir has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 2:
(4 comments)
.................................................... File vdsm.spec.in Line 535: Line 536: %description hook-spiceoptions Line 537: This vdsm hook can be used to configure some of Line 538: the spice optimization attributes and values.. Line 539: remove this extra white space Line 540: %package hook-vmfex Line 541: Summary: vmfex support for VDSM Line 542: BuildArch: noarch Line 543:
Line 1236: Line 1237: Line 1238: %files hook-spiceoptions Line 1239: %defattr(-, root, root, -) Line 1240: %{_libexecdir}/%{vdsm_name}/hooks/before_vm_start/60_spiceoptions hope it should be "%{_libexecdir}/%{vdsm_name}/hooks/before_vm_start/50_spiceoptions" Line 1241: Line 1242: %files hook-vmdisk Line 1243: %defattr(-, root, root, -) Line 1244: %{_libexecdir}/%{vdsm_name}/hooks/before_vm_start/50_vmdisk
.................................................... File vdsm_hooks/Makefile.am Line 40: qos \ Line 41: scratchpad \ Line 42: smbios \ Line 43: sriov \ Line 44: spiceoptions \ please keep this in sorted order. Line 45: vmdisk \ Line 46: vmfex Line 47: endif Line 48:
.................................................... File vdsm_hooks/spiceoptions/README Line 43: spiceoptions={'image': {'compression': 'auto_glz'}, Line 44: 'jpeg': {'compressions': 'never'}, Line 45: 'streaming':{'mode':'filter'}, Line 46: 'clipboard':{'copypaste':'yes'}}..etc Line 47: Remove this extra white spaces Line 48: Line 49: Installation: Line 50: * Use the engine-config to append the appropriate custom property as such: Line 51: sudo engine-config -s UserDefinedVMProperties=
Humble Devassy Chirammal has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 2:
(4 comments)
.................................................... File vdsm.spec.in Line 535: Line 536: %description hook-spiceoptions Line 537: This vdsm hook can be used to configure some of Line 538: the spice optimization attributes and values.. Line 539: Done Line 540: %package hook-vmfex Line 541: Summary: vmfex support for VDSM Line 542: BuildArch: noarch Line 543:
Line 1236: Line 1237: Line 1238: %files hook-spiceoptions Line 1239: %defattr(-, root, root, -) Line 1240: %{_libexecdir}/%{vdsm_name}/hooks/before_vm_start/60_spiceoptions Done Line 1241: Line 1242: %files hook-vmdisk Line 1243: %defattr(-, root, root, -) Line 1244: %{_libexecdir}/%{vdsm_name}/hooks/before_vm_start/50_vmdisk
.................................................... File vdsm_hooks/Makefile.am Line 40: qos \ Line 41: scratchpad \ Line 42: smbios \ Line 43: sriov \ Line 44: spiceoptions \ Done Line 45: vmdisk \ Line 46: vmfex Line 47: endif Line 48:
.................................................... File vdsm_hooks/spiceoptions/README Line 43: spiceoptions={'image': {'compression': 'auto_glz'}, Line 44: 'jpeg': {'compressions': 'never'}, Line 45: 'streaming':{'mode':'filter'}, Line 46: 'clipboard':{'copypaste':'yes'}}..etc Line 47: Done Line 48: Line 49: Installation: Line 50: * Use the engine-config to append the appropriate custom property as such: Line 51: sudo engine-config -s UserDefinedVMProperties=
oVirt Jenkins CI Server has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/5981/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5185/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6073/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_install_rpm_sanity_gerrit/107/ : SUCCESS
Humble Devassy Chirammal has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 3: Verified+1
Dan Kenigsberg has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 3: Code-Review-1
(2 comments)
partial review
.................................................... File vdsm_hooks/spiceoptions/before_vm_start.py Line 42: strModeList = ['filter', 'all', 'off'] Line 43: Line 44: mouseModeList = ['server', 'client'] Line 45: Line 46: spiceDict = {'image': {'compression': imageCompList}, these are all CONSTANTS, and should be named as such. Line 47: 'jpeg': {'compression': jpegCompList}, Line 48: 'streaming': {'mode': strModeList}, Line 49: 'mouse': {'mode': mouseModeList}, Line 50: 'clipboard': {'copypaste': copyPaste}}
Line 104: sys.stderr.write('\n No Valid Element created for graphic device :%s\n' Line 105: % (attrname)) Line 106: Line 107: Line 108: if 'spiceoptions' in os.environ: please split to main() and test() functions, and use hooking.py's hook_exit(). Line 109: try: Line 110: attrName = '' Line 111: attrVal = '' Line 112: attrOpt = ''
oVirt Jenkins CI Server has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 4: Verified-1
Build Failed
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6157/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5370/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6261/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_install_rpm_sanity_gerrit/149/ : FAILURE
Humble Devassy Chirammal has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 3:
(2 comments)
.................................................... File vdsm_hooks/spiceoptions/before_vm_start.py Line 42: strModeList = ['filter', 'all', 'off'] Line 43: Line 44: mouseModeList = ['server', 'client'] Line 45: Line 46: spiceDict = {'image': {'compression': imageCompList}, Done Line 47: 'jpeg': {'compression': jpegCompList}, Line 48: 'streaming': {'mode': strModeList}, Line 49: 'mouse': {'mode': mouseModeList}, Line 50: 'clipboard': {'copypaste': copyPaste}}
Line 104: sys.stderr.write('\n No Valid Element created for graphic device :%s\n' Line 105: % (attrname)) Line 106: Line 107: Line 108: if 'spiceoptions' in os.environ: Done Line 109: try: Line 110: attrName = '' Line 111: attrVal = '' Line 112: attrOpt = ''
oVirt Jenkins CI Server has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 5:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6158/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5371/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6262/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_install_rpm_sanity_gerrit/150/ : SUCCESS
Francesco Romani has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 5:
(4 comments)
.................................................... Commit Message Line 17: <graphics type='spice' port='-1' tlsPort='-1' autoport='yes'> Line 18: ****** Line 19: <image compression='auto_glz'/> Line 20: <streaming mode='filter'/> Line 21: <clipboard copypaste='no'/> copypaste is already being addressed by http://gerrit.ovirt.org/#/c/22646/ Line 22: <mouse mode='client'/> Line 23: </graphics> Line 24: Line 25: Change-Id: I7761aab98cdc3a0d37bed7984ae540278e6bbf70
.................................................... File vdsm_hooks/spiceoptions/before_vm_start.py Line 49: 'jpeg': {'compression': JPEG_COMP_LIST}, Line 50: 'streaming': {'mode': STR_MODE_LIST}, Line 51: 'mouse': {'mode': MOUSE_MODE_LIST}, Line 52: 'clipboard': {'copypaste': COPY_PASTE_LIST}} Line 53: As matter as personal taste I'd not use a name for a variable which contains the expected type (like _LIST and _DICT) above, I think it's non-pythonic. Line 54: Line 55: def createOptionElement(domxml, attrname, attroption, attrvalue): Line 56: if attrname == "jpeg": Line 57: jpegEle = domxml.createElement(attrname)
Line 54: Line 55: def createOptionElement(domxml, attrname, attroption, attrvalue): Line 56: if attrname == "jpeg": Line 57: jpegEle = domxml.createElement(attrname) Line 58: if attrvalue in JPEG_COMP_LIST: If the list is used just for this maybe a frozenset() is better. Line 59: jpegEle.setAttribute(attroption, attrvalue) Line 60: return jpegEle Line 61: else: Line 62: sys.stderr.write("\n InValid option:%s \t Available options are %s"
Line 104: % (attrvalue, COPY_PASTE_LIST)) Line 105: else: Line 106: sys.stderr.write('\n No Valid Element created for graphic device :%s\n' Line 107: % (attrname)) Line 108: Seems there is a pattern here, can't be this factored in some way? Line 109: Line 110: def main(): Line 111: if 'spiceoptions' in os.environ: Line 112: try:
Itamar Heim has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 5:
ping
oVirt Jenkins CI Server has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 6:
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/7047/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_install_rpm_sanity_gerrit/450/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7949/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7838/ : SUCCESS
Amador Pahim has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 6: Verified+1
Build error not part of this patch:
./vdsm_reg/engine.py.in:151: local variable 'item' is assigned to but never used ./vdsm_reg/engine.py:151: local variable 'item' is assigned to but never used ./vdsm/sourceRoute.py:159: list comprehension redefines 'rule' from line 152 ./vdsm/clientIF.py:487: list comprehension redefines 'vm' from line 477
oVirt Jenkins CI Server has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 7:
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/7053/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_install_rpm_sanity_gerrit/451/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7955/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7844/ : SUCCESS
Amador Pahim has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 7: Verified+1
Build failure not related to the path:
./vdsm_reg/engine.py.in:151: local variable 'item' is assigned to but never used ./vdsm_reg/engine.py:151: local variable 'item' is assigned to but never used ./vdsm/sourceRoute.py:159: list comprehension redefines 'rule' from line 152 ./vdsm/clientIF.py:487: list comprehension redefines 'vm' from line 477
Francesco Romani has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 7:
(5 comments)
http://gerrit.ovirt.org/#/c/22178/7/vdsm_hooks/spiceoptions/before_vm_start.... File vdsm_hooks/spiceoptions/before_vm_start.py:
Line 14: ex IMO redundant
Line 15: Line 16: Syntax: Line 17: spiceoptions={'element': {'attribute': 'value'},.. Line 18: Line 19: For ex: No need of shortening here:
Example: Line 20: spiceoptions={'image': {'compression': 'auto_glz'}, Line 21: 'jpeg': {'compression': 'never'}, Line 22: 'streaming':{'mode':'filter'}} Line 23:
Line 52: Line 53: def main(): Line 54: if 'spiceoptions' in os.environ: Line 55: try: Line 56: spiceConfig = ast.literal_eval(os.environ['spiceoptions']) I see this is already used, but I still wonder if that's the best solution. Not big problem however. Line 57: spiceConfig = dict((k.lower(), v) Line 58: for k, v in spiceConfig.iteritems()) Line 59: Line 60: domxml = hooking.read_domxml()
Line 64: keys please use
if elmt not in spiceOpts:
Line 65: sys.stderr.write(" Invalid ELEMENT" Line 66: " [%s] " % elmt) Line 67: else: Line 68: for attr, attrValue in value.items(): Line 69: if attr not in spiceOpts[elmt].keys(): same here:
if attr not in spiceOpts[elmt]: Line 70: sys.stderr.write(" Invalid ATTRIBUTE" Line 71: " [%s]" % attr) Line 72: elif attrValue not in spiceOpts[elmt][attr]: Line 73: sys.stderr.write(" Invalid VALUE"
Amador Pahim has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 7:
(4 comments)
http://gerrit.ovirt.org/#/c/22178/7/vdsm_hooks/spiceoptions/before_vm_start.... File vdsm_hooks/spiceoptions/before_vm_start.py:
Line 10: Line 11: ''' Line 12: Hook to configure spice options on a vm Line 13: Line 14: For ex:
IMO redundant
Done Line 15: Line 16: Syntax: Line 17: spiceoptions={'element': {'attribute': 'value'},.. Line 18:
Line 15: Line 16: Syntax: Line 17: spiceoptions={'element': {'attribute': 'value'},.. Line 18: Line 19: For ex:
No need of shortening here:
Done Line 20: spiceoptions={'image': {'compression': 'auto_glz'}, Line 21: 'jpeg': {'compression': 'never'}, Line 22: 'streaming':{'mode':'filter'}} Line 23:
Line 60: domxml = hooking.read_domxml() Line 61: for graphDev in domxml.getElementsByTagName('graphics'): Line 62: if graphDev.getAttribute('type') == 'spice': Line 63: for elmt, value in spiceConfig.items(): Line 64: if elmt not in spiceOpts.keys():
please use
Done Line 65: sys.stderr.write(" Invalid ELEMENT" Line 66: " [%s] " % elmt) Line 67: else: Line 68: for attr, attrValue in value.items():
Line 65: sys.stderr.write(" Invalid ELEMENT" Line 66: " [%s] " % elmt) Line 67: else: Line 68: for attr, attrValue in value.items(): Line 69: if attr not in spiceOpts[elmt].keys():
same here:
Done Line 70: sys.stderr.write(" Invalid ATTRIBUTE" Line 71: " [%s]" % attr) Line 72: elif attrValue not in spiceOpts[elmt][attr]: Line 73: sys.stderr.write(" Invalid VALUE"
Michal Skrivanek has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 7:
not sure if "playback" is useful, but it's missing from the list. I don't need it, just asking:) The others we are adding as a proper feature in 3.5 (copy&paste and file transfer)
oVirt Jenkins CI Server has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 8:
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/7066/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_install_rpm_sanity_gerrit/453/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7968/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7857/ : SUCCESS
Amador Pahim has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 8: Verified+1
Douglas Schilling Landgraf has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 8: Code-Review-1
(3 comments)
few comments
http://gerrit.ovirt.org/#/c/22178/8/vdsm_hooks/spiceoptions/Makefile.am File vdsm_hooks/spiceoptions/Makefile.am:
Line 1: # Line 2: # Copyright 2013 Red Hat, Inc. 2014 Line 3: # Line 4: # This program is free software; you can redistribute it and/or modify Line 5: # it under the terms of the GNU General Public License as published by Line 6: # the Free Software Foundation; either version 2 of the License, or
Line 18: # Refer to the README and COPYING files for full details of the license Line 19: # Line 20: # Line 21: EXTRA_DIST = \ Line 22: before_vm_start.py tab Line 23: Line 24: install-data-local: Line 25: $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start Line 26: $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \
http://gerrit.ovirt.org/#/c/22178/8/vdsm_hooks/spiceoptions/before_vm_start.... File vdsm_hooks/spiceoptions/before_vm_start.py:
Line 1: #!/usr/bin/python Line 2: Line 3: import os Line 4: import sys Line 5: import hooking (for import hooking) Imports should be grouped in the following order:
standard library imports related third party imports local application/library specific imports You should put a blank line between each group of imports.
http://legacy.python.org/dev/peps/pep-0008/#imports Line 6: import traceback Line 7: import ast Line 8: from xml.dom import minidom Line 9:
oVirt Jenkins CI Server has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 9:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_install_rpm_sanity_gerrit/466/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7938/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/7148/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/8050/ : SUCCESS
Amador Pahim has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 9: Verified+1
Michal Skrivanek has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 9: Code-Review+1
Amador Pahim has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 10: Verified+1
oVirt Jenkins CI Server has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 10:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_install_rpm_sanity_gerrit/473/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7967/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/7177/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/8080/ : SUCCESS
Douglas Schilling Landgraf has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 10: Code-Review+1
Jenkins error not related to this patch.
Error: Package: vdsm-hook-vhostmd-4.13.0-259.git2aec1ed.el6.noarch (/vdsm-hook-vhostmd-4.13.0-259.git2aec1ed.el6.noarch) Requires: vhostmd
Michal Skrivanek has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 10: Code-Review+1
thx for adding the playback as well
Francesco Romani has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 10: Code-Review+1
Looks ok.
Dan Kenigsberg has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 10: Code-Review+2
Escalating scores
Dan Kenigsberg has submitted this change and it was merged.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
hook: spiceoptions: To provide spice option attributes to vm
This hook goes through VM definitions xml file and manipulate its graphics device if the protocol type is spice. This can be used to configure spice options. This hook script will be really useful to configure some of the spice optimization attributes and values like image, streaming, clipboard..etc
For ex:
<graphics type='spice' port='-1' tlsPort='-1' autoport='yes'> ****** <image compression='auto_glz'/> <streaming mode='filter'/> <mouse mode='client'/> </graphics>
Change-Id: I7761aab98cdc3a0d37bed7984ae540278e6bbf70 Signed-off-by: Humble Chirammal hchiramm@redhat.com Signed-off-by: Amador Pahim apahim@redhat.com Reviewed-on: http://gerrit.ovirt.org/22178 Reviewed-by: Douglas Schilling Landgraf dougsland@redhat.com Reviewed-by: Michal Skrivanek michal.skrivanek@redhat.com Reviewed-by: Francesco Romani fromani@redhat.com Reviewed-by: Dan Kenigsberg danken@redhat.com --- M AUTHORS M configure.ac M vdsm.spec.in M vdsm_hooks/Makefile.am A vdsm_hooks/spiceoptions/Makefile.am A vdsm_hooks/spiceoptions/README A vdsm_hooks/spiceoptions/before_vm_start.py 7 files changed, 224 insertions(+), 0 deletions(-)
Approvals: Douglas Schilling Landgraf: Looks good to me, but someone else must approve Amador Pahim: Verified Dan Kenigsberg: Looks good to me, approved Francesco Romani: Looks good to me, but someone else must approve Michal Skrivanek: Looks good to me, but someone else must approve
oVirt Jenkins CI Server has posted comments on this change.
Change subject: hook: spiceoptions: To provide spice option attributes to vm ......................................................................
Patch Set 10:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_install_rpm_sanity_gerrit/479/ : FAILURE
vdsm-patches@lists.fedorahosted.org