Commit e1867ca7 authored by Katerina Koukiou's avatar Katerina Koukiou

Implement Wipe 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 bd0ec46e
......@@ -30,5 +30,11 @@
<arg name="capacity" type="t" direction="in"/>
<arg name="flags" type="u" direction="in"/>
</method>
<method name="Wipe">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolWipePattern"/>
<arg name="pattern" type="u" direction="in"/>
<arg name="flags" type="u" direction="in"/>
</method>
</interface>
</node>
......@@ -143,6 +143,31 @@ virtDBusStorageVolResize(GVariant *inArgs,
virtDBusUtilSetLastVirtError(error);
}
static void
virtDBusStorageVolWipe(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;
guint pattern;
guint flags;
g_variant_get(inArgs, "(uu)", &pattern, &flags);
storageVol = virtDBusStorageVolGetVirStorageVol(connect, objectPath,
error);
if (!storageVol)
return;
if (virStorageVolWipePattern(storageVol, pattern, flags) < 0)
virtDBusUtilSetLastVirtError(error);
}
static virtDBusGDBusPropertyTable virtDBusStorageVolPropertyTable[] = {
{ "Name", virtDBusStorageVolGetName, NULL },
{ "Key", virtDBusStorageVolGetKey, NULL },
......@@ -153,6 +178,7 @@ static virtDBusGDBusPropertyTable virtDBusStorageVolPropertyTable[] = {
static virtDBusGDBusMethodTable virtDBusStorageVolMethodTable[] = {
{ "GetXMLDesc", virtDBusStorageVolGetXMLDesc },
{ "Resize", virtDBusStorageVolResize },
{ "Wipe", virtDBusStorageVolWipe },
{ 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