예제 #1
0
func (v *VirStorageVol) GetPath() (string, error) {
	result := C.virStorageVolGetPath(v.ptr)
	if result == nil {
		return "", GetLastError()
	}
	path := C.GoString(result)
	C.free(unsafe.Pointer(result))
	return path, nil
}
예제 #2
0
// Path fetches the storage volume path. Depending on the pool configuration
// this is either persistent across hosts, or dynamically assigned at pool
// startup. Consult pool documentation for information on getting the
// persistent naming.
func (vol StorageVolume) Path() (string, error) {
	vol.log.Println("reading storage volume path...")
	cPath := C.virStorageVolGetPath(vol.virStorageVol)

	if cPath == nil {
		err := LastError()
		vol.log.Printf("an error occurred: %v\n", err)
		return "", err
	}
	defer C.free(unsafe.Pointer(cPath))

	path := C.GoString(cPath)
	vol.log.Printf("path: %v\n", path)

	return path, nil
}