Bug 2190276
| Summary: | virt-v2v should relabel Linux guest filesystems in parallel | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Richard W.M. Jones <rjones> |
| Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> |
| Status: | CLOSED ERRATA | QA Contact: | mxie <mxie> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 9.3 | CC: | chhu, hongzliu, juzhou, lersek, mxie, qzhang, rjones, tyan, tzheng, virt-maint, vwu, xiaodwan, ymao, yoguo |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libguestfs-1.50.1-4.el9 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-11-07 08:24:21 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: | 2177705 | ||
| Bug Blocks: | |||
|
Description
Richard W.M. Jones
2023-04-27 18:10:48 UTC
For testing this, the first, most important thing is that it doesn't break existing Linux guest conversions. It should also make them faster. This may be noticable even with a regular RHEL or Fedora guest conversion just by timing before and after. There may only be a few seconds difference. The real test would be a RHEL or Fedora guest with a very large filesystem (ie. lots of small files and directories - many millions of them). If you create that kind of guest then the difference in conversion time may be significant. You could try something like this inside a guest ... $ wget https://ftp.gnu.org/gnu/glibc/glibc-2.37.tar.xz $ xzcat glibc-2.37.tar.xz | tar xf - $ du -sh glibc-2.37 278M glibc-2.37 $ find glibc-2.37 | wc -l 20202 (or another large software package would work) Then create many copies, eg: $ for f in {01..10}; do cp -a glibc-2.37 glibc-2.37.$f; done $ du -sh glibc-2.37* 278M glibc-2.37 278M glibc-2.37.01 278M glibc-2.37.02 278M glibc-2.37.03 278M glibc-2.37.04 278M glibc-2.37.05 278M glibc-2.37.06 278M glibc-2.37.07 278M glibc-2.37.08 278M glibc-2.37.09 278M glibc-2.37.10 18M glibc-2.37.tar.xz $ find glibc-2.37* | wc -l 222223 (increase "10" to a larger number) Reproduce the bug with below builds: libguestfs-1.50.1-3.el9.x86_64 guestfs-tools-1.50.1-1.el9.x86_64 virt-v2v-2.3.4-1.el9.x86_64 nbdkit-server-1.34.1-1.el9.x86_64 libnbd-1.16.0-1.el9.x86_64 Steps to reproduce: Scenario1: 1.1 Prepare a rhel9 guest with large disk and SELINUX=enforcing on VMware environment, then convert the guest from VMware to local libvirt by v2v # virt-v2v -ic vpx://root.74.72/data/10.73.75.219/?no_verify=1 -it vddk -io vddk-libdir=/home/vddk8.0.0 -io vddk-thumbprint=24:40:7E:C8:C8:1F:9C:DF:E4:E0:48:D0:9E:25:64:94:64:AF:C6:8C -ip /home/passwd esx6.7-rhel9.3-with-large-disk -v -x |& ts > v2v-convert-guest-with-large-disk-selinux-enforcing-libguestfs-1.50.1-3.log 1.2 Check v2v debug log, find selinux relael takes 121.19 secs # cat v2v-convert-guest-with-large-disk-selinux-enforcing-libguestfs-1.50.1-3.log |grep 'setfiles -F' -A 4 May 06 16:10:00 commandrvf: setfiles -F -e /sysroot/dev -e /sysroot/proc -e /sysroot/selinux -e /sysroot/sys -m -C -r /sysroot -v /sysroot/etc/selinux/targeted/contexts/files/file_contexts /sysroot/ May 06 16:10:00 Can't stat exclude path "/sysroot/selinux", No such file or directory - ignoring. May 06 16:12:01 libguestfs: trace: v2v: selinux_relabel = 0 May 06 16:12:01 libguestfs: trace: v2v: rm_f "/.autorelabel" May 06 16:12:01 guestfsd: => selinux_relabel (0x1d3) took 121.19 secs Scenario2: 2.1 Prepare a rhel9 guest with large disk and disabled SELINUX on VMware environment, then convert the guest from VMware to local libvirt by v2v # virt-v2v -ic vpx://root.74.72/data/10.73.75.219/?no_verify=1 -it vddk -io vddk-libdir=/home/vddk8.0.0 -io vddk-thumbprint=24:40:7E:C8:C8:1F:9C:DF:E4:E0:48:D0:9E:25:64:94:64:AF:C6:8C -ip /home/passwd esx6.7-rhel9.3-with-large-disk -v -x |& ts > v2v-convert-guest-with-large-disk-selinux-disabled-libguestfs-1.50.1-3.log 2.2 Check v2v debug log, find selinux relael takes 122.63 secs # cat v2v-convert-guest-with-large-disk-selinux-disabled-libguestfs-1.50.1-3.log |grep 'setfiles -F' -A 4 May 06 18:29:30 commandrvf: setfiles -F -e /sysroot/dev -e /sysroot/proc -e /sysroot/selinux -e /sysroot/sys -m -C -r /sysroot -v /sysroot/etc/selinux/targeted/contexts/files/file_contexts /sysroot/ May 06 18:29:30 Can't stat exclude path "/sysroot/selinux", No such file or directory - ignoring. May 06 18:31:32 libguestfs: trace: v2v: selinux_relabel = 0 May 06 18:31:32 libguestfs: trace: v2v: rm_f "/.autorelabel" May 06 18:31:32 guestfsd: => selinux_relabel (0x1d3) took 122.63 secs Test the bug with below builds: libguestfs-1.50.1-4.el9.x86_64 guestfs-tools-1.50.1-2.el9.x86_64 virt-v2v-2.3.4-1.el9.x86_64 nbdkit-server-1.34.1-1.el9.x86_64 libnbd-1.16.0-1.el9.x86_64 Steps: Scenario1: 1.1 Convert the same guest of above reproduction step1.1 by v2v #virt-v2v -ic vpx://root.74.72/data/10.73.75.219/?no_verify=1 -it vddk -io vddk-libdir=/home/vddk8.0.0 -io vddk-thumbprint=24:40:7E:C8:C8:1F:9C:DF:E4:E0:48:D0:9E:25:64:94:64:AF:C6:8C -ip /home/passwd esx6.7-rhel9.3-with-large-disk -v -x |& ts > v2v-convert-guest-with-large-disk-selinux-enforcing-libguestfs-1.50.1-4.log 1.2 Check v2v debug log, find selinux relael takes 60.11 secs and '-T 0' parameter is added to setfiles command, besides, warning 'Can't stat exclude path "/sysroot/selinux", No such file or directory - ignoring.' is removed # cat v2v-convert-guest-with-large-disk-selinux-enforcing-libguestfs-1.50.1-4.log |grep 'setfiles -F' -A 3 May 06 15:44:18 commandrvf: setfiles -F -e /sysroot/dev -e /sysroot/proc -e /sysroot/sys -m -C -T 0 -r /sysroot -v /sysroot/etc/selinux/targeted/contexts/files/file_contexts /sysroot/ May 06 15:45:18 libguestfs: trace: v2v: selinux_relabel = 0 May 06 15:45:18 libguestfs: trace: v2v: rm_f "/.autorelabel" May 06 15:45:18 guestfsd: => selinux_relabel (0x1d3) took 60.11 secs Scenario2: 2.1 Convert the same guest of above reproduction step2.1 by v2v #virt-v2v -ic vpx://root.74.72/data/10.73.75.219/?no_verify=1 -it vddk -io vddk-libdir=/home/vddk8.0.0 -io vddk-thumbprint=24:40:7E:C8:C8:1F:9C:DF:E4:E0:48:D0:9E:25:64:94:64:AF:C6:8C -ip /home/passwd esx6.7-rhel9.3-with-large-disk -v -x |& ts > v2v-convert-guest-with-large-disk-selinux-disabled-libguestfs-1.50.1-4.log 2.2 Check v2v debug log, find selinux relael takes 61.27 secs and '-T 0' parameter is added to setfiles command, besides, warning 'Can't stat exclude path "/sysroot/selinux", No such file or directory - ignoring' is removed # cat v2v-convert-guest-with-large-disk-selinux-disabled-libguestfs-1.50.1-4.log |grep 'setfiles -F' -A 3 May 06 18:38:59 commandrvf: setfiles -F -e /sysroot/dev -e /sysroot/proc -e /sysroot/sys -m -C -T 0 -r /sysroot -v /sysroot/etc/selinux/targeted/contexts/files/file_contexts /sysroot/ May 06 18:40:00 libguestfs: trace: v2v: selinux_relabel = 0 May 06 18:40:00 libguestfs: trace: v2v: rm_f "/.autorelabel" May 06 18:40:01 guestfsd: => selinux_relabel (0x1d3) took 61.27 secs Result: The time of selinux relabel for linux guest has reduced with libguestfs-1.50.1-4.el9.x86_64 during v2v conversion Hi Richard, Please help to check scenanio2, selinux will be relabeling even if selinux is disabled during v2v conversion, is it expected? First I think doubling the relabelling speed is pretty good, thanks for verifying that. Yes, we do relabel the filesystem even if SELinux is disabled. HOWEVER in future this might change, because we accepted a patch upstream which entirely skips the SELinux relabel step if we detect that it is disabled (https://github.com/libguestfs/libguestfs-common/commit/17ef57a9bc8196d2e521c877a835ea84d02b931d) It is not in RHEL 9 so far. 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 (libguestfs bug fix and enhancement update), 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://access.redhat.com/errata/RHBA-2023:6327 |