func (d *VirDomain) Suspend() error { result := C.virDomainSuspend(d.ptr) if result == -1 { return GetLastError() } return nil }
// Suspend suspends an active domain, the process is frozen without further // access to CPU resources and I/O but the memory used by the domain at the // hypervisor level will stay allocated. Use Resume() to reactivate the domain. // This function may require privileged access. Moreover, suspend may not be // supported if domain is in some special state like DomStatePMSuspended. func (dom Domain) Suspend() error { dom.log.Println("suspending domain...") cRet := C.virDomainSuspend(dom.virDomain) ret := int32(cRet) if ret == -1 { err := LastError() dom.log.Printf("an error occurred: %v\n", err) return err } dom.log.Println("domain suspended") return nil }