
Andy, Many thanks! That got me going the right direction. I did some extensive testing of with this. Here are the changes I made but basically what I do is: - If the user specifies a custom property of usbtablet, just rewrite
Itamar, I will take a look through the wiki on code submission (I know I saw a write up on it in there), and figure out how to get this submitted. - Chris -----Original Message----- From: Itamar Heim [mailto:iheim@redhat.com] Sent: Friday, February 03, 2012 4:45 AM To: Brown, Chris (GE Healthcare) Cc: Andrew Cathrow; users@ovirt.org Subject: Re: [Users] ovirt VM custom properties On 02/02/2012 10:51 PM, Brown, Chris (GE Healthcare) wrote: the input tag with:
<input type='tablet' bus='usb'/ id='input0'> This will of course rewrite the existing<input type='mouse' bus='ps2'/> But in this case we know we desire usbtablet so just re-write with what we want. For non problematic guests or guests to which the agent can be installed we simply remove the custom property after the agent is added. For legacy guests all the way back to redhat 7.3 and win98/win2k etc we can simply use usbtablet for now. Once the issues with the mouse input issues with the aforementioned guest types are resolved we again won't need this (hopefully).
how about formalizing this into a patch for the vdsm custom hooks library?
- Chris
#!/usr/bin/python # VDSM Hook Script for RHEV/oVirt # Enables USB tablet support for a guest # use rhevm-config for RHEV or engine-config for oVirt to add UserDefinedVMProperties # EX: rhevm-config -s UserDefinedVMProperties='usbtablet=^(true|false)$' --cver=3.0 # Remember to restart jboss # Use VM custom property usbtablet=true in vm configuration (Custom Properties)
import os import sys import hooking import traceback
if os.environ.has_key('usbtablet'): try: sys.stderr.write('usbtablet requested\n') domxml = hooking.read_domxml()
devices = domxml.getElementsByTagName('devices')[0] inputdev = domxml.getElementsByTagName('input')[0]
inputdev.setAttribute('bus', 'usb') inputdev.setAttribute('type', 'tablet') inputdev.setAttribute('id', 'input0') hooking.write_domxml(domxml) sys.stderr.write('usbtablet support enabled\n')
except: sys.stderr.write('usbtablet: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
-----Original Message----- From: Andrew Cathrow [mailto:acathrow@redhat.com] Sent: Wednesday, February 01, 2012 5:01 PM To: Brown, Chris (GE Healthcare) Cc: users@ovirt.org Subject: Re: [Users] ovirt VM custom properties
Not tested, no error handling (eg. does the element exist already) but
...
#!/usr/bin/python
import os import sys import hooking import traceback
if os.environ.has_key('usbtablet'): try: sys.stderr.write('tablet: adding usbtablet support\n') domxml = hooking.read_domxml()
devices = domxml.getElementsByTagName('devices')[0] tablet = domxml.createElement('input') tablet.setAttribute('bus', 'usb')
devices.appendChild(tablet)
hooking.write_domxml(domxml) except: sys.stderr.write('tablet: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
----- Original Message -----
From: "Chris Brown (GE Healthcare)"<Christopher.Brown@med.ge.com> To: "Andrew Cathrow"<acathrow@redhat.com> Cc: users@ovirt.org Sent: Wednesday, February 1, 2012 5:20:09 PM Subject: RE: [Users] ovirt VM custom properties
Thanks Andy, I was afraid that might be case ;) I'll check out the examples and see what I can come up with. - Chris
-----Original Message----- From: Andrew Cathrow [mailto:acathrow@redhat.com] Sent: Wednesday, February 01, 2012 3:29 PM To: Brown, Chris (GE Healthcare) Cc: users@ovirt.org Subject: Re: [Users] ovirt VM custom properties
----- Original Message -----
From: "Chris Brown (GE Healthcare)"<Christopher.Brown@med.ge.com> To: users@ovirt.org Sent: Wednesday, February 1, 2012 4:16:35 PM Subject: [Users] ovirt VM custom properties
In an effort to work around the mouse issues with spice consoles and
certain guests I had an idea for the time being.
My thought process is to leverage custom properties to enable usb-tablet support on said guests.
--> (
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Virtualization/3.
0/html/Administration_Guide/VDSM_Hooks.html )
I perused the available documentation and it appears that these custom properties are ultimately fed into the generated libvirt domain xml.
Thus sifting through --> http://libvirt.org/formatdomain.html#elementsInput we can pass in:
<devices>
<input type='tablet' bus='usb'/ id='input0'>
</devices>
The issue I am hung up on is that since this contains multi-level elements can this even be specified as a custom property?
The custom property wouldn't contain the XML it would contain data you want to pass to a hook script eg. addTablet=true, then it's down to your hook script to add the appropriate element to the device node
in the libvirt xml. There's a number of good examples in the vdsm git repo.
If so can one of the ovirt developers provide an example on how to go about it?
- Chris _______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users