Bug 895041

Summary: QMP: forward port I/O error debug messages
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Laszlo Ersek <lersek>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, chayang, eblake, flang, hhuang, jdenemar, juli, juzhang, kwolf, lcapitulino, lersek, michen, mrezanin, pbonzini, qzhang, sluo, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-20.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 10:27: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:
Bug Depends On: 971938, 1007204    
Bug Blocks: 987757, 1026966    

Description Sibiao Luo 2013-01-14 11:02:26 UTC
Description of problem:
set a lvm as readonly in host via 'lvchange -pr /path/to/lvm', then attach it to guest. do I/O to the disk in guest, the guest and host will be in paused status, the qemu-kvm should give correct prompts. rhel6 and rhel7 host give different respondence.
rhel6.4 host: 
(qemu) block I/O error in device 'drive-virtio0-0-0': Operation not permitted (1)
block I/O error in device 'drive-virtio0-0-0': Operation not permitted (1)
block I/O error in device 'drive-virtio0-0-0': Operation not permitted (1)
block I/O error in device 'drive-virtio0-0-0': Operation not permitted (1)
(qemu) info status 
VM status: paused (io-error)
rhel7 host:
qemu-kvm prompts nothing, qemu and guest just in paused status.

BTW, bonzini give a explain as following:
"Operation not permitted" which means something returned "-1" instead of a negative errno value such as EACCES or EROFS. EPERM = 1 and "Operation not permitted" is almost always a sign of incorrect propagation of errors.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm
3.6.0-0.29.el7.x86_64
qemu-kvm-1.3.0-3.el7.x86_64
geust info:
kernel-3.6.0-0.29.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.set a lvm as readonly in host via 'lvchange -pr /path/to/lvm'.
# lvchange -pr /dev/vg-90.100-sluo/lv-90-100-data-disk1.raw
# lvdisplay /dev/vg-90.100-sluo/lv-90-100-data-disk1.raw
  --- Logical volume ---
  LV Path                /dev/vg-90.100-sluo/lv-90-100-data-disk1.raw
  LV Name                lv-90-100-data-disk1.raw
  VG Name                vg-90.100-sluo
  LV UUID                a4UbmJ-copd-ybW4-iasP-z0Ql-8vgD-rHA0cO
  LV Write Access        read only
...
2.boot guest with 'werror=stop,rerror=stop'.
e.g:...-drive file=/dev/vg-90.100-sluo/lv-90-100-data-disk2.raw,if=none,format=raw,id=drive-virtio0-0-0,media=disk,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,bus=pci.0,addr=0x8,drive=drive-virtio0-1-0,id=virtio0-0-0
3.do I/O to the lvm.
# dd if=/dev/zero of=/dev/vda bs=1M count=1000 oflag=direct
  
Actual results:
after step 3, qemu-kvm prompts nothing, qemu and guest just in paused status.

Expected results:
qemu-kvm give correct prompts when qemu and guest just in paused status.

Additional info:

Comment 1 Luiz Capitulino 2013-01-14 12:19:43 UTC
Oh, good catch.

What happens here is that in RHEL6 we added the error messages for
debugging purposes. The positive errno value is correct, it's the
errno code that caused the VM to stop.

For RHEL7 we have two options:

 1. Try to think on an upstremable solution (ie. extend the QMP
    event with the error info)

 2. Just forward port the RHEL6 solution

Item 2 is trivial, item 1 has to be discussed upstream and may or may not be simple.

Comment 3 Jiri Denemark 2013-11-21 12:59:40 UTC
Is this going to be solved in any way? If so, libvirt will either need to add support for the possible upstream solution or backport it's RHEL6 support for __com.redhat_reason.

Comment 4 Laszlo Ersek 2013-11-21 13:09:24 UTC
It will be solved as soon as I can work more than 16 hours per day. Thanks.

Comment 15 Miroslav Rezanina 2013-11-28 07:36:22 UTC
Fix included in qemu-kvm-1.5.3-20.el7

Comment 17 Jun Li 2013-12-13 05:01:26 UTC
Reproduce this bug:
Version-Release number of selected component (if applicable):
qemu-kvm-1.0-17.1.el7.x86_64
3.3.0-0.20.el7.x86_64

Do as the comment 0, after step 3, qemu-kvm prompts "VM status: paused (io-error)", guest just in paused status.

