Disable parallel collect mode when there is only one host

CPU consumption is increased when using the parallel mode in
comparison to inline mode, due to the task monitoring code, even when
there is just one host to collect.

To improve collect performance on AIO-SX system configured with a
single platform core, this change disables parallel collection mode
when there is just one host and it is not a subcloud collect.

TEST PLAN:
PASS: AIO-SX: Perform a collect without this change and notice the cpu
      consumption on /var/log/collectd.log (it is shown as ssh
      process). Manually edit the source code with this change and
      perform the collect again. Notice the cpu consumption is
      decreased.
PASS: STD: Perform the same test from AIO-SX on active controller node
      but specify the inactive controller for collection.
PASS: STD: Perform the same test from AIO-SX, but from inactive
      controller.

Story: 2010533
Task: 47600

Signed-off-by: Alyson Deives Pereira <alyson.deivespereira@windriver.com>
Change-Id: Ide743d33ad1e0af40344fd4faa8153388891c655
This commit is contained in:
Alyson Deives Pereira 2023-03-07 17:15:51 -03:00
parent 2b86f05463
commit 576c45e851

View File

@ -1,7 +1,7 @@
#! /bin/bash
########################################################################
#
# Copyright (c) 2014-2021 Wind River Systems, Inc.
# Copyright (c) 2014-2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -39,7 +39,7 @@
#
# 3. Default to collecting from hosts or subclouds in parallel. Parallel
# collect reduces the overall collect time for the specified system.
# Collect now launchs host or subcloud collect requests as backgroud
# Collect now launches host or subcloud collect requests as background
# threads and monitors for completion or error before moving on to
# create the final tarball collect bundle.
#
@ -47,6 +47,8 @@
# supported with the introduction and use of the --inline or -in
# command option.
#
# If there is just one host to collect, the inline mode is used by default.
#
# Typical Usages:
#
# command line collect data for function
@ -794,7 +796,6 @@ dlog "${TOOL_NAME} ver ${TOOL_REV}.${TOOL_REV} (pid:$$)"
dlog "USERNAME = ${USER}"
dlog "ACTIVE = ${ACTIVE}"
dlog "HOSTNAME = ${HOSTNAME}"
dlog "PARALLEL = ${PARALLEL_COLLECT_MODE}"
dlog "INVENTORY = ${INVENTORY}"
dlog "STARTDATE = ${STARTDATE}"
dlog "ENDDATE = ${ENDDATE}"
@ -1037,6 +1038,7 @@ elif [ "${SUBCLOUD_COLLECT}" = false -a ${HOSTS} -eq 1 ] ; then
# Single host bundle
COLLECT_NAME="${HOSTLIST[0]}"
COLLECT_TYPE="single-node"
PARALLEL_COLLECT_MODE=false
elif [ "${SUBCLOUD_COLLECT}" = true -a ${SUBCLOUDS} -eq 1 ] ; then
@ -1072,6 +1074,7 @@ fi
if [ "${DCROLE}" != "" ] ; then
dlog "DCROLE = ${DCROLE}"
fi
dlog "PARALLEL = ${PARALLEL_COLLECT_MODE}"
dlog "COLLECT_TYPE = ${COLLECT_TYPE}"
dlog "COLLECT_NAME = ${COLLECT_NAME}"
dlog "COLLECT_DIR = ${COLLECT_DIR}"