func (c *VirConnection) LookupStoragePoolByUUIDString(uuid string) (VirStoragePool, error) { cUuid := C.CString(uuid) defer C.free(unsafe.Pointer(cUuid)) ptr := C.virStoragePoolLookupByUUIDString(c.ptr, cUuid) if ptr == nil { return VirStoragePool{}, GetLastError() } return VirStoragePool{ptr: ptr}, nil }
// LookupStoragePoolByUUID fetches a storage pool based on its globally // unique id. // "Free" should be used to free the resources after the storage pool object is // no longer needed. func (conn Connection) LookupStoragePoolByUUID(uuid string) (StoragePool, error) { cUUID := C.CString(uuid) defer C.free(unsafe.Pointer(cUUID)) conn.log.Printf("looking up storage pool with UUID = %v\n", uuid) cPool := C.virStoragePoolLookupByUUIDString(conn.virConnect, cUUID) if cPool == nil { err := LastError() conn.log.Printf("an error occurred: %v\n", err) return StoragePool{}, err } conn.log.Println("pool found") pool := StoragePool{ log: conn.log, virStoragePool: cPool, } return pool, nil }