Exemple #1
0
func createRemoteBootPool(conn libvirt.VirConnection) (libvirt.VirStoragePool, error) {
	// Test volume pool
	// create vol from pool and Upload
	var pool libvirt.VirStoragePool
	pool, err := conn.StoragePoolLookupByName("boot-scratch")
	if err != nil {
		// pool not existed
		// create on pool named "boot-scrath"
		// TODO
		log.Println("pool not exist")
		//poolXML, _:= ioutil.ReadFile("./pool.xml")
		poolXML := POOXML
		pool, err = conn.StoragePoolDefineXML(string(poolXML))
		if err != nil {
			return libvirt.VirStoragePool{}, err
		}
	}
	return pool, nil
}