Bug 831159
Summary: | [NetApp 7.0 RFE] add support for starting FITRIM in the guest (via qemu-ga) | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Paolo Bonzini <pbonzini> | |
Component: | libvirt | Assignee: | Michal Privoznik <mprivozn> | |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Virtualization Bugs <virt-bugs> | |
Severity: | unspecified | Docs Contact: | ||
Priority: | unspecified | |||
Version: | 7.0 | CC: | ajia, bili, cwei, dallan, dyuan, fsimonce, mprivozn, mzhan, pbonzini, rjones | |
Target Milestone: | rc | Keywords: | FutureFeature | |
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | libvirt-1.0.1-1.el7 | Doc Type: | Enhancement | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1061577 (view as bug list) | Environment: | ||
Last Closed: | 2014-06-13 11:02:49 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: | ||||
Bug Blocks: | 1061577 |
Description
Paolo Bonzini
2012-06-12 10:58:56 UTC
Paolo is there a qemu BZ on which this BZ should depend? I didn't create it because the QEMU patch is already on its way to upstream and should be already in F18. Patch proposed upstream: https://www.redhat.com/archives/libvir-list/2012-November/msg00852.html Moving to POST: commit 47c724e54f43208382a08edd75c706ea6be7205c Author: Michal Privoznik <mprivozn> AuthorDate: Tue Nov 20 18:23:20 2012 +0100 Commit: Michal Privoznik <mprivozn> CommitDate: Wed Nov 28 16:15:01 2012 +0100 virsh: Expose new virDomainFSTrim API It's exposed under domfstrim command. Although the API doesn't support specifying mount point yet, expose it anyway. commit 6092fea93a365405576db6955af1757060bd001b Author: Michal Privoznik <mprivozn> AuthorDate: Tue Nov 20 17:10:29 2012 +0100 Commit: Michal Privoznik <mprivozn> CommitDate: Wed Nov 28 16:15:01 2012 +0100 qemu: Implement virDomainFSTrim using qemu guest agent. As said in previous patch, @mountPoint must be NULL and @flags zero because qemu guest agent doesn't support these arguments yet. If qemu learns them, we can start supporting them as well. commit bcbe646d92f94b456a4396a083b8277fbee0d432 Author: Michal Privoznik <mprivozn> AuthorDate: Tue Nov 20 19:01:21 2012 +0100 Commit: Michal Privoznik <mprivozn> CommitDate: Wed Nov 28 16:15:01 2012 +0100 remote: Implement virDomainFSTrim A new rule to fixup_name() in gendispatch.pl needs to be added, otherwise we are left with remoteDomainFstrim which is not wanted. commit 0fbf3704fd0c0432dca5be10b707155f43208891 Author: Michal Privoznik <mprivozn> AuthorDate: Tue Nov 20 16:43:56 2012 +0100 Commit: Michal Privoznik <mprivozn> CommitDate: Wed Nov 28 16:15:01 2012 +0100 Introduce virDomainFSTrim() public API This will call FITRIM within guest. The API has 4 arguments, however, only 2 will be used for now (@dom and @minumum). The rest two are there if in future qemu guest agent learns them. v1.0.0-154-g47c724e v1.0.0-153-g6092fea v1.0.0-152-gbcbe646 v1.0.0-151-g0fbf370 Verifying this bug with packages: libvirt-1.0.5-1.el7.x86_64 qemu-kvm-1.4.0-4.el7.x86_64 and guest with qemu-guest-agent-1.4.0-4.el7.x86_64 1. For DOC test: # virsh help domfstrim NAME domfstrim - Invoke fstrim on domain's mounted filesystems. SYNOPSIS domfstrim <domain> [--minimum <number>] [<mountpoint>] DESCRIPTION Invoke fstrim on domain's mounted filesystems. OPTIONS [--domain] <string> domain name, id or uuid --minimum <number> Just a hint to ignore contiguous free ranges smaller than this (Bytes) [--mountpoint] <string> which mount point to trim # man virsh ... domfstrim domain [--minimum bytes] [--mountpoint mountPoint] Issue a fstrim command on all mounted filesystems within a running domain. It discards blocks which are not in use by the filesystem. If --minimum bytes is specified, it tells guest kernel length of contiguous free range. Smaller than this may be ignored (this is a hint and the guest may not respect it). By increasing this value, the fstrim operation will complete more quickly for filesystems with badly fragmented free space, although not all blocks will be discarded. The default value is zero, meaning "discard every free block". Moreover, a if user wants to trim only one mount point, it can be specified via optional --mountpoint parameter. ... 2. Function test (pass-through scsi disk): Steps: 1.On the host: # modprobe scsi_debug lbpu=1 lbpws=1 // after this step a new disk will appears # lsscsi [0:0:0:0] disk ATA ST3500413AS HP64 /dev/sda [2:0:0:0] cd/dvd hp DVD-RAM GH80N RF01 /dev/sr0 [6:0:0:0] disk Linux scsi_debug 0004 /dev/sdb 2.# sg_vpd -p0xb2 /dev/sdb 3.Using "virsh edit", add the following nodes to the guest's libvirt XML, under the /domain/devices node: <disk type='block' device='lun'> <driver name='qemu' type='raw' cache='none' io='native'/> <source dev='/dev/disk/by-path/scsi-0:0:0:0'/> <target dev='sdb' bus='scsi'/> <alias name='scsi0-0-0-1'/> <address type='drive' controller='0' bus='0' target='0' unit='1'/> </disk> <controller type='scsi' index='0' model='virtio-scsi'> <alias name='scsi0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </controller> <channel type='unix'> <source mode='bind' path='/var/lib/libvirt/qemu/r7.agent'/> <target type='virtio' name='org.qemu.guest_agent.0'/> <alias name='channel1'/> <address type='virtio-serial' controller='0' bus='0' port='2'/> </channel> Start the guest, and start qemu-guest-agent.service in it. 4.make file system(ext4) to the scsi disk in the guest. # mkfs.ext4 /dev/sda 5.on the host. # cat /sys/bus/pseudo/drivers/scsi_debug/map 1-136,641-2660 6.in the guest. # mount /dev/sda /home/test # dd if=/dev/zero of=/home/test/file 7.cat map in host. # cat /sys/bus/pseudo/drivers/scsi_debug/map 1-136,641-2660,2689-14688,15025-16016 8.in guest. # rm -f /home/test/file 9.in host: # virsh domfstrim r7 # echo $? 0 10. cat map in host. # cat /sys/bus/pseudo/drivers/scsi_debug/map 1-136,641-2660 11. in guest: # cat /var/log/messages .... May 21 05:55:43 localhost qemu-ga: info: guest-fstrim called May 21 05:56:07 localhost systemd[1]: Starting Cleanup of Temporary Directories... May 21 05:56:07 localhost systemd[1]: Started Cleanup of Temporary Directories. Worked as expected. Setting VERIFIED. 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. |