<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:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
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;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Текст выноски Знак";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-US;}
span.a
        {mso-style-name:"Текст Знак";
        mso-style-priority:99;
        mso-style-link:Текст;
        font-family:"Calibri","sans-serif";}
span.a0
        {mso-style-name:"Текст выноски Знак";
        mso-style-priority:99;
        mso-style-link:"Текст выноски";
        font-family:"Tahoma","sans-serif";}
span.hps
        {mso-style-name:hps;}
span.shorttext
        {mso-style-name:short_text;}
.MsoChpDefault
        {mso-style-type:export-only;
        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;}
/* List Definitions */
@list l0
        {mso-list-id:1383016826;
        mso-list-type:hybrid;
        mso-list-template-ids:-238923374 68747279 68747289 68747291 68747279 68747289 68747291 68747279 68747289 68747291;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1
        {mso-list-id:2115705428;
        mso-list-type:hybrid;
        mso-list-template-ids:-1894639670 68747279 68747289 68747291 68747279 68747289 68747291 68747279 68747289 68747291;}
@list l1:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></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="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><span style="mso-fareast-language:RU">-----Original Message-----<br>
From: Federico Simoncelli [mailto:fsimonce@redhat.com] <br>
Sent: Friday, January 17, 2014 9:04 PM<br>
To: libguestfs@redhat.com<br>
Cc: Исаев Виталий Анатольевич<br>
Subject: Re: [Libguestfs] Libguestfs can't launch with one of the disk images in the RHEV cluster</span></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">----- Original Message -----<o:p></o:p></p>
<p class="MsoPlainText">> From: "Richard W.M. Jones" <<a href="mailto:rjones@redhat.com"><span style="color:windowtext;text-decoration:none">rjones@redhat.com</span></a>><o:p></o:p></p>
<p class="MsoPlainText">> To: "Исаев Виталий Анатольевич" <<a href="mailto:isaev@fintech.ru"><span style="color:windowtext;text-decoration:none">isaev@fintech.ru</span></a>><o:p></o:p></p>
<p class="MsoPlainText">> Cc: <a href="mailto:libguestfs@redhat.com"><span style="color:windowtext;text-decoration:none">libguestfs@redhat.com</span></a><o:p></o:p></p>
<p class="MsoPlainText">> Sent: Tuesday, January 14, 2014 6:42:23 PM<o:p></o:p></p>
<p class="MsoPlainText">> Subject: Re: [Libguestfs] Libguestfs can't launch with one of the disk
<o:p></o:p></p>
<p class="MsoPlainText">> images in the RHEV cluster<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> On Tue, Jan 14, 2014 at 02:57:35PM +0000, Исаев Виталий Анатольевич wrote:<o:p></o:p></p>
<p class="MsoPlainText">> This works because you're accessing the backing disk, not the top
<o:p></o:p></p>
<p class="MsoPlainText">> disk.  Since the backing disk (in this case) doesn't itself have a
<o:p></o:p></p>
<p class="MsoPlainText">> backing disk, qemu has no problem opening it.<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> > Now I’m a little bit confused with the results of my research. I
<o:p></o:p></p>
<p class="MsoPlainText">> > found that VM with the only disk attached has at least two block
<o:p></o:p></p>
<p class="MsoPlainText">> > devices mapped to the hypervisor’s file system in fact – I mean<o:p></o:p></p>
<p class="MsoPlainText">> > /dev/dm-19 (raw) and /dev/dm-30 (qcow2). The RHEV-M API (aka Python
<o:p></o:p></p>
<p class="MsoPlainText">> > oVirt SDK) provides no info about the first one, but the second
<o:p></o:p></p>
<p class="MsoPlainText">> > cannot be accessed from libguestfs.  I have an urgent need to work
<o:p></o:p></p>
<p class="MsoPlainText">> > with a chosen VM disk images through the libguestfs layer, but I
<o:p></o:p></p>
<p class="MsoPlainText">> > don’t know which images belong to every VM exactly. It seems like
<o:p></o:p></p>
<p class="MsoPlainText">> > I’m going the hard way :) Sincerely,<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> Basically you need to find out which directory RHEV-M itself starts
<o:p></o:p></p>
<p class="MsoPlainText">> qemu in.  Try going onto the node and doing:<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">>   ps ax | grep qemu<o:p></o:p></p>
<p class="MsoPlainText">>   ls -l /proc/PID/cwd<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> substituting PID for some of the qemu process IDs.<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> My guess would be some subdirectory of /rhev/data-center/mnt/blockSD/<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Yes, the full path to the images is:<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">/rhev/data-center/mnt/blockSD/<sdUUID>/images/<imgUUID>/<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">sdUUID is the uuid of the storage domain (vg name) where the images are stored and imgUUID is the uuid of the image (as reported in the "Disks" tab in the webadmin).<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">The symlinks and the LVs are managed by vdsm (activated when the VM starts, deactivated as soon as the VM is stopped).<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">If you just want to access these images once and you're sure that they are not in use you could activate the relevant LVs and create the symlinks yourself on any machine (no need of oVirt/vdsm), e.g.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">/tmp/ovirt-images/<imgUUID>/<volUUID1> -> /dev/dm-xx  /tmp/ovirt-images/<imgUUID>/<volUUID2> -> /dev/dm-xx  /tmp/ovirt-images/<imgUUID>/<volUUID3> -> /dev/dm-xx<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">this could even be automated eventually (from the qemu-img output).<o:p></o:p></p>
<p class="MsoPlainText">If instead you're trying to integrate with oVirt and you need a more reliable/automated solution I invite you start a thread on the oVirt mailing list.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">The imgUUIDs can be found also with: lvs -o +tags looking for the tags starting with "IU_".<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">--<o:p></o:p></p>
<p class="MsoPlainText">Federico<span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US" style="color:black"><o:p> </o:p></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span lang="EN-US" style="color:black">Hello, Federico, thank you for your reply and invitation.
<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span lang="EN-US" style="color:black"><o:p> </o:p></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span class="hps"><span lang="EN">I'm working on the project of RHEV enforcement. I’m trying to</span></span><span lang="EN">
<span class="hps">develop a program that</span> <span class="hps">will monitor</span>
<span class="hps">the integrity of the</span> <span class="hps">files stored on the</span>
<span class="hps">virtual machine disk</span> <span class="hps">images</span>. There are several conditions for the RHEV environment:<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin-left:71.4pt;text-indent:-18.0pt;mso-list:l1 level1 lfo1">
<![if !supportLists]><span lang="EN"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><![endif]><span lang="EN">We have a fixed number of the VMs that will not change after the RHEV HA cluster deployment;<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin-left:71.4pt;text-indent:-18.0pt;mso-list:l1 level1 lfo1">
<![if !supportLists]><span lang="EN"><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><![endif]><span lang="EN">VM’s key system directories [‘/bin’, ’/sbin’, ’/lib’, ’boot’ etc.] content must not change after cluster deployment;<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin-left:71.4pt;text-indent:-18.0pt;mso-list:l1 level1 lfo1">
<![if !supportLists]><span lang="EN"><span style="mso-list:Ignore">3.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><![endif]><span lang="EN">Checksums of the files from system directories must be compared to the initial checksums (computed after the cluster deployment) every time when VM is starting;<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span lang="EN"><o:p> </o:p></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span lang="EN">So what I am trying to do is just:<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin-left:71.4pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2">
<![if !supportLists]><span lang="EN"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><![endif]><span lang="EN">To define which disk belongs to every VM;                                                                                                                                                                                   
 //python oVirt SDK                        <o:p></o:p></span></p>
