Follow this pattern even if negative values will not appear, in order to be consistent with libvirt APIs.
Signed-off-by: Katerina Koukiou <kkouk...@redhat.com> --- Added type change for MemoryStats data/org.libvirt.Connect.xml | 18 +++++++++--------- data/org.libvirt.Domain.xml | 18 +++++++++--------- data/org.libvirt.Network.xml | 2 +- data/org.libvirt.Secret.xml | 2 +- data/org.libvirt.StoragePool.xml | 2 +- src/connect.c | 6 +++--- src/domain.c | 22 +++++++++++----------- src/events.c | 12 ++++++------ src/network.c | 4 ++-- src/secret.c | 2 +- src/storagepool.c | 2 +- 11 files changed, 45 insertions(+), 45 deletions(-) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index ba78acc..e96f91b 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -40,7 +40,7 @@ value="See https://libvirt.org/html/libvirt-libvirt-host.html#virConnectCompareCPU"/> <arg name="xmlDesc" type="s" direction="in"/> <arg name="flags" type="u" direction="in"/> - <arg name="compareResult" type="u" direction="out"/> + <arg name="compareResult" type="i" direction="out"/> </method> <method name="DomainCreateXML"> <annotation name="org.gtk.GDBus.DocString" @@ -66,7 +66,7 @@ <method name="DomainLookupByID"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainLookupByID"/> - <arg name="id" type="u" direction="in"/> + <arg name="id" type="i" direction="in"/> <arg name="domain" type="o" direction="out"/> </method> <method name="DomainLookupByName"> @@ -288,28 +288,28 @@ <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEventCallback"/> <arg name="domain" type="o"/> - <arg name="event" type="u"/> - <arg name="detail" type="u"/> + <arg name="event" type="i"/> + <arg name="detail" type="i"/> </signal> <signal name="NetworkEvent"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-network.html#virConnectNetworkEventLifecycleCallback"/> <arg name="network" type="o"/> - <arg name="event" type="u"/> + <arg name="event" type="i"/> </signal> <signal name="SecretEvent"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-secret.html#virConnectSecretEventLifecycleCallback"/> <arg name="secret" type="o"/> - <arg name="event" type="u"/> - <arg name="detail" type="u"/> + <arg name="event" type="i"/> + <arg name="detail" type="i"/> </signal> <signal name="StoragePoolEvent"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectStoragePoolEventLifecycleCallback"/> <arg name="storagePool" type="o"/> - <arg name="event" type="u"/> - <arg name="detail" type="u"/> + <arg name="event" type="i"/> + <arg name="detail" type="i"/> </signal> </interface> </node> diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 0452592..f1a980c 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -195,7 +195,7 @@ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetBlockJobInfo"/> <arg name="disk" type="s" direction="in"/> <arg name="flags" type="u" direction="in"/> - <arg name="blockJobInfo" type="(uttt)" direction="out"/> + <arg name="blockJobInfo" type="(ittt)" direction="out"/> </method> <method name="GetControlInfo"> <annotation name="org.gtk.GDBus.DocString" @@ -207,7 +207,7 @@ <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetDiskErrors"/> <arg name="flags" type="u" direction="in"/> - <arg name="diskErrors" type="a(su)" direction="out"/> + <arg name="diskErrors" type="a(si)" direction="out"/> </method> <method name="GetEmulatorPinInfo"> <annotation name="org.gtk.GDBus.DocString" @@ -249,13 +249,13 @@ <method name="GetJobInfo"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetJobInfo"/> - <arg name="jobInfo" type="(uttttttttttt)" direction="out"/> + <arg name="jobInfo" type="(ittttttttttt)" direction="out"/> </method> <method name="GetJobStats"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetJobStats"/> <arg name="flags" type="u" direction="in"/> - <arg name="stats" type="(ua{sv})" direction="out"/> + <arg name="stats" type="(ia{sv})" direction="out"/> </method> <method name="GetMemoryParameters"> <annotation name="org.gtk.GDBus.DocString" @@ -267,7 +267,7 @@ <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetMetadata Empty string can be used to pass a NULL as @uri argument."/> - <arg name="type" type="u" direction="in"/> + <arg name="type" type="i" direction="in"/> <arg name="uri" type="s" direction="in"/> <arg name="flags" type="u" direction="in"/> <arg name="metadata" type="s" direction="out"/> @@ -372,7 +372,7 @@ <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMemoryStats"/> <arg name="flags" type="u" direction="in"/> - <arg name="stats" type="a{ut}" direction="out"/> + <arg name="stats" type="a{it}" direction="out"/> </method> <method name="MigrateGetCompressionCache"> <annotation name="org.gtk.GDBus.DocString" @@ -540,7 +540,7 @@ <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetMetadata Empty string can be used to pass a NULL as @key or @uri argument."/> - <arg name="type" type="u" direction="in"/> + <arg name="type" type="i" direction="in"/> <arg name="metadata" type="s" direction="in"/> <arg name="key" type="s" direction="in"/> <arg name="uri" type="s" direction="in"/> @@ -640,7 +640,7 @@ <arg name="oldSrcPath" type="s"/> <arg name="newSrcPath" type="s"/> <arg name="device" type="s"/> - <arg name="reason" type="u"/> + <arg name="reason" type="i"/> </signal> <signal name="JobCompleted"> <annotation name="org.gtk.GDBus.DocString" @@ -686,7 +686,7 @@ <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEventTrayChangeCallback"/> <arg name="device" type="s"/> - <arg name="reason" type="u"/> + <arg name="reason" type="i"/> </signal> <signal name="Tunable"> <annotation name="org.gtk.GDBus.DocString" diff --git a/data/org.libvirt.Network.xml b/data/org.libvirt.Network.xml index 6ac25e9..dec3533 100644 --- a/data/org.libvirt.Network.xml +++ b/data/org.libvirt.Network.xml @@ -42,7 +42,7 @@ Empty string will be returned in output for NULL variables."/> <arg name="mac" type="s" direction="in"/> <arg name="flags" type="u" direction="in"/> - <arg name="leases" type="a(stusssuss)" direction="out"/> + <arg name="leases" type="a(stisssuss)" direction="out"/> </method> <method name="GetXMLDesc"> <annotation name="org.gtk.GDBus.DocString" diff --git a/data/org.libvirt.Secret.xml b/data/org.libvirt.Secret.xml index 3a5d742..7ae5e6d 100644 --- a/data/org.libvirt.Secret.xml +++ b/data/org.libvirt.Secret.xml @@ -13,7 +13,7 @@ value="See https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetUsageID"/> <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/> </property> - <property name="UsageType" type="u" access="read"> + <property name="UsageType" type="i" access="read"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetUsageType"/> <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/> diff --git a/data/org.libvirt.StoragePool.xml b/data/org.libvirt.StoragePool.xml index 01ab39d..e9d6b0e 100644 --- a/data/org.libvirt.StoragePool.xml +++ b/data/org.libvirt.StoragePool.xml @@ -49,7 +49,7 @@ <method name="GetInfo"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetInfo"/> - <arg name="info" type="(uttt)" direction="out"/> + <arg name="info" type="(ittt)" direction="out"/> </method> <method name="GetXMLDesc"> <annotation name="org.gtk.GDBus.DocString" diff --git a/src/connect.c b/src/connect.c index 6719e21..e396650 100644 --- a/src/connect.c +++ b/src/connect.c @@ -289,7 +289,7 @@ virtDBusConnectCompareCPU(GVariant *inArgs, if (compareResult < 0) return virtDBusUtilSetLastVirtError(error); - *outArgs = g_variant_new("(u)", compareResult); + *outArgs = g_variant_new("(i)", compareResult); } static void @@ -399,9 +399,9 @@ virtDBusConnectDomainLookupByID(GVariant *inArgs, virtDBusConnect *connect = userData; g_autoptr(virDomain) domain = NULL; g_autofree gchar *path = NULL; - guint id; + gint id; - g_variant_get(inArgs, "(u)", &id); + g_variant_get(inArgs, "(i)", &id); if (!virtDBusConnectOpen(connect, error)) return; diff --git a/src/domain.c b/src/domain.c index 150c74e..caf6508 100644 --- a/src/domain.c +++ b/src/domain.c @@ -102,10 +102,10 @@ virtDBusDomainMemoryStatsToGVariant(virDomainMemoryStatPtr stats, { GVariantBuilder builder; - g_variant_builder_init(&builder, G_VARIANT_TYPE("a{ut}")); + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{it}")); for (gint i = 0; i < nr_stats; i++) - g_variant_builder_add(&builder, "{ut}", stats[i].tag, stats[i].val); + g_variant_builder_add(&builder, "{it}", stats[i].tag, stats[i].val); return g_variant_builder_end(&builder); } @@ -1009,7 +1009,7 @@ virtDBusDomainGetBlockJobInfo(GVariant *inArgs, if (virDomainGetBlockJobInfo(domain, disk, &info, flags) < 0) return virtDBusUtilSetLastVirtError(error); - *outArgs = g_variant_new("((uttt))", info.type, info.bandwidth, + *outArgs = g_variant_new("((ittt))", info.type, info.bandwidth, info.cur, info.end); } @@ -1078,11 +1078,11 @@ virtDBusDomainGetDiskErrors(GVariant *inArgs, return virtDBusUtilSetLastVirtError(error); } - g_variant_builder_init(&builder, G_VARIANT_TYPE("a(su)")); + g_variant_builder_init(&builder, G_VARIANT_TYPE("a(si)")); for (gint i = 0; i < count; i++) { - g_variant_builder_open(&builder, G_VARIANT_TYPE("(su)")); + g_variant_builder_open(&builder, G_VARIANT_TYPE("(si)")); g_variant_builder_add(&builder, "s", disks[i].disk); - g_variant_builder_add(&builder, "u", disks[i].error); + g_variant_builder_add(&builder, "i", disks[i].error); g_variant_builder_close(&builder); } res = g_variant_builder_end(&builder); @@ -1345,7 +1345,7 @@ virtDBusDomainGetJobInfo(GVariant *inArgs G_GNUC_UNUSED, if (virDomainGetJobInfo(domain, jobInfo) < 0) return virtDBusUtilSetLastVirtError(error); - *outArgs = g_variant_new("((uttttttttttt))", jobInfo->type, + *outArgs = g_variant_new("((ittttttttttt))", jobInfo->type, jobInfo->timeElapsed, jobInfo->timeRemaining, jobInfo->dataTotal, jobInfo->dataProcessed, jobInfo->dataRemaining, jobInfo->memTotal, @@ -1385,8 +1385,8 @@ virtDBusDomainGetJobStats(GVariant *inArgs, grecords = virtDBusUtilTypedParamsToGVariant(params.params, params.nparams); - g_variant_builder_init(&builder, G_VARIANT_TYPE("(ua{sv})")); - g_variant_builder_add(&builder, "u", type); + g_variant_builder_init(&builder, G_VARIANT_TYPE("(ia{sv})")); + g_variant_builder_add(&builder, "i", type); g_variant_builder_add_value(&builder, grecords); gret = g_variant_builder_end(&builder); @@ -1448,7 +1448,7 @@ virtDBusDomainGetMetadata(GVariant *inArgs, guint flags; g_autofree gchar *ret = NULL; - g_variant_get(inArgs, "(u&su)", &type, &uri, &flags); + g_variant_get(inArgs, "(i&su)", &type, &uri, &flags); if (g_str_equal(uri, "")) uri = NULL; @@ -2758,7 +2758,7 @@ virtDBusDomainSetMetadata(GVariant *inArgs, const gchar *uri; guint flags; - g_variant_get(inArgs, "(u&s&s&su)", &type, &metadata, &key, &uri, &flags); + g_variant_get(inArgs, "(i&s&s&su)", &type, &metadata, &key, &uri, &flags); if (g_str_equal(key, "")) key = NULL; if (g_str_equal(uri, "")) diff --git a/src/events.c b/src/events.c index 206c79f..76d9ab5 100644 --- a/src/events.c +++ b/src/events.c @@ -88,7 +88,7 @@ virtDBusEventsDomainLifecycle(virConnectPtr connection G_GNUC_UNUSED, connect->connectPath, VIRT_DBUS_CONNECT_INTERFACE, "DomainEvent", - g_variant_new("(ouu)", path, event, detail), + g_variant_new("(oii)", path, event, detail), NULL); return 0; @@ -357,7 +357,7 @@ virtDBusEventsDomainTrayChange(virConnectPtr connection G_GNUC_UNUSED, path, VIRT_DBUS_DOMAIN_INTERFACE, "TrayChange", - g_variant_new("(su)", device, reason), + g_variant_new("(si)", device, reason), NULL); return 0; @@ -430,7 +430,7 @@ virtDBusEventsDomainDiskChange(virConnectPtr connection G_GNUC_UNUSED, path, VIRT_DBUS_DOMAIN_INTERFACE, "DiskChange", - g_variant_new("(sssu)", old_src_path, + g_variant_new("(sssi)", old_src_path, new_src_path, device, reason), NULL); @@ -454,7 +454,7 @@ virtDBusEventsNetworkLifecycle(virConnectPtr connection G_GNUC_UNUSED, connect->connectPath, VIRT_DBUS_CONNECT_INTERFACE, "NetworkEvent", - g_variant_new("(ou)", path, event), + g_variant_new("(oi)", path, event), NULL); return 0; @@ -477,7 +477,7 @@ virtDBusEventsSecretLifecycle(virConnectPtr connection G_GNUC_UNUSED, connect->connectPath, VIRT_DBUS_CONNECT_INTERFACE, "SecretEvent", - g_variant_new("(ouu)", path, event, detail), + g_variant_new("(oii)", path, event, detail), NULL); return 0; @@ -501,7 +501,7 @@ virtDBusEventsStoragePoolLifecycle(virConnectPtr connection G_GNUC_UNUSED, connect->connectPath, VIRT_DBUS_CONNECT_INTERFACE, "StoragePoolEvent", - g_variant_new("(ouu)", path, event, detail), + g_variant_new("(oii)", path, event, detail), NULL); return 0; diff --git a/src/network.c b/src/network.c index 7596687..e7087f7 100644 --- a/src/network.c +++ b/src/network.c @@ -228,11 +228,11 @@ virtDBusNetworkGetDHCPLeases(GVariant *inArgs, if (nleases < 0) return virtDBusUtilSetLastVirtError(error); - g_variant_builder_init(&builder, G_VARIANT_TYPE("a(stusssuss)")); + g_variant_builder_init(&builder, G_VARIANT_TYPE("a(stisssuss)")); for (gint i = 0; i < nleases; i++) { virNetworkDHCPLeasePtr lease = leases[i]; - g_variant_builder_add(&builder, "(stusssuss)", + g_variant_builder_add(&builder, "(stisssuss)", lease->iface, lease->expirytime, lease->type, lease->mac, lease->iaid ? lease->iaid : "" , diff --git a/src/secret.c b/src/secret.c index 3aaed03..903cfc2 100644 --- a/src/secret.c +++ b/src/secret.c @@ -83,7 +83,7 @@ virtDBusSecretGetUsageType(const gchar *objectPath, if (usageType < 0) return virtDBusUtilSetLastVirtError(error); - *value = g_variant_new("u", usageType); + *value = g_variant_new("i", usageType); } static void diff --git a/src/storagepool.c b/src/storagepool.c index c8b6467..0da732f 100644 --- a/src/storagepool.c +++ b/src/storagepool.c @@ -268,7 +268,7 @@ virtDBusStoragePoolGetInfo(GVariant *inArgs G_GNUC_UNUSED, if (virStoragePoolGetInfo(storagePool, info) < 0) return virtDBusUtilSetLastVirtError(error); - *outArgs = g_variant_new("((uttt))", info->state, + *outArgs = g_variant_new("((ittt))", info->state, info->capacity, info->allocation, info->available); } -- 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list