[Libvir] RFC: get/set properties
veillard at redhat.com
Tue Apr 15 21:23:05 UTC 2008
On Tue, Apr 15, 2008 at 11:31:32AM -0700, Ryan Scott wrote:
> I'd like to get some comments on the following...
> We would like to use libvirt to store some properties related to a
> domain. This can be done by adding a simple get/set API as follows:
> * Domain property get/set interfaces
> * For GetProp, the return value must be freed by the caller.
> char * virDomainGetProp (virDomainPtr domain,
> const char *propName);
> int virDomainSetProp (virDomainPtr domain,
> const char *propName,
> const char *value);
> Sample command-line usage:
> virsh # setprop solaris-pv-0 foo bar
> virsh # setprop solaris-pv-0 blah 3
> virsh # getprop solaris-pv-0 foo
> foo: bar
Would you have a meaningful concrete example instead ?
> The XML would look something like this:
> virsh # dumpxml solaris-pv-0
> <domain type='xen' id='-1'>
> [ snip ]
> <blah value="3"/>
> <foo value="bar"/>
The XML is a part of the API. This allows some flexibility but I think
should be kept under control. I don't understand what need this should
fullfill and I'm afraid this open the door to a lot of problems. Experience
proved that you really need the xmldump result for a domain to really match
what is used to crate it. So you can't use it for application input,
it really has to represent data that the hypervisor knows about the domain.
I have a bit of experience with XML and markup language too and dropping
control for the structure in that way means a depreciation of the value of
the data. This means for example it would become impossible to build XSLT
stylesheet transforming the XML, because suddenly the language is not fully
defined anymore by the libvirt project description.
I really don't understand what you are trying to achieve, and I'm
wondering if this means we need to extend existing structure, or if this
is just not hypervisor related.
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard at redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
More information about the libvir-list