Bug 1213236

Summary: [virtagent] 'guest-fstrim' failed for guest with os on spapr-vscsi disk
Product: Red Hat Enterprise Linux 6 Reporter: Gu Nini <ngu>
Component: qemu-kvmAssignee: Thomas Huth <thuth>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.8CC: chayang, dgibson, hhuang, juzhang, knoel, michen, mkenneth, qzhang, rbalakri, rpacheco, virt-bugs, virt-maint, weliao, xuhan, ypu, zhengtli, zhguo
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.480.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1211973 Environment:
Last Closed: 2016-05-10 20:58:12 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: 1211973    
Bug Blocks:    

Comment 2 David Gibson 2015-05-01 01:31:58 UTC
Assigning to Thomas Huth, who already owns the original RHEL 7 bug.

This will probably need to be deferred, since it looks like an upstream fix will be necessary which is unlikely to be ready for the imminent RHEL 6.7.

Comment 5 Thomas Huth 2015-07-09 09:13:31 UTC
Fix is now available upstream: http://git.qemu-project.org/?p=qemu.git;a=commitdiff;h=73a652a1b08445e8d91e50cdbb2da50e571c61b3

Comment 6 Jeff Nelson 2015-08-06 17:55:09 UTC
Fix included in qemu-kvm-0.12.1.2-2.480.el6

Comment 7 weliao 2015-11-09 08:51:48 UTC
Reproduce this bug using the following version:
Host:
3.10.0-324.el7.x86_64
qemu-kvm-rhev-2.3.0-31.el7.x86_64
Guest:
2.6.32-584.el6.x86_64
qemu-guest-agent-0.12.1.2-2.456.el6.x86_64

Steps to Reproduce:
1. Start a guest rhel6.7 with scsi hd system disk and data disk:
/usr/libexec/qemu-kvm -name bz1211973 -machine pc,accel=kvm,usb=off -m 4096 -realtime mlock=off -smp 8,sockets=1,cores=16,threads=8  -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x8 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 -drive file=/home/rhel67-64-virtio.qcow2,if=none,id=drive-scsi0-0-0-0,format=qcow2 -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 -drive file=/home/hd-0414.qcow2,if=none,id=drive-scsi1-0-2-0,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop,discard=on -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=2,lun=0,drive=drive-scsi1-0-2-0,id=scsi1-0-2-0 -drive file=/dev/sdb,if=none,id=drive-scsi0-0-3-0,format=raw,cache=none,aio=native,werror=stop,rerror=stop,discard=on -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=3,lun=0,drive=drive-scsi0-0-3-0,id=scsi0-0-3-0 -chardev socket,id=charchannel0,path=/tmp/qemu.guest_agent.0,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0  -qmp tcp:0:6666,server,nowait -nodefaults -nodefconfig -spice port=5910,seamless-migration=on,disable-ticketing -vga qxl -global qxl-vga.vram_size=67108864 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -monitor stdio -netdev tap,id=hostnet0,vhost=on,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown -device virtio-net-pci,netdev=hostnet0,mac=52:54:00:c6:4b:15,id=test

2. In the guest, install and start guest agent; 'mkfs.ext4' and 'mount' the 2 data disks; write/remove some data on them

3. In the host, connect to the guest agent channel with cmd 'nc -U /tmp/qemu.guest_agent.0'

4. On above channel, execute guest agent cmd 'guest-fstrim' for 5 times:
{"execute":"guest-fstrim"}            
{"return": {}}
{"execute":"guest-fstrim"}
{"error": {"class": "GenericError", "desc": "failed to trim /media: Invalid argument"}}
{"execute":"guest-fstrim"}
{"error": {"class": "GenericError", "desc": "failed to trim /media: Invalid argument"}}
{"execute":"guest-fstrim"}
{"error": {"class": "GenericError", "desc": "failed to trim /media: Invalid argument"}}

Test this bug using the following version:
Host:
3.10.0-324.el7.x86_64
qemu-kvm-rhev-2.3.0-31.el7.x86_64
Guest:
2.6.32-584.el6.x86_64
qemu-guest-agent-0.12.1.2-2.481.el6.x86_64

