示例#1
0
func (d *VirDomain) IsPersistent() (bool, error) {
	result := C.virDomainIsPersistent(d.ptr)
	if result == -1 {
		return false, GetLastError()
	}
	if result == 1 {
		return true, nil
	}
	return false, nil
}
示例#2
0
// IsPersistent determines if the domain has a persistent configuration which
// means it will still exist after shutting down
func (dom Domain) IsPersistent() (bool, error) {
	dom.log.Println("checking whether domain is persistent...")
	cRet := C.virDomainIsPersistent(dom.virDomain)
	ret := int32(cRet)

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

	persistent := (ret == 1)

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

	return persistent, nil
}