<p class="MsoPlainText" style="margin-left:71.4pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2">
<![if !supportLists]><span lang="EN"><span style="mso-list:Ignore">2.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><![endif]><span lang="EN">To write deployment script that will compute the initial checksums of the VMs;                                                                                                          //libguestfs<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin-left:71.4pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2">
<![if !supportLists]><span lang="EN"><span style="mso-list:Ignore">3.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><![endif]><span lang="EN">To store these sums on every RHEV-H (ovirt-node in terms of oVirt?) locally;<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin-left:71.4pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2">
<![if !supportLists]><span lang="EN"><span style="mso-list:Ignore">4.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><![endif]><span lang="EN">To write hook script that will provide the comparation of existing checksums and initial checksums every time when VM is starting.   //vdsm hooks, libguestfs<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span lang="EN"><o:p> </o:p></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span lang="EN">So you can see that libguestfs is a base tool for this part of system but in some cases it cannot work with disk images properly (I described them here:
<a href="https://bugzilla.redhat.com/show_bug.cgi?id=1053684">https://bugzilla.redhat.com/show_bug.cgi?id=1053684</a>,
<a href="https://www.redhat.com/archives/libguestfs/2014-January/msg00175.html)">
https://www.redhat.com/archives/libguestfs/2014-January/msg00175.html)</a>. Probably
<span class="hps">I use</span><span class="shorttext"> </span><span class="hps">the library</span><span class="shorttext">
</span><span class="hps">in the wrong way and this causes all the issues… <o:p></o:p></span></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span class="hps"><span lang="EN"><o:p> </o:p></span></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span class="hps"><span lang="EN">Honestly speaking I don’t know if the functionality that I have just described</span></span><span lang="EN"> should integrate with oVirt or it rather should be a standalone
 solution. I would be glad <span class="hps">if</span><span class="shorttext"> </span>
<span class="hps">you could comment this problem. <o:p></o:p></span></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span class="hps"><span lang="EN">Thank you.
<o:p></o:p></span></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span class="hps"><span lang="EN"><o:p> </o:p></span></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span class="hps"><span lang="EN">Sincerely,<o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt;mso-fareast-language:RU">Vitaly Isaev<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt;color:gray;mso-fareast-language:RU">Software engineer<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt;color:gray;mso-fareast-language:RU">Information security department<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="EN-US" style="font-size:10.0pt;color:gray;mso-fareast-language:RU">Fintech JSC, Moscow, Russia<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoPlainText"><span lang="EN"><o:p> </o:p></span></p>
</div>
</body>
</html>