Commit b8570d18 authored by Daniel P. Berrangé's avatar Daniel P. Berrangé

Add support for virStoragePoolLookupByTargetPath API

Signed-off-by: 's avatarDaniel P. Berrangé <berrange@redhat.com>
parent 77299c9e
......@@ -1202,6 +1202,20 @@ func (c *Connect) LookupStoragePoolByUUID(uuid []byte) (*StoragePool, error) {
return &StoragePool{ptr: ptr}, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolLookupByTargetPath
func (c *Connect) LookupStoragePoolByTargetPath(path string) (*StoragePool, error) {
if C.LIBVIR_VERSION_NUMBER < 4001000 {
return nil, GetNotImplementedError("virStoragePoolLookupByTargetPath")
}
cPath := C.CString(path)
defer C.free(unsafe.Pointer(cPath))
ptr := C.virStoragePoolLookupByTargetPathCompat(c.ptr, cPath)
if ptr == nil {
return nil, GetLastError()
}
return &StoragePool{ptr: ptr}, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterDefineXML
func (c *Connect) NWFilterDefineXML(xmlConfig string) (*NWFilter, error) {
cXml := C.CString(string(xmlConfig))
......
......@@ -116,5 +116,16 @@ virDomainPtr virDomainDefineXMLFlagsCompat(virConnectPtr conn,
#endif
}
virStoragePoolPtr virStoragePoolLookupByTargetPathCompat(virConnectPtr conn,
const char *path)
{
#if LIBVIR_VERSION_NUMBER < 4001000
assert(0); // Caller should have checked version
#else
return virStoragePoolLookupByTargetPath(conn, path);
#endif
}
*/
import "C"
......@@ -212,4 +212,9 @@ virDomainPtr virDomainDefineXMLFlagsCompat(virConnectPtr conn,
#define VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV 1 << 15
#endif
/* 4.1.0 */
virStoragePoolPtr virStoragePoolLookupByTargetPathCompat(virConnectPtr conn,
const char *path);
#endif /* LIBVIRT_GO_CONNECT_COMPAT_H__ */
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