From 262142c50cdd057352a1df8bd507b067bb6fe526 Mon Sep 17 00:00:00 2001 From: Yi Wang Date: Wed, 27 Feb 2019 23:03:59 +0800 Subject: [PATCH] updates to stx-nfv devstack plugin * Build and install guest_scale_helper. It is called by nova. So we don't implement start_xx and stop_xx functions in the plugin. * Fix two minor issues in guest-comm and guest-agent Makefiles. * Remove "make host_clean" in host-agent installation function. * Add EXTRALDFLAGS to linker in guest-agent and mtce-guest Makefiles. Story: 2003163 Task: 29237 Depends-On: https://review.openstack.org/639253 Change-Id: I4ab0b6d6e5c4920572ebadbb48778470ee020281 Signed-off-by: Yi Wang --- devstack/lib/stx-nfv | 37 +++++++++++++++++----- guest-agent/guest-scale-agent-2.0/Makefile | 6 ++-- guest-comm/host-guest-comm-2.0/Makefile | 2 +- mtce-guest/src/Makefile | 2 +- 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/devstack/lib/stx-nfv b/devstack/lib/stx-nfv index a6f3dfad..589525f1 100644 --- a/devstack/lib/stx-nfv +++ b/devstack/lib/stx-nfv @@ -56,7 +56,7 @@ PYTHON_SITE_DIR=$(python -c "from distutils.sysconfig import get_python_lib; pri function cleanup_guest_agent { sudo rm -rf $MTCE_GUEST_OCF_DIR/guestAgent sudo rm -rf $MTCE_GUEST_CONF/guestAgent.ini - sudo rm -rf $STX_INST_DIR/bin/guestAgent + rm -rf $STX_INST_DIR/bin/guestAgent sudo rm -rf $STXNFV_SYSCONFDIR/init.d/guestAgent sudo rm -rf $STXNFV_SYSCONFDIR/logrotate.d/guestAgent.logrotate } @@ -73,12 +73,16 @@ function cleanup_guest_client { function cleanup_guest_server { sudo rm -rf $MTCE_GUEST_CONF/guestServer.ini - sudo rm -rf $STX_INST_DIR/bin/guestServer + rm -rf $STX_INST_DIR/bin/guestServer sudo rm -rf $STXNFV_SYSCONFDIR/init.d/guestServer sudo rm -rf $STXNFV_SYSCONFDIR/pmon.d/guestServer.conf sudo rm -rf $STXNFV_SYSCONFDIR/logrotate.d/guestServer.logrotate } +function cleanup_guest_scale_helper { + rm -rf $STX_INST_DIR/sbin/guest_scale_helper +} + function cleanup_host_agent { sudo rm -rf $STXNFV_SYSCONFDIR/init.d/host_agent sudo rm -rf $STXNFV_SYSCONFDIR/pmon.d/host_agent.conf @@ -136,6 +140,10 @@ function cleanup_nfv { if is_service_enabled host-agent; then cleanup_host_agent fi + + if is_service_enabled guest-scale-helper; then + cleanup_guest_scale_helper + fi } function cleanup_nfv_client { @@ -163,11 +171,13 @@ function cleanup_nova_api_proxy { } function configure_guest_agent { + sudo sed -i "s%DAEMON=\"/usr/local/bin/\${DAEMON_NAME}\"%DAEMON=\"$STX_INST_DIR/local/bin/\${DAEMON_NAME}\"%" $STXNFV_SYSCONFDIR/init.d/guestAgent iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@guest-agent.service "Service" "Type" "forking" iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@guest-agent.service "Service" "PIDFile" "/var/run/guestAgent.pid" } function configure_guest_server { + sudo sed -i "s%DAEMON=\"/usr/local/bin/\${DAEMON_NAME}\"%DAEMON=\"$STX_INST_DIR/local/bin/\${DAEMON_NAME}\"%" $STXNFV_SYSCONFDIR/init.d/guestServer iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@guest-server.service "Service" "Type" "forking" iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@guest-server.service "Service" "PIDFile" "/var/run/guestServer.pid" } @@ -303,7 +313,7 @@ function install_guest_agent { sudo install -m 755 -d $MTCE_GUEST_OCF_DIR sudo install -m 755 -p -D scripts/guestAgent.ocf $MTCE_GUEST_OCF_DIR/guestAgent sudo install -m 644 -p -D scripts/guest.ini $MTCE_GUEST_CONF/guestAgent.ini - sudo install -m 755 -p -D guestAgent $STX_INST_DIR/bin/guestAgent + install -m 755 -p -D guestAgent $STX_INST_DIR/local/bin/guestAgent sudo install -m 755 -p -D scripts/guestAgent $STXNFV_SYSCONFDIR/init.d/guestAgent sudo install -m 644 -p -D scripts/guestAgent.logrotate $STXNFV_SYSCONFDIR/logrotate.d/guestAgent.logrotate @@ -342,8 +352,6 @@ function install_guest_client { function install_host_agent { pushd $HOST_AGENT_COMM_DIR - - make host_clean # to remove sdk folder make all sudo install -m 755 -p -D scripts/host_agent $STXNFV_SYSCONFDIR/init.d/host_agent @@ -364,18 +372,27 @@ function install_guest_server { pushd $MTCE_GUEST_DIR/src sudo install -m 644 -p -D scripts/guest.ini $MTCE_GUEST_CONF/guestServer.ini - sudo install -m 755 -p -D guestServer $STX_INST_DIR/bin/guestServer + install -m 755 -p -D guestServer $STX_INST_DIR/local/bin/guestServer sudo install -m 755 -p -D scripts/guestServer $STXNFV_SYSCONFDIR/init.d/guestServer - sudo install -m 755 -d $(STXNFV_SYSCONFDIR)/pmon.d + sudo install -m 755 -d $STXNFV_SYSCONFDIR/pmon.d sudo install -m 644 -p -D scripts/guestServer.pmon $STXNFV_SYSCONFDIR/pmon.d/guestServer.conf sudo install -m 644 -p -D scripts/guestServer.logrotate $STXNFV_SYSCONFDIR/logrotate.d/guestServer.logrotate popd } +function install_guest_scale_helper { + pushd $GUEST_SCALE_AGENT_DIR + make EXTRALDFLAGS="-L$STX_INST_DIR"/lib64 all + + install -m 750 bin/guest_scale_helper $STX_INST_DIR/sbin/guest_scale_helper + + popd +} + function install_mtce_guest_common { pushd $MTCE_GUEST_DIR/src - make build + make EXTRALDFLAGS="-L$STX_INST_DIR"/lib64 build popd sudo install -m 755 -d $(STXNFV_SYSCONFDIR)/logrotate.d @@ -409,6 +426,10 @@ function install_nfv { if is_service_enabled host-agent; then install_host_agent fi + + if is_service_enabled guest-scale-helper; then + install_guest_scale_helper + fi } function install_nfv_client { diff --git a/guest-agent/guest-scale-agent-2.0/Makefile b/guest-agent/guest-scale-agent-2.0/Makefile index a880a727..fbf93ffd 100644 --- a/guest-agent/guest-scale-agent-2.0/Makefile +++ b/guest-agent/guest-scale-agent-2.0/Makefile @@ -95,7 +95,7 @@ sdk/$(EXPORT_SDK).tgz: printvars @cp misc.h sdk/$(EXPORT_SDK) @cd sdk && tar czf $(EXPORT_SDK).tgz $(EXPORT_SDK) @echo -n "sdk/$(EXPORT_SDK).tgz: Makefile.sdk docs/README.txt docs/TiS-Guest-Resource-Scaling.pdf " > sdk/sdk.d - @echo -n "scripts/init_offline_cpus scripts/offline_cpus scripts/offline-cpus.service" >> sdk/sdk.d + @echo -n "scripts/init_offline_cpus scripts/offline_cpus scripts/offline-cpus.service " >> sdk/sdk.d @echo -n "scripts/app_scale_helper " >> sdk/sdk.d @echo -n "$(GUEST_SCALE_AGENT_SRCS) " >> sdk/sdk.d @echo "misc.h " >> sdk/sdk.d @@ -106,10 +106,10 @@ $(ODIR)/%.o: %.c $(CC) -c $(CFLAGS) $(CFLAGS2) -MMD -o $@ $< $(BINDIR)/guest_scale_agent: $(GUEST_SCALE_AGENT_OBJ) - $(CC) -o $@ $^ $(LDFLAGS) -lguesthostmsg -ljson-c + $(CC) -o $@ $^ $(LDFLAGS) $(EXTRALDFLAGS) -lguesthostmsg -ljson-c $(BINDIR)/guest_scale_helper: $(GUEST_SCALE_HELPER_OBJ) - $(CC) -o $@ $^ $(LDFLAGS) -lhostguestmsg -ljson-c + $(CC) -o $@ $^ $(LDFLAGS) $(EXTRALDFLAGS) -lhostguestmsg -ljson-c install: install -d 750 -d $(DESTDIR)/usr/sbin diff --git a/guest-comm/host-guest-comm-2.0/Makefile b/guest-comm/host-guest-comm-2.0/Makefile index 9e7f1800..c05302ca 100644 --- a/guest-comm/host-guest-comm-2.0/Makefile +++ b/guest-comm/host-guest-comm-2.0/Makefile @@ -97,7 +97,7 @@ sdk/$(EXPORT_SDK).tgz: @cd sdk && tar czf $(EXPORT_SDK).tgz $(EXPORT_SDK) @echo -n "sdk/$(EXPORT_SDK).tgz: Makefile.sdk docs/README.txt docs/TiS-Guest-Server-Group-Messaging.pdf " > sdk/sdk.d - @echo -n "scripts/guest-agent.service" >> sdk/sdk.d + @echo -n "scripts/guest-agent.service " >> sdk/sdk.d @echo -n "$(GUEST_CLIENT_APP_SRCS) $(LIBSERVERGROUP_SRCS) $(GUEST_AGENT_SRCS) $(LIBGUESTHOSTMSG_SRCS)" >> sdk/sdk.d @echo " host_guest_msg.h server_group.h misc.h" >> sdk/sdk.d @echo '*' > sdk/.gitignore diff --git a/mtce-guest/src/Makefile b/mtce-guest/src/Makefile index a6bd30c3..40dd9337 100644 --- a/mtce-guest/src/Makefile +++ b/mtce-guest/src/Makefile @@ -27,7 +27,7 @@ SERVER_OBJS = \ OBJS = $(SRCS:.cpp=.o) CCPFLAGS = -g -O2 -Wall -Wextra -Werror -LDLIBS = -lstdc++ -ldaemon -lcommon -lfmcommon -ljson-c -levent -lrt -lcrypto -luuid +LDLIBS = $(EXTRALDFLAGS) -lstdc++ -ldaemon -lcommon -lfmcommon -ljson-c -levent -lrt -lcrypto -luuid INCLUDES = -I. -I/usr/include/mtce-common -I/usr/include/mtce-daemon build: $(OBJS)