[dbus PATCH 10/25] Implement BlockRebase method for Domain Interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
 data/org.libvirt.Domain.xml |  8 ++++++++
 src/domain.c                | 29 +++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 46a6632..f5c7fb0 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -91,6 +91,14 @@
       <arg name="bandwidth" type="t" direction="in"/>
       <arg name="flags" type="u" direction="in"/>
     </method>
+    <method name="BlockRebase">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockRebase"/>
+      <arg name="disk" type="s" direction="in"/>
+      <arg name="base" type="s" direction="in"/>
+      <arg name="bandwidth" type="t" direction="in"/>
+      <arg name="flags" type="u" direction="in"/>
+    </method>
     <method name="Create">
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateWithFlags"/>
diff --git a/src/domain.c b/src/domain.c
index af8cc73..107355e 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -521,6 +521,34 @@ virtDBusDomainBlockPull(GVariant *inArgs,
         virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainBlockRebase(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 *base;
+    gulong bandwidth;
+    guint flags;
+
+    g_variant_get(inArgs, "(&s&stu)", &disk, &base, &bandwidth, &flags);
+    if (g_strcmp0(base, "") == 0)
+        base = NULL;
+
+    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+    if (!domain)
+        return;
+
+    if (virDomainBlockRebase(domain, disk, base, bandwidth, flags) < 0)
+        virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusDomainCreate(GVariant *inArgs,
                      GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -1383,6 +1411,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
     { "BlockJobAbort", virtDBusDomainBlockJobAbort },
     { "BlockPeek", virtDBusDomainBlockPeek },
     { "BlockPull", virtDBusDomainBlockPull },
+    { "BlockRebase", virtDBusDomainBlockRebase },
     { "Create", virtDBusDomainCreate },
     { "Destroy", virtDBusDomainDestroy },
     { "DetachDevice", virtDBusDomainDetachDevice },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux