[Users] ovirt VM custom properties
Andrew Cathrow
acathrow at redhat.com
Wed Feb 1 23:00:35 UTC 2012
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 at med.ge.com>
> To: "Andrew Cathrow" <acathrow at redhat.com>
> Cc: users at 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 at redhat.com]
> Sent: Wednesday, February 01, 2012 3:29 PM
> To: Brown, Chris (GE Healthcare)
> Cc: users at ovirt.org
> Subject: Re: [Users] ovirt VM custom properties
>
>
>
> ----- Original Message -----
> > From: "Chris Brown (GE Healthcare)" <Christopher.Brown at med.ge.com>
> > To: users at 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 at ovirt.org
> > http://lists.ovirt.org/mailman/listinfo/users
> >
>
More information about the Users
mailing list