Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.Domain.xml | 10 ++++----- src/domain.c | 49 +++++++++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 3f91354..ecd3f04 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -40,6 +40,11 @@ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateWithFlags"/> <arg name="flags" type="u" direction="in"/> </method> + <method name="Destroy"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDestroyFlags"/> + <arg name="flags" type="u" direction="in"/> + </method> <method name="GetVcpus"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetVcpusFlags"/> @@ -64,11 +69,6 @@ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainShutdownFlags"/> <arg name="flags" type="u" direction="in"/> </method> - <method name="Destroy"> - <annotation name="org.gtk.GDBus.DocString" - value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDestroyFlags"/> - <arg name="flags" type="u" direction="in"/> - </method> <method name="Reboot"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainReboot"/> diff --git a/src/domain.c b/src/domain.c index 4e43a36..f797627 100644 --- a/src/domain.c +++ b/src/domain.c @@ -241,6 +241,30 @@ virtDBusDomainCreate(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } +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) +{ + 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 (virDomainDestroyFlags(domain, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + + static void virtDBusDomainGetVcpus(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -356,29 +380,6 @@ virtDBusDomainShutdown(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } -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) -{ - 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 (virDomainDestroyFlags(domain, flags) < 0) - virtDBusUtilSetLastVirtError(error); -} - static void virtDBusDomainReboot(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -504,11 +505,11 @@ static virtDBusGDBusPropertyTable virtDBusDomainPropertyTable[] = { static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { { "Create", virtDBusDomainCreate }, + { "Destroy", virtDBusDomainDestroy }, { "GetVcpus", virtDBusDomainGetVcpus }, { "GetXMLDesc", virtDBusDomainGetXMLDesc }, { "GetStats", virtDBusDomainGetStats }, { "Shutdown", virtDBusDomainShutdown }, - { "Destroy", virtDBusDomainDestroy }, { "Reboot", virtDBusDomainReboot }, { "Reset", virtDBusDomainReset }, { "Undefine", virtDBusDomainUndefine }, -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list