[libvirt] [dbus PATCH 18/25] Implement PinEmulator method for Domain Interface

Daniel P. Berrangé berrange at redhat.com
Wed Apr 18 13:41:19 UTC 2018


On Wed, Apr 18, 2018 at 03:03:20PM +0200, Pavel Hrdina wrote:
> On Tue, Apr 17, 2018 at 02:04:37PM +0200, Katerina Koukiou wrote:
> > Signed-off-by: Katerina Koukiou <kkoukiou at redhat.com>
> > ---
> >  data/org.libvirt.Domain.xml |  6 ++++++
> >  src/domain.c                | 34 ++++++++++++++++++++++++++++++++++
> >  2 files changed, 40 insertions(+)
> > 
> > diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
> > index f2ef3dd..97c5471 100644
> > --- a/data/org.libvirt.Domain.xml
> > +++ b/data/org.libvirt.Domain.xml
> > @@ -268,6 +268,12 @@
> >          value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateStartPostCopy"/>
> >        <arg name="flags" type="u" direction="in"/>
> >      </method>
> > +    <method name="PinEmulator">
> > +      <annotation name="org.gtk.GDBus.DocString"
> > +        value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainPinEmulator"/>
> > +      <arg name="cpumap" type="ay" direction="in"/>
> 
> We need to figure out a better way how to represent the CPU map in
> libvirt-dbus.  IMHO using an array of unsigned char is not the best
> from for D-Bus.
> 
> There are two possible forms, using the string representation as we
> have in virsh, so for example "0,3-7,^5" which is 10011011.
> 
> The second form is the one that libvirt-python uses, a tuple of boolean
> values, which in case of D-Bus would be represented as array of boolean
> values.

array of boolean is better than array of char in that it is explicitly
typed. It is inefficient though - each boolean value takes up 32-bit on
the wire !

> The first form is better suited for humans so I guess we should go with
> the second form in D-Bus.

Ultimately you should think about how a dbus client will consume the
data. If you use  array of boolean, that all the DBus clients will
map that into native boolean types which are easy to acess for apps.

If you use the string syntax, then every application has to write
parsing & formatting code for this syntax.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list