# lvdisplay /dev/juli-vg/juli-lv 
  --- Logical volume ---
  LV Path                /dev/juli-vg/juli-lv
  LV Name                juli-lv
  VG Name                juli-vg
  LV UUID                nxiIZQ-ME4b-HD6u-Lrff-r0S6-jGKW-soQaZR
  LV Write Access        read only
  LV Creation host, time localhost.localdomain, 2013-12-12 23:30:37 -0500
  LV Status              available
  # open                 1
  LV Size                10.00 GiB
  Current LE             2560
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3
---

<cli>:
# /usr/bin/qemu-kvm -M pc -cpu host -enable-kvm -m 4G -smp 4,sockets=2,cores=2,threads=1 -device virtio-scsi-pci,bus=pci.0,addr=0x5,id=scsi0 -drive file=/home/juli/RHEL-7.0-20131127.1.qcow2,if=none,id=drive-scsi0-0-0,media=disk,cache=none,format=qcow2,werror=stop,rerror=stop,aio=native -device scsi-hd,drive=drive-scsi0-0-0,bus=scsi0.0,scsi-id=0,lun=0,id=juli,bootindex=1 \
-drive file=/dev/juli-vg/juli-lv,if=none,id=drive-virtio-disk1,format=raw,cache=none,werror=stop,rerror=stop,aio=native \
-device virtio-blk-pci,scsi=on,bus=pci.0,addr=0x6,drive=drive-virtio-disk1,id=virtio-disk1,bootindex=2 \
-spice port=5932,disable-ticketing -k en-us -vga qxl -global qxl-vga.vram_size=67108864 -monitor stdio -device virtio-balloon-pci,id=ballooning -qmp tcp:0:4445,server,nowait -global pvpanic.ioport=0x0505

After step 3 as comment 0: 
(qemu) info status 
VM status: paused (io-error)

--------------
Verify this bug:
Version-Release number of selected component (if applicable):
qemu-kvm-1.5.3-21.el7.x86_64

# lvdisplay /dev/juli-vg/juli-lv
  --- Logical volume ---
  LV Path                /dev/juli-vg/juli-lv
  LV Name                juli-lv
  VG Name                juli-vg
  LV UUID                DXjFrZ-fCNt-0u1P-pcip-gpCT-17VW-EJ6b9F
  LV Write Access        read only
  LV Creation host, time localhost.localdomain, 2013-12-13 11:27:26 +0800
  LV Status              available
  # open                 0
  LV Size                2.00 GiB
  Current LE             512
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3
-------
# /usr/libexec/qemu-kvm -M pc -cpu host -enable-kvm -m 4G -smp 4,sockets=2,cores=2,threads=1 -device virtio-scsi-pci,bus=pci.0,addr=0x5,id=scsi0 -drive file=/home/juli/RHEL-7.0-20131127.1.qcow2_v3,if=none,id=drive-scsi0-0-0,media=disk,cache=none,format=qcow2,werror=stop,rerror=stop,aio=native -device scsi-hd,drive=drive-scsi0-0-0,bus=scsi0.0,scsi-id=0,lun=0,id=juli,bootindex=1 \
-drive file=/dev/juli-vg/juli-lv,if=none,id=drive-virtio-disk1,format=raw,cache=none,werror=stop,rerror=stop,aio=native \
-device virtio-blk-pci,scsi=on,bus=pci.0,addr=0x6,drive=drive-virtio-disk1,id=virtio-disk1,bootindex=2 \
-netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,mq=on,vectors=17,id=net0,mac=00:1a:4a:42:0b:38,bus=pci.0 -spice port=5932,disable-ticketing -k en-us -vga qxl -global qxl-vga.vram_size=67108864 -monitor stdio -device virtio-balloon-pci,id=ballooning -qmp tcp:0:4445,server,nowait -global pvpanic.ioport=0x0505

qemu-kvm: -drive file=/dev/juli-vg/juli-lv,if=none,id=drive-virtio-disk1,format=raw,cache=none,werror=stop,rerror=stop,aio=native: could not open disk image /dev/juli-vg/juli-lv: The device is not writable: Permission denied
/etc/qemu-ifdown: could not launch network script

As the above show, qemu-kvm cannot boot. Based on above test, this bug has been verified.

Comment 19 Ludek Smid 2014-06-13 10:27: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.