Bug 1140984 - sub-element in <disk>...</disk> change after create external disk snapshot
Summary: sub-element in <disk>...</disk> change after create external disk snapshot
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-12 07:35 UTC by Shanzhi Yu
Modified: 2015-03-05 07:44 UTC (History)
4 users (show)

Fixed In Version: libvirt-1.2.8-3.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 07:44:25 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0323 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2015-03-05 12:10:54 UTC

Description Shanzhi Yu 2014-09-12 07:35:27 UTC
Description of problem:

sub-element in <disk>...</disk> change after create external disk snapshot

Version-Release number of selected component (if applicable):

libvirt-1.2.7-2.el7.x86_64
libvirt-client-1.2.7-2.el7.x86_64


How reproducible:

100%

Steps to Reproduce:

1. Prepare a running guest 

# virsh dumpxml rhel7-qcow2 |grep disk -A 5 
..
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/rhel7-qcow2.img'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
..

2. create external disk snapshot 

# virsh snapshot-create-as rhel7-qcow2 ss --disk-only

3. check guest xml 

# virsh dumpxml rhel7-qcow2 |grep disk -A 8
 <disk type='file' device='disk'>
      <driver type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/rhel7-qcow2.ss'/>
      <backingStore type='file' index='1'>
        <format type='qcow2'/>
        <source file='/var/lib/libvirt/images/rhel7-qcow2.img'/>
        <backingStore/>
      </backingStore>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>

4. validate xml for running guest 

#virsh dumpxml rhel7-qcow2 > r7.xml
# virt-xml-validate r7.xml 
Relax-NG validity error : Extra element devices in interleave
r7.xml:1: element domain: Relax-NG validity error : Element domain failed to validate content
r7.xml fails to validate

5. destroy/start guest and re-check guest xml

# virsh destroy rhel7-qcow2;virsh start rhel7-qcow2 
Domain rhel7-qcow2 destroyed

Domain rhel7-qcow2 started

#virsh dumpxml rhel7-qcow2
...
   <disk type='file' device='disk'>
      <driver type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/rhel7-qcow2.ss'/>
      <backingStore type='file' index='1'>
        <format type='qcow2'/>
        <source file='/var/lib/libvirt/images/rhel7-qcow2.img'/>
        <backingStore/>
      </backingStore>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
...


Actual results:

In step 3, <driver name='qemu' type='qcow2' cache='none'/> change to <driver type='qcow2' cache='none'/>

Expected results:

driver name='qemu' type='qcow2' should not change in step 3 or virt-xml-validate pass in step 4 

Additional info:

# grep "driverFormat" docs/schemas/*.rng  -A 12
docs/schemas/domaincommon.rng:        <ref name="driverFormat"/>
docs/schemas/domaincommon.rng-      </optional>
docs/schemas/domaincommon.rng-      <optional>
docs/schemas/domaincommon.rng-        <ref name="driverCache"/>
docs/schemas/domaincommon.rng-      </optional>
docs/schemas/domaincommon.rng-      <optional>
docs/schemas/domaincommon.rng-        <ref name="driverErrorPolicy"/>
docs/schemas/domaincommon.rng-      </optional>
docs/schemas/domaincommon.rng-      <optional>
docs/schemas/domaincommon.rng-        <ref name="driverRerrorPolicy"/>
docs/schemas/domaincommon.rng-      </optional>
docs/schemas/domaincommon.rng-      <optional>
docs/schemas/domaincommon.rng-        <ref name="driverIO"/>
--
docs/schemas/domaincommon.rng:  <define name="driverFormat">
docs/schemas/domaincommon.rng-    <attribute name="name">
docs/schemas/domaincommon.rng-      <ref name="genericName"/>
docs/schemas/domaincommon.rng-    </attribute>
docs/schemas/domaincommon.rng-    <optional>
docs/schemas/domaincommon.rng-      <attribute name='type'>
docs/schemas/domaincommon.rng-        <choice>
docs/schemas/domaincommon.rng-          <ref name='storageFormat'/>
docs/schemas/domaincommon.rng-          <value>aio</value> <!-- back-compat for 'raw' -->
docs/schemas/domaincommon.rng-        </choice>
docs/schemas/domaincommon.rng-      </attribute>
docs/schemas/domaincommon.rng-    </optional>
docs/schemas/domaincommon.rng-  </define>

Comment 1 Peter Krempa 2014-09-16 16:11:00 UTC
Fixed upstream:

commit 865421c94a63f43c0164d598a73226d0e4231c93
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Tue Sep 16 12:55:32 2014 +0200

    util: storage: Copy driver type when initializing chain element
    
    virStorageSourceInitChainElement initializes a new storage chain element
    for use as a new disk source. If the new element doesn't contain the
    driver name, copy it from the old source.
    
    This fixes issue where a disk would forget the driver after a snapshot.

Comment 4 Shanzhi Yu 2014-09-19 06:57:17 UTC
Verify this bug with libvirt-1.2.8-3.el7.x86_64.
Steps as comment 0. 

line "<driver name='qemu' type='qcow2' cache='none'/>" doesn't change after create external disk snapshot

Comment 6 errata-xmlrpc 2015-03-05 07:44:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0323.html


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