On Tue, Jun 12, 2018 at 11:00:23AM +0200, Katerina Koukiou wrote:
Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Connect.xml | 6 ++++++
src/connect.c | 29 +++++++++++++++++++++++++++++
tests/test_connect.py | 1 +
3 files changed, 36 insertions(+)
diff --git a/src/connect.c b/src/connect.c
index c526808..157cdb3 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -1573,6 +1573,34 @@ virtDBusConnectStorageVolLookupByKey(GVariant *inArgs,
*outArgs = g_variant_new("(o)", path);
}
+static void
+virtDBusConnectStorageVolLookupByPath(GVariant *inArgs,
+ GUnixFDList *inFDs G_GNUC_UNUSED,
+ const gchar *objectPath G_GNUC_UNUSED,
+ gpointer userData,
+ GVariant **outArgs,
+ GUnixFDList **outFDs G_GNUC_UNUSED,
+ GError **error)
+{
+ virtDBusConnect *connect = userData;
+ g_autoptr(virStorageVol) storageVol = NULL;
+ g_autofree gchar *path = NULL;
+
+ g_variant_get(inArgs, "(s)", &path);
I'd suggest using a different variable for the input parameter,
e.g.
const gchar *inPath and "(&s)" here, to save g_variant_get the trouble
of strdup-ing the path and us the trouble of freeing it before reusing
the variable for the storage volume object path.
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano
+
+ if (!virtDBusConnectOpen(connect, error))
+ return;
+
+ storageVol = virStorageVolLookupByPath(connect->connection, path);
+ if (!storageVol)
+ return virtDBusUtilSetLastVirtError(error);
+