[Libvir] RFC: get/set properties

Ryan Scott Ryan.Scott at Sun.COM
Tue Apr 15 18:31:32 UTC 2008


   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

   The XML would look something like this:

virsh # dumpxml solaris-pv-0
<domain type='xen' id='-1'>
[ snip ]
   <properties>
     <blah value="3"/>
     <foo value="bar"/>
   </properties>
</domain>

   Looking at the Xen code, I'll need to do a bit of work on that API 
before I can implement this.  I don't know how well this will fit into 
the other hypervisors that Libvirt supports, so I'll leave those 
implementations up to someone else :)

   Any thoughts?

-Ryan




More information about the libvir-list mailing list