Steps to Test:
1. Start a guest rhel6.7 with scsi hd system disk and data disk:
/usr/libexec/qemu-kvm -name bz1211973 -machine pc,accel=kvm,usb=off -m 4096 -realtime mlock=off -smp 8,sockets=1,cores=16,threads=8  -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x8 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 -drive file=/home/rhel67-64-virtio.qcow2,if=none,id=drive-scsi0-0-0-0,format=qcow2 -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 -drive file=/home/hd-0414.qcow2,if=none,id=drive-scsi1-0-2-0,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop,discard=on -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=2,lun=0,drive=drive-scsi1-0-2-0,id=scsi1-0-2-0 -drive file=/dev/sdb,if=none,id=drive-scsi0-0-3-0,format=raw,cache=none,aio=native,werror=stop,rerror=stop,discard=on -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=3,lun=0,drive=drive-scsi0-0-3-0,id=scsi0-0-3-0 -chardev socket,id=charchannel0,path=/tmp/qemu.guest_agent.0,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0  -qmp tcp:0:6666,server,nowait -nodefaults -nodefconfig -spice port=5910,seamless-migration=on,disable-ticketing -vga qxl -global qxl-vga.vram_size=67108864 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -monitor stdio -netdev tap,id=hostnet0,vhost=on,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown -device virtio-net-pci,netdev=hostnet0,mac=52:54:00:c6:4b:15,id=test

2. In the guest, install and start guest agent; 'mkfs.ext4' and 'mount' the 2 data disks; write/remove some data on them

3. In the host, connect to the guest agent channel with cmd 'nc -U /tmp/qemu.guest_agent.0'

4. On above channel, execute guest agent cmd 'guest-fstrim' for 5 times:
{"execute":"guest-fstrim"}            
{"return": {}}
{"execute":"guest-fstrim"}            
{"return": {}}
{"execute":"guest-fstrim"}            
{"return": {}}
{"execute":"guest-fstrim"}            
{"return": {}}
{"execute":"guest-fstrim"}            
{"return": {}}



Actual results:
The fstrim cmd execution always success.

Comment 9 Shuang Yu 2015-12-08 07:50:01 UTC
Reproduce this issue with "qemu-guest-agent-0.12.1.2-2.465.el6.ppc64" on PowerPC,the fstrim cmd execution failed at 2nd time.

Version:
Host:
qemu-kvm-rhev-2.3.0-31.el7_2.3.ppc64le
kernel-3.10.0-327.4.1.el7.ppc64le
SLOF-20150313-5.gitc89b0df.el7.noarch

Guest:
kernel-2.6.32-548.el6.ppc64
qemu-guest-agent-0.12.1.2-2.465.el6.ppc64

Steps:
1.Create a qcow2 image disk and a scsi debug disk in the host:
# qemu-img create -f qcow2 hd-0414.qcow2 2G
# modprobe scsi_debug lbpu=1 lbpws=1 
# lsscsi 

2.Boot RHEL6.7 guest with spapr-vscsi as system disk and guest agent, and above 2 disks with 'discard=on' and as virtio-scsi hd/spapr-vscsi block on the backend: 

/usr/libexec/qemu-kvm -name bug1213236 -machine pseries -m 32768 -realtime mlock=off -smp 8,sockets=1,cores=16,threads=8 -uuid 95346a10-1828-403a-a610-ac5a52a29490 -no-user-config -nodefaults -monitor stdio -rtc base=utc,clock=host -no-shutdown -boot strict=on -device pci-ohci,id=usb1,bus=pci.0,addr=0x1 -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x8 -device spapr-vscsi,id=scsi0,reg=0x1000 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 -drive file=spaprraw,if=none,id=drive-scsi0-0-0-0,format=raw -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 -drive file=RHEL-6.7-20150331.0-Server-ppc64-dvd1.iso,if=none,id=drive-scsi0-0-1-0,readonly=on,format=raw,cache=none -device scsi-cd,bus=scsi0.0,channel=0,scsi-id=1,lun=0,drive=drive-scsi0-0-1-0,id=scsi0-0-1-0,bootindex=2 -drive file=hd-0414.qcow2,if=none,id=drive-scsi1-0-2-0,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop,discard=on -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=2,lun=0,drive=drive-scsi1-0-2-0,id=scsi1-0-2-0 -drive file=/dev/sdm,if=none,id=drive-scsi0-0-3-0,format=raw,cache=none,aio=native,werror=stop,rerror=stop,discard=on -device scsi-block,bus=scsi0.0,channel=0,scsi-id=3,lun=0,drive=drive-scsi0-0-3-0,id=scsi0-0-3-0 -netdev tap,id=hostnet0,script=/etc/qemu-ifup -device spapr-vlan,netdev=hostnet0,id=net0,mac=52:54:00:c4:e7:90,reg=0x2000 -chardev pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x30000000 -chardev socket,id=charchannel0,path=/tmp/qemu.guest_agent.0,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0 -device usb-kbd,id=input0 -device usb-mouse,id=input1 -device usb-tablet,id=input2 -vnc 0:1 -device VGA,id=video0,vgamem_mb=16,bus=pci.0,addr=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -object rng-random,id=objrng0,filename=/dev/random -device virtio-rng-pci,rng=objrng0,id=rng0,max-bytes=1234,period=2000,bus=pci.0,addr=0x6 -msg timestamp=on

