Exemple #1
0
func (d *VirDomain) Create() error {
	result := C.virDomainCreate(d.ptr)
	if result == -1 {
		return GetLastError()
	}
	return nil
}
Exemple #2
0
func (d *Domain) Start() error {
	result := C.virDomainCreate(d.cptr)
	if result == -1 {
		return GetLastError()
	}

	return nil
}
Exemple #3
0
func (c *VirConnection) CreateAndBootNewDomain(xml string) (VirDomain, error) {
	cXml := C.CString(xml)
	defer C.free(unsafe.Pointer(cXml))

	cDomainPtr := C.virDomainDefineXML(c.ptr, cXml)
	if cDomainPtr == nil {
		return VirDomain{}, errors.New(GetLastError())
	}

	result := C.virDomainCreate(cDomainPtr)
	if result == -1 {
		return VirDomain{}, errors.New(GetLastError())
	}

	return VirDomain{ptr: cDomainPtr}, nil
}