Commit bd0ec46e authored by Katerina Koukiou's avatar Katerina Koukiou

Implement Resize method for StorageVol Interface

Signed-off-by: default avatarKaterina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Jano Tomko's avatarJán Tomko <jtomko@redhat.com>
parent 36c1f8cd
......@@ -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>
......@@ -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 }
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment