Bug 1031526

Summary: Can not commit snapshot when disk is using glusterfs:native backend
Product: Red Hat Enterprise Linux 7 Reporter: Qian Guo <qiguo>
Component: qemu-kvmAssignee: Jeff Cody <jcody>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, dyuan, hhuang, huding, juzhang, mazhang, michen, shyu, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-53.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 13:17:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Qian Guo 2013-11-18 08:15:56 UTC
Description of problem:
Create disk snapshot for guest when disk is with glusterfs:native backend, when try to commit it, it failed by permission denied(readonly).

Version-Release number of selected component (if applicable):

Gluster client:

# rpm -q qemu-kvm-rhev
qemu-kvm-rhev-1.5.3-19.el7.x86_64
# rpm -qa |grep gluster
glusterfs-fuse-3.4.0.40rhs-2.el7.x86_64
glusterfs-3.4.0.40rhs-2.el7.x86_64
glusterfs-libs-3.4.0.40rhs-2.el7.x86_64
glusterfs-api-3.4.0.40rhs-2.el7.x86_64
glusterfs-rdma-3.4.0.40rhs-2.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1.Boot a guest with glusterfs:native:
# /usr/libexec/qemu-kvm -M pc -cpu Penryn -enable-kvm -m 4096 -smp 4,socket=1,cores=4,threads=1 -name rhel7 -nodefaults -nodefconfig -drive file=gluster://10.66.5.134/gv0/win2012.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,werror=stop,rerror=stop,aio=native -device virtio-scsi-pci,id=virtio-disk0 -device scsi-hd,bus=virtio-disk0.0,drive=drive-virtio-disk0,id=scsi-hd -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -vnc :10 -vga qxl -global qxl-vga.vram_size=67108864 -monitor stdio -boot menu=on -netdev tap,id=netdev0,vhost=on,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown -device virtio-net-pci,mac=ce:71:f6:64:8f:18,netdev=netdev0,id=net0 -global qxl-vga.revision=3 -drive file=gluster://10.66.5.134/gv0/test.qcow2,if=none,id=drive-virtio-disk1,format=qcow2,werror=stop,rerror=stop,aio=native -device virtio-scsi-pci,id=virtio-disk1 -device scsi-hd,bus=virtio-disk1.0,drive=drive-virtio-disk1,id=scsi-hd1 -qmp unix:/tmp/qmp,server,nowait

2.Under hmp. create 2 snapshots with the glusterfs:native mode
(qemu) snapshot_blkdev drive-virtio-disk1 gluster://10.66.5.134/gv0/sn1.qcow2
(qemu) snapshot_blkdev drive-virtio-disk1 gluster://10.66.5.134/gv0/sn2.qcow2

3.Shutdown guest, then try to commit sn2:
# qemu-img commit -f qcow2 gluster://10.66.5.134/gv0/sn2.qcow2
qemu-img: Image is read-only

4.Boot guest with this snapshot, inside guest, can read/write to this snapshot image.

5.Do live snapshot under hmp:
(qemu) commit drive-virtio-disk1
'commit' error for 'drive-virtio-disk1': Permission denied

Actual results:
Can not commit the snapshot when it is created under glusterfs:native

Expected results:
Can commit it.

Additional info:
1.Test with mount as fuse.glusterfs, then create it in the mount dir, no such issue.
2.Test with mount as nfs, then create it in the mount dir, no such issue.

