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 1168453 - Disk should be removed while using no-exist 'file' type volume with startupPolicy='optional'
Summary: Disk should be removed while using no-exist 'file' type volume with startupPo...
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: Martin Kletzander
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-27 02:26 UTC by Pei Zhang
Modified: 2016-11-03 18:11 UTC (History)
5 users (show)

Fixed In Version: libvirt-2.0.0-4.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:11:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Pei Zhang 2014-11-27 02:26:19 UTC
Description of problem:
For specified storage volume is of 'file' type which represents a disk , if it is not accessible with startupPolicy='optional' .the disk should be removed.

version:
libvirt-1.2.8-8.el7.x86_64
qemu-kvm-rhev-2.1.2-12.el7.x86_64
kernel-3.10.0-208.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.prepare a pool in which the volume is of 'file' type
# virsh vol-list netfs-nfs-pool --details
 Name              Path                                                Type       Capacity  Allocation
-------------------------------------------------------------------------------------------------------
 disk.img          /var/lib/libvirt/images/netfs-nfs/disk.img          file       1.00 GiB      0.00 B
 qcow2.img         /var/lib/libvirt/images/netfs-nfs/qcow2.img         file       1.00 GiB      0.00 B
2.add the volume to domain 
# virsh dumpxml r7q2 | grep disk -A 10
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/r7q2.img' startupPolicy='optional'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <disk type='volume' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source pool='netfs-nfs-pool' volume='qcow2.img' startupPolicy='optional'/>
      <target dev='vdb' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </disk>

3.remove the volume 
# virsh vol-list netfs-nfs-pool --details 
 Name              Path                                                Type    Capacity  Allocation
----------------------------------------------------------------------------------------------------
 disk.img          /var/lib/libvirt/images/netfs-nfs/disk.img          file    1.00 GiB      0.00 B
 qcow2.img.bak     /var/lib/libvirt/images/netfs-nfs/qcow2.img.bak     file    1.00 GiB  196.00 KiB

4.reboot the domain , fail to start . cannot find volume 
# virsh destroy r7q2 ; virsh start r7q2
Domain r7q2 destroyed

error: Failed to start domain r7q2
error: Storage volume not found: no storage vol with matching path '/var/lib/libvirt/images/qcow2.img'

Actual results:
as steps 4 , guest fail to start .

Expected results:
the volume disk with startupPolicy='optional' should be removed and guest can start successfully.

Additional info:

Comment 5 Martin Kletzander 2016-08-02 11:28:57 UTC
Fixed upstream with v2.1.0-rc1-30-ge2705cfb6e50..v2.1.0-rc1-32-ga2b97a8d912a:

commit e2705cfb6e50039a5f1d1c620f7ed18b37eca36d
Author: Martin Kletzander <mkletzan>
Date:   Mon Aug 1 17:52:02 2016 +0200

    qemu: Make qemuDomainCheckDiskStartupPolicy self-contained

commit 779a4ea9066560b92b0df462b5a6d5c127c15920
Author: Martin Kletzander <mkletzan>
Date:   Mon Aug 1 17:56:26 2016 +0200

    qemu: Remove unnecessary label and its only reference

commit a2b97a8d912a37ba1935bf98be4c332f42332236
Author: Martin Kletzander <mkletzan>
Date:   Mon Aug 1 17:51:28 2016 +0200

    qemu: Fix support for startupPolicy with volume/pool disks

Comment 8 yisun 2016-08-10 06:28:51 UTC
Verified on libvirt-2.0.0-4.el7.x86_64n & qemu-kvm-rhev-2.6.0-17.el7.x86_64
PASSED


steps:

# virsh dumpxml --inactive virtlab_test | grep disk -a10
...
    <disk type='volume' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source pool='tmpdir' volume='qcow2.img' startupPolicy='optional'/>
      <target dev='vdb' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </disk>
...

# virsh vol-list tmpdir
 Name                 Path                                    
------------------------------------------------------------------------------
 qcow2.img            /tmp/dir/qcow2.img           


# virsh dumpxml virtlab_test | grep disk -a10
...
    <disk type='volume' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source pool='tmpdir' volume='qcow2.img' startupPolicy='optional'/>
      <backingStore/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </disk>
...


# mv /tmp/dir/qcow2.img /tmp/dir/qcow2.img.bkup

# virsh pool-refresh tmpdir
Pool tmpdir refreshed

# virsh vol-list tmpdir
 Name                 Path                                    
------------------------------------------------------------------------------
 qcow2.img.bkup       /tmp/dir/qcow2.img.bkup     

# virsh destroy virtlab_test
Domain virtlab_test destroyed

# virsh start virtlab_test
Domain virtlab_test started

# virsh dumpxml virtlab_test | grep disk -a10
... <the volume not listed as not existed anymore > ...


#virsh edit virtlab_test  //change the pool name to a non-existing name
...
    <disk type='volume' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source pool='non-exiting-pool' volume='qcow2.img' startupPolicy='optional'/>
      <target dev='vdb' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </disk>
...

# virsh destroy virtlab_test
virDomain virtlab_test destroyed

# virsh start virtlab_test
Domain virtlab_test started

# virsh dumpxml virtlab_test | grep disk -a10
... <the volume not listed as the pool not existed> ...

Comment 10 errata-xmlrpc 2016-11-03 18:11:19 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-2016-2577.html


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