Files
libguestfs/daemon
Andrey Drobyshev d2f8308813 daemon/selinux-relabel: run setfiles with "-T 0", if supported
Since SELinux userspace v3.4 [1], setfiles command supports "-T nthreads"
option, which allows parallel execution.  "-T 0" allows using as many
threads as there're available CPU cores.  This might speed up the process
of filesystem relabeling in case the appliance is being run with multiple
vCPUs.  The latter is true for at least v2v starting from d2b64ecc67
("v2v: Set the number of vCPUs to same as host number of pCPUs.").

For instance, when running virt-v2v-in-place on my 12-core Xeon host
with SSD, with appliance being run with 8 vCPUs (the upper limit specified
in d2b64ecc67), and on the ~150GiB disk VM (physical size on the host),
I get the following results:

./in-place/virt-v2v-in-place -i libvirt fedora37-vm -v -x

Without this patch:
...
commandrvf: setfiles -F -e /sysroot/dev -e /sysroot/proc -e /sysroot/sys -m -C -r /sysroot -v /sysroot/etc/selinux/targeted/contexts/files/file_contexts /sysroot/^M
libguestfs: trace: v2v: selinux_relabel = 0
libguestfs: trace: v2v: rm_f "/.autorelabel"
guestfsd: => selinux_relabel (0x1d3) took 17.94 secs
...

With this patch:
...
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/^M
libguestfs: trace: v2v: selinux_relabel = 0
libguestfs: trace: v2v: rm_f "/.autorelabel"
guestfsd: => selinux_relabel (0x1d3) took 5.88 secs
...

So in my scenario it's getting 3 times faster.

[1] https://github.com/SELinuxProject/selinux/releases/tag/3.4

Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit d0d8e67384)
2024-07-09 14:42:43 +01:00
..
2022-03-09 09:28:02 +00:00
2017-07-27 17:31:41 +01:00
2017-07-27 17:31:41 +01:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2024-07-09 14:06:52 +01:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2017-07-27 17:31:41 +01:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2021-03-16 11:24:37 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2017-07-27 17:31:41 +01:00
2017-07-27 17:31:41 +01:00
2017-07-27 17:31:41 +01:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2018-04-19 11:30:29 +02:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2024-07-09 14:08:41 +01:00
2017-07-27 17:31:41 +01:00
2017-07-27 17:31:41 +01:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2014-10-23 19:03:11 +02:00
2017-07-27 17:31:41 +01:00
2018-02-12 11:24:06 +01:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2017-07-27 17:31:41 +01:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2014-10-23 19:03:11 +02:00
2017-07-27 17:31:41 +01:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2017-07-27 17:31:41 +01:00
2017-07-27 17:31:41 +01:00
2017-07-27 17:31:41 +01:00
2017-07-27 17:31:41 +01:00
2017-07-27 17:31:41 +01:00
2017-07-27 17:31:41 +01:00
2017-07-10 17:01:59 +01:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2017-07-27 17:31:41 +01:00
2023-02-07 10:50:48 +00:00
2017-07-27 17:31:41 +01:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2015-07-02 16:08:44 +01:00
2023-02-07 10:50:48 +00:00
2023-02-07 10:50:48 +00:00
2014-10-23 19:03:11 +02:00
2015-10-05 14:28:33 +01:00
2023-02-07 10:50:48 +00:00
2021-03-30 12:56:58 +01:00
2023-02-07 10:50:48 +00:00
2017-07-27 17:31:41 +01:00