Exemplo n.º 1
0
func (c *VirConnection) StoragePoolDefineXML(xmlConfig string, flags uint32) (VirStoragePool, error) {
	cXml := C.CString(string(xmlConfig))
	defer C.free(unsafe.Pointer(cXml))
	ptr := C.virStoragePoolDefineXML(c.ptr, cXml, C.uint(flags))
	if ptr == nil {
		return VirStoragePool{}, GetLastError()
	}
	return VirStoragePool{ptr: ptr}, nil
}
Exemplo n.º 2
0
func (c *VirConnection) StoragePoolDefineXML(xml string) (VirStoragePool, error) {
	cXML := C.CString(xml)
	defer C.free(unsafe.Pointer(cXML))
	ptr := C.virStoragePoolDefineXML(c.ptr, cXML, 0)
	if ptr == nil {
		return VirStoragePool{}, errors.New(GetLastError())
	}
	return VirStoragePool{ptr: ptr}, nil

}
Exemplo n.º 3
0
// DefineStoragePool defines a new inactive storage pool based on its XML
// description. The pool is persistent, until explicitly undefined.
// "Free" should be used to free the resources after the storage pool object is
// no longer needed.
func (conn Connection) DefineStoragePool(xml string) (StoragePool, error) {
	cXML := C.CString(xml)
	defer C.free(unsafe.Pointer(cXML))

	conn.log.Println("defining storage pool...")
	cPool := C.virStoragePoolDefineXML(conn.virConnect, cXML, 0)

	if cPool == nil {
		err := LastError()
		conn.log.Printf("an error occurred: %v\n", err)
		return StoragePool{}, err
	}

	pool := StoragePool{
		log:            conn.log,
		virStoragePool: cPool,
	}

	conn.log.Println("pool defined")

	return pool, nil
}