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 <yi.c.wang@intel.com>
This commit is contained in:
Yi Wang 2019-02-27 23:03:59 +08:00
parent 4af91b450d
commit 262142c50c
4 changed files with 34 additions and 13 deletions

View File

@ -56,7 +56,7 @@ PYTHON_SITE_DIR=$(python -c "from distutils.sysconfig import get_python_lib; pri
function cleanup_guest_agent { function cleanup_guest_agent {
sudo rm -rf $MTCE_GUEST_OCF_DIR/guestAgent sudo rm -rf $MTCE_GUEST_OCF_DIR/guestAgent
sudo rm -rf $MTCE_GUEST_CONF/guestAgent.ini 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/init.d/guestAgent
sudo rm -rf $STXNFV_SYSCONFDIR/logrotate.d/guestAgent.logrotate sudo rm -rf $STXNFV_SYSCONFDIR/logrotate.d/guestAgent.logrotate
} }
@ -73,12 +73,16 @@ function cleanup_guest_client {
function cleanup_guest_server { function cleanup_guest_server {
sudo rm -rf $MTCE_GUEST_CONF/guestServer.ini 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/init.d/guestServer
sudo rm -rf $STXNFV_SYSCONFDIR/pmon.d/guestServer.conf sudo rm -rf $STXNFV_SYSCONFDIR/pmon.d/guestServer.conf
sudo rm -rf $STXNFV_SYSCONFDIR/logrotate.d/guestServer.logrotate 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 { function cleanup_host_agent {
sudo rm -rf $STXNFV_SYSCONFDIR/init.d/host_agent sudo rm -rf $STXNFV_SYSCONFDIR/init.d/host_agent
sudo rm -rf $STXNFV_SYSCONFDIR/pmon.d/host_agent.conf sudo rm -rf $STXNFV_SYSCONFDIR/pmon.d/host_agent.conf
@ -136,6 +140,10 @@ function cleanup_nfv {
if is_service_enabled host-agent; then if is_service_enabled host-agent; then
cleanup_host_agent cleanup_host_agent
fi fi
if is_service_enabled guest-scale-helper; then
cleanup_guest_scale_helper
fi
} }
function cleanup_nfv_client { function cleanup_nfv_client {
@ -163,11 +171,13 @@ function cleanup_nova_api_proxy {
} }
function configure_guest_agent { 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" "Type" "forking"
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@guest-agent.service "Service" "PIDFile" "/var/run/guestAgent.pid" iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@guest-agent.service "Service" "PIDFile" "/var/run/guestAgent.pid"
} }
function configure_guest_server { 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" "Type" "forking"
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@guest-server.service "Service" "PIDFile" "/var/run/guestServer.pid" 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 -d $MTCE_GUEST_OCF_DIR
sudo install -m 755 -p -D scripts/guestAgent.ocf $MTCE_GUEST_OCF_DIR/guestAgent 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 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 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 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 { function install_host_agent {
pushd $HOST_AGENT_COMM_DIR pushd $HOST_AGENT_COMM_DIR
make host_clean # to remove sdk folder
make all make all
sudo install -m 755 -p -D scripts/host_agent $STXNFV_SYSCONFDIR/init.d/host_agent 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 pushd $MTCE_GUEST_DIR/src
sudo install -m 644 -p -D scripts/guest.ini $MTCE_GUEST_CONF/guestServer.ini 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 -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.pmon $STXNFV_SYSCONFDIR/pmon.d/guestServer.conf
sudo install -m 644 -p -D scripts/guestServer.logrotate $STXNFV_SYSCONFDIR/logrotate.d/guestServer.logrotate sudo install -m 644 -p -D scripts/guestServer.logrotate $STXNFV_SYSCONFDIR/logrotate.d/guestServer.logrotate
popd 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 { function install_mtce_guest_common {
pushd $MTCE_GUEST_DIR/src pushd $MTCE_GUEST_DIR/src
make build make EXTRALDFLAGS="-L$STX_INST_DIR"/lib64 build
popd popd
sudo install -m 755 -d $(STXNFV_SYSCONFDIR)/logrotate.d sudo install -m 755 -d $(STXNFV_SYSCONFDIR)/logrotate.d
@ -409,6 +426,10 @@ function install_nfv {
if is_service_enabled host-agent; then if is_service_enabled host-agent; then
install_host_agent install_host_agent
fi fi
if is_service_enabled guest-scale-helper; then
install_guest_scale_helper
fi
} }
function install_nfv_client { function install_nfv_client {

View File

@ -95,7 +95,7 @@ sdk/$(EXPORT_SDK).tgz: printvars
@cp misc.h sdk/$(EXPORT_SDK) @cp misc.h sdk/$(EXPORT_SDK)
@cd sdk && tar czf $(EXPORT_SDK).tgz $(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 "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 "scripts/app_scale_helper " >> sdk/sdk.d
@echo -n "$(GUEST_SCALE_AGENT_SRCS) " >> sdk/sdk.d @echo -n "$(GUEST_SCALE_AGENT_SRCS) " >> sdk/sdk.d
@echo "misc.h " >> sdk/sdk.d @echo "misc.h " >> sdk/sdk.d
@ -106,10 +106,10 @@ $(ODIR)/%.o: %.c
$(CC) -c $(CFLAGS) $(CFLAGS2) -MMD -o $@ $< $(CC) -c $(CFLAGS) $(CFLAGS2) -MMD -o $@ $<
$(BINDIR)/guest_scale_agent: $(GUEST_SCALE_AGENT_OBJ) $(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) $(BINDIR)/guest_scale_helper: $(GUEST_SCALE_HELPER_OBJ)
$(CC) -o $@ $^ $(LDFLAGS) -lhostguestmsg -ljson-c $(CC) -o $@ $^ $(LDFLAGS) $(EXTRALDFLAGS) -lhostguestmsg -ljson-c
install: install:
install -d 750 -d $(DESTDIR)/usr/sbin install -d 750 -d $(DESTDIR)/usr/sbin

View File

@ -97,7 +97,7 @@ sdk/$(EXPORT_SDK).tgz:
@cd sdk && tar czf $(EXPORT_SDK).tgz $(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-Server-Group-Messaging.pdf " > sdk/sdk.d @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 -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 " host_guest_msg.h server_group.h misc.h" >> sdk/sdk.d
@echo '*' > sdk/.gitignore @echo '*' > sdk/.gitignore

View File

@ -27,7 +27,7 @@ SERVER_OBJS = \
OBJS = $(SRCS:.cpp=.o) OBJS = $(SRCS:.cpp=.o)
CCPFLAGS = -g -O2 -Wall -Wextra -Werror 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 INCLUDES = -I. -I/usr/include/mtce-common -I/usr/include/mtce-daemon
build: $(OBJS) build: $(OBJS)