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 1227664 - Wrong type for dir type volume causes a failure when doing vol-delete
Summary: Wrong type for dir type volume causes a failure when doing vol-delete
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-03 09:08 UTC by Yang Yang
Modified: 2015-11-19 06:40 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.17-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:40:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Yang Yang 2015-06-03 09:08:04 UTC
Description of problem:
Do a vol-create to create a dir type volume in default pool. However,
the type got from both vol-info and vol-dumpxml is file so that deleting it
causes a failure.

Version-Release number of selected component (if applicable):
libvirt-1.2.15-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. create vol
# cat vol.xml
<volume>
  <name>demo</name>
<capacity unit='bytes'>0</capacity>
  <source>
  </source>
  <target>
    <format type='dir'/>
  </target>
</volume>

# virsh vol-create default vol.xml
Vol demo created from vol.xml

2. check vol-dumpxml, vol-info
# virsh vol-dumpxml demo default
<volume type='file'>
  <name>demo</name>
  <key>/var/lib/libvirt/images/demo</key>
  <source>
  </source>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <target>
    <path>/var/lib/libvirt/images/demo</path>
    <format type='dir'/>
    <permissions>
      <mode>0600</mode>
      <owner>0</owner>
      <group>0</group>
      <label>system_u:object_r:virt_image_t:s0</label>
    </permissions>
    <timestamps>
      <atime>1432868902.483414837</atime>
      <mtime>1432868902.483414837</mtime>
      <ctime>1432868902.483414837</ctime>
    </timestamps>
  </target>
</volume>

# virsh vol-info demo default
Name:           demo
Type:           file
Capacity:       0.00 B
Allocation:     0.00 B

# ll /var/lib/libvirt/images/demo/
total 0

3. delete vol
# virsh vol-delete demo default
error: Failed to delete vol demo
error: cannot unlink file '/var/lib/libvirt/images/demo': Is a directory

# virsh vol-list default | grep demo
 demo                 /var/lib/libvirt/images/demo

4. refresh pool
# virsh pool-refresh default
Pool default refreshed

# virsh vol-info demo default
Name:           demo
Type:           dir
Capacity:       0.00 B
Allocation:     0.00 B

# virsh vol-delete demo default
Vol demo deleted

Actual results:
Volume type gets from vol-info and vol-dumpxml is not dir, file instead. Deleting the volume failed. After doing a pool-refresh, volume type change to dir.

Expected results:
If it's supported to create dir type vol via vol-create with xml, fix the type
in the output of vol-dumpxml and vol-info.
If not supported, provide an error when creating volume.

Additional info:

Comment 2 John Ferlan 2015-06-29 18:25:14 UTC
According to bug 727088, having a directory in a fs pool is supported.  Seems that change missed the VolCreate path possibility for having a volume type setting.

Patch sent upstream:

http://www.redhat.com/archives/libvir-list/2015-June/msg01599.html

Comment 3 John Ferlan 2015-06-30 11:03:01 UTC
Patch pushed upstream:

commit e66a4c0b53a7a4a8afcb0d7d10b0569b84aac91c
Author: John Ferlan <jferlan>
Date:   Mon Jun 29 14:18:49 2015 -0400

    storage: Set correct vol->type at VolCreate
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1227664
    
    If the requested format type for the new entry in the file system pool
    is a 'dir', then be sure to set the vol->type correctly as would be done
    when the pool is refreshed.

$ git describe e66a4c0b53a7a4a8afcb0d7d10b0569b84aac91c
v1.2.17-rc1-4-ge66a4c0
$

Comment 5 yisun 2015-07-13 10:19:23 UTC
verified on libvirt-1.2.17-2.el7.x86_64


1. # cat vol.xml 
<volume>
  <name>demo</name>
<capacity unit='bytes'>0</capacity>
  <source>
  </source>
  <target>
    <format type='dir'/>
  </target>
</volume>


2. # virsh vol-create default vol.xml
Vol demo created from vol.xml

3. # virsh vol-dumpxml demo default
<volume type='dir'>    <===== modified as expect.
  <name>demo</name>
  <key>/home/pool/demo</key>
  <source>
  </source>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <target>
    <path>/home/pool/demo</path>
    <format type='dir'/>
    <permissions>
      <mode>0600</mode>
      <owner>0</owner>
      <group>0</group>
      <label>system_u:object_r:home_root_t:s0</label>
    </permissions>
    <timestamps>
      <atime>1436782523.935482441</atime>
      <mtime>1436782523.935482441</mtime>
      <ctime>1436782523.935482441</ctime>
    </timestamps>
  </target>
</volume>

4. # virsh vol-info demo default
Name:           demo
Type:           dir    <==== modified as expected. 
Capacity:       0.00 B
Allocation:     0.00 B

5. # virsh vol-delete demo default
Vol demo deleted   <==== can be deleted due to type is corrected. 


6. # virsh pool-refresh default; virsh vol-list default
Pool default refreshed

 Name                 Path                                    
------------------------------------------------------------------------------

Comment 7 errata-xmlrpc 2015-11-19 06:40:01 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/RHBA-2015-2202.html


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