Exemplo n.º 1
0
func (p *VirStoragePool) IsActive() (bool, error) {
	result := C.virStoragePoolIsActive(p.ptr)
	if result == -1 {
		return false, errors.New(GetLastError())
	}
	if result == 1 {
		return true, nil
	}
	return false, nil
}
Exemplo n.º 2
0
func (p *VirStoragePool) IsActive() bool {
	result := C.virStoragePoolIsActive(p.ptr)
	switch result {
	case -1:
		return false
	case 0:
		return false
	case 1:
		return true
	default:
		return false
	}
}
Exemplo n.º 3
0
// IsActive determines if the storage pool is currently running.
func (pool StoragePool) IsActive() (bool, error) {
	pool.log.Println("checking whether storage pool is active...")
	cRet := C.virStoragePoolIsActive(pool.virStoragePool)
	ret := int32(cRet)

	if ret == -1 {
		err := LastError()
		pool.log.Printf("an error occurred: %v\n", err)
		return false, err
	}

	active := (ret == 1)

	if active {
		pool.log.Println("pool is active")
	} else {
		pool.log.Println("pool is not active")
	}

	return active, nil
}