Bug 781515 - virsh vol-path can't correctly display which pool a volume belongs to
Summary: virsh vol-path can't correctly display which pool a volume belongs to
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Linux
high
medium
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-01-13 16:20 UTC by Alex Jia
Modified: 2016-04-26 15:25 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-03-16 17:04:59 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1088667 0 medium CLOSED [storage] some volume related virsh commands work when the passed volume is not one volume of the passed pool 2021-02-22 00:41:40 UTC

Internal Links: 1088667

Description Alex Jia 2012-01-13 16:20:20 UTC
Description of problem:
As summary. 

Version-Release number of selected component (if applicable):
# rpm -q libvirt
libvirt-0.9.9-1.el6.x86_64

How reproducible:
always

Steps to Reproduce:

# cat /tmp/pool-dir.xml 
<pool type="dir">
  <name>pool-dir</name>
  <source/>
  <target>
    <path>/var/lib/libvirt/images/pool-dir</path>
  </target>
</pool>

# virsh pool-define /tmp/pool-dir.xml 
Pool pool-dir defined from /tmp/pool-dir.xml

# virsh pool-build pool-dir
Pool pool-dir built

# virsh pool-start pool-dir
Pool pool-dir started

# virsh pool-list
Name                 State      Autostart 
-----------------------------------------
default              active     yes       
pool-dir             active     no        

# qemu-img create /var/lib/libvirt/images/foo.img 10M
Formatting '/var/lib/libvirt/images/foo.img', fmt=raw size=10485760

# virsh pool-refresh default
Pool default refreshed

# virsh vol-list default
Name                 Path                                    
-----------------------------------------
foo.img              /var/lib/libvirt/images/foo.img         
pool-dir             /var/lib/libvirt/images/pool-dir        

# virsh vol-list pool-dir
Name                 Path                                    
-----------------------------------------


# virsh vol-path --pool default /var/lib/libvirt/images/foo.img
/var/lib/libvirt/images/foo.img

# virsh vol-path --pool pool-dir /var/lib/libvirt/images/foo.img
/var/lib/libvirt/images/foo.img

Note, in fact, pool-dir is a empty pool, but vol-path thinks volume foo.img belongs to it.
  
Actual results:
virsh vol-path says empty pool has a volume path /var/lib/libvirt/images/foo.img.

Expected results:
fix it.

Additional info:

Comment 3 Ján Tomko 2015-03-16 17:04:59 UTC
commit 6ef0b03483281659f2e1e321da9c56c97e05a305
Author:     Peter Krempa <pkrempa>
AuthorDate: 2014-05-30 14:44:55 +0200
Commit:     Peter Krempa <pkrempa>
CommitDate: 2014-06-02 10:56:49 +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'
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1088667

git describe: v1.2.5-3-g6ef0b03 contains: v1.2.6-rc1~239


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