Commit 10f1e1f7 authored by Katerina Koukiou's avatar Katerina Koukiou

Implement StorageVolLookupByName method for StoragePool Interface

Signed-off-by: default avatarKaterina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Jano Tomko's avatarJán Tomko <jtomko@redhat.com>
parent 155d3424
......@@ -75,6 +75,12 @@
<arg name="flags" type="u" direction="in"/>
<arg name="storageVol" type="o" direction="out"/>
</method>
<method name="StorageVolLookupByName">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolLookupByName"/>
<arg name="name" type="s" direction="in"/>
<arg name="storageVol" type="o" direction="out"/>
</method>
<method name="Undefine">
<annotation name="org.gtk.GDBus.DocString"
value="See https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolUndefine"/>
......
......@@ -400,6 +400,39 @@ virtDBusStoragePoolStorageVolCreateXML(GVariant *inArgs,
*outArgs = g_variant_new("(o)", path);
}
static void
virtDBusStoragePoolStorageVolLookupByName(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
const gchar *objectPath,
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, "(&s)", &name);
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,
......@@ -441,6 +474,7 @@ static virtDBusGDBusMethodTable virtDBusStoragePoolMethodTable[] = {
{ "ListStorageVolumes", virtDBusStoragePoolListStorageVolumes },
{ "Refresh", virtDBusStoragePoolRefresh },
{ "StorageVolCreateXML", virtDBusStoragePoolStorageVolCreateXML },
{ "StorageVolLookupByName", virtDBusStoragePoolStorageVolLookupByName },
{ "Undefine", virtDBusStoragePoolUndefine },
{ 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