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 fdde430..aed3f7a 100644 --- a/data/org.libvirt.StorageVol.xml +++ b/data/org.libvirt.StorageVol.xml @@ -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> diff --git a/src/storagevol.c b/src/storagevol.c index 44965a9..7bfe39e 100644 --- a/src/storagevol.c +++ b/src/storagevol.c @@ -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 } }; -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list