Port stx packages and fix postrun class enable drdb

This commit is contained in:
babak sarashki 2019-10-20 23:28:16 -07:00
parent cfae882d3f
commit 5bf763d458
13 changed files with 203 additions and 100 deletions

View File

@ -1,26 +1,85 @@
ROOTFS_POSTPROCESS_COMMAND += " stx_postprocess_rootfs"
ROOTFS_POSTPROCESS_COMMAND_append = " stx_postprocess_rootfs;"
ETHDEV = "enp0s4"
stx_postprocess_rootfs() {
chmod -R go+r usr/lib/python2.7/site-packages/httpretty-0.9.5-py2.7.egg-info
sed -i -e 's/^\(ExecStartPre.*gencert.sh\)/#\1/g' lib/systemd/system/haproxy.service
rm etc/systemd/system/haproxy.service
chmod -R go+r ${IMAGE_ROOTFS}/usr/lib/python2.7/site-packages/httpretty-0.9.5-py2.7.egg-info
sed -i -e 's/^\(ExecStartPre.*gencert.sh\)/#\1/g' ${IMAGE_ROOTFS}/lib/systemd/system/haproxy.service
mkdir -p ${IMAGE_ROOTFS}/usr/share/haproxy
rm -f ${IMAGE_ROOTFS}/etc/systemd/system/haproxy.service
sed -i -e 's/^physical_.*:eth0/physical_interface_mappings = provider:eno1/g' \
etc/neutron/plugins/ml2/linuxbridge_agent.ini
sed -i -e '/^l .*resolv.conf$/d' etc/default/volatiles/00_core
sed -i -e '/^f .*resolv.conf none$/d' etc/default/volatiles/00_core
sed -i -e 's/^physical_.*:eth0/physical_interface_mappings = provider:${ETHDEV}/g' \
${IMAGE_ROOTFS}/etc/neutron/plugins/ml2/linuxbridge_agent.ini
sed -i -e '/^l .*resolv.conf$/d' ${IMAGE_ROOTFS}/etc/default/volatiles/00_core
sed -i -e '/^f .*resolv.conf none$/d' ${IMAGE_ROOTFS}/etc/default/volatiles/00_core
cd etc
rm resolv.conf
ln -s resolv-conf.systemd resolv.conf
cd ..
for srv in $(echo apache2 kubelet cinder-init glance-api glance-init glance-registry keystone-init \
neutron-init nova-compute nova-consoleauth nova-console nova-init nova-network \
nova-xvpvncproxy nova-spicehtml5proxy openvswitch rabbitmq-server \
registry-token-server)
do
rm -f ${IMAGE_ROOTFS}/etc/systemd/system/multi-user.target.wants/$srv.service
ln -s /dev/null ${IMAGE_ROOTFS}/etc/systemd/system/multi-user.target.wants/$srv.service
done
chown etcd:etcd ${IMAGE_ROOTFS}/var/lib/etcd
echo 'sysadmin ALL=(ALL) NOPASSWD:ALL' >> ${IMAGE_ROOTFS}/etc/sudoers
cat > ${IMAGE_ROOTFS}/etc/build.info << \EOF
OS="poky"
SW_VERSION="19.01"
BUILD_TARGET="Host Installer"
BUILD_TYPE="Formal"
BUILD_ID="r/stx.2.0"
JOB="STX_BUILD_2.0"
BUILD_BY="starlingx.build@cengn.ca"
BUILD_NUMBER="40"
BUILD_HOST="starlingx_mirror"
BUILD_DATE="2019-08-26 23:30:00 +0000"
EOF
mkdir -p ${IMAGE_ROOTFS}/etc/platform/
cat > ${IMAGE_ROOTFS}/etc/platform/platform.conf << \EOF
nodetype=controllcentoser
subfunction=controller,worker,lowlatency
system_type=All-in-one
security_profile=standard
management_interface=lo
http_port=8080
INSTALL_UUID=d0bb64fe-fb55-4996-8382-ce5fd4aa251c
UUID=e4939a75-c84f-48b5-ad49-af406859d352
sdn_enabled=no
region_config=no
system_mode=simplex
sw_version=19.08
security_feature="nopti nospectre_v2"
vswitch_type=none
region_config=False
cluster_host_interface=lo
oam_interface=enp0s4
EOF
cat > ${IMAGE_ROOTFS}/etc/keystone/password-rules.conf << \EOF
[security_compliance]
unique_last_password_count = 2
password_regex = ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()<>{}+=_\\\[\]\-?|~`,.;:]).{7,}$
password_regex_description = Password must have a minimum length of 7 characters, and must contain at least 1 upper case, 1 lower case, 1 digit, and 1 special character'
EOF
cat > ${IMAGE_ROOTFS}/home/root/.vimrc << \EOF
set background=dark
set noundofile
set nobackup
map b : buffer
map `r : register
EOF
systemctl --root=${D} disable apache2.service
systemctl --root=${D} disable cinder-volume.service
systemctl --root=${D} disable cinder-api.service
systemctl --root=${D} disable cinder-scheduler.service
systemctl --root=${D} disable cinder-backup.service
systemctl --root=${D} enable systemd-resolved.service
chown etcd:etcd var/lib/etcd
}

