Exemplo n.º 1
0
func (d *VirDomain) DestroyFlags(flags uint) error {
	result := C.virDomainDestroyFlags(d.ptr, C.uint(flags))
	if result == -1 {
		return GetLastError()
	}
	return nil
}
Exemplo n.º 2
0
func (h *Hypervisor) DestroyDomain(domain *Domain, flags uint) error {
	result := C.virDomainDestroyFlags(domain.cptr, C.uint(flags))
	if result == -1 {
		return GetLastError()
	}

	domain = nil

	return nil
}
Exemplo n.º 3
0
// Destroy destroys the domain object. The running instance is shutdown if not
// down already and all resources used by it are given back to the hypervisor.
// This does not free the associated virDomainPtr object. This function may
// require privileged access.
func (dom Domain) Destroy(flags DomainDestroyFlag) error {
	dom.log.Printf("destroying domain (flags = %v)...\n", flags)
	cRet := C.virDomainDestroyFlags(dom.virDomain, C.uint(flags))
	ret := int32(cRet)

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

	dom.log.Println("domain destroyed")

	return nil
}