Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.Domain.xml | 6 ++++++ src/domain.c | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 9490654..f68cc39 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -286,6 +286,12 @@ value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainReboot"/> <arg name="flags" type="u" direction="in"/> </method> + <method name="Rename"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainRename"/> + <arg name="name" type="s" direction="in"/> + <arg name="flags" type="u" direction="in"/> + </method> <method name="Reset"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainReset"/> diff --git a/src/domain.c b/src/domain.c index 60dab7e..2a27667 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1458,6 +1458,31 @@ virtDBusDomainReboot(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } +static void +virtDBusDomainRename(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; + const gchar *name; + guint flags; + + g_variant_get(inArgs, "(&su)", &name, &flags); + + domain = virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainRename(domain, name, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + static void virtDBusDomainReset(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1717,6 +1742,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { { "PinEmulator", virtDBusDomainPinEmulator }, { "PinIOThread", virtDBusDomainPinIOThread }, { "Reboot", virtDBusDomainReboot }, + { "Rename", virtDBusDomainRename }, { "Reset", virtDBusDomainReset }, { "Resume", virtDBusDomainResume }, { "SendKey", virtDBusDomainSendKey }, -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list