Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx> --- data/org.libvirt.StorageVol.xml | 6 ++++++ src/storagevol.c | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/data/org.libvirt.StorageVol.xml b/data/org.libvirt.StorageVol.xml index c1fecf3..fdde430 100644 --- a/data/org.libvirt.StorageVol.xml +++ b/data/org.libvirt.StorageVol.xml @@ -24,5 +24,11 @@ <arg name="flags" type="u" direction="in"/> <arg name="xml" type="s" direction="out"/> </method> + <method name="Resize"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolResize"/> + <arg name="capacity" type="t" direction="in"/> + <arg name="flags" type="u" direction="in"/> + </method> </interface> </node> diff --git a/src/storagevol.c b/src/storagevol.c index fb66dd0..44965a9 100644 --- a/src/storagevol.c +++ b/src/storagevol.c @@ -118,6 +118,31 @@ virtDBusStorageVolGetXMLDesc(GVariant *inArgs, *outArgs = g_variant_new("(s)", xml); } +static void +virtDBusStorageVolResize(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(virStorageVol) storageVol = NULL; + guint64 capacity; + guint flags; + + g_variant_get(inArgs, "(tu)", &capacity, &flags); + + storageVol = virtDBusStorageVolGetVirStorageVol(connect, objectPath, + error); + if (!storageVol) + return; + + if (virStorageVolResize(storageVol, capacity, flags) < 0) + virtDBusUtilSetLastVirtError(error); +} + static virtDBusGDBusPropertyTable virtDBusStorageVolPropertyTable[] = { { "Name", virtDBusStorageVolGetName, NULL }, { "Key", virtDBusStorageVolGetKey, NULL }, @@ -127,6 +152,7 @@ static virtDBusGDBusPropertyTable virtDBusStorageVolPropertyTable[] = { static virtDBusGDBusMethodTable virtDBusStorageVolMethodTable[] = { { "GetXMLDesc", virtDBusStorageVolGetXMLDesc }, + { "Resize", virtDBusStorageVolResize }, { 0 } }; -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list