コード例 #1
0
ファイル: storage_volume.go プロジェクト: ericcapricorn/flynn
func (v *VirStorageVol) GetKey() (string, error) {
	key := C.virStorageVolGetKey(v.ptr)
	if key == nil {
		return "", GetLastError()
	}
	return C.GoString(key), nil
}
コード例 #2
0
// 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
}