<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;}
/* 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;}
span.a
        {mso-style-name:"Текст Знак";
        mso-style-priority:99;
        mso-style-link:Текст;
        font-family:"Calibri","sans-serif";}
.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;}
--></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"><span style="mso-fareast-language:RU"><o:p> </o:p></span></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><span style="mso-fareast-language:RU">-----Original Message-----<br>
From: Richard W.M. Jones [mailto:rjones@redhat.com] <br>
Sent: Tuesday, January 14, 2014 4:42 PM<br>
To: Исаев Виталий Анатольевич<br>
Cc: libguestfs@redhat.com<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">On Tue, Jan 14, 2014 at 08:07:43AM +0000, Исаев Виталий Анатольевич wrote:<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">> [00072ms] /usr/libexec/qemu-kvm \<o:p></o:p></p>
<p class="MsoPlainText">>     -global virtio-blk-pci.scsi=off \<o:p></o:p></p>
<p class="MsoPlainText">>     -nodefconfig \<o:p></o:p></p>
<p class="MsoPlainText">>     -nodefaults \<o:p></o:p></p>
<p class="MsoPlainText">>     -nographic \<o:p></o:p></p>
<p class="MsoPlainText">>     -drive file=/dev/mapper/1a9aa971--f81f--4ad8--932f--607034c924fc-666faa62--da73--4465--aed2--912119fcf67f,snapshot=on,if=virtio \<o:p></o:p></p>
<p class="MsoPlainText">>     -nodefconfig \<o:p></o:p></p>
<p class="MsoPlainText">>     -machine accel=kvm:tcg \<o:p></o:p></p>
<p class="MsoPlainText">>     -m 500 \<o:p></o:p></p>
<p class="MsoPlainText">>     -no-reboot \<o:p></o:p></p>
<p class="MsoPlainText">>     -device virtio-serial \<o:p></o:p></p>
<p class="MsoPlainText">>     -serial stdio \<o:p></o:p></p>
<p class="MsoPlainText">>     -device sga \<o:p></o:p></p>
<p class="MsoPlainText">>     -chardev socket,path=/tmp/libguestfs2yVhoH/guestfsd.sock,id=channel0 \<o:p></o:p></p>
<p class="MsoPlainText">>     -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \<o:p></o:p></p>
<p class="MsoPlainText">>     -kernel /var/tmp/.guestfs-0/kernel.3269 \<o:p></o:p></p>
<p class="MsoPlainText">>     -initrd /var/tmp/.guestfs-0/initrd.3269 \<o:p></o:p></p>
<p class="MsoPlainText">>     -append 'panic=1 console=ttyS0 udevtimeout=300 no_timer_check acpi=off printk.time=1 cgroup_disable=memory selinux=0 guestfs_verbose=1 TERM=xterm ' \<o:p></o:p></p>
<p class="MsoPlainText">>     -drive <o:p></o:p></p>
<p class="MsoPlainText">> file=/var/tmp/.guestfs-0/root.3269,snapshot=on,if=virtio,cache=unsafeq<o:p></o:p></p>
<p class="MsoPlainText">> emu-kvm: -drive <o:p></o:p></p>
<p class="MsoPlainText">> file=/dev/mapper/1a9aa971--f81f--4ad8--932f--607034c924fc-666faa62--da<o:p></o:p></p>
<p class="MsoPlainText">> 73--4465--aed2--912119fcf67f,snapshot=on,if=virtio: could not open
<o:p></o:p></p>
<p class="MsoPlainText">> disk image <o:p></o:p></p>
<p class="MsoPlainText">> /dev/mapper/1a9aa971--f81f--4ad8--932f--607034c924fc-666faa62--da73--4<o:p></o:p></p>
<p class="MsoPlainText">> 465--aed2--912119fcf67f: No such file or directory<o:p></o:p></p>
<p class="MsoPlainText">> libguestfs: child_cleanup: 0x23dc5d0: child process died<o:p></o:p></p>
<p class="MsoPlainText">> libguestfs: trace: launch = -1 (error)<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">libguestfs runs qemu with the command line above.  qemu tries to open the /dev/mapper/1a9... file.  qemu reports that it cannot open that file.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Unfortunately qemu's error messages are very poor.  However there are a few possibilities:<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(a) An actual permissions issue.  Since you seem to be running this as root, this doesn't seem to be likely, but you should check that anyway.  Are there SELinux AVCs?<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(b) qemu cannot open the backing file.  Try running:<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">  qemu-img info /dev/mapper/1a9...<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">and if it has a backing file, check that the backing file(s) [recursively] can be opened too.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(c) Also check that the backing file paths are not relative.  If they are you will need to run your script from the correct directory so that the relative paths are accessible.<o:p></o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><o:p> </o:p></p>
<p class="MsoPlainText">Rich.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">--<o:p></o:p></p>
<p class="MsoPlainText">Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/~rjones">
<span style="color:windowtext;text-decoration:none">http://people.redhat.com/~rjones</span></a> virt-p2v converts physical machines to virtual machines.  Boot with a live CD or over the network (PXE) and turn machines into KVM guests.<o:p></o:p></p>
<p class="MsoPlainText"><a href="http://libguestfs.org/virt-v2v"><span style="color:windowtext;text-decoration:none">http://libguestfs.org/virt-v2v</span></a><o:p></o:p></p>
<p class="MsoPlainText"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span lang="EN-US" style="color:black">Dear Rich, thank you for a
</span><span lang="EN-US">prompt reply on my question. <span style="color:black">
The similar problems have been found with all of the rest Thin Provisioned disks in the cluster, while all the Preallocated disks were handled with libguestfs correctly. I guess these issues were caused by (b) and probably (c) reasons:   <o:p></o:p></span></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 lang="EN-US" style="color:black">The backing file of any of the thin provisioned disks does not exist. For instance let’s consider the /dev/mapper/1a9aa971--f81f--4ad8--932f--607034c924fc-666faa62--da73--4465--aed2--912119fcf67f
 symbolic link pointing to /dev/dm-30 :<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">[root@rhevh1 mapper]# pwd<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">/dev/mapper<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">[root@rhevh1 mapper]# qemu-img info 1a9aa971--f81f--4ad8--932f--607034c924fc-666faa62--da73--4465--aed2--912119fcf67f<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">image: 1a9aa971--f81f--4ad8--932f--607034c924fc-666faa62--da73--4465--aed2--912119fcf67f<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">file format: qcow2<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">virtual size: 40G (42949672960 bytes)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">disk size: 0<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">cluster_size: 65536<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">backing file: ../6439863f-2d4e-48ae-a150-f9054650789c/cbe36298-6397-4ffa-ba8c-5f64e90023e5<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">[root@rhevh1 mapper]# ll ../6439863f-2d4e-48ae-a150-f9054650789c/cbe36298-6397-4ffa-ba8c-5f64e90023e5<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">ls: cannot access ../6439863f-2d4e-48ae-a150-f9054650789c/cbe36298-6397-4ffa-ba8c-5f64e90023e5: No such file or directory<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US">Note that <span style="color:black">
/dev/dm-30 is not accessible with libguestfs.</span><o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US" style="color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-US" style="color:black">Now I am trying to find the files with the same name. As a result I receive three symbolic links pointing to /dev/1a9aa971-f81f-4ad8-932f-607034c924fc/cbe36298-6397-4ffa-ba8c-5f64e90023e5:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">[root@rhevh1 mapper]# find / -name cbe36298-6397-4ffa-ba8c-5f64e90023e5<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">/dev/1a9aa971-f81f-4ad8-932f-607034c924fc/cbe36298-6397-4ffa-ba8c-5f64e90023e5<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">/var/lib/stateless/writable/rhev/data-center/mnt/blockSD/1a9aa971-f81f-4ad8-932f-607034c924fc/images/6439863f-2d4e-48ae-a150-f9054650789c/cbe36298-6397-4ffa-ba8c-5f64e90023e5<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">/rhev/data-center/mnt/blockSD/1a9aa971-f81f-4ad8-932f-607034c924fc/images/6439863f-2d4e-48ae-a150-f9054650789c/cbe36298-6397-4ffa-ba8c-5f64e90023e5<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-US" style="color:black">In turn, the /dev/1a9aa971-f81f-4ad8-932f-607034c924fc/cbe36298-6397-4ffa-ba8c-5f64e90023e5 file is a symbolic link which points to the /dev/dm-19<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-US" style="color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-US" style="color:black">At last I am trying to launch libguestfs with block device directly:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">[root@rhevh1 mapper]# qemu-img info /dev/dm-19<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">image: /dev/dm-19<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">file format: raw<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">virtual size: 40G (42949672960 bytes)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">disk size: 0<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">[root@rhevh1 mapper]# python<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">Python 2.6.6 (r266:84292, Oct 12 2012, 14:23:48)
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">Type "help", "copyright", "credits" or "license" for more information.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">>>> import guestfs<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">>>> g = guestfs.GuestFS()<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-indent:35.4pt;text-autospace:none">
<span lang="EN-US" style="font-family:"Courier New"">>>> g.add_drive_opts("/dev/dm-19",readonly=1)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">>>> g.launch()<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">>>> g.lvs()<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">[]<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">>>> g.pvs()<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">[]<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">>>> g.list_partitions()<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">['/dev/vda1', '/dev/vda2']<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-family:"Courier New"">>>> g.inspect_os()<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-indent:35.4pt;text-autospace:none">
<span lang="EN-US" style="font-family:"Courier New"">['/dev/vda1']<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 lang="EN-US" style="color:black">Now I’m a little bit confused with the results of my research. I found that VM with the only disk attached has at least two block devices mapped to the hypervisor’s file
 system in fact – I mean /dev/dm-19 (raw) and /dev/dm-30 (qcow2). The RHEV-M API (aka Python oVirt SDK) provides no info about the first one, but the second cannot be accessed from libguestfs.  I have an urgent need to work with a chosen VM disk images through
 the libguestfs layer, but I don’t know which images belong to every VM exactly. It seems like I’m going the hard way :) Sincerely,<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">Vitaly Isaev<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span lang="EN-US" style="color:black">Software engineer<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span lang="EN-US" style="color:black">Information security department<o:p></o:p></span></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><span style="color:black">Fintech JSC, Moscow, Russia<o:p></o:p></span></p>
</div>
</body>
</html>