Hi, I am using virStorageVolDownload to download volumes for the VDSM project. What is the best approch to know domains volume? Is there an api for associating domain to its pool and then to its volumes? I was able to do that by iterating the pools and then iterating all its volume..., is there a better way? Thank you, Shahar Havivi.
Michal Privoznik
2016-Apr-07 07:47 UTC
Re: [libvirt-users] Domain, volume and storage-pool
On 06.04.2016 10:18, Shahar Havivi wrote:> Hi, > > I am using virStorageVolDownload to download volumes for the VDSM project. > What is the best approch to know domains volume? > Is there an api for associating domain to its pool and then to its volumes? > > I was able to do that by iterating the pools and then iterating all its > volume..., is there a better way?You mean you have a domain and you want to get list of all its volumes or vice versa? There's no API for either though. For the former you'll have to dump domain XML and iterate over disks to look up them in libvirt. Just like you do now. For the latter, there's no easy mapping. But I know virt-manager does it somehow. /me goes and looks into the code. https://github.com/virt-manager/virt-manager/blob/master/virtinst/devicedisk.py#L315 So basically it's fetching all the volumes and all domain XMLs and computing the intersection. Michal