diff --git a/playbookconfig/centos/playbookconfig.spec b/playbookconfig/centos/playbookconfig.spec index f88dfa696..016407f11 100644 --- a/playbookconfig/centos/playbookconfig.spec +++ b/playbookconfig/centos/playbookconfig.spec @@ -9,6 +9,7 @@ URL: unknown Source0: %{name}-%{version}.tar.gz Requires: ansible +Requires: pigz Requires: pyparted Requires: python Requires: python2-netaddr diff --git a/playbookconfig/debian/deb_folder/control b/playbookconfig/debian/deb_folder/control index f55d30940..71a06472d 100644 --- a/playbookconfig/debian/deb_folder/control +++ b/playbookconfig/debian/deb_folder/control @@ -10,6 +10,7 @@ Package: playbookconfig Architecture: all Depends: ${misc:Depends}, ansible, + pigz, python3, python3-netaddr, python3-ptyprocess, diff --git a/playbookconfig/src/playbooks/roles/prestage/prestage-images/files/gen-image-bundles.sh b/playbookconfig/src/playbooks/roles/prestage/prestage-images/files/gen-image-bundles.sh index a6dbac395..690adcbdc 100644 --- a/playbookconfig/src/playbooks/roles/prestage/prestage-images/files/gen-image-bundles.sh +++ b/playbookconfig/src/playbooks/roles/prestage/prestage-images/files/gen-image-bundles.sh @@ -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}) }