Bug 1282283 - Storage volume is not removed when creating fails in root squash pool
Storage volume is not removed when creating fails in root squash pool
Status: CLOSED DUPLICATE of bug 1233003
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.2
x86_64 Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: John Ferlan
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-15 21:42 EST by yangyang
Modified: 2015-11-16 07:10 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-16 07:10:08 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description yangyang 2015-11-15 21:42:59 EST
Description of problem:
Storage volume is not removed when creating fails in root squash pool

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

How reproducible:
100%

Steps to Reproduce:
1.Setup a nfs server with root_squash
# cat /etc/exports
/var/lib/libvirt/images/nfs *(rw,sync,root_squash)

Change the nfs dir owner to qemu, and chmod to 755.
# chown qemu.qemu /var/lib/libvirt/images/nfs \
&& chmod 755 /var/lib/libvirt/images/nfs


2. Create nfs pool with qemu user and group.
# cat nfs.xml
<pool type='netfs'>
<name>nfs</name>
<source>
<host name='10.66.x.x'/>
<dir path='/var/lib/libvirt/images/nfs'/>
<format type='nfs'/>
</source>
<target>
<path>/mnt/nfs</path>
<permissions>
<mode>0755</mode>
<owner>107</owner>
<group>107</group>
</permissions>
</target>

# virsh pool-define nfs.xml&& virsh pool-build nfs && virsh pool-start nfs
Pool nfs defined from nfs.xml

Pool nfs built

Pool nfs started

3. create a volume with following xml
# cat nfs.vol.xml
<volume type='file'>
  <name>test.qcow2</name>
  <capacity unit='bytes'>1048576000</capacity>
  <target>
    <format type='qcow2'/>
<permissions>
<owner>0</owner>
<group>0</group>
</permissions>
  </target>
</volume>

# virsh vol-create nfs nfs.vol.xml
error: Failed to create vol from nfs.vol.xml
error: cannot unlink file '/mnt/nfs/test.qcow2': Success

4. underlying file is not created, but storage volume is not removed,

# virsh vol-list netfs | grep test.qcow2
 test.qcow2           /mnt/nfs/test.qcow2

# ll /mnt/nfs/test.qcow2
ls: cannot access /mnt/nfs/test.qcow2: No such file or directory

Actual results:
Storage volume is not removed when vol creation fails with root user in root squash nfs pool

Expected results:
Storage volume should be removed when vol creation fails

Additional info:
2015-11-13 06:35:44.815+0000: 3477: error : virCommandWait:2552 : internal error: Child process (/usr/bin/qemu-img create -f qcow2 -o compat=0.10 /mnt/nfs/test.qcow2 1024000K) unexpected exit status 1: 2015-11-13 06:35:44.761+0000: 25360: debug : virFileClose:102 : Closed fd 24
2015-11-13 06:35:44.761+0000: 25360: debug : virFileClose:102 : Closed fd 26
2015-11-13 06:35:44.761+0000: 25360: debug : virFileClose:102 : Closed fd 22
libust[25360/25360]: Warning: HOME environment variable not set. Disabling LTTng-UST per-user tracing. (in setup_local_apps() at lttng-ust-comm.c:305)
qemu-img: /mnt/nfs/test.qcow2: Could not create file: Permission denied
2015-11-13 06:35:44.815+0000: 3477: debug : virCommandRun:2279 : Result status 0, stdout: 'Formatting '/mnt/nfs/test.qcow2', fmt=qcow2 size=1048576000 compat='0.10' encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
2015-11-13 06:35:44.817+0000: 3477: error : virFileUnlink:2364 : internal error: child failed to unlink '/mnt/nfs/test.qcow2': exit status 2
2015-11-13 06:35:44.817+0000: 3477: error : virStorageBackendFileSystemVolDelete:1212 : cannot unlink file '/mnt/nfs/test.qcow2': Success
Comment 1 John Ferlan 2015-11-16 07:10:08 EST
Duplicating to bz 1233003 since it handles the more generic issue regarding deletion of volumes during the creation/build processing.

I believe in particular the root squash nfs issue for a 'raw' volume is handled by commit id '2265e7dd' while for a qcow2 volume commit id '77346f27'.

*** This bug has been marked as a duplicate of bug 1233003 ***

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