Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1065258

Summary: file is missing in backing file after qemu-img commit
Product: Red Hat Enterprise Linux 7 Reporter: CongLi <coli>
Component: qemu-kvmAssignee: Jeff Cody <jcody>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.0CC: acathrow, coli, famz, hhuang, jcody, juzhang, kwolf, michen, shuang, shu, virt-maint, xutian, xwei
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-17 02:57:11 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:
Attachments:
Description Flags
autotest debug file none

Description CongLi 2014-02-14 08:17:43 UTC
Description of problem:
file is missing in backing file after qemu-img commit

Version-Release number of selected component (if applicable):
kernel-3.10.0-87.el7.x86_64
qemu-kvm-rhev-1.5.3-47.el7.x86_64

How reproducible:
only once

Steps to Reproduce:
1. Create backing file by command: 
   # qemu-img create -b /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/RHEL-Server-7.0-64-virtio.qcow2 -f qcow2 /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/RHEL-Server-7.0-64-virtio_bak.qcow2 

2. Start a new VM, using backing file as its harddisk

3. Touch a file "commit_testfile" in the backing_file, and shutdown the VM.
   # touch /commit_testfile
   
4. Boot the original harddisk to make sure touching the file does not affect it.
   # [ ! -e /commit_testfile ] && echo $?

5. Commit the change to the original harddisk by executing "qemu-img commit" command:
   # qemu-img commit -f qcow2 /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/RHEL-Server-7.0-64-virtio_bak.qcow2

6. Start the VM using the original harddisk and check if the file "commit_testfile" exists.

Actual results:
Could not find commit_testfile in backing file after commit

Expected results:
File should be still existed after commit

Additional info:
1. Qemu CML:
/home/staf-kvm-devel/autotest-devel/client/tests/virt/qemu/qemu \
    -S  \
    -name 'virt-tests-vm1'  \
    -sandbox off  \
    -M pc-i440fx-rhel7.0.0  \
    -nodefaults  \
    -vga qxl  \
    -global qxl-vga.vram_size=33554432 \
    -device intel-hda,bus=pci.0,addr=03 \
    -device hda-duplex  \
    -chardev socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20140214-024611-TGAd2Ijj,server,nowait \
    -mon chardev=qmp_id_qmpmonitor1,mode=control  \
    -chardev socket,id=serial_id_serial0,path=/tmp/serial-serial0-20140214-024611-TGAd2Ijj,server,nowait \
    -device isa-serial,chardev=serial_id_serial0 \
    -device virtio-serial-pci,id=virtio_serial_pci0,bus=pci.0,addr=04  \
    -chardev socket,id=devvs,path=/tmp/virtio_port-vs-20140214-024611-TGAd2Ijj,server,nowait \
    -device virtserialport,chardev=devvs,name=vs,id=vs,bus=virtio_serial_pci0.0  \
    -chardev socket,id=seabioslog_id_20140214-024611-TGAd2Ijj,path=/tmp/seabios-20140214-024611-TGAd2Ijj,server,nowait \
    -device isa-debugcon,chardev=seabioslog_id_20140214-024611-TGAd2Ijj,iobase=0x402 \
    -device nec-usb-xhci,id=usb1,bus=pci.0,addr=05 \
    -drive id=drive_image1,if=none,cache=none,snapshot=off,aio=native,file=/home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/RHEL-Server-7.0-64-virtio.qcow2 \
    -device virtio-blk-pci,id=image1,drive=drive_image1,bootindex=0,bus=pci.0,addr=06 \
    -device virtio-net-pci,mac=9a:8c:8d:8e:8f:90,id=idQiI89V,netdev=idLOXATs,bus=pci.0,addr=07  \
    -netdev tap,id=idLOXATs,vhost=on,vhostfd=23,fd=22  \
    -m 4096  \
    -smp 4,maxcpus=4,cores=2,threads=1,sockets=2  \
    -cpu 'Opteron_G4',+kvm_pv_unhalt \
    -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1  \
    -spice port=3000,password=123456,addr=0,tls-port=3200,x509-dir=/tmp/spice_x509d,tls-channel=main,tls-channel=inputs,image-compression=auto_glz,zlib-glz-wan-compression=auto,streaming-video=all,agent-mouse=on,playback-compression=on,ipv4  \
    -rtc base=utc,clock=host,driftfix=slew  \
    -boot order=cdn,once=c,menu=off  \
    -no-kvm-pit-reinjection \
    -enable-kvm

