Something else I thought of on this. While the admin portal allows for custom properties
and this works there for the user portal it does not.
Thus a power user in the PUP cannot specify this as a custom property. This again would
inhibit their ability to interact with and install certain guests.
Is there a way we can allow a power user to specify a custom property on a VM w/o admin
interaction?
- Chris
-----Original Message-----
From: Brown, Chris (GE Healthcare)
Sent: Thursday, February 02, 2012 2:52 PM
To: 'Andrew Cathrow'
Cc: users(a)ovirt.org
Subject: RE: [Users] ovirt VM custom properties
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 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).
- 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(a)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(a)med.ge.com>
To: "Andrew Cathrow" <acathrow(a)redhat.com>
Cc: users(a)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(a)ovirt.org
Subject: Re: [Users] ovirt VM custom properties
----- Original Message -----
> From: "Chris Brown (GE Healthcare)" <Christopher.Brown(a)med.ge.com>
> To: users(a)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(a)ovirt.org
>
http://lists.ovirt.org/mailman/listinfo/users
>