Please see reply inline
On Mon, Dec 9, 2013 at 12:03 AM, Исаев Виталий Анатольевич <isaev(a)fintech.ru
wrote:
Hi Dan, glad to meet you both on LOR and in this mailing list :)
I know, I'm everywhere :)
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.
I hope Michael or Itamar can shed some more light on this part, I don't
have a system in front of me to check. AFAIR some objects aren't linked
directly and you simply need to know how to get to them, I've had plenty of
help from Michael before, when I was running a seemingly correct script,
and getting no data, simply because I didn't understand the way the API
looks for objects and relationships.
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.
I assume you are using before_vm_start? This will catch the VM definitions,
as passed by the engine, and allow you to reassemble the domxml. You can
get the disk path from the domxml directly, bypassing the engine APIs
completely.
The problem however, if you are doing this on block storage, is that the
right LV will not be prepared for use by vdsm at this point, so you'll have
to make it accessible manually, then disable access and let vdsm do it's
job. Much easier with NFS/Gluster of course.
>
>
> Thank you,
>
> Vitaly Isaev
>
> Software engineer
>
> Information security department
>
> Fintech JSC, Moscow, Russia
>
>
>
> *From:* Dan Yasny [mailto:dyasny@gmail.com]
> *Sent:* Friday, December 06, 2013 8:56 PM
> *To:* Исаев Виталий Анатольевич
> *Cc:* users(a)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
>
>
>
> --
>
> D
>
>
>
> On Wed, Dec 4, 2013 at 2:34 AM, Исаев Виталий Анатольевич <
> isaev(a)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(a)ovirt.org
>
http://lists.ovirt.org/mailman/listinfo/users
>
>
>