[Users] oVirt Python SDK: getting the full filenames of disk images

Исаев Виталий Анатольевич isaev at fintech.ru
Mon Dec 9 07:03:03 UTC 2013

Hi Dan, glad to meet you both on LOR and in this mailing list :)

Unfortunately ovirtsdk.infrastructure.brokers.<anything> classes instances miss information about the higher objects very often. The typical situation is returning of empty string when we ask something about the parent from the child object ("child" and "parent" in terms Red Hat Enterprise Virtualization objects hierarchy). Consider this Python code:

                from ovirtsdk.api import API

                from ovirtsdk.xml import params


                api = API(...)

                d = api.vms.list()[i].get_disks().list()[i]                                                 # ovirtsdk.infrastructure.brokers.VMDisk class instance, i – any number in range(api.vms.list().__len__())

                s = d.get_storage_domains().get_storage_domain()[0]              # ovirtsdk.infrastructure.params.StorageDomain class instance

                t = s.get_data_center()                                                                              # NoneType

So you can see that this approach does not work here.

Our purpose is checking the VM’s disk image integrity (I mean integrity of system files, stored in /boot, /bin, /sbin, /lib etc.) every time the VM starts. The integrity checking script is written in Python and relies on libguestfs and vdsm hooks. Specific vdsm hook runs our script and block the VM’s boot process until the correctness of the system files hash sums will be checked. But libguestfs requires the full path to the disk to be handled, and it’s not integrated with ovirt infrastructure. And here we face with a task of full disk image filenames definition.

Thank you,
Vitaly Isaev
Software engineer
Information security department
Fintech JSC, Moscow, Russia

From: Dan Yasny [mailto:dyasny at gmail.com]
Sent: Friday, December 06, 2013 8:56 PM
To: Исаев Виталий Анатольевич
Cc: users at ovirt.org
Subject: Re: [Users] oVirt Python SDK: getting the full filenames of disk images

Probably not, but you can
- get the disk image UUID (that's the name in the filesystem or LV name),
- get the UUID of the storage domain (that will be the top level dir name or VG name)
- get the DC UUID (this will be the top level dir name and the mount point for LVM)

Then compose the path out of these. Keep in mind that the disk UUID you get is the latest leaf in a snapshot tree, and if you need the entire chain of images, you need to recursively traverse the tree starting at the leaf, using the PUUID tag to find the parent.

Might be a better way, but I'm not aware of it.

Moreover, if you explain why you need to touch those images manually instead of letting ovirt handle everything, we might be able to suggest a better way


On Wed, Dec 4, 2013 at 2:34 AM, Исаев Виталий Анатольевич <isaev at fintech.ru<mailto:isaev at fintech.ru>> wrote:
Dear ovirt-engine users,

I will be appreciated if someone experienced in oVirt Python SDK could advice the method of getting the full filename of the VM’s disk images in the RHEV hypervisor’s file system. Can I get filename with a full file system path from a ovirtsdk.infrastructure.brokers.VMDisk class instance?

If Python SDK (what is preffered) can’t provide such an information, may be it is still possible with RHEV-M REST API?

Thank you,
Vitaly Isaev
Software engineer
Information security department
Fintech JSC, Moscow, Russia

Users mailing list
Users at ovirt.org<mailto:Users at ovirt.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20131209/dd4714d4/attachment-0001.html>

More information about the Users mailing list