3. In the guest, install and start the guest agent,and 'mkfs.ext4' and 'mount' the 2 data disks; write/remove some data on them.

4. In the host, connect to the guest agent with cmd 'nc -U /tmp/qemu.guest_agent.0'

5. On above channel, execute guest agent cmd 'guest-fstrim' for 5 times:
{"execute":"guest-fstrim"}
{"return": {}}
{"execute":"guest-fstrim"}
{"error": {"class": "GenericError", "desc": "failed to trim /boot: Invalid argument", "data": {"message": "failed to trim /boot: Invalid argument"}}}
{"execute":"guest-fstrim"}
{"error": {"class": "GenericError", "desc": "failed to trim /boot: Invalid argument", "data": {"message": "failed to trim /boot: Invalid argument"}}}
{"execute":"guest-fstrim"}
{"error": {"class": "GenericError", "desc": "failed to trim /boot: Invalid argument", "data": {"message": "failed to trim /boot: Invalid argument"}}}
{"execute":"guest-fstrim"}
{"error": {"class": "GenericError", "desc": "failed to trim /boot: Invalid argument", "data": {"message": "failed to trim /boot: Invalid argument"}}}




Verify this issue with "qemu-guest-agent-0.12.1.2-2.481.el6.ppc64" on PowerPC,the fstrim cmd execution 10 times and all successful.

Version:
Host:
qemu-kvm-rhev-2.3.0-31.el7_2.3.ppc64le
kernel-3.10.0-327.4.1.el7.ppc64le
SLOF-20150313-5.gitc89b0df.el7.noarch

Guest:
kernel-2.6.32-548.el6.ppc64
qemu-guest-agent-0.12.1.2-2.481.el6.ppc64

Steps:
1.Create a qcow2 image disk and a scsi debug disk in the host:
# qemu-img create -f qcow2 hd-0414.qcow2 2G
# modprobe scsi_debug lbpu=1 lbpws=1 
# lsscsi 

2.Boot RHEL6.7 guest with spapr-vscsi as system disk and guest agent, and above 2 disks with 'discard=on' and as virtio-scsi hd/spapr-vscsi block on the backend: 

/usr/libexec/qemu-kvm -name bug1213236 -machine pseries -m 32768 -realtime mlock=off -smp 8,sockets=1,cores=16,threads=8 -uuid 95346a10-1828-403a-a610-ac5a52a29490 -no-user-config -nodefaults -monitor stdio -rtc base=utc,clock=host -no-shutdown -boot strict=on -device pci-ohci,id=usb1,bus=pci.0,addr=0x1 -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x8 -device spapr-vscsi,id=scsi0,reg=0x1000 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 -drive file=spaprraw,if=none,id=drive-scsi0-0-0-0,format=raw -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 -drive file=RHEL-6.7-20150331.0-Server-ppc64-dvd1.iso,if=none,id=drive-scsi0-0-1-0,readonly=on,format=raw,cache=none -device scsi-cd,bus=scsi0.0,channel=0,scsi-id=1,lun=0,drive=drive-scsi0-0-1-0,id=scsi0-0-1-0,bootindex=2 -drive file=hd-0414.qcow2,if=none,id=drive-scsi1-0-2-0,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop,discard=on -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=2,lun=0,drive=drive-scsi1-0-2-0,id=scsi1-0-2-0 -drive file=/dev/sdm,if=none,id=drive-scsi0-0-3-0,format=raw,cache=none,aio=native,werror=stop,rerror=stop,discard=on -device scsi-block,bus=scsi0.0,channel=0,scsi-id=3,lun=0,drive=drive-scsi0-0-3-0,id=scsi0-0-3-0 -netdev tap,id=hostnet0,script=/etc/qemu-ifup -device spapr-vlan,netdev=hostnet0,id=net0,mac=52:54:00:c4:e7:90,reg=0x2000 -chardev pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x30000000 -chardev socket,id=charchannel0,path=/tmp/qemu.guest_agent.0,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0 -device usb-kbd,id=input0 -device usb-mouse,id=input1 -device usb-tablet,id=input2 -vnc 0:1 -device VGA,id=video0,vgamem_mb=16,bus=pci.0,addr=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -object rng-random,id=objrng0,filename=/dev/random -device virtio-rng-pci,rng=objrng0,id=rng0,max-bytes=1234,period=2000,bus=pci.0,addr=0x6 -msg timestamp=on

