Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1354355 - 'guest-fstrim' test failed for guest with scsi debug disk as a scsi block device
Summary: 'guest-fstrim' test failed for guest with scsi debug disk as a scsi block de...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-guest-agent
Version: 7.3
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Fam Zheng
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-11 07:46 UTC by Xueqiang Wei
Modified: 2017-01-23 03:44 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-23 03:44:09 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Xueqiang Wei 2016-07-11 07:46:38 UTC
Description of problem:

For guest started with scsi debug disk as a scsi block device, it's a failure to execute the guest agent cmd 'guest-fstrim'


Version-Release number of selected component (if applicable):
Host: kernel-3.10.0-461.el7.x86_64
      qemu-kvm-rhev-2.6.0-12.el7

guest: kernel-3.10.0-464.el7.x86_64
       qemu-guest-agent-2.5.0-2.el7.x86_64     

 
How reproducible:
100%


Steps to Reproduce:
1. On the host, execute following commands, after this step a new disk will appears:
# modprobe scsi_debug lbpu=1 lbpws=1  
# lsscsi
2. Test with scsi debug disk as a scsi block device:
  Boot guest with /dev/sda (generaled as that in the step 1)
  /usr/libexec/qemu-kvm \
    -S  \
    -name 'virt-tests-vm1'  \
    -sandbox off  \
    -machine pc-i440fx-rhel7.1.0  \
    -nodefaults  \
    -vga std \
    -chardev socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1,server,nowait \
    -mon chardev=qmp_id_qmpmonitor1,mode=control  \
    -chardev socket,id=qmp_id_catch_monitor,path=/tmp/monitor-catch_monitor,server,nowait \
    -mon chardev=qmp_id_catch_monitor,mode=control \
    -device pvpanic,ioport=0x505,id=idgNyj1n  \
    -chardev socket,id=serial_id_serial0,path=/tmp/serial-serial0,server,nowait \
    -device isa-serial,chardev=serial_id_serial0  \
    -chardev socket,id=seabioslog_id_20160513-025045-NDvE761N,path=/tmp/seabios,server,nowait \
    -device isa-debugcon,chardev=seabioslog_id_20160513-025045-NDvE761N,iobase=0x402 \
    -device ich9-usb-ehci1,id=usb1,addr=1d.7,multifunction=on,bus=pci.0 \
    -device ich9-usb-uhci1,id=usb1.0,multifunction=on,masterbus=usb1.0,addr=1d.0,firstport=0,bus=pci.0 \
    -device ich9-usb-uhci2,id=usb1.1,multifunction=on,masterbus=usb1.0,addr=1d.2,firstport=2,bus=pci.0 \
    -device ich9-usb-uhci3,id=usb1.2,multifunction=on,masterbus=usb1.0,addr=1d.4,firstport=4,bus=pci.0 \
    -device virtio-serial-pci,disable-legacy=true,disable-modern=false,id=virtio-serial0,addr=0x3 \
    -chardev socket,id=charchannel1,path=/home/socketfile2Gqcow2,server,nowait \
    -device virtserialport,bus=virtio-serial0.0,nr=3,chardev=charchannel1,id=channel1,name=org.qemu.guest_agent.0 \
    -drive id=drive_image1,if=none,cache=none,snapshot=off,aio=native,format=qcow2,file=/home/kvm_autotest_root/images/RHEL-Server-7.3-64-virtio.qcow2 \
    -device virtio-blk-pci,id=image1,drive=drive_image1,bootindex=0,bus=pci.0,addr=04 \
    -device virtio-net-pci,mac=9a:4f:07:b9:ca:1e,id=idrHvx0y,vectors=4,netdev=idZFMN1h,bus=pci.0,addr=05  \
    -netdev tap,id=idZFMN1h  \
    -m 4096  \
    -smp 4,maxcpus=4,cores=4,threads=1,sockets=1  \
    -cpu 'SandyBridge' \
    -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1  \
    -vnc :3  \
    -rtc base=utc,clock=host,driftfix=slew  \
    -boot order=cdn,once=c,menu=off,strict=off \
    -enable-kvm \
    -monitor stdio \
    -qmp tcp:0:4444,server,nowait \
    -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x8  \
    -drive file=/dev/sdb,if=none,id=drive-data-disk,format=raw,cache=none,aio=native,werror=stop,rerror=stop,discard=on \
    -device scsi-block,drive=drive-data-disk,bus=scsi1.0,id=data-disk \
3. Install and start guest agent inside guest
4. Check above disk label inside the guest, and make file system there
   # ll /dev/sd*
   # mkfs.ext4 /dev/sda
5. on the host, cat map:
   # cat /sys/bus/pseudo/drivers/scsi_debug/map
6. In the guest, mount and write a file to the disk:
   # mount /dev/sda /home/test
   # df -h
   # dd if=/dev/zero of=/home/test/file bs=1M count=4  
   [The 'count' number is decided by detailed disk size of the scsi disk, which      can obtained from above cmd 'df -h' output]
7. on the host, cat map again:
  # cat /sys/bus/pseudo/drivers/scsi_debug/map
8. In the guest, remove the written file:
  # rm /home/test/file -f
9. Connect to the guest agent chardev socket in host side and send  "guest-fstrim" command there:
  # nc -U /home/socketfile2Gqcow2
 {"execute":"guest-fstrim"} 
