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 1088667 - [storage] some volume related virsh commands work when the passed volume is not one volume of the passed pool
Summary: [storage] some volume related virsh commands work when the passed volume is n...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-17 01:10 UTC by Yang Yang
Modified: 2015-03-16 17:04 UTC (History)
7 users (show)

Fixed In Version: libvirt-1.2.7-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 07:34:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 781515 0 high CLOSED virsh vol-path can't correctly display which pool a volume belongs to 2021-02-22 00:41:40 UTC
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

Internal Links: 781515

Description Yang Yang 2014-04-17 01:10:49 UTC
Description:
Tried to resize volume by running virsh cmd vol-resize by passing an pool and passing the full volume path. But the volume passed is not one of the volumes of the passed pool. Finally, resize successfully.

Product Version:
libvirt-1.1.1-29.el7.x86_64
qemu-kvm-rhev-1.5.3-60.el7ev.x86_64

How producible:
Always

Steps:
1. Create a qcow3 format volume in default pool
# cat qcow3-vol2.xml
<volume>
  <name>qcow3-vol2</name>
  <source>
  </source>
  <capacity unit='bytes'>1024000000</capacity>
  <allocation unit='bytes'>204000</allocation>
  <target>
    <format type='qcow2'/>
    <compat>1.1</compat>
    <features>
    <lazy_refcounts/>
    </features>
  </target>
</volume>

# virsh vol-create default qcow3-vol2.xml
Vol qcow3-vol2 created from qcow3-vol2.xml

# ll /var/lib/libvirt/images/qcow3-vol2
-rw-------. 1 qemu qemu 17826304 Mar 28 15:12 /var/lib/libvirt/images/qcow3-vol2

2.# virsh pool-list --all
Name                 State      Autostart
-----------------------------------------
default              active     yes       
fs                   active     no

# virsh pool-dumpxml fs | grep path
    <path>/mnt</path>


# virsh vol-list fs
Name                 Path                                    
-----------------------------------------
lost+found           /mnt/lost+found                        
qcow3-vol            /mnt/qcow3-vol                          
qcow3-vol3           /mnt/qcow3-vol3

Make sure there is no volume named qcow3-vol2 in fs pool.

3. Resize the volume by passing pool fs and path of volume qcow3-vol2 which is in default pool
# virsh vol-resize --pool fs /var/lib/libvirt/images/qcow3-vol2 6G
Size of volume 'qcow3-vol2' successfully changed to 6G


Actual results:
in step 3: As above shows.

Expected results:
in step 3:
Should check if the passed volume exists in the passed pool. The command should quit and return with error like this:
error: Storage vol not found: no storage vol with matching name 'qcow3-vol2' in pool fs

Additional info:
The same issue was hit by virsh cmd vol-upload, vol-download, vol-clone, vol-wipe, vol-delete, vol-dumpxml, vol-info, vol-key, vol-path.

Comment 1 Peter Krempa 2014-06-02 09:03:57 UTC
Fixed upstream:

commit 6ef0b03483281659f2e1e321da9c56c97e05a305
Author: Peter Krempa <pkrempa>
Date:   Fri May 30 14:44:55 2014 +0200

    virsh: Check whether found volume is member of the specified storage pool
    
    When looking up storage volumes virsh uses multiple lookup steps. Some
    of the steps don't require a pool name specified. This resulted into a
    possibility that a volume would be part of a different pool than the
    user specified:
    
    Let's have a /var/lib/libvirt/images/test.qcow image in the 'default'
    pool and a second pool 'emptypool':
    
    Currently we'd return:
      $ virsh vol-info --pool emptypool /var/lib/libvirt/images/test.qcow
      Name:           test.qcow
      Type:           file
      Capacity:       100.00 MiB
      Allocation:     212.00 KiB
    
    After the fix:
     $ tools/virsh vol-info --pool emptypool /var/lib/libvirt/images/test.qcow
     error: Requested volume '/var/lib/libvirt/images/test.qcow' is not in pool 'emptypool'

Comment 3 Pei Zhang 2014-12-01 09:31:03 UTC
verify version:
libvirt-1.2.8-9.el7.x86_64
qemu-kvm-rhev-2.1.2-13.el7.x86_64
kernel-3.10.0-211.el7.x86_64

steps:

prepare a pool of  other type and create volumes in the pool.

1.check the volume in pool
# virsh vol-list default --details| grep test.img 
 test.img          /var/lib/libvirt/images/test.img          file    1.00 GiB    1.00 GiB

# virsh vol-list fs-pool1 --details| grep test.img 
 test.img    /var/lib/libvirt/images/fs-pool/test.img    file  1.00 GiB    1.00 GiB

# virsh vol-list dir-pool --details | grep vol1.xml
 vol1.xml     /tmp/dir-pool/vol1.xml     file    358.00 B    4.00 KiB

2.test commands vol-X using mismatching pool and volume.

# virsh vol-info --pool fs-pool1 /var/lib/libvirt/images/test.img
error: Requested volume '/var/lib/libvirt/images/test.img' is not in pool 'fs-pool1'

# virsh vol-resize --pool fs-pool1 /var/lib/libvirt/images/test.img 2G
error: Requested volume '/var/lib/libvirt/images/test.img' is not in pool 'fs-pool1'

# virsh vol-upload --pool default /tmp/dir-pool/vol1.xml disk-volume.xml 
error: Requested volume '/tmp/dir-pool/vol1.xml' is not in pool 'default'

# virsh vol-download /tmp/dir-pool/vol1.xml test-pool.xml --pool default
error: Requested volume '/tmp/dir-pool/vol1.xml' is not in pool 'default'

# virsh vol-key --pool fs-pool1 /var/lib/libvirt/images/test.img 
error: Requested volume '/var/lib/libvirt/images/test.img' is not in pool 'fs-pool1'

Tt will give a clear error message if the volume does not match the pool when using other vol-X commands . 

3.test commands vol-X using matched pool and volume.

# virsh vol-key /var/lib/libvirt/images/fs-pool/test.img --pool fs-pool1
/var/lib/libvirt/images/fs-pool/test.img

# virsh vol-key --pool fs-pool1 /var/lib/libvirt/images/fs-pool/test.img 
/var/lib/libvirt/images/fs-pool/test.img

# virsh vol-resize --pool fs-pool1 /var/lib/libvirt/images/fs-pool/test.img 2G
Size of volume 'test.img' successfully changed to 2G

# ll /var/lib/libvirt/images/fs-pool/test.img -h
-rw-------. 1 root root 2.0G Dec  1 14:31 /var/lib/libvirt/images/fs-pool/test.img

4. test command vol-X  just using volume name and matched pool name instead of absolute path when the two volume has a same name. 

# virsh vol-info test.img default
Name:           test.img
Type:           file
Capacity:       1.00 GiB
Allocation:     1.00 GiB

# virsh vol-info test.img fs-pool1
Name:           test.img
Type:           file
Capacity:       2.00 GiB
Allocation:     1.00 GiB

# virsh vol-key test.img fs-pool1
/var/lib/libvirt/images/fs-pool/test.img

# virsh vol-key test.img default
/var/lib/libvirt/images/test.img

it will check the specified storage pool .move to verified.

Comment 5 errata-xmlrpc 2015-03-05 07:34:13 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.