Update engtools to use python3

Change spec and scripts to only use
python3 explicitly

Verification:
1. Regard as the README,in development docker environment, run
./patch-engtools.sh,
it will generate the ENGTOOLS-20.01.patch
if we scp the patch to controller,
we could sw-patch upload and sw-apply it successfully.

2. The engtools-1.0-4.tis.noarch.rpm is not built into bootimage by default
thus if we package it into bootimage when to verify it.
1). Run some bash script, such as
ceph.sh, memstats.sh, netstats.sh and so on
it will display the collect system resource information.
2). The service of collect-engtools.service
could start and stop without problem
3). If we run the modified python which we have changed to python3.
python3 buddyinfo.py
it will deplay the resource information
python3 live_stream.py
the log of livestream.log will display collect information

This package only be packaged into bootimage when we need it to
collect system resource information.

Change-Id: I9bd77e34650e200f0c65db966635a8ebcdc584aa
Story: 2007106
Task: 39112
Depends-on: https://review.opendev.org/#/c/712218/
Depends-on: https://review.opendev.org/#/c/714072/
Signed-off-by: Long Li <lilong-neu@neusoft.com>
This commit is contained in:
Long Li 2020-03-20 18:24:32 +08:00
parent 4a49816467
commit 9ec7cf4447
6 changed files with 11 additions and 9 deletions

View File

@ -2,7 +2,7 @@ The Engineering tools is meant to be installed as a patch. Therefore, the RPM is
of the build but is not included in the image. Assuming your development environment is fully set up,
simply run patch-engtools.sh to generate the patch:
In this directory ($MY_REPO/stx/middleware/util/recipes-common/engtools/hostdata-collectors),
In this directory ($MY_REPO/stx/utilities/tools/engtools/hostdata-collectors),
enter the command:
>./patch-engtools.sh

View File

@ -12,6 +12,8 @@ Source: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: systemd
Requires: iperf3
Requires: python36-six
Requires: python36-psutil
%description
This package contains data collection tools to monitor host performance.

View File

@ -14,7 +14,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
source ${MY_REPO}/stx/middleware/recipes-common/build-info/release-info.inc
source ${MY_REPO}/stx/utilities/utilities/build-info/release-info.inc
#TiS_REL="16.10"
#PATCH_ID="ENGTOOLS-${TiS_REL}"
PATCH_ID="ENGTOOLS-${PLATFORM_RELEASE}"
@ -23,7 +23,7 @@ PWD=$(pwd)
# Create CGCS Patch
cd ${MY_WORKSPACE}
PATCH_BUILD=${MY_REPO}/stx/stx-update/extras/scripts/patch_build.sh
PATCH_BUILD=${MY_REPO}/stx/update/extras/scripts/patch_build.sh
${PATCH_BUILD} --id ${PATCH_ID} --reboot-required=N \
--summary "System engineering data collection and analysis tools." \
--desc "System engineering data collection and analysis tools." \

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 textwidth=79 autoindent
"""
@ -8,7 +8,7 @@ Last author: lmwangi at gmail com
Displays the available memory fragments
by querying /proc/buddyinfo
Example:
# python buddyinfo.py
# python3 buddyinfo.py
"""
import optparse
import os

View File

@ -87,7 +87,7 @@ OPEN_STACK_SERVICE_LIST=nova cinder aodh barbican ceilometer heat glance ceph ho
SKIP_LIST=ps top sh <defunct> curl awk wc sleep lsof cut grep ip tail su
[ExcludeList]
EXCLUDE_LIST=python python2 bash perl sudo init
EXCLUDE_LIST=python python2 python3 bash perl sudo init
[ApiStatsConstantPorts]
DB_PORT_NUMBER=5432

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
"""
Copyright (c) 2017 Wind River Systems, Inc.
@ -1478,14 +1478,14 @@ if __name__ == "__main__":
# use first interface if not specified in engtools.conf
if external_if == "" or external_if is None:
p = Popen("ifconfig", shell=True, stdout=PIPE)
external_if = p.stdout.readline().split(":")[0]
external_if = p.stdout.readline().decode().split(":")[0]
p.kill()
appendToFile("/tmp/livestream.log", "-External interface for {}: {}".format(node, external_if))
# enable IP forwarding
p = Popen("sysctl -w net.ipv4.ip_forward=1 > /dev/null", shell=True)
p.communicate()
p = Popen("iptables -t nat -L --line-numbers", shell=True, stdout=PIPE)
tmp = [line.strip("\n") for line in p.stdout.readlines()]
tmp = [line.decode().strip("\n") for line in p.stdout.readlines()]
# entries need to be removed in reverse order
for line in reversed(tmp):
formatted_line = " ".join(line.strip("\n").split()[1:])