[libvirt] [PATCH 2/2] Add API for calling systemd-machined's DBus API

Eric Blake eblake at redhat.com
Thu Jul 18 23:11:45 UTC 2013


On 07/18/2013 07:27 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> To register virtual machines and containers with systemd-machined,
> and thus have cgroups auto-created, we need to talk over DBus.
> This is somewhat tedious code, so introduce a dedicated function
> to isolate the DBus call in one place.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---

Fails 'make syntax-check':

  GEN      bracket-spacing-check
tests/virsystemdmock.c:74:         reply =
dbus_message_new_method_return(message);
maint.mk: incorrect whitespace, see HACKING for rules

but that's a false positive against 'return(foo)' - looks like I'll have
to tweak that.


> +++ b/src/util/virerror.h
> @@ -145,6 +145,17 @@ void virReportSystemErrorFull(int domcode,
>                        0, 0,                                          \
>                        (fmt), __VA_ARGS__)
>  
> +# define virReportDBusServiceError(message, name)                    \

Ah, this hunk probably belongs in 1/2.  In fact, it fixes compilation,
so I was able to run 'make check', but the test from 1/2 fails:

TEST: virdbustest
      Failed to round-trip byte '0' to '200'
!..Failed to round-trip byte '0' to '200'
!.                                    5   FAIL


> +    /*
> +     * The systemd DBus API we're invoking has the
> +     * following signature
> +     *
> +     * CreateMachine(in  s name,
> +     *               in  ay id,
> +     *               in  s service,
> +     *               in  s class,
> +     *               in  u leader,
> +     *               in  s root_directory,
> +     *               in  a(sv) scope_properties,
> +     *               out o path);


> +
> +    if (virDBusCallMethod(conn,
> +                          NULL,
> +                          "org.freedesktop.machine1",
> +                          "/org/freedesktop/machine1",
> +                          "org.freedesktop.machine1.Manager",
> +                          "CreateMachine",
> +                          "sayssusa(sv)",
> +                          machinename,
> +                          16,
> +                          uuid[0], uuid[1], uuid[2], uuid[3],
> +                          uuid[4], uuid[5], uuid[6], uuid[7],
> +                          uuid[8], uuid[9], uuid[10], uuid[11],
> +                          uuid[12], uuid[13], uuid[14], uuid[15],
> +                          creatorname,
> +                          iscontainer ? "container" : "vm",
> +                          (unsigned int)pidleader,
> +                          rootdir ? rootdir : "",
> +                          1, "Slice","s",

Space after ','

> +                          slice ? slice : "") < 0)

Looks like the correct call translation.

ACK if you can fix the problems.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130718/951f54c4/attachment-0001.sig>


More information about the libvir-list mailing list