2. cpuinfo:
processor	: 23
vendor_id	: AuthenticAMD
cpu family	: 21
model		: 1
model name	: AMD Opteron(TM) Processor 6234                 
stepping	: 2
microcode	: 0x6000626
cpu MHz		: 2399.938
cache size	: 2048 KB
physical id	: 1
siblings	: 12
core id		: 5
cpu cores	: 6
apicid		: 75
initial apicid	: 43
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 nodeid_msr topoext perfctr_core perfctr_nb arat cpb hw_pstate npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold
bogomips	: 4799.73
TLB size	: 1536 4K pages
clflush size	: 64
cache_alignment	: 64
address sizes	: 48 bits physical, 48 bits virtual
power management: ts ttp tm 100mhzsteps hwpstate cpb

Comment 1 CongLi 2014-02-14 08:19:33 UTC
As only met this bug once and is hard to reporduce, set the priority to low.

Comment 2 CongLi 2014-02-14 08:22:23 UTC
Created attachment 863171 [details]
autotest debug file

Comment 4 Kevin Wolf 2014-02-14 15:42:11 UTC
(In reply to CongLi from comment #0)
> Steps to Reproduce:
> 1. Create backing file by command: 
>    # qemu-img create -b
> /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/
> RHEL-Server-7.0-64-virtio.qcow2 -f qcow2
> /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/
> RHEL-Server-7.0-64-virtio_bak.qcow2 
> 
> 2. Start a new VM, using backing file as its harddisk
> 
> 3. Touch a file "commit_testfile" in the backing_file, and shutdown the VM.
>    # touch /commit_testfile
>    
> 4. Boot the original harddisk to make sure touching the file does not affect
> it.
>    # [ ! -e /commit_testfile ] && echo $?

The original hard disk is /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/RHEL-Server-7.0-64-virtio.qcow2? (This is what is
generally called the backing file, whereas the new image you created is an
overlay.)

Did you boot it up with the hard-disk in read/write mode? If so, you have
written to the backing file, which is likely to destroy data on the overlays.
You must not do that.

To confirm that this is the problem you can try booting the overlay file once
again and check if the file is still there.

Comment 5 juzhang 2014-02-17 02:05:36 UTC
(In reply to Kevin Wolf from comment #4)
> (In reply to CongLi from comment #0)
> > Steps to Reproduce:
> > 1. Create backing file by command: 
> >    # qemu-img create -b
> > /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/
> > RHEL-Server-7.0-64-virtio.qcow2 -f qcow2
> > /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/
> > RHEL-Server-7.0-64-virtio_bak.qcow2 
> > 
> > 2. Start a new VM, using backing file as its harddisk
> > 
> > 3. Touch a file "commit_testfile" in the backing_file, and shutdown the VM.
> >    # touch /commit_testfile
> >    
> > 4. Boot the original harddisk to make sure touching the file does not affect
> > it.
> >    # [ ! -e /commit_testfile ] && echo $?
> 
> The original hard disk is
> /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/
> RHEL-Server-7.0-64-virtio.qcow2? (This is what is
> generally called the backing file, whereas the new image you created is an
> overlay.)
> 
> Did you boot it up with the hard-disk in read/write mode? If so, you have
> written to the backing file, which is likely to destroy data on the overlays.
> You must not do that.
> 
> To confirm that this is the problem you can try booting the overlay file once
> again and check if the file is still there.

Hi Coli,

Could you update your comment?

Best Regards,
Junyi

Comment 6 CongLi 2014-02-17 02:57:11 UTC
(In reply to Kevin Wolf from comment #4)

> The original hard disk is
> /home/staf-kvm-devel/autotest-devel/client/tests/virt/shared/data/images/
> RHEL-Server-7.0-64-virtio.qcow2? (This is what is
> generally called the backing file, whereas the new image you created is an
> overlay.)
> 
> Did you boot it up with the hard-disk in read/write mode? If so, you have
> written to the backing file, which is likely to destroy data on the overlays.
> You must not do that.

Yes, boot the backing file in read/write mode and snapshot=off before commit.

> To confirm that this is the problem you can try booting the overlay file once
> again and check if the file is still there.

Sorry for can't be back to the origin env for I have tried to reproduced this bug 50 times on that image, but test pass.

Will update our test case's steps, thanks a lot.

Close this as 'NOT A BUG'.

Thanks,
Cong