Skip to content

Commit eab17ee

Browse files
angelcerveraroldandustymabe
authored andcommitted
Limit smp to 255 for libguestfish
libguestfs will fail with `-set-smp v` for `v` greater than 255. This can be seen in their source code: https://github.com/libguestfs/libguestfs/blob/5011bea96da06878864149767650bcc41f425fb9/lib/handle.c#L916
1 parent 9467ee2 commit eab17ee

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/libguestfish.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,16 @@ coreos_gf_run() {
4545
return
4646
fi
4747
coreos_gf_launch "$@"
48+
49+
# set-smp has a limit of 255 vcpus, anything over that will error
50+
# See: https://github.com/libguestfs/libguestfs/blob/5011bea96da06878864149767650bcc41f425fb9/lib/handle.c#L916
51+
local ncpus
52+
ncpus=$(kola ncpu)
53+
if [ "$ncpus" -gt 255 ]; then
54+
ncpus=255
55+
fi
4856
# Allow mksquashfs to parallelize
49-
coreos_gf set-smp "$(kola ncpu)"
57+
coreos_gf set-smp "$ncpus"
5058
coreos_gf run
5159
GUESTFISH_RUNNING=1
5260
}

0 commit comments

Comments
 (0)