View File

@ -99,3 +99,8 @@ PREFERRED_VERSION_python3-cherrypy = "git"
PREFERRED_VERSION_python-cheroot = "git"
PREFERRED_VERSION_python3-cheroot = "git"
PREFERRED_VERSION_python-cherrypy = "git"
# Used by:
# neutron-init
# glance-init
CONTROLLER_IP = "0.0.0.0"

View File

@ -78,12 +78,22 @@ RDEPENDS_packagegroup-stx-misc = "\
python-keystoneauth1 \
python-keystoneclient \
python-ansible \
python-pynacl \
python-psycopg2 \
playbookconfig \
tzdata \
go-dep \
mariadb \
auditd \
spice-html5 \
postgresql-setup \
bind-utils \
nscd \
dnsmasq \
platform-util \
namespace-utils \
drbd-utils \
"
# mariadb
RDEPENDS_packagegroup-stx-ceph = "\
ceph \
@ -125,6 +135,7 @@ RDEPENDS_packagegroup-stx-ceph = "\
python-pyudev \
python-ldap \
python-configparser \
python-httpretty \
"
# ceph-manager \
# sysinv \

View File

@ -5,6 +5,7 @@ do_install_prepend () {
cd ${S}/storageconfig/storageconfig/
oe_runmake GOENABLEDDIR=${D}/${sysconfdir}/goenabled.d INITDDIR=${D}/${sysconfdir}/init.d \
SYSTEMDDIR=${D}/${systemd_system_unitdir} install
sed -i -e 's:/usr/local/bin/:/usr/bin/:g' ${D}/${sysconfdir}/init.d/storage_config
}
FILES_storageconfig = " \

View File

@ -34,10 +34,10 @@ require stx-collector.inc
require stx-filesystem.inc
require stx-ldap.inc
require stx-logging.inc
# database
# Mariadb included from Yocto. TODO: Port relevant patches.
# utilities
require stx-utilities.inc
# networking
#require stx-networking.inc
# kernel
# kubernetes
@ -48,7 +48,6 @@ require stx-logging.inc
# monitoring
# networking
# python
@ -56,7 +55,6 @@ require stx-logging.inc
# storage-drivers
# utilities
# virt

View File

@ -0,0 +1,4 @@
DESCRIPTION = "stx-networking"
#require networking/lldpd.inc

View File

@ -0,0 +1,6 @@
DESCRIPTION = "stx-utilities"
require utilities/platform-util.inc
require utilities/namespace-utils.inc
#require utilities/buildinfo.inc

View File

@ -0,0 +1,2 @@
# Implement this through class ?

View File

@ -0,0 +1,26 @@
PACKAGES += " namespace-utils"
RDEPENDS_namespace-utils_append = " bash"
do_configure_append() {
:
}
do_compile_append() {
cd ${S}/utilities/namespace-utils/namespace-utils
${CC} ${TARGET_CFLAGS} -c -o bashns.o bashns.c
${CC} ${TARGET_LDFLAGS} -o bashns bashns.o
}
do_install_append() {
cd ${S}/utilities/namespace-utils/namespace-utils
install -d ${D}/${sbindir}
install -m 500 bashns ${D}/${sbindir}
install -m 500 umount-in-namespace ${D}/${sbindir}
}
FILES_namespace-utils_append = "\
${sbindir}/bashns \
${sbindir}/umount-in-namespace \
"

View File

@ -0,0 +1,49 @@
PACKAGES += " platform-util"
RDEPENDS_platform-util_append = " bash"
do_configure_append() {
:
}
do_compile_append() {
cd ${S}/utilities/platform-util/platform-util
distutils_do_configure
}
do_install_append() {
cd ${S}/utilities/platform-util/platform-util
distutils_do_compile
install -d ${D}/${bindir}
install ${S}/utilities/platform-util/scripts/cgcs_tc_setup.sh ${D}/${bindir}
install ${S}/utilities/platform-util/scripts/remotelogging_tc_setup.sh ${D}/${bindir}
install ${S}/utilities/platform-util/scripts/connectivity_test ${D}/${bindir}
install -d ${D}/${sysconfdir}/init.d
install ${S}/utilities/platform-util/scripts/log_functions.sh ${D}/${sysconfdir}/init.d
install -d ${D}/${sbindir}
install -m 700 -p -D ${S}/utilities/platform-util/scripts/patch-restart-mtce ${D}/${sbindir}
install -m 700 -p -D ${S}/utilities/platform-util/scripts/patch-restart-processes ${D}/${sbindir}
install -m 700 -p -D ${S}/utilities/platform-util/scripts/patch-restart-haproxy ${D}/${sbindir}
install -d ${D}/${systemd_unitdir}
install -m 644 -p -D ${S}/utilities/platform-util/scripts/opt-platform.mount ${D}/${systemd_unitdir}
install -m 644 -p -D ${S}/utilities/platform-util/scripts/opt-platform.service ${D}/${systemd_unitdir}
}
FILES_platform-util_append = "\
${libdir}/python2.7/site-packages/platform_util \
${libdir}/python2.7/site-packages/platform_util-1.0.0-py2.7.egg-info \
${bindir}/cgcs_tc_setup.sh \
${bindir}/remotelogging_tc_setup.sh \
${bindir}/connectivity_test \
${sysconfdir}/init.d \
${sysconfdir}/init.d/log_functions.sh \
${sbindir}/patch-restart-mtce \
${sbindir}/patch-restart-processes \
${sbindir}/patch-restart-haproxy \
${systemd_unitdir}/opt-platform.mount \
${systemd_unitdir}/opt-platform.service \
"

