<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Текст Знак";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.a
        {mso-style-name:"Текст Знак";
        mso-style-priority:99;
        mso-style-link:Текст;
        font-family:"Calibri","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:2.0cm 42.5pt 2.0cm 3.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="RU" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi Dan, glad to meet you both on LOR and in this mailing list :)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">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:<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"> from ovirtsdk.api import API<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"> from ovirtsdk.xml import params<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"> ...<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"> api = API(...)<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"> d = api.vms.list()[i].get_disks().list()[i] # ovirtsdk.infrastructure.brokers.VMDisk class instance, i – any number in range(api.vms.list().__len__())<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"> s = d.get_storage_domains().get_storage_domain()[0] # ovirtsdk.infrastructure.params.StorageDomain class instance<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"> t = s.get_data_center() # NoneType<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">So you can see that this approach does not work here.
<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">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.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thank you,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Vitaly Isaev<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:gray">Software engineer<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:gray">Information security department<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:gray">Fintech JSC, Moscow, Russia<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Dan Yasny [mailto:dyasny</span><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">@gmail.com]
<br>
<b>Sent:</b> Friday, December 06, 2013 8:56 PM<br>
<b>To:</b> Исаев Виталий Анатольевич<br>
<b>Cc:</b> users@ovirt.org<br>
<b>Subject:</b> Re: [Users] oVirt Python SDK: getting the full filenames of disk images<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Probably not, but you can <o:p></o:p></p>
<div>
<p class="MsoNormal">- get the disk image UUID (that's the name in the filesystem or LV name), <o:p></o:p></p>
<div>
<p class="MsoNormal">- get the UUID of the storage domain (that will be the top level dir name or VG name) <o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal">- get the DC UUID (this will be the top level dir name and the mount point for LVM)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Might be a better way, but I'm not aware of it.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">--<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">D<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Wed, Dec 4, 2013 at 2:34 AM, Исаев Виталий Анатольевич <<a href="mailto:isaev@fintech.ru" target="_blank">isaev@fintech.ru</a>> wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">Dear ovirt-engine users,
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">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?</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">If Python SDK (what is preffered) can’t provide such an information, may be it is still possible with RHEV-M REST API?</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">Thank you,
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:10.0pt">Vitaly Isaev</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:10.0pt;color:gray">Software engineer</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:10.0pt;color:gray">Information security department</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-size:10.0pt;color:gray">Fintech JSC, Moscow, Russia</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@ovirt.org">Users@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/users" target="_blank">http://lists.ovirt.org/mailman/listinfo/users</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>