On Thu, 2018-04-12 at 11:42 +0200, Katerina Koukiou wrote: > In C and XML files the order is: > 1) properties > 2) methods > 3) signals > All of them sorted in their category alphabetically. > > Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> > --- > data/org.libvirt.Connect.xml | 12 +-- > data/org.libvirt.Domain.xml | 54 ++++++------ > src/connect.c | 2 +- > src/domain.c | 200 +++++++++++++++++++++---------- > ------------ > 4 files changed, 134 insertions(+), 134 deletions(-) > > diff --git a/data/org.libvirt.Connect.xml > b/data/org.libvirt.Connect.xml > index 5b49ed9..55260cc 100644 > --- a/data/org.libvirt.Connect.xml > +++ b/data/org.libvirt.Connect.xml > @@ -25,12 +25,6 @@ > <annotation name="org.gtk.GDBus.DocString" > value="See https://libvirt.org/html/libvirt-libvirt-host.htm > l#virConnectGetVersion"/>; > </property> > - <method name="ListDomains"> > - <annotation name="org.gtk.GDBus.DocString" > - value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virConnectListAllDomains"/>; > - <arg name="flags" type="u" direction="in"/> > - <arg name="domains" type="ao" direction="out"/> > - </method> > <method name="DomainCreateXML"> > <annotation name="org.gtk.GDBus.DocString" > value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainCreateXML"/>; > @@ -73,6 +67,12 @@ > <arg name="flags" type="u" direction="in"/> > <arg name="sysinfo" type="s" direction="out"/> > </method> > + <method name="ListDomains"> > + <annotation name="org.gtk.GDBus.DocString" > + value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virConnectListAllDomains"/>; > + <arg name="flags" type="u" direction="in"/> > + <arg name="domains" type="ao" direction="out"/> > + </method> > <method name="ListNetworks"> > <annotation name="org.gtk.GDBus.DocString" > value="See https://libvirt.org/html/libvirt-libvirt-network. > html#virConnectListAllNetworks"/>; > diff --git a/data/org.libvirt.Domain.xml > b/data/org.libvirt.Domain.xml > index 7679018..78378bb 100644 > --- a/data/org.libvirt.Domain.xml > +++ b/data/org.libvirt.Domain.xml > @@ -3,25 +3,25 @@ > > <node name="/org/libvirt/domain"> > <interface name="org.libvirt.Domain"> > - <property name="Name" type="s" access="read"> > + <property name="Active" type="b" access="read"> > <annotation name="org.gtk.GDBus.DocString" > - value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainGetName"/>; > + value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainIsActive"/>; > </property> > - <property name="UUID" type="s" access="read"> > + <property name="Autostart" type="b" access="read"> > <annotation name="org.gtk.GDBus.DocString" > - value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainGetUUIDString"/>; > + value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainGetAutostart"/>; > </property> > <property name="Id" type="u" access="read"> > <annotation name="org.gtk.GDBus.DocString" > value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainGetID"/>; > </property> > - <property name="OSType" type="s" access="read"> > + <property name="Name" type="s" access="read"> > <annotation name="org.gtk.GDBus.DocString" > - value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainGetOSType"/>; > + value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainGetName"/>; > </property> > - <property name="Active" type="b" access="read"> > + <property name="OSType" type="s" access="read"> > <annotation name="org.gtk.GDBus.DocString" > - value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainIsActive"/>; > + value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainGetOSType"/>; > </property> > <property name="Persistent" type="b" access="read"> > <annotation name="org.gtk.GDBus.DocString" > @@ -31,21 +31,19 @@ > <annotation name="org.gtk.GDBus.DocString" > value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainGetState"/>; > </property> > - <property name="Autostart" type="b" access="read"> > + <property name="UUID" type="s" access="read"> > <annotation name="org.gtk.GDBus.DocString" > - value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainGetAutostart"/>; > + value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainGetUUIDString"/>; > </property> > - <method name="GetVcpus"> > + <method name="Create"> > <annotation name="org.gtk.GDBus.DocString" > - value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainGetVcpusFlags"/>; > + value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainCreateWithFlags"/>; > <arg name="flags" type="u" direction="in"/> > - <arg name="vcpus" type="u" direction="out"/> > </method> > - <method name="GetXMLDesc"> > + <method name="Destroy"> > <annotation name="org.gtk.GDBus.DocString" > - value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainGetXMLDesc"/>; > + value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainDestroyFlags"/>; > <arg name="flags" type="u" direction="in"/> > - <arg name="xml" type="s" direction="out"/> > </method> > <method name="GetStats"> > <annotation name="org.gtk.GDBus.DocString" > @@ -54,15 +52,17 @@ > <arg name="flags" type="u" direction="in"/> > <arg name="records" type="a{sv}" direction="out"/> > </method> > - <method name="Shutdown"> > + <method name="GetVcpus"> > <annotation name="org.gtk.GDBus.DocString" > - value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainShutdownFlags"/>; > + value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainGetVcpusFlags"/>; > <arg name="flags" type="u" direction="in"/> > + <arg name="vcpus" type="u" direction="out"/> > </method> > - <method name="Destroy"> > + <method name="GetXMLDesc"> > <annotation name="org.gtk.GDBus.DocString" > - value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainDestroyFlags"/>; > + value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainGetXMLDesc"/>; > <arg name="flags" type="u" direction="in"/> > + <arg name="xml" type="s" direction="out"/> > </method> > <method name="Reboot"> > <annotation name="org.gtk.GDBus.DocString" > @@ -74,23 +74,23 @@ > value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainReset"/>; > <arg name="flags" type="u" direction="in"/> > </method> > - <method name="Create"> > + <method name="Resume"> > <annotation name="org.gtk.GDBus.DocString" > - value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainCreateWithFlags"/>; > - <arg name="flags" type="u" direction="in"/> > + value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainResume"/>; > </method> > - <method name="Undefine"> > + <method name="Shutdown"> > <annotation name="org.gtk.GDBus.DocString" > - value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainUndefineFlags"/>; > + value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainShutdownFlags"/>; > <arg name="flags" type="u" direction="in"/> > </method> > <method name="Suspend"> > <annotation name="org.gtk.GDBus.DocString" > value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainSuspend"/>; > </method> > - <method name="Resume"> > + <method name="Undefine"> > <annotation name="org.gtk.GDBus.DocString" > - value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainResume"/>; > + value="See https://libvirt.org/html/libvirt-libvirt-domain.h > tml#virDomainUndefineFlags"/>; > + <arg name="flags" type="u" direction="in"/> > </method> > <signal name="DeviceAdded"> > <annotation name="org.gtk.GDBus.DocString" > diff --git a/src/connect.c b/src/connect.c > index 9820de5..d18f77d 100644 > --- a/src/connect.c > +++ b/src/connect.c > @@ -575,7 +575,6 @@ static virtDBusGDBusPropertyTable > virtDBusConnectPropertyTable[] = { > }; > > static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = { > - { "ListDomains", virtDBusConnectListDomains }, > { "DomainCreateXML", virtDBusConnectDomainCreateXML }, > { "DomainDefineXML", virtDBusConnectDomainDefineXML }, > { "DomainLookupByID", virtDBusConnectDomainLookupByID }, > @@ -583,6 +582,7 @@ static virtDBusGDBusMethodTable > virtDBusConnectMethodTable[] = { > { "DomainLookupByUUID", virtDBusConnectDomainLookupByUUID }, > { "GetCapabilities", virtDBusConnectGetCapabilities }, > { "GetSysinfo", virtDBusConnectGetSysinfo }, > + { "ListDomains", virtDBusConnectListDomains }, > { "ListNetworks", virtDBusConnectListNetworks }, > { "NetworkCreateXML", virtDBusConnectNetworkCreateXML }, > { "NetworkDefineXML", virtDBusConnectNetworkDefineXML }, > diff --git a/src/domain.c b/src/domain.c > index 0066788..b3b3630 100644 > --- a/src/domain.c > +++ b/src/domain.c > @@ -25,44 +25,44 @@ virtDBusDomainGetVirDomain(virtDBusConnect > *connect, > } > > static void > -virtDBusDomainGetName(const gchar *objectPath, > - gpointer userData, > - GVariant **value, > - GError **error) > +virtDBusDomainGetActive(const gchar *objectPath, > + gpointer userData, > + GVariant **value, > + GError **error) > { > virtDBusConnect *connect = userData; > g_autoptr(virDomain) domain = NULL; > - const gchar *name; > + gint active; > > domain = virtDBusDomainGetVirDomain(connect, objectPath, error); > if (!domain) > return; > > - name = virDomainGetName(domain); > - if (!name) > + active = virDomainIsActive(domain); > + if (active < 0) > return virtDBusUtilSetLastVirtError(error); > > - *value = g_variant_new("s", name); > + *value = g_variant_new("b", !!active); > } > > static void > -virtDBusDomainGetUUID(const gchar *objectPath, > - gpointer userData, > - GVariant **value, > - GError **error) > +virtDBusDomainGetAutostart(const gchar *objectPath, > + gpointer userData, > + GVariant **value, > + GError **error) > { > virtDBusConnect *connect = userData; > g_autoptr(virDomain) domain = NULL; > - gchar uuid[VIR_UUID_STRING_BUFLEN] = ""; > + gint autostart = 0; > > domain = virtDBusDomainGetVirDomain(connect, objectPath, error); > if (!domain) > return; > > - if (virDomainGetUUIDString(domain, uuid) < 0) > + if (virDomainGetAutostart(domain, &autostart) < 0) > return virtDBusUtilSetLastVirtError(error); > > - *value = g_variant_new("s", uuid); > + *value = g_variant_new("b", !!autostart); > } > > static void > @@ -87,45 +87,45 @@ virtDBusDomainGetId(const gchar *objectPath, > } > > static void > -virtDBusDomainGetOsType(const gchar *objectPath, > - gpointer userData, > - GVariant **value, > - GError **error) > +virtDBusDomainGetName(const gchar *objectPath, > + gpointer userData, > + GVariant **value, > + GError **error) > { > virtDBusConnect *connect = userData; > g_autoptr(virDomain) domain = NULL; > - g_autofree gchar *osType = NULL; > + const gchar *name; > > domain = virtDBusDomainGetVirDomain(connect, objectPath, error); > if (!domain) > return; > > - osType = virDomainGetOSType(domain); > - if (!osType) > + name = virDomainGetName(domain); > + if (!name) > return virtDBusUtilSetLastVirtError(error); > > - *value = g_variant_new("s", osType); > + *value = g_variant_new("s", name); > } > > static void > -virtDBusDomainGetActive(const gchar *objectPath, > +virtDBusDomainGetOsType(const gchar *objectPath, > gpointer userData, > GVariant **value, > GError **error) > { > virtDBusConnect *connect = userData; > g_autoptr(virDomain) domain = NULL; > - gint active; > + g_autofree gchar *osType = NULL; > > domain = virtDBusDomainGetVirDomain(connect, objectPath, error); > if (!domain) > return; > > - active = virDomainIsActive(domain); > - if (active < 0) > + osType = virDomainGetOSType(domain); > + if (!osType) > return virtDBusUtilSetLastVirtError(error); > > - *value = g_variant_new("b", !!active); > + *value = g_variant_new("s", osType); > } > > static void > @@ -199,38 +199,36 @@ virtDBusDomainGetState(const gchar *objectPath, > } > > static void > -virtDBusDomainGetAutostart(const gchar *objectPath, > - gpointer userData, > - GVariant **value, > - GError **error) > +virtDBusDomainGetUUID(const gchar *objectPath, > + gpointer userData, > + GVariant **value, > + GError **error) > { > virtDBusConnect *connect = userData; > g_autoptr(virDomain) domain = NULL; > - gint autostart = 0; > + gchar uuid[VIR_UUID_STRING_BUFLEN] = ""; > > domain = virtDBusDomainGetVirDomain(connect, objectPath, error); > if (!domain) > return; > > - if (virDomainGetAutostart(domain, &autostart) < 0) > + if (virDomainGetUUIDString(domain, uuid) < 0) > return virtDBusUtilSetLastVirtError(error); > > - *value = g_variant_new("b", !!autostart); > + *value = g_variant_new("s", uuid); > } > > static void > -virtDBusDomainGetVcpus(GVariant *inArgs, > - GUnixFDList *inFDs G_GNUC_UNUSED, > - const gchar *objectPath, > - gpointer userData, > - GVariant **outArgs, > - GUnixFDList **outFDs G_GNUC_UNUSED, > - GError **error) > - > +virtDBusDomainCreate(GVariant *inArgs, > + GUnixFDList *inFDs G_GNUC_UNUSED, > + const gchar *objectPath, > + gpointer userData, > + GVariant **outArgs G_GNUC_UNUSED, > + GUnixFDList **outFDs G_GNUC_UNUSED, > + GError **error) > { > virtDBusConnect *connect = userData; > g_autoptr(virDomain) domain = NULL; > - gint vcpus; > guint flags; > > g_variant_get(inArgs, "(u)", &flags); > @@ -239,25 +237,21 @@ virtDBusDomainGetVcpus(GVariant *inArgs, > if (!domain) > return; > > - vcpus = virDomainGetVcpusFlags(domain, flags); > - if (vcpus < 0) > - return virtDBusUtilSetLastVirtError(error); > - > - *outArgs = g_variant_new("(u)", vcpus); > + if (virDomainCreateWithFlags(domain, flags) < 0) > + virtDBusUtilSetLastVirtError(error); > } > > static void > -virtDBusDomainGetXMLDesc(GVariant *inArgs, > - GUnixFDList *inFDs G_GNUC_UNUSED, > - const gchar *objectPath, > - gpointer userData, > - GVariant **outArgs, > - GUnixFDList **outFDs G_GNUC_UNUSED, > - GError **error) > +virtDBusDomainDestroy(GVariant *inArgs, > + GUnixFDList *inFDs G_GNUC_UNUSED, > + const gchar *objectPath, > + gpointer userData, > + GVariant **outArgs G_GNUC_UNUSED, > + GUnixFDList **outFDs G_GNUC_UNUSED, > + GError **error) > { > virtDBusConnect *connect = userData; > g_autoptr(virDomain) domain = NULL; > - g_autofree gchar *xml = NULL; > guint flags; > > g_variant_get(inArgs, "(u)", &flags); > @@ -266,11 +260,8 @@ virtDBusDomainGetXMLDesc(GVariant *inArgs, > if (!domain) > return; > > - xml = virDomainGetXMLDesc(domain, flags); > - if (!xml) > - return virtDBusUtilSetLastVirtError(error); > - > - *outArgs = g_variant_new("(s)", xml); > + if (virDomainDestroyFlags(domain, flags) < 0) > + virtDBusUtilSetLastVirtError(error); > } > > G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainStatsRecordPtr, > virDomainStatsRecordListFree); > @@ -311,16 +302,18 @@ virtDBusDomainGetStats(GVariant *inArgs, > } > > static void > -virtDBusDomainShutdown(GVariant *inArgs, > +virtDBusDomainGetVcpus(GVariant *inArgs, > GUnixFDList *inFDs G_GNUC_UNUSED, > const gchar *objectPath, > gpointer userData, > - GVariant **outArgs G_GNUC_UNUSED, > + GVariant **outArgs, > GUnixFDList **outFDs G_GNUC_UNUSED, > GError **error) > + > { > virtDBusConnect *connect = userData; > g_autoptr(virDomain) domain = NULL; > + gint vcpus; > guint flags; > > g_variant_get(inArgs, "(u)", &flags); > @@ -329,21 +322,25 @@ virtDBusDomainShutdown(GVariant *inArgs, > if (!domain) > return; > > - if (virDomainShutdownFlags(domain, flags) < 0) > - virtDBusUtilSetLastVirtError(error); > + vcpus = virDomainGetVcpusFlags(domain, flags); > + if (vcpus < 0) > + return virtDBusUtilSetLastVirtError(error); > + > + *outArgs = g_variant_new("(u)", vcpus); > } > > static void > -virtDBusDomainDestroy(GVariant *inArgs, > - GUnixFDList *inFDs G_GNUC_UNUSED, > - const gchar *objectPath, > - gpointer userData, > - GVariant **outArgs G_GNUC_UNUSED, > - GUnixFDList **outFDs G_GNUC_UNUSED, > - GError **error) > +virtDBusDomainGetXMLDesc(GVariant *inArgs, > + GUnixFDList *inFDs G_GNUC_UNUSED, > + const gchar *objectPath, > + gpointer userData, > + GVariant **outArgs, > + GUnixFDList **outFDs G_GNUC_UNUSED, > + GError **error) > { > virtDBusConnect *connect = userData; > g_autoptr(virDomain) domain = NULL; > + g_autofree gchar *xml = NULL; > guint flags; > > g_variant_get(inArgs, "(u)", &flags); > @@ -352,8 +349,11 @@ virtDBusDomainDestroy(GVariant *inArgs, > if (!domain) > return; > > - if (virDomainDestroyFlags(domain, flags) < 0) > - virtDBusUtilSetLastVirtError(error); > + xml = virDomainGetXMLDesc(domain, flags); > + if (!xml) > + return virtDBusUtilSetLastVirtError(error); > + > + *outArgs = g_variant_new("(s)", xml); > } > > static void > @@ -405,7 +405,7 @@ virtDBusDomainReset(GVariant *inArgs, > } > > static void > -virtDBusDomainCreate(GVariant *inArgs, > +virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED, > GUnixFDList *inFDs G_GNUC_UNUSED, > const gchar *objectPath, > gpointer userData, > @@ -415,20 +415,17 @@ virtDBusDomainCreate(GVariant *inArgs, > { > virtDBusConnect *connect = userData; > g_autoptr(virDomain) domain = NULL; > - guint flags; > - > - g_variant_get(inArgs, "(u)", &flags); > > domain = virtDBusDomainGetVirDomain(connect, objectPath, error); > if (!domain) > return; > > - if (virDomainCreateWithFlags(domain, flags) < 0) > + if (virDomainResume(domain) < 0) > virtDBusUtilSetLastVirtError(error); > } > > static void > -virtDBusDomainUndefine(GVariant *inArgs, > +virtDBusDomainShutdown(GVariant *inArgs, > GUnixFDList *inFDs G_GNUC_UNUSED, > const gchar *objectPath, > gpointer userData, > @@ -446,7 +443,7 @@ virtDBusDomainUndefine(GVariant *inArgs, > if (!domain) > return; > > - if (virDomainUndefineFlags(domain, flags) < 0) > + if (virDomainShutdownFlags(domain, flags) < 0) > virtDBusUtilSetLastVirtError(error); > } > > @@ -471,49 +468,52 @@ virtDBusDomainSuspend(GVariant *inArgs > G_GNUC_UNUSED, > } > > static void > -virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED, > - GUnixFDList *inFDs G_GNUC_UNUSED, > - const gchar *objectPath, > - gpointer userData, > - GVariant **outArgs G_GNUC_UNUSED, > - GUnixFDList **outFDs G_GNUC_UNUSED, > - GError **error) > +virtDBusDomainUndefine(GVariant *inArgs, > + GUnixFDList *inFDs G_GNUC_UNUSED, > + const gchar *objectPath, > + gpointer userData, > + GVariant **outArgs G_GNUC_UNUSED, > + GUnixFDList **outFDs G_GNUC_UNUSED, > + GError **error) > { > virtDBusConnect *connect = userData; > g_autoptr(virDomain) domain = NULL; > + guint flags; > + > + g_variant_get(inArgs, "(u)", &flags); > > domain = virtDBusDomainGetVirDomain(connect, objectPath, error); > if (!domain) > return; > > - if (virDomainResume(domain) < 0) > + if (virDomainUndefineFlags(domain, flags) < 0) > virtDBusUtilSetLastVirtError(error); > } > > static virtDBusGDBusPropertyTable virtDBusDomainPropertyTable[] = { > - { "Name", virtDBusDomainGetName, NULL }, > - { "UUID", virtDBusDomainGetUUID, NULL }, > + { "Active", virtDBusDomainGetActive, NULL }, > + { "Autostart", virtDBusDomainGetAutostart, NULL }, > { "Id", virtDBusDomainGetId, NULL }, > + { "Name", virtDBusDomainGetName, NULL }, > { "OSType", virtDBusDomainGetOsType, NULL }, > - { "Active", virtDBusDomainGetActive, NULL }, > { "Persistent", virtDBusDomainGetPersistent, NULL }, > { "State", virtDBusDomainGetState, NULL }, > - { "Autostart", virtDBusDomainGetAutostart, NULL }, > + { "UUID", virtDBusDomainGetUUID, NULL }, > { 0 } > }; > > static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { > + { "Create", virtDBusDomainCreate }, > + { "Destroy", virtDBusDomainDestroy }, > + { "GetStats", virtDBusDomainGetStats }, > { "GetVcpus", virtDBusDomainGetVcpus }, > { "GetXMLDesc", virtDBusDomainGetXMLDesc }, > - { "GetStats", virtDBusDomainGetStats }, > - { "Shutdown", virtDBusDomainShutdown }, > - { "Destroy", virtDBusDomainDestroy }, > { "Reboot", virtDBusDomainReboot }, > { "Reset", virtDBusDomainReset }, > - { "Create", virtDBusDomainCreate }, > - { "Undefine", virtDBusDomainUndefine }, > - { "Suspend", virtDBusDomainSuspend }, > { "Resume", virtDBusDomainResume }, > + { "Shutdown", virtDBusDomainShutdown }, > + { "Suspend", virtDBusDomainSuspend }, > + { "Undefine", virtDBusDomainUndefine }, > { 0 } > }; > Please ignore this. Thanks, Katerina -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list