10. on the host, cat map for the 3rd time:
  # cat /sys/bus/pseudo/drivers/scsi_debug/map


Actual results:
after step 9, execute "guest-fstrim" error.
{"return": {"paths": [{"minimum": 512, "path": "/home/test", "trimmed": 6993920}, {"path": "/boot", "error": "trim not supported"}, {"path": "/", "error": "trim not supported"}]}}


Expected results:
after step 9, it should be return {"return": {}}


Additional info:
after step 5, the map message:
[root@intel-q9550-4-2 aa]# cat /sys/bus/pseudo/drivers/scsi_debug/map 
0-199,704-2727,16256-16383

after step 7, the map message:
[root@intel-q9550-4-2 aa]# cat /sys/bus/pseudo/drivers/scsi_debug/map 
0-199,704-2727,2752-14783,16256-16383

after step 10, the map message:
[root@intel-q9550-4-2 aa]# cat /sys/bus/pseudo/drivers/scsi_debug/map 
0-199,704-2723


cmd 'fstrim' inside the guest could be used normally.



tested on 7.2, it is passed.
Host: kernel-3.10.0-327.8.1.el7.x86_64
      qemu-kvm-rhev-2.3.0-31.el7_2.7
Guest: kernel-3.10.0-327.10.1.el7.x86_64
       qemu-guest-agent-2.3.0-4.el7.x86_64

Comment 2 Marc-Andre Lureau 2016-07-11 17:17:08 UTC
(In reply to Xueqiang Wei from comment #0)
> 
> Actual results:
> after step 9, execute "guest-fstrim" error.
> {"return": {"paths": [{"minimum": 512, "path": "/home/test", "trimmed":
> 6993920}, {"path": "/boot", "error": "trim not supported"}, {"path": "/",
> "error": "trim not supported"}]}}
> 
> 
> Expected results:
> after step 9, it should be return {"return": {}}
> 
> cmd 'fstrim' inside the guest could be used normally.
> 

It returns a list of all the mount points with the result. {"minimum": 512, "path": "/home/test", "trimmed": 6993920} is fine, no?

Comment 3 Xueqiang Wei 2016-07-12 05:21:12 UTC
(In reply to Marc-Andre Lureau from comment #2)
> (In reply to Xueqiang Wei from comment #0)
> > 
> > Actual results:
> > after step 9, execute "guest-fstrim" error.
> > {"return": {"paths": [{"minimum": 512, "path": "/home/test", "trimmed":
> > 6993920}, {"path": "/boot", "error": "trim not supported"}, {"path": "/",
> > "error": "trim not supported"}]}}
> > 
> > 
> > Expected results:
> > after step 9, it should be return {"return": {}}
> > 
> > cmd 'fstrim' inside the guest could be used normally.
> > 
> 
> It returns a list of all the mount points with the result. {"minimum": 512,
> "path": "/home/test", "trimmed": 6993920} is fine, no?


"trimmed": 6993920, is fine. The size of /dev/sda is 6.8M.

the details as below:
# mount /dev/sda /home/test/
# df -h
Filesystem                                  Size  Used Avail Use% Mounted on
/dev/mapper/rhel_virtlab--66--85--156-root   18G  4.2G   14G  24% /
devtmpfs                                    1.9G     0  1.9G   0% /dev
tmpfs                                       1.9G  8.0K  1.9G   1% /dev/shm
tmpfs                                       1.9G   17M  1.9G   1% /run
tmpfs                                       1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/vda1                                   497M  242M  255M  49% /boot
tmpfs                                       380M  4.0K  380M   1% /run/user/0
/dev/sda                                    6.8M   77K  6.2M   2% /home/test
# dd if=/dev/zero of=/home/test/file bs=1M count=6
6+0 records in
6+0 records out
6291456 bytes (6.3 MB) copied, 0.0161715 s, 389 MB/s
# df -h
Filesystem                                  Size  Used Avail Use% Mounted on
/dev/mapper/rhel_virtlab--66--85--156-root   18G  4.2G   14G  24% /
devtmpfs                                    1.9G     0  1.9G   0% /dev
tmpfs                                       1.9G  8.0K  1.9G   1% /dev/shm
tmpfs                                       1.9G   17M  1.9G   1% /run
tmpfs                                       1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/vda1                                   497M  242M  255M  49% /boot
tmpfs                                       380M  4.0K  380M   1% /run/user/0
/dev/sda                                    6.8M  6.1M  113K  99% /home/test
# rm /home/test/file -f
# nc -U /home/socketfile2Gqcow2
 {"execute":"guest-fstrim"} 
{"return": {"paths": [{"minimum": 512, "path": "/home/test", "trimmed": 6993920}, {"path": "/boot", "error": "trim not supported"}, {"path": "/", "error": "trim not supported"}]}}


Additional info:

on RHEL7.2, the file system is also include "/" and "/boot"(listed above), after execute "guest-fstrim", no error: {"path": "/boot", "error": "trim not supported"}, {"path": "/", "error": "trim not supported"}]}}

{"execute":"guest-fstrim"} 
{"return": {}}

if the return message is changed after run "guest-fstrim"?

Comment 6 Fam Zheng 2017-01-23 03:44:09 UTC
virtio-blk doesn't support discard, one has to use virtio-scsi for this to work.


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