Ejemplo n.º 1
0
func (d *VirDomain) IsActive() bool {
	result := C.virDomainIsActive(d.ptr)
	if result == -1 {
		return false
	}
	if result == 1 {
		return true
	}
	return false
}
Ejemplo n.º 2
0
func (d *VirDomain) IsActive() (bool, error) {
	result := C.virDomainIsActive(d.ptr)
	if result == -1 {
		return false, GetLastError()
	}
	if result == 1 {
		return true, nil
	}
	return false, nil
}
Ejemplo n.º 3
0
// IsActive determines if the domain is currently running.
func (dom Domain) IsActive() (bool, error) {
	dom.log.Println("checking whether domain is active...")
	cRet := C.virDomainIsActive(dom.virDomain)
	ret := int32(cRet)

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

	active := (ret == 1)

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

	return active, nil
}