Example #1
0
func (v *VirStorageVol) GetKey() (string, error) {
	key := C.virStorageVolGetKey(v.ptr)
	if key == nil {
		return "", GetLastError()
	}
	return C.GoString(key), nil
}
// Key fetches the storage volume key. This is globally unique, so the same
// volume will have the same key no matter what host it is accessed from.
func (vol StorageVolume) Key() (string, error) {
	vol.log.Println("reading storage volume key...")
	cKey := C.virStorageVolGetKey(vol.virStorageVol)

	if cKey == nil {
		err := LastError()
		vol.log.Printf("an error occurred: %v\n", err)
		return "", err
	}

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

	return key, nil
}