View File

@ -17,18 +17,18 @@ Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
--- a/_mysql.c
+++ b/_mysql.c
@@ -2002,7 +2002,14 @@ _mysql_ConnectionObject_ping(
int r, reconnect = -1;
if (!PyArg_ParseTuple(args, "|I", &reconnect)) return NULL;
check_connection(self);
- if ( reconnect != -1 ) self->connection.reconnect = reconnect;
+ if ( reconnect != -1 ) {
+#if MYSQL_VERSION_ID >= 50013
+ my_bool recon = reconnect;
+ mysql_options(&self->connection, MYSQL_OPT_RECONNECT, &recon);
+#else
+ self->connection.reconnect = reconnect;
+#endif
+ }
Py_BEGIN_ALLOW_THREADS
r = mysql_ping(&(self->connection));
Py_END_ALLOW_THREADS
int r, reconnect = -1;
if (!PyArg_ParseTuple(args, "|I", &reconnect)) return NULL;
check_connection(self);
- if ( reconnect != -1 ) self->connection.reconnect = reconnect;
+ if ( reconnect != -1 ) {
+#if MYSQL_VERSION_ID >= 50013
+ my_bool recon = reconnect;
+ mysql_options(&self->connection, MYSQL_OPT_RECONNECT, &recon);
+#else
+ self->connection.reconnect = reconnect;
+#endif
+ }
Py_BEGIN_ALLOW_THREADS
r = mysql_ping(&(self->connection));
Py_END_ALLOW_THREADS

View File

@ -14,63 +14,4 @@ SRC_URI[sha256sum] = "8e9403e755ce8ef27b6066cdd7a4c567aa80ebe2fd90d0ff8efa0a725d
S = "${WORKDIR}/${SRCNAME}-${PV}"
ANSIBLE_WHITELIST_MODULES ?= "commands files system network/ovs __pycache__ service"
do_install_append() {
set +e
# install hosts and conf
install -d ${D}/${sysconfdir}/ansible
# There is no default inventory configuration installed for ansible,
# so we use the example as a template to improve OOBE.
install ${S}/examples/hosts ${D}/${sysconfdir}/ansible/
install ${S}/examples/ansible.cfg ${D}/${sysconfdir}/ansible/
# do not gather machine's information, which could reduce setup time
sed -i "s|^#gathering = implicit|gathering = explicit|g" \
${D}/${sysconfdir}/ansible/ansible.cfg
for d in $(ls ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/ansible/modules); do
if [ -d ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/ansible/modules/$d ]; then
match=
rm_target=
for w in ${ANSIBLE_WHITELIST_MODULES}; do
m=$(echo $w | grep $d)
if [ $? -eq 0 ]; then
match=t
match_word=$m
fi
done
if [ -n "$match" ]; then
echo $match_word | grep -q "/"
if [ $? -eq 0 ]; then
for d2 in $(ls ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/ansible/modules/$d); do
if [ -d ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/ansible/modules/$d/$d2 ]; then
sub_remove=t
for w in ${ANSIBLE_WHITELIST_MODULES}; do
m=$(echo $w | grep $d2)
if [ $? -eq 0 ]; then
sub_remove=
fi
done
if [ -n "$sub_remove" ]; then
echo "[info]: removing $d/$d2"
rm -rf ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/ansible/modules/$d/$d2
else
echo "[info]: whitlisting $d/$d2"
fi
fi
done
else
echo "[info]: whitlisting $d"
fi
else
echo "[info]: removing $d"
rm -rf ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/ansible/modules/$d
fi
fi
done
}
CLEANBROKEN = "1"

View File

@ -3,3 +3,4 @@ CONFIG_NFSD_V3=y
CONFIG_NFSD_V3_ACL=y
CONFIG_NF_TABLES=m
CONFIG_NFT_COMPAT=m
CONFIG_BLK_DEV_DRBD=m