On Fri, Oct 07, 2011 at 02:59:28PM +0300, Zeeshan Ali (Khattak) wrote:
On Fri, Oct 7, 2011 at 12:40 PM, Christophe Fergeau
<cfergeau(a)redhat.com> wrote:
> * I don't know how to handle XMLs where the same node appears multiple
> times (eg "name"). If it's the latest name that wins, what do we do
when
> changing the name on such an XML document? only modify the last name node?
> Drop all the redundant name nodes?
I would say take the first one only and set just that.
Is it consistent with what libvirt will do? Ie will it only use the first
item in such an XML file?
> * I'm also not sure how to make it possible to check whether
a given
> property is set or not. For strings, this is easy, NULL means that the
> property was not set, but for integers, this is less obvious. Any thoughts on
> that?
For many properties (e.g cpu freq, ram, storage size etc) I think a
negative value (-1) would do, for others we can choose an insane
number like -G_MAXINT for example.
Yup, this could be surprising for library users though. We could also add a
GError parameter to the various getters, but this wouldn't be available
when using g_object_get.
Not sure about booleans though. Do
we really need to check if value is provided btw? AFAIK, every
node/attribute has a default value.
Ah if they all have a well defined default value, we could also use that
instead. I don't see any immediate use for checking if a value is defined
or not, but I can imagine people needing it.
Christophe