You can use the all_disks_for_vms view, instead of all_disks. Then add the vm_id and / or vm_names columns.

For example:

/usr/share/ovirt-engine/dbscripts/engine-psql.sh -c "select disk_id,image_guid,disk_alias,disk_profile_name,vm_id,vm_names from all_disks_for_vms where disk_content_type='0' order by disk_alias" > /root/disk_ids-to_vms.txt

-Patrick Hibbs


On Sun, 2022-06-05 at 16:16 +0200, Gianluca Cecchi wrote:


On Mon, May 30, 2022 at 4:44 PM _isi _ <uli.iske@elkb.de> wrote:
Do you mean something like this ?

/usr/share/ovirt-engine/dbscripts/engine-psql.sh -c "select disk_id,image_guid,disk_alias,disk_profile_name from all_disks where disk_content_type='0' order by disk_alias" > /root/disk_ids-to_vms.txt

isi
_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-leave@ovirt.org
Privacy Statement: https://www.ovirt.org/privacy-policy.html
oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/
List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/3FBFDABUYYTMVWQGJWRKAXESO3S67JWO/


partially, because in my case if I take a VM with VM ID 711e5dc6-04a1-42a4-b52c-96685bc19b1f

It has 3 disks, one of which has the alias ostack-ceph1_Disk3

the query for this disk gives
 select disk_id,image_guid,disk_alias,disk_profile_name from all_disks where disk_content_type='0' order by disk_alias;
. . .
 1093ada3-65b2-407a-a6b8-fd9529f4a0db | ded7c7c7-477f-44e3-8ac5-8908bde6340c | ostack-ceph1_Disk3   | 2t_1

And I get under /2t_1

/2t_1/images/caa6fd69-e371-4476-89eb-cbbae82c2add/images

# ll | grep 1093
drwxr-xr-x. 2 vdsm kvm 4096 Apr 20  2021 1093ada3-65b2-407a-a6b8-fd9529f4a0db
#

# cd 1093ada3-65b2-407a-a6b8-fd9529f4a0db/
# ll
total 156872396
-rw-rw----. 1 vdsm kvm 161061273600 Apr 30  2021 ded7c7c7-477f-44e3-8ac5-8908bde6340c
-rw-r--r--. 1 vdsm kvm          289 Apr 20  2021 ded7c7c7-477f-44e3-8ac5-8908bde6340c.meta
#

but I miss the link between the id of the VM and the disk, that is what I would like to get

_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-leave@ovirt.org
Privacy Statement: https://www.ovirt.org/privacy-policy.html
oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/
List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/BJ5J4KNMMZ4PNWAYHAC36AW7T4W4ICZU/