in the gluster server, got that 
...
-rw------- 2 root root  7026507776 Nov 18 03:00 test.qcow2 ---- test snapshot image (created as qemu-img create -f qcow2 gluster://10.66.5.134/gv0/test.qcow2 10G)
-rw------- 2 root root  7756840960 Nov 18 03:11 win2012.qcow2 ---- system image (created as qemu-img create -f qcow2 gluster://10.66.5.134/gv0/win2012.qcow2 80G)

-rw------- 2 root root      197120 Nov 18 03:00 sssn1.qcow2 --- glusterfs:native
-rw------- 2 root root     1048576 Nov 18 03:02 sssn2.qcow2 --- glusterfs:native
-rw-r--r-- 2 root root     1048576 Nov 18 02:55 sssss1.qcow2 --- mount in client as fuse.gluster 
-rw-r--r-- 2 root root     1114112 Nov 18 02:57 sssss2.qcow2 --- mount in client as fuse.gluster 
-rw-r--r-- 2 root root     1048576 Nov 18 02:59 ssssssssssss1.qcow2 --- mount in client as nfs
-rw-r--r-- 2 root root      851968 Nov 18 02:59 ssssssssssss2.qcow2 --- mount in client as nfs

..

Comment 2 Jeff Cody 2013-12-03 15:15:55 UTC
The glusterfs image driver needs a reopen implementation for block commit to work correctly.  Currently, there is no reopen implementation.  Without that, if the backing file is a glusterfs image, it cannot be changed to r/w from r/o.

Comment 5 Miroslav Rezanina 2014-03-12 08:44:26 UTC
Fix included in qemu-kvm-1.5.3-53.el7

Comment 7 huiqingding 2014-03-17 09:37:42 UTC
Reproduce this bug using the following version:
qemu-kvm-rhev-1.5.3-19.el7.x86_64
kernel-3.10.0-99.el7.x86_64

Steps to Reproduce
1. boot a guest, the storage backend is native glusterfs
 /usr/libexec/qemu-kvm -name test -S -M pc -cpu Nehalem -m 4G -realtime mlock=off -smp 2,sockets=2,cores=1,threads=1 -nodefaults -rtc base=utc -boot menu=on,strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0 -drive file=gluster://10.66.8.178/chayang_test/rhel7-64.qcow2,if=none,id=drive-scsi0-disk0,format=qcow2,cache=writethrough -device virtio-scsi-pci,id=scsi0,addr=0x4 -device scsi-hd,scsi-id=0,lun=0,bus=scsi0.0,drive=drive-scsi0-disk0,id=virtio-disk0,bootindex=1  -netdev tap,id=hostnet0,vhost=on,queues=4 -device virtio-net-pci,vectors=9,netdev=hostnet0,id=net0,mac=52:54:00:18:85:20,bus=pci.0 -device usb-tablet,id=input0 -spice port=5900,disable-ticketing,seamless-migration=on -vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=67108864 -device intel-hda,id=sound0,bus=pci.0 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0  -monitor stdio -qmp tcp:0:4455,server,nowait
2.Under qmp. create 1 snapshots with the glusterfs:native mode
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive-scsi0-disk0","snapshot-file":"gluster://10.66.8.178/chayang_test/sp1.qcow2","format":"qcow2"}}

3.Shutdown guest, then try to commit sn2:
# qemu-img commit -f qcow2 gluster://10.66.8.178/chayang_test/sp1.qcow2
qemu-img: Image is read-only

4.Boot guest with this snapshot, inside guest, can read/write to this snapshot image.

5.Do live snapshot under hmp:
(qemu) commit drive-virtio-disk1
'commit' error for 'drive-virtio-disk1': Permission denied

Verify this bug using the following version:
qemu-kvm-rhev-1.5.3-53.el7.x86_64
kernel-3.10.0-99.el7.x86_64

Steps to Verification:
1. boot a guest, the storage backend is native glusterfs
 /usr/libexec/qemu-kvm -name test -S -M pc -cpu Nehalem -m 4G -realtime mlock=off -smp 2,sockets=2,cores=1,threads=1 -nodefaults -rtc base=utc -boot menu=on,strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0 -drive file=gluster://10.66.8.178/chayang_test/rhel7-64.qcow2,if=none,id=drive-scsi0-disk0,format=qcow2,cache=writethrough -device virtio-scsi-pci,id=scsi0,addr=0x4 -device scsi-hd,scsi-id=0,lun=0,bus=scsi0.0,drive=drive-scsi0-disk0,id=virtio-disk0,bootindex=1  -netdev tap,id=hostnet0,vhost=on,queues=4 -device virtio-net-pci,vectors=9,netdev=hostnet0,id=net0,mac=52:54:00:18:85:20,bus=pci.0 -device usb-tablet,id=input0 -spice port=5900,disable-ticketing,seamless-migration=on -vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=67108864 -device intel-hda,id=sound0,bus=pci.0 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0  -monitor stdio -qmp tcp:0:4455,server,nowait
2.Under qmp. create 1 snapshots with the glusterfs:native mode
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive-scsi0-disk0","snapshot-file":"gluster://10.66.8.178/chayang_test/sp1.qcow2","format":"qcow2"}}

3.Shutdown guest, then try to commit sn2:
# qemu-img commit -f qcow2 gluster://10.66.8.178/chayang_test/sp1.qcow2
Image committed.

4.Boot guest with this snapshot, inside guest, can read/write to this snapshot image.

5.Do live snapshot under hmp:
(qemu) commit drive-virtio-disk1
(qemu) 

Atual results:
after step3 and step5, the snapshot can be committed to the base image.

Based on the above result, I think this bug has been fixed.

Comment 9 Ludek Smid 2014-06-13 13:17:08 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.