Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.Domain.xml | 7 +++++++ src/domain.c | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index ffb40d1..0f0ec79 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -107,6 +107,13 @@ <arg name="size" type="t" direction="in"/> <arg name="flags" type="u" direction="in"/> </method> + <method name="BlockJobSetSpeed"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockJobSetSpeed"/> + <arg name="disk" type="s" direction="in"/> + <arg name="bandwidth" type="t" direction="in"/> + <arg name="flags" type="u" direction="in"/> + </method> <method name="CoreDump"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCoreDumpWithFormat"/> diff --git a/src/domain.c b/src/domain.c index 5e59094..465daa6 100644 --- a/src/domain.c +++ b/src/domain.c @@ -442,6 +442,31 @@ virtDBusDomainBlockJobAbort(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } +static void +virtDBusDomainBlockJobSetSpeed(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; + gulong bandwidth; + guint flags; + + g_variant_get(inArgs, "(&stu)", &disk, &bandwidth, &flags); + + domain = virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainBlockJobSetSpeed(domain, disk, bandwidth, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + static void virtDBusDomainBlockPeek(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1573,6 +1598,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { { "AttachDevice", virtDBusDomainAttachDevice }, { "BlockCommit", virtDBusDomainBlockCommit }, { "BlockJobAbort", virtDBusDomainBlockJobAbort }, + { "BlockJobSetSpeed", virtDBusDomainBlockJobSetSpeed }, { "BlockPeek", virtDBusDomainBlockPeek }, { "BlockPull", virtDBusDomainBlockPull }, { "BlockRebase", virtDBusDomainBlockRebase }, -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list