Set compression method based on platform core number
This change will switch to PIGZ for file compression when working with more platform CPUs for faster run time. PIGZ is also added as the required file in playbook config. Test Plan: 1. Bring up StarlingX and verify that pigz utility is available. 2. Perform prestage for a subcloud with less than 4 platform cores. Verify that gzip compression is used. 3. Perform prestage for a subcloud with 4 platform cores. Verify that pigz compression is used. Story: 2009948 Task: 45045 Signed-off-by: BoYuan Chang <boyuan.chang@windriver.com> Change-Id: I77a999df87183946661ceac6845b986c1a009e2f
This commit is contained in:
parent
35437ba52f
commit
2a5978d66c
@ -9,6 +9,7 @@ URL: unknown
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
|
||||
Requires: ansible
|
||||
Requires: pigz
|
||||
Requires: pyparted
|
||||
Requires: python
|
||||
Requires: python2-netaddr
|
||||
|
@ -10,6 +10,7 @@ Package: playbookconfig
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends},
|
||||
ansible,
|
||||
pigz,
|
||||
python3,
|
||||
python3-netaddr,
|
||||
python3-ptyprocess,
|
||||
|
@ -20,6 +20,12 @@ IMAGE_BUNDLES=""
|
||||
# Registry Images are loaded into this array
|
||||
declare -a IMAGE_ARRAY=()
|
||||
|
||||
# Find out how many CPUs are assigned to platform
|
||||
NUM_OF_PLATFORM_CPU=$(cat /etc/platform/worker_reserved.conf | \
|
||||
grep PLATFORM_CPU_LIST | \
|
||||
perl -pe 's/(\d+)-(\d+)/join(",",$1..$2)/eg' | \
|
||||
grep -Eo '[0-9]+' | wc -l)
|
||||
|
||||
LOG_FILE="/tmp/$(basename $0).log"
|
||||
|
||||
function log {
|
||||
@ -39,7 +45,11 @@ function generate_image_bundle {
|
||||
log "Generating image bundle ${bundle_num}..."
|
||||
log "Image list: ${images}, list size: ${list_size}, \
|
||||
bundle: ${bundle_num}, output file: ${OUTPUT}"
|
||||
docker save $(echo "${images}") | gzip > ${OUTPUT}
|
||||
if (( NUM_OF_PLAT_CPU < 4)); then
|
||||
docker save $(echo "${images}") | gzip > ${OUTPUT}
|
||||
else
|
||||
docker save $(echo "${images}") | pigz > ${OUTPUT}
|
||||
fi
|
||||
IMAGE_BUNDLES=${IMAGE_BUNDLES}" "$(basename ${OUTPUT})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user