bigclouds
2013-Sep-11 02:33 UTC
[Libguestfs] question about backing file path of a qcow2 image
hi,all images of qcow2 format with backing files, its backing files have two path infos (absolute path and relative path) ,how to let libguestfs use absolute path rather than relative path. in some case, this leads error. thanks
Richard W.M. Jones
2013-Sep-11 12:38 UTC
Re: [Libguestfs] question about backing file path of a qcow2 image
On Wed, Sep 11, 2013 at 10:33:06AM +0800, bigclouds wrote:> hi,all > images of qcow2 format with backing files, its backing files have > two path infos (absolute path and relative path),This is not true. The file format only contains the relative path. qemu-img info will print an absolute path, but it's not stored inside the file.> how to let > libguestfs use absolute path rather than relative path. in some > case, this leads error.It's hard to know what the problem is you're describing since you give no details at all. But anyway ... Libguestfs doesn't actually use or care about the backing file of qcow2 files. That is entirely handled by qemu when it opens the qcow2 file. There are three problems I know about: (1) If your backing file is located on tmpfs, then qemu can have problems opening the file. This is fixed upstream (commit 749e947bb010 / RHBZ#994517). (2) If your disk image refers to the backing file by its relative path then it may not work if you move it around. This should be obvious, but seems to cause people enough trouble. (3) Certain characters in filenames may be forbidden (esp. ':') or may require quoting (','). Libguestfs (recent versions, anyhow) should always do the right thing when it encounters one of these characters. If not, file a bug. The solution to (2) is to always use absolute paths to files and/or not to move files around. So long as you don't move the file around, qemu handles the case where it is started from a different directory. It searches for the backing file relative to the location of the qcow2 file, NOT relative to the current directory. If you find some other problem, please show us a clear reproducer and include all of the debugging and error messages: http://libguestfs.org/guestfs-faq.1.html#debug Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
bigclouds
2013-Sep-12 02:46 UTC
Re: [Libguestfs] question about backing file path of a qcow2 image
thanks . now i know qcow2 only store relative path. look at my error message, 6a3256bb-b247-4fb5-9f75-8ffa7151eeda i a symlink to a LV. it is the backing_file of several images(LV).. i have no idea of the reason of the error. # virt-win-reg 6a3256bb-b247-4fb5-9f75-8ffa7151eeda 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion' 'Productname' hivex: /tmp/libguestfsIdLWuF/0-software: trailing garbage at end of file (at 0x86e000, after 2088 pages) hivex_open: Operation not supported at /usr/bin/virt-win-reg line 259. #qemu-img info 6a3256bb-b247-4fb5-9f75-8ffa7151eeda image: 6a3256bb-b247-4fb5-9f75-8ffa7151eeda file format: raw virtual size: 10G (10737418240 bytes) disk size: 0 #ls -l 6a3256bb-b247-4fb5-9f75-8ffa7151eeda lrwxrwxrwx. 1 vdsm kvm 78 Sep 11 13:54 6a3256bb-b247-4fb5-9f75-8ffa7151eeda -> /dev/28da8f65-abe7-4ffd-a16d-9155d12a8d72/6a3256bb-b247-4fb5-9f75-8ffa7151eeda At 2013-09-11 20:38:59,"Richard W.M. Jones" <rjones@redhat.com> wrote:>On Wed, Sep 11, 2013 at 10:33:06AM +0800, bigclouds wrote: >> hi,all >> images of qcow2 format with backing files, its backing files have >> two path infos (absolute path and relative path), > >This is not true. The file format only contains the relative path. >qemu-img info will print an absolute path, but it's not stored inside >the file. > >> how to let >> libguestfs use absolute path rather than relative path. in some >> case, this leads error. > >It's hard to know what the problem is you're describing since you give >no details at all. But anyway ... > >Libguestfs doesn't actually use or care about the backing file of >qcow2 files. That is entirely handled by qemu when it opens the qcow2 >file. > >There are three problems I know about: > >(1) If your backing file is located on tmpfs, then qemu can have > problems opening the file. This is fixed upstream (commit > 749e947bb010 / RHBZ#994517). > >(2) If your disk image refers to the backing file by its relative path > then it may not work if you move it around. This should be > obvious, but seems to cause people enough trouble. > >(3) Certain characters in filenames may be forbidden (esp. ':') or may > require quoting (','). Libguestfs (recent versions, anyhow) > should always do the right thing when it encounters one of these > characters. If not, file a bug. > >The solution to (2) is to always use absolute paths to files and/or >not to move files around. > >So long as you don't move the file around, qemu handles the case where >it is started from a different directory. It searches for the backing >file relative to the location of the qcow2 file, NOT relative to the >current directory. > >If you find some other problem, please show us a clear reproducer and >include all of the debugging and error messages: > >http://libguestfs.org/guestfs-faq.1.html#debug > >Rich. > >-- >Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones >libguestfs lets you edit virtual machines. Supports shell scripting, >bindings from many languages. http://libguestfs.org
Reasonably Related Threads
- Re: question about backing file path of a qcow2 image
- Re: question about backing file path of a qcow2 image
- who Maintain netfilter, i want to submit a patch
- Cannot pass secret id for backing file after taking external snapshot on encrypted qcow2 file
- Re: Change in treatment of qcow2 with chained backing files in v5.10.0?