RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1069407 - Provide XML to retrieve the current image chain of a virtual disk
Summary: Provide XML to retrieve the current image chain of a virtual disk
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Eric Blake
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1045196 1057800 1082754 1083310 1173188
TreeView+ depends on / blocked
 
Reported: 2014-02-24 23:25 UTC by Federico Simoncelli
Modified: 2016-04-26 16:28 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-12-19 22:47:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Federico Simoncelli 2014-02-24 23:25:23 UTC
Description of problem:
Currently there is no API to retrieve the image chain used by qemu for a virtual disk. On the qemu side the relevant information is returned by the "query-block" command.

One interesting use case would be to use the information to understand what was the end result of a block-job (e.g. live merge) if the managing application on top of libvirt missed the event (e.g. down, crashed, restarting, etc.).

Comment 1 Eric Blake 2014-02-24 23:41:28 UTC
This has been on my wishlist for a while, for several reasons.  Some thoughts on the matter:

Several times, people have opened bugs stating 'blockpull' (or some other chain manipulation command) doesn't work; but at the end of the day, it turns out they weren't using qemu-img -o backing_fmt=qcow2 when creating their backing chain, so libvirt was treating the backing file as raw to avoid a CVE while the user thought it was qcow2 and pointed to yet another backing file.  Having the full list of files as libvirt understands it would make it blatantly obvious when there are differences in expectations between the user and what libvirt is willing to probe without a format hint.

We also just recently hit a thread on the mailing list about how to support block rebase to a gluster volume, where having the full backing chain information available would make life much easier:
https://www.redhat.com/archives/libvir-list/2014-February/msg01226.html

It might be possible to provide this information without requiring a rebase, by expanding the <domain> XML to output the entire backing chain.  And this is a good move for multiple reasons as well.  Still, I can't help but wonder if a new API that returns just the chain information will be easier to use than the existing virDomainGetXMLDesc expanded to output full chain information.

Comment 5 Federico Simoncelli 2014-02-26 17:37:15 UTC
I have heard mentioning a couple of times that libvirt would keep its own (cached) internal representation of the image chain. I am obviously fine with that but I am worried that we will hit some problems keeping it in sync in some corner cases (e.g. a block job ending when libvirt is down).

Eventually as phase 1 we could just have libvirt returning what query-block returns (without any caching). Anyway in this case it would be harder to go with the virDomainGetXMLDesc implementation (as you would need every time to loop with query-block calls over all the disks).

Comment 6 Eric Blake 2014-02-26 17:41:54 UTC
If libvirt starts tracking full backing chain in the <domain>, then libvirt is responsible to update the chain for every action initiated through libvirt, as well as flagging (perhaps by log messages and tainting the domain) any case where the chain reported by qemu differs from the chain that libvirt had recorded should be in effect.  If libvirtd is restarted across a long-running operation that is modifying the backing chain, then on restart, it should clean up its notion of the state to match the reality of the state reported by qemu.

Comment 7 Eric Blake 2014-03-12 20:22:36 UTC
Upstream implementation proposal:
https://www.redhat.com/archives/libvir-list/2014-March/msg00804.html

Comment 9 Eric Blake 2014-04-28 19:36:57 UTC
Upstream as of 1.2.4 release.  However, backporting may prove to be more pain than it is worth, since there are a LOT of prerequisite refactoring patches.

commit a2e369bc000126b6b0048ce1256c8cea00976f16
Author: Jiri Denemark <jdenemar>
Date:   Wed Apr 16 15:28:10 2014 +0200

    conf: Output disk backing store details in domain XML
    
    The XML for quite a longish backing chain is shown below:
    
      <disk type='network' device='disk'>
        <driver name='qemu' type='qcow2'/>
        <source protocol='nbd' name='bar'>
          <host transport='unix' socket='/var/run/nbdsock'/>
        </source>
        <backingStore type='block' index='1'>
          <format type='qcow2'/>
          <source dev='/dev/HostVG/QEMUGuest1'/>
          <backingStore type='file' index='2'>
            <format type='qcow2'/>
            <source file='/tmp/image2.qcow'/>
            <backingStore type='file' index='3'>
              <format type='qcow2'/>
              <source file='/tmp/image3.qcow'/>
              <backingStore type='file' index='4'>
                <format type='qcow2'/>
                <source file='/tmp/image4.qcow'/>
                <backingStore type='file' index='5'>
                  <format type='qcow2'/>
                  <source file='/tmp/image5.qcow'/>
                  <backingStore type='file' index='6'>
                    <format type='raw'/>
                    <source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/>
                    <backingStore/>
                  </backingStore>
                </backingStore>
              </backingStore>
            </backingStore>
          </backingStore>
        </backingStore>
        <target dev='vdb' bus='virtio'/>
      </disk>
    
    Various disk types and formats can be mixed in one chain. The
    <backingStore/> empty element marks the end of the backing chain and it
    is there mostly for future support of parsing the chain provided by a
    user. If it's missing, we are supposed to probe for the rest of the
    chain ourselves, otherwise complete chain was provided by the user. The
    index attributes of backingStore elements can be used to unambiguously
    identify a specific part of the image chain.
    
    Signed-off-by: Jiri Denemark <jdenemar>

Comment 10 Eric Blake 2014-05-12 21:01:19 UTC
(In reply to Eric Blake from comment #9)
> Upstream as of 1.2.4 release.  However, backporting may prove to be more
> pain than it is worth, since there are a LOT of prerequisite refactoring
> patches.

By "a LOT of prerequisite refactoring patches", I'm talking easily over 100 patches (not a trivial task).  Basically, the new XML depends on the virStorageSource struct, which itself touches a lot of the tree to consolidate four similar but previously distinct types.


Note You need to log in before you can comment on or make changes to this bug.