Esempio n. 1
0
func (d *Domain) HasCurrentSnapshot(flags uint16) (bool, error) {
	result := C.virDomainHasCurrentSnapshot(d.cptr, C.uint(flags))
	if result == -1 {
		return false, GetLastError()
	}

	if result == 1 {
		return true, nil
	}

	return false, nil
}
Esempio n. 2
0
// HasCurrentSnapshot determines if the domain has a current snapshot.
func (dom Domain) HasCurrentSnapshot() (bool, error) {
	dom.log.Println("checking whether domain has current snapshot...")
	cRet := C.virDomainHasCurrentSnapshot(dom.virDomain, 0)
	ret := int32(cRet)

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

	hasCurrentSnapshot := (ret == 1)

	if hasCurrentSnapshot {
		dom.log.Println("domain has current snapshot")
	} else {
		dom.log.Println("domain does not have current snapshot")
	}

	return hasCurrentSnapshot, nil
}