Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.Domain.xml | 8 ++++++++ src/domain.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 1cd79f8..96a1ca6 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -69,6 +69,14 @@ <arg name="bandwidth" type="t" direction="in"/> <arg name="flags" type="u" direction="in"/> </method> + <method name="BlockCopy"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockCopy"/> + <arg name="disk" type="s" direction="in"/> + <arg name="destxml" type="s" direction="in"/> + <arg name="params" type="a{sv}" direction="in"/> + <arg name="flags" type="u" direction="in"/> + </method> <method name="BlockJobAbort"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockJobAbort"/> diff --git a/src/domain.c b/src/domain.c index ec5b99c..562e709 100644 --- a/src/domain.c +++ b/src/domain.c @@ -476,6 +476,40 @@ virtDBusDomainBlockCommit(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } +static void +virtDBusDomainBlockCopy(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 *disk; + const gchar *destxml; + g_autoptr(GVariantIter) iter = NULL; + guint flags; + g_auto(virtDBusUtilTypedParams) params = { 0 }; + + g_variant_get(inArgs, "(&s&sa{sv}u)", &disk, &destxml, &iter, &flags); + + if (!virtDBusUtilGVariantToTypedParams(iter, ¶ms.params, + ¶ms.nparams, error)) { + return; + } + + domain = virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainBlockCopy(domain, disk, destxml, params.params, + params.nparams, flags) < 0) { + virtDBusUtilSetLastVirtError(error); + } +} + static void virtDBusDomainBlockJobAbort(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2628,6 +2662,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { { "AddIOThread", virtDBusDomainAddIOThread }, { "AttachDevice", virtDBusDomainAttachDevice }, { "BlockCommit", virtDBusDomainBlockCommit }, + { "BlockCopy", virtDBusDomainBlockCopy }, { "BlockJobAbort", virtDBusDomainBlockJobAbort }, { "BlockJobSetSpeed", virtDBusDomainBlockJobSetSpeed }, { "BlockPeek", virtDBusDomainBlockPeek }, -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list