3. In the guest, install and start the guest agent,and 'mkfs.ext4' and 'mount' the 2 data disks; write/remove some data on them.

4. In the host, connect to the guest agent with cmd 'nc -U /tmp/qemu.guest_agent.0'

5. On above channel, execute guest agent cmd 'guest-fstrim' for 10 times:

# nc -U /tmp/qemu.guest_agent.0
{"execute":"guest-fstrim"}
{"return": {}}
{"execute":"guest-fstrim"}
{"return": {}}
{"execute":"guest-fstrim"}
{"return": {}}
{"execute":"guest-fstrim"}
{"return": {}}
{"execute":"guest-fstrim"}
{"return": {}}
{"execute":"guest-fstrim"}
{"return": {}}            
{"execute":"guest-fstrim"}
{"return": {}}
{"execute":"guest-fstrim"}
{"return": {}}
{"execute":"guest-fstrim"}
{"return": {}}
{"execute":"guest-fstrim"}
{"return": {}}

Comment 11 Guo, Zhiyi 2016-03-22 09:52:22 UTC
Verify this bug using the following version:
Host:
2.6.32-633.el6.x86_64
qemu-kvm-0.12.1.2-2.490.el6.x86_64
Guest:
2.6.32-633.el6.x86_64
qemu-guest-agent-0.12.1.2-2.490.el6.x86_64

Steps to Test:
1. Start a guest rhel6.7 with scsi hd system disk and data disk:
/usr/libexec/qemu-kvm -name rhel -m 2048 -machine pc,accel=kvm -cpu SandyBridge -smp 2,cores=1,threads=1,sockets=1,maxcpus=4 -device virtio-serial -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 -qmp tcp:0:5555,nowait,server -chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x8 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0 -drive file=/home/images/80g.qcow2,if=none,id=drive-scsi0-0-0-0,format=qcow2 -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 -drive file=/home/images/data.qcow2,if=none,id=drive-scsi1-0-2-0,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=2,lun=0,drive=drive-scsi1-0-2-0,id=scsi1-0-2-0 -drive file=/dev/sdc,if=none,id=drive-scsi0-0-3-0,format=raw,cache=none,aio=native,werror=stop,rerror=stop -device scsi-hd,bus=scsi1.0,channel=0,scsi-id=3,lun=0,drive=drive-scsi0-0-3-0,id=scsi0-0-3-0 -vga qxl -monitor stdio -spice port=3001,disable-ticketing -netdev tap,id=idinWyYp,vhost=on -device virtio-net-pci,mac=42:ce:a9:d2:4d:d7,id=idlbq7eA,netdev=idinWyYp

2. In the guest, install and start guest agent; 'mkfs.ext4' and 'mount' the 2 data disks; write/remove some data on them

3. In the host, connect to the guest agent channel with cmd 'nc -U /tmp/qemu.guest_agent.0'

4. On above channel, execute guest agent cmd 'guest-fstrim' for 5 times:
{"execute":"guest-fstrim"}            
{"return": {}}
{"execute":"guest-fstrim"}            
{"return": {}}
{"execute":"guest-fstrim"}            
{"return": {}}
{"execute":"guest-fstrim"}            
{"return": {}}
{"execute":"guest-fstrim"}            
{"return": {}}



Actual results:
The fstrim cmd execution always success.

Comment 13 errata-xmlrpc 2016-05-10 20:58:12 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-2016-0815.html