Signed-off-by: Katerina Koukiou
---
data/org.libvirt.StoragePool.xml | 6 ++
src/storagepool.c| 34 ++
2 files changed, 40 insertions(+)
diff --git a/data/org.libvirt.StoragePool.xml b/data/org.libvirt.StoragePool.xml
index 51d65ab..161ade5 100644
--- a/data/org.libvirt.StoragePool.xml
+++ b/data/org.libvirt.StoragePool.xml
@@ -75,6 +75,12 @@
+
+ https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolLookupByName"/>
+
+
+
https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolUndefine"/>
diff --git a/src/storagepool.c b/src/storagepool.c
index c3fd0bf..55077ed 100644
--- a/src/storagepool.c
+++ b/src/storagepool.c
@@ -401,6 +401,39 @@ virtDBusStoragePoolStorageVolCreateXML(GVariant *inArgs,
*outArgs = g_variant_new("(o)", path);
}
+static void
+virtDBusStoragePoolStorageVolLookupByName(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(virStoragePool) storagePool = NULL;
+g_autoptr(virStorageVol) storageVol = NULL;
+g_autofree gchar *path = NULL;
+const gchar *name;
+
+g_variant_get(inArgs, "()", );
+
+storagePool = virtDBusStoragePoolGetVirStoragePool(connect, objectPath,
+ error);
+if (!storagePool)
+return;
+
+storageVol = virStorageVolLookupByName(storagePool, name);
+
+if (!storageVol)
+return virtDBusUtilSetLastVirtError(error);
+
+path = virtDBusUtilBusPathForVirStorageVol(storageVol,
+ connect->storageVolPath);
+
+*outArgs = g_variant_new("(o)", path);
+}
+
static void
virtDBusStoragePoolUndefine(GVariant *inArgs G_GNUC_UNUSED,
GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -442,6 +475,7 @@ static virtDBusGDBusMethodTable
virtDBusStoragePoolMethodTable[] = {
{ "ListStorageVolumes", virtDBusStoragePoolListAllVolumes },
{ "Refresh", virtDBusStoragePoolRefresh },
{ "StorageVolCreateXML", virtDBusStoragePoolStorageVolCreateXML },
+{ "StorageVolLookupByName", virtDBusStoragePoolStorageVolLookupByName },
{ "Undefine", virtDBusStoragePoolUndefine },
{ 0 }
};
--
2.15.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list