aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrainbow_0206 <jiangwenjiang@huawei.com>2018-10-18 16:28:54 +0800
committerrainbow_0206 <jiangwenjiang@huawei.com>2018-10-22 10:42:43 +0800
commita28a94065f013f459f7b4713e623538cba8337db (patch)
tree48a42eb7b361af9c9ec28db66c7c7e16a57d3e1b
parentaf0587ee6e44e9057ff6047a00fcd9015df1f5a1 (diff)
Fix: modify something that not standardized
1.replace RTP and NSPOL 2.delete the build_dpdk1805.sh Change-Id: Ic561cf5f5c8b3b4c4f42858bde5a41e4bdb45113 Signed-off-by: rainbow_0206 <jiangwenjiang@huawei.com>
-rwxr-xr-xscripts/build_dpdk1805.sh82
-rw-r--r--src/framework/include/nstack_log.h14
-rw-r--r--stacks/lwip_stack/lwip_src/api/spl_sbr.c6
-rw-r--r--stacks/lwip_stack/lwip_src/core/spl_pbuf.c2
-rw-r--r--stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c8
-rw-r--r--stacks/lwip_stack/lwip_src/netif/spl_hal.c22
-rw-r--r--stacks/lwip_stack/release/script/nstack_var.sh4
-rw-r--r--stacks/lwip_stack/release/upgrade_nstack.sh452
8 files changed, 28 insertions, 562 deletions
diff --git a/scripts/build_dpdk1805.sh b/scripts/build_dpdk1805.sh
deleted file mode 100755
index 2727877..0000000
--- a/scripts/build_dpdk1805.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/bash -x
-#########################################################################
-#
-# Copyright (c) 2018 Huawei Technologies Co.,Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#########################################################################
-
-echo "check whether dpdk installed"
-cur_directory=${PWD}
-check_dpdk=$(rpm -qa | grep dpdk)
-if [ -z "$check_dpdk" ]; then
- echo "system will install the dpdk"
-else
- echo "system has installed the dpdk"
- echo "$check_dpdk"
- exit 0
-fi
-
-cd ~
-mkdir -p rpmbuild/SOURCES
-
-cd ~/rpmbuild/SOURCES
-
-if [ ! -s dpdk-18.05.tar.gz ]; then
-wget http://dpdk.org/browse/dpdk/snapshot/dpdk-18.05.tar.gz
-fi
-
-tar xzvf dpdk-18.05.tar.gz
-cp dpdk-18.05/pkg/dpdk.spec ~/rpmbuild/SOURCES/
-
-echo "modify the spec"
-
-#get rid of the dependence of texlive-collection
-sed -i '/BuildRequires: texlive-collection/s/^/#&/' dpdk.spec
-
-#delete something of generating doc
-sed -i '/%{target} doc/s/^/#&/' dpdk.spec
-sed -i '70d' dpdk.spec
-sed -i '69a datadir=%{_datadir}/dpdk' dpdk.spec
-sed -i '70a # datadir=%{_datadir}/dpdk docdir=%{_docdir}/dpdk' dpdk.spec
-sed -i '/%files doc/s/^/#&/' dpdk.spec
-sed -i '/%doc %{_docdir}/s/^/#&/' dpdk.spec
-
-sed -i '54a sed -i '\''s!CONFIG_RTE_EXEC_ENV=.*!CONFIG_RTE_EXEC_ENV=y!1'\'' config/common_base' dpdk.spec
-sed -i '55a sed -i '\''s!CONFIG_RTE_BUILD_SHARED_LIB=.*!CONFIG_RTE_BUILD_SHARED_LIB=y!1'\'' config/common_base' dpdk.spec
-sed -i '56a sed -i '\''s!CONFIG_RTE_LIBRTE_EAL=.*!CONFIG_RTE_LIBRTE_EAL=y!1'\'' config/common_base' dpdk.spec
-sed -i '57a sed -i '\''s!CONFIG_RTE_EAL_PMD_PATH=.*!CONFIG_RTE_EAL_PMD_PATH="/tmp/dpdk/drivers/"!1'\'' config/common_base' dpdk.spec
-sed -i '58a sed -i '\''s!CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=.*!CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=n!1'\'' config/common_base' dpdk.spec
-
-echo "build the dependence"
-#sudo yum-builddep -y dpdk.spec
-sudo yum install -y libpcap-devel python-sphinx inkscape kernel-devel-`uname -r` doxygen libnuma-devel kernel-`uname -r`
-
-
-echo "generate the rpm package"
-rpmbuild -ba dpdk.spec --define "_sourcedir ${PWD}"
-if [ $? -eq 0 ]; then
- echo "dpdk rpm build success"
-else
- echo "dpdk rpm build error"
- exit 1
-fi
-
-echo "install the rpm"
-cd ../RPMS/x86_64/
-sudo rpm -ivh dpdk-18.05-1.x86_64.rpm || exit 1
-sudo rpm -ivh dpdk-devel-18.05-1.x86_64.rpm || exit 1
-
-mkdir -p /tmp/dpdk/drivers/
-cp -f /usr/lib64/librte_mempool_ring.so /tmp/dpdk/drivers/
-
-cd ${cur_directory}
diff --git a/src/framework/include/nstack_log.h b/src/framework/include/nstack_log.h
index 4e1ba81..9473aa4 100644
--- a/src/framework/include/nstack_log.h
+++ b/src/framework/include/nstack_log.h
@@ -318,11 +318,11 @@ extern int ctrl_log_switch;
#define NSMON_LOGWAR(fmt, ...) NS_LOGPID(MASTER,"NSMON",NSLOG_WAR,fmt,##__VA_ARGS__)
#define NSMON_LOGERR(fmt, ...) NS_LOGPID(MASTER,"NSMON",NSLOG_ERR,fmt,##__VA_ARGS__)
-#define NSPOL_LOGINF(debug,fmt, ...)NS_LOG_STACKX(debug,STACKX,"NSPOL",NSLOG_INF,fmt,##__VA_ARGS__)
-#define NSPOL_LOGDBG(debug,fmt, ...) NS_LOG_STACKX(debug,STACKX,"NSPOL",NSLOG_DBG,fmt,##__VA_ARGS__)
-#define NSPOL_LOGWAR(debug,fmt, ...) NS_LOG_STACKX(debug,STACKX,"NSPOL",NSLOG_WAR,fmt,##__VA_ARGS__)
-#define NSPOL_LOGERR(fmt, ...) NS_LOGPID(STACKX,"NSPOL",NSLOG_ERR,fmt,##__VA_ARGS__)
-#define NSPOL_LOGEMG(fmt, ...) NS_LOGPID(STACKX,"NSPOL",NSLOG_EMG,fmt,##__VA_ARGS__)
+#define NSPOL_LOGINF(debug,fmt, ...)NS_LOG_STACKX(debug,STACKX,"NSLWIP",NSLOG_INF,fmt,##__VA_ARGS__)
+#define NSPOL_LOGDBG(debug,fmt, ...) NS_LOG_STACKX(debug,STACKX,"NSLWIP",NSLOG_DBG,fmt,##__VA_ARGS__)
+#define NSPOL_LOGWAR(debug,fmt, ...) NS_LOG_STACKX(debug,STACKX,"NSLWIP",NSLOG_WAR,fmt,##__VA_ARGS__)
+#define NSPOL_LOGERR(fmt, ...) NS_LOGPID(STACKX,"NSLWIP",NSLOG_ERR,fmt,##__VA_ARGS__)
+#define NSPOL_LOGEMG(fmt, ...) NS_LOGPID(STACKX,"NSLWIP",NSLOG_EMG,fmt,##__VA_ARGS__)
#define NSOPR_LOGINF(fmt, ...) NS_LOGPID(OPERATION,"NSOPR",NSLOG_INF,fmt,##__VA_ARGS__)
#define NSOPR_LOGDBG(fmt, ...) NS_LOGPID(OPERATION,"NSOPR",NSLOG_DBG,fmt,##__VA_ARGS__)
@@ -403,10 +403,10 @@ extern int ctrl_log_switch;
} \
#define INITPOL_LOGINF(init_module_name, function, err_string, err_value, status) \
- INIT_LOG_ASSEM(STACKX,"NSPOL",NSLOG_INF,init_module_name , function, err_string, err_value, status)\
+ INIT_LOG_ASSEM(STACKX,"NSLWIP",NSLOG_INF,init_module_name , function, err_string, err_value, status)\
#define INITPOL_LOGERR(init_module_name, function, err_string, err_value, status) \
- INIT_LOG_ASSEM(STACKX,"NSPOL",NSLOG_ERR,init_module_name , function, err_string, err_value, status)\
+ INIT_LOG_ASSEM(STACKX,"NSLWIP",NSLOG_ERR,init_module_name , function, err_string, err_value, status)\
#define INITTCP_LOGINF(init_module_name , function, err_string, err_value, status) \
INIT_LOG_ASSEM(LOGTCP,"NSTCP",NSLOG_INF,init_module_name , function, err_string, err_value, status)\
diff --git a/stacks/lwip_stack/lwip_src/api/spl_sbr.c b/stacks/lwip_stack/lwip_src/api/spl_sbr.c
index 4c510a5..4c1be2f 100644
--- a/stacks/lwip_stack/lwip_src/api/spl_sbr.c
+++ b/stacks/lwip_stack/lwip_src/api/spl_sbr.c
@@ -157,7 +157,7 @@ _do_send (data_com_msg * m)
msg_send_buf *_m = (msg_send_buf *) m->buffer;
if (cpcb == NULL)
{
- NS_LOG_CTRL (LOG_CTRL_SEND, STACKX, "NSPOL", NSLOG_ERR,
+ NS_LOG_CTRL (LOG_CTRL_SEND, STACKX, "NSLWIP", NSLOG_ERR,
"failed to find target pcb, drop the message]"
"module=%u, major=%u, minor=%u",
m->param.module_type,
@@ -192,7 +192,7 @@ _do_write (data_com_msg * m)
msg_write_buf *_m = (msg_write_buf *) m->buffer;
if ((tpcb == NULL) || (cpcb == NULL))
{
- NS_LOG_CTRL (LOG_CTRL_WRITE, STACKX, "NSPOL", NSLOG_ERR,
+ NS_LOG_CTRL (LOG_CTRL_WRITE, STACKX, "NSLWIP", NSLOG_ERR,
"failed to find target pcb, drop the message]"
"module=%u, major=%u, minor=%u",
m->param.module_type,
@@ -225,7 +225,7 @@ _do_recv (data_com_msg * m)
if ((tpcb == NULL) || (cpcb == NULL))
{
- NS_LOG_CTRL (LOG_CTRL_RECV, STACKX, "NSPOL", NSLOG_ERR,
+ NS_LOG_CTRL (LOG_CTRL_RECV, STACKX, "NSLWIP", NSLOG_ERR,
"failed to find target pcb, drop the message]"
"module=%u, major=%u, minor=%u",
m->param.module_type,
diff --git a/stacks/lwip_stack/lwip_src/core/spl_pbuf.c b/stacks/lwip_stack/lwip_src/core/spl_pbuf.c
index 54589e8..e4aa014 100644
--- a/stacks/lwip_stack/lwip_src/core/spl_pbuf.c
+++ b/stacks/lwip_stack/lwip_src/core/spl_pbuf.c
@@ -89,7 +89,7 @@ spl_pbuf_alloc_hugepage (spl_pbuf_layer layer, u16_t length,
{
/* last_log_prt_time and unprint_log_count indeed have multi-thread issue,
* but their values don't have precision requirement. No risk. */
- NS_LOG_CTRL (LOG_CTRL_HUGEPAGE_ALLOC_FAIL, STACKX, "NSPOL", NSLOG_ERR,
+ NS_LOG_CTRL (LOG_CTRL_HUGEPAGE_ALLOC_FAIL, STACKX, "NSLWIP", NSLOG_ERR,
"pbuf_alloc_huge: Could not allocate PBUF for SPL_PBUF_HUGE");
return NULL;
diff --git a/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c b/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c
index 03b5998..e2334ea 100644
--- a/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c
+++ b/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c
@@ -996,13 +996,13 @@ int
init_configuration_reader ()
{
int error_number = 0;
- INITPOL_LOGINF ("RTP", "init_configuration_reader", NULL_STRING,
+ INITPOL_LOGINF ("CONFIGURATION", "init_configuration_reader", NULL_STRING,
LOG_INVALID_VALUE, MODULE_INIT_START);
g_config_data = &g_ip_module_buff;
if (init_ip_module_unix_socket_path () < 0)
{
- INITPOL_LOGERR ("RTP", "init_configuration_reader",
+ INITPOL_LOGERR ("CONFIGURATION", "init_configuration_reader",
"Error when init path", LOG_INVALID_VALUE,
MODULE_INIT_FAIL);
return -1;
@@ -1012,7 +1012,7 @@ init_configuration_reader ()
if (listen_fd < 0)
{
error_number = errno;
- INITPOL_LOGERR ("RTP", "init_configuration_reader",
+ INITPOL_LOGERR ("CONFIGURATION", "init_configuration_reader",
"when listening ip_module_unix_socket", error_number,
MODULE_INIT_FAIL);
return -1;
@@ -1027,7 +1027,7 @@ init_configuration_reader ()
return -1;
}
- INITPOL_LOGINF ("RTP", "init_configuration_reader", NULL_STRING,
+ INITPOL_LOGINF ("CONFIGURATION", "init_configuration_reader", NULL_STRING,
LOG_INVALID_VALUE, MODULE_INIT_SUCCESS);
return 0;
}
diff --git a/stacks/lwip_stack/lwip_src/netif/spl_hal.c b/stacks/lwip_stack/lwip_src/netif/spl_hal.c
index c7cfca1..596962e 100644
--- a/stacks/lwip_stack/lwip_src/netif/spl_hal.c
+++ b/stacks/lwip_stack/lwip_src/netif/spl_hal.c
@@ -379,7 +379,7 @@ spl_hal_port_zone_init ()
nsfw_mem_zone create_port_zone;
nsfw_mem_zone create_port_info;
struct stackx_port_info *mz_port_info;
- INITPOL_LOGINF ("RTP", "spl_hal_port_zone_init", NULL_STRING,
+ INITPOL_LOGINF ("HAL", "spl_hal_port_zone_init", NULL_STRING,
LOG_INVALID_VALUE, MODULE_INIT_START);
if ((CUR_CFG_HAL_PORT_NUM < 1)
@@ -408,7 +408,7 @@ spl_hal_port_zone_init ()
if (NULL == p_stackx_port_zone)
{
- INITPOL_LOGERR ("RTP", "spl_hal_port_zone_init",
+ INITPOL_LOGERR ("HAL", "spl_hal_port_zone_init",
"Cannot create memory zone for MP_STACKX_PORT_ZONE information",
LOG_INVALID_VALUE, MODULE_INIT_FAIL);
common_exit (EXIT_FAILURE,
@@ -421,7 +421,7 @@ spl_hal_port_zone_init ()
if (EOK != retVal)
{
- INITPOL_LOGERR ("RTP", "spl_hal_port_zone_init", "MEMSET_S return fail",
+ INITPOL_LOGERR ("HAL", "spl_hal_port_zone_init", "MEMSET_S return fail",
retVal, MODULE_INIT_FAIL);
nsfw_mem_zone_release (&create_port_zone.stname);
return -1;
@@ -445,7 +445,7 @@ spl_hal_port_zone_init ()
if (NULL == mz_port_info)
{
- INITPOL_LOGERR ("RTP", "spl_hal_port_zone_init",
+ INITPOL_LOGERR ("HAL", "spl_hal_port_zone_init",
"Cannot create memory zone for MP_STACKX_PORT_INFO information",
LOG_INVALID_VALUE, MODULE_INIT_FAIL);
common_exit (EXIT_FAILURE,
@@ -458,7 +458,7 @@ spl_hal_port_zone_init ()
if (EOK != retVal)
{
- INITPOL_LOGERR ("RTP", "spl_hal_port_zone_init", "MEMSET_S return fail",
+ INITPOL_LOGERR ("HAL", "spl_hal_port_zone_init", "MEMSET_S return fail",
retVal, MODULE_INIT_FAIL);
nsfw_mem_zone_release (&create_port_info.stname);
nsfw_mem_zone_release (&create_port_zone.stname);
@@ -470,7 +470,7 @@ spl_hal_port_zone_init ()
p_stackx_port_zone->stackx_one_port = mz_port_info;
- INITPOL_LOGINF ("RTP", "spl_hal_port_zone_init", NULL_STRING,
+ INITPOL_LOGINF ("HAL", "spl_hal_port_zone_init", NULL_STRING,
LOG_INVALID_VALUE, MODULE_INIT_SUCCESS);
return 0;
@@ -495,7 +495,7 @@ spl_hal_init (int argc, char *argv[])
/* Init DPDK */
argc = uStackArgIndex--;
- INITPOL_LOGINF ("RTP", "hal_init_global", NULL_STRING, LOG_INVALID_VALUE,
+ INITPOL_LOGINF ("HAL", "hal_init_global", NULL_STRING, LOG_INVALID_VALUE,
MODULE_INIT_START);
for (idx_init = 0; idx_init < argc; idx_init++)
@@ -1326,7 +1326,7 @@ spl_hal_port_setup ()
unsigned int i;
struct stackx_port_info *p_port_info = NULL;
- INITPOL_LOGINF ("RTP", "spl_hal_port_setup", NULL_STRING, LOG_INVALID_VALUE,
+ INITPOL_LOGINF ("HAL", "spl_hal_port_setup", NULL_STRING, LOG_INVALID_VALUE,
MODULE_INIT_START);
for (i = num_ports_NIC_start; i < num_ports_NIC; i++)
@@ -1337,7 +1337,7 @@ spl_hal_port_setup ()
{
NSPOL_LOGERR ("Error initialising]nic_id=%u", i);
- INITPOL_LOGERR ("RTP", "spl_hal_port_setup", NULL_STRING,
+ INITPOL_LOGERR ("HAL", "spl_hal_port_setup", NULL_STRING,
LOG_INVALID_VALUE, MODULE_INIT_FAIL);
return -1;
@@ -1353,7 +1353,7 @@ spl_hal_port_setup ()
{
NSPOL_LOGERR ("bond port init failed!");
- INITPOL_LOGERR ("RTP", "spl_hal_port_setup", NULL_STRING,
+ INITPOL_LOGERR ("HAL", "spl_hal_port_setup", NULL_STRING,
LOG_INVALID_VALUE, MODULE_INIT_FAIL);
return -1;
@@ -1361,7 +1361,7 @@ spl_hal_port_setup ()
spl_hal_capa_init ();
- INITPOL_LOGINF ("RTP", "spl_hal_port_setup", NULL_STRING, LOG_INVALID_VALUE,
+ INITPOL_LOGINF ("HAL", "spl_hal_port_setup", NULL_STRING, LOG_INVALID_VALUE,
MODULE_INIT_SUCCESS);
return 0;
diff --git a/stacks/lwip_stack/release/script/nstack_var.sh b/stacks/lwip_stack/release/script/nstack_var.sh
index 4c5c6f6..45efafc 100644
--- a/stacks/lwip_stack/release/script/nstack_var.sh
+++ b/stacks/lwip_stack/release/script/nstack_var.sh
@@ -26,10 +26,10 @@ DPDK_FILE_NAME=nstack_dpdk.log
export VM_ID=agent-node-x
-export DPDK_INSTALL_PATH="/tmp/dpdk/dpdk-18.02/"
+export DPDK_INSTALL_PATH="/usr/share/dpdk/"
export DPDK_LIB_PATH=${DPDK_INSTALL_PATH}/x86_64-native-linuxapp-gcc/lib
export DPDK_TOOL_DIR=${DPDK_INSTALL_PATH}/usertools
-export DPDK_MOD_PATH=${DPDK_INSTALL_PATH}/x86_64-native-linuxapp-gcc/kmod
+export DPDK_MOD_PATH=/usr/lib/modules/`uname -r`/extra/dpdk
cur_user=`whoami`
if [ "root" != "${cur_user}" ]
diff --git a/stacks/lwip_stack/release/upgrade_nstack.sh b/stacks/lwip_stack/release/upgrade_nstack.sh
deleted file mode 100644
index 9302da6..0000000
--- a/stacks/lwip_stack/release/upgrade_nstack.sh
+++ /dev/null
@@ -1,452 +0,0 @@
-#!/bin/bash
-
-. ./script/nstack_var.sh
-. ./script/nstack_fun.sh
-
-VERSION_CHK=0
-UPG_MASTER=0
-
-# OLD_VERSION indicates the nStackServer version, in order to support Version upgrade and rollback feature
-# OLD_VERSION=1 B031~newest
-# OLD_VERSION=0 B020~B030
-OLD_VERSION=1
-cur_user=`whoami`
-
-upg_pre_chk()
-{
- ##########check input info###########################
- if [ -z "${DST_VER_PATH}" ]; then
- log $LINENO "dst ${DST_VER_PATH} path error!"
- return 1
- fi
-
- if [ "x${UPG_RBK}" != "x1" -a "x${UPG_RBK}" != "x2" ]; then
- log $LINENO "type error ${UPG_RBK}!"
- return 1
- fi
-
- ##########check src version info######################
- SRC_STOP_FILE=${SRC_VER_PATH}/stop_nstack.sh
- if [ ! -f "$SRC_STOP_FILE" ]; then
- log $LINENO "${SRC_STOP_FILE} path error!"
- return 1
- fi
-
- MASTER_PATH=`get_nstack_bin nStackMaster`
- if [ -z "${MASTER_PATH}" ]; then
- log $LINENO "master not start"
- return 1
- fi
-
- if [ ! -d "${MASTER_PATH}${MASTERBIN}" ]; then
- log $LINENO "${MASTER_PATH} path error!"
- return 1
- fi
-
- SRC_VERSION=`get_version 1`
- if [ -z "${SRC_VERSION}" ]; then
- log $LINENO "get srcVersion error"
- exit 1
- fi
-
- ###########check dst version info######################
- DST_RUN_FILE=${DST_VER_PATH}/script/run_nstack_main.sh
- if [ ! -f "$DST_RUN_FILE" ]; then
- log $LINENO "${DST_RUN_FILE} path error. Try the path of older nstack version then."
- DST_RUN_FILE=${DST_VER_PATH}/bin/run_nstack_main.sh
- OLD_VERSION=0
- if [ ! -f "$DST_RUN_FILE" ]; then
- log $LINENO "${DST_RUN_FILE} older path error!"
- return 1
- fi
- fi
-
- DST_STOP_FILE=${DST_VER_PATH}/stop_nstack.sh
- if [ ! -f "$DST_STOP_FILE" ]; then
- log $LINENO "${DST_STOP_FILE} path error!"
- return 1
- fi
-
- DST_STAT_FILE=${DST_VER_PATH}/start_nstack.sh
- if [ ! -f "$DST_STAT_FILE" ]; then
- log $LINENO "${DST_STAT_FILE} path error!"
- return 1
- fi
-
- if [ ! -x "${DST_VER_PATH}/bin/nStackCtrl" ]; then
- log $LINENO "${DST_VER_PATH} path nStackCtrl exec error!"
- return 1
- fi
-
- DST_VERSION=`get_version 4 ${DST_VER_PATH}/bin/nStackCtrl`
- if [ -z "${DST_VERSION}" ]; then
- log $LINENO "get dstversion error"
- return 1
- fi
-}
-
-restart_upgrade()
-{
- local monipid=`pidof monit`
- local stop_moni=0
- if [ ! -z "${monipid}" ]; then
- for i in `seq 60`
- do
- if [ ${cur_user} = "paas" ]; then
- stop_fin=`/var/ICTS_BASE/Monit/bin/monit summary | grep nstack | grep "Not monitored"`
- else
- stop_fin=`su paas -s /bin/bash -c "/var/ICTS_BASE/Monit/bin/monit summary" | grep nstack | grep "Not monitored"`
- fi
- if [ -n "${stop_fin}" ]; then
- break;
- fi
-
- if [ $stop_moni -eq 0 ]; then
- if [ ${cur_user} = "paas" ]; then
- /var/ICTS_BASE/Monit/bin/monit unmonitor nstack
- else
- su paas -s /bin/bash -c "/var/ICTS_BASE/Monit/bin/monit unmonitor nstack"
- fi
- stop_moni=1
- log $LINENO "stop monit"
- fi
-
- sleep 1
- done
- cd ${SRC_VER_PATH}
- ./stop_nstack.sh
- cd -
- cd ${DST_VER_PATH}
- if [ -n "${LOG_PATH}" ]; then
- ./start_nstack.sh -l $LOG_PATH -i $hostinfo_path
- else
- ./start_nstack.sh -i $hostinfo_path
- fi
- cd -
-
- log $LINENO "with monit restart"
- if [ $stop_moni -eq 1 ]; then
- if [ ${cur_user} = "paas" ]; then
- /var/ICTS_BASE/Monit/bin/monit monitor nstack
- else
- su paas -s /bin/bash -c "/var/ICTS_BASE/Monit/bin/monit monitor nstack"
- fi
- log $LINENO "monit restart"
- fi
- else
- cd ${SRC_VER_PATH}
- ./stop_nstack.sh
- cd -
- cd ${DST_VER_PATH}
- if [ -n "${LOG_PATH}" ]; then
- ./start_nstack.sh -l $LOG_PATH -i $hostinfo_path
- else
- ./start_nstack.sh -i $hostinfo_path
- fi
- cd -
- log $LINENO "none monit restart"
- fi
- return 0
-}
-
-run_upgrade()
-{
-
- if [ -n "${DST_RUN_FILE}" ]; then
- if [ $OLD_VERSION -ge 1 ]; then
- ln -s -f "$DST_RUN_FILE" "${DST_VER_PATH}/script/${RUN_NSTACK_FILE}"
- else
- ln -s -f "$DST_RUN_FILE" "${DST_VER_PATH}/bin/${RUN_NSTACK_FILE}"
- fi
- if [ $? -ne 0 ]; then
- log $LINENO "dst version link failed!"
- return 1
- fi
- fi
-
- # copy old config to avoid config change issue
- copy_config $SRC_VER_PATH $DST_VER_PATH
-
- ./bin/nStackCtrl --module vermgr -t $UPG_RBK -s $SRC_VERSION -d $DST_VERSION
- ret=$?
- if [ $ret -eq 121 ]; then
- restart_upgrade
- WAIT_TIME=50
- RESTART_MASTER=1
- return 0
- fi
-
- if [ $ret -ne 0 ]; then
- log $LINENO "nStackCtrl send vermsg err $ret code"
- return 1
- fi
-
- nStackMain_pid=`pidof nStackMain`
- if [ -n "${DST_RUN_FILE}" ]; then
- ln -s -f "$DST_RUN_FILE" "${MASTER_PATH}${RUN_NSTACK_FILE}"
- if [ $? -ne 0 ]; then
- log $LINENO "link failed!"
- kill -9 $nStackMain_pid
- return 1
- fi
- fi
- kill -9 $nStackMain_pid
- return 0
-}
-
-after_upg_chk()
-{
- for i in `seq $WAIT_TIME`
- do
- NEW_DST_VERSION=`get_version 1`
- if [ -n "${NEW_DST_VERSION}" ]; then
- if [ "$NEW_DST_VERSION" != "$DST_VERSION" ]; then
- log $LINENO "new version:$NEW_DST_VERSION maybe error! expect version is:$DST_VERSION"
- else
- break;
- fi
- fi
- sleep 1
- done
-
- if [ -z "${NEW_DST_VERSION}" ]; then
- log $LINENO "nStackCtrl get dstVersion error"
- return 1
- fi
-
- if [ "$NEW_DST_VERSION" != "$DST_VERSION" -a $VERSION_CHK -eq 1 ]; then
- log $LINENO "new version:$NEW_DST_VERSION maybe error! expect version is:$DST_VERSION"
- return 1
- fi
-
- DST_MAIN_PATH=`get_nstack_bin nStackMain`
- if [ -z "${DST_MAIN_PATH}" ]; then
- log $LINENO "main not start"
- return 1
- fi
-
- if [ "$DST_MAIN_PATH" != "${DST_VER_PATH}/bin/" ]; then
- log $LINENO "main start failed run;$DST_MAIN_PATH expect:${DST_VER_PATH}/script !"
- return 1
- fi
-}
-
-
-run_upgrade_master()
-{
- core_mask=`get_core_mask`
- START_TYPE="secondary"
- ./bin/nStackCtrl --module vermgr -t $UPG_RBK -s $SRC_VERSION -d $DST_VERSION -p 2
- ret=$?
- if [ $ret -ne 0 ]; then
- log $LINENO "nStackMaster nStackCtrl send vermsg err $ret code"
- return 1
- fi
-
- nStackMaster_pid=`pidof nStackMaster`
- kill -9 $nStackMaster_pid
- cd ${DST_VER_PATH}/script/
- ./run_nstack_master.sh ${core_mask} $HUGE_DIR $MEM_SIZE $START_TYPE
- log $LINENO "./script/run_nstack_master.sh ${core_mask} $HUGE_DIR $MEM_SIZE $START_TYPE"
- cd -
- return 0
-}
-
-
-after_upg_master_chk()
-{
- for i in `seq 10`
- do
- NEW_MAS_VERSION=`get_version 2`
- if [ -n "${NEW_MAS_VERSION}" ]; then
- if [ "$NEW_MAS_VERSION" != "$DST_VERSION" ]; then
- log $LINENO "new version:$NEW_MAS_VERSION maybe error! expect version is:$DST_VERSION"
- else
- break;
- fi
- fi
- sleep 1
- done
-
- if [ -z "${NEW_MAS_VERSION}" ]; then
- log $LINENO "nStackCtrl get dstVersion error"
- return 1
- fi
-
- if [ "$NEW_MAS_VERSION" != "$DST_VERSION" -a $VERSION_CHK -eq 1 ]; then
- log $LINENO "new version:$NEW_MAS_VERSION maybe error! expect version is:$DST_VERSION"
- return 1
- fi
-
- DST_MAS_PATH=`get_nstack_bin nStackMaster`
- if [ -z "${DST_MAS_PATH}" ]; then
- log $LINENO "master not start"
- return 1
- fi
-
- if [ "$DST_MAS_PATH" != "${DST_VER_PATH}/script/" ]; then
- log $LINENO "main start failed run;$DST_MAS_PATH expect:${DST_VER_PATH}/script !"
- return 1
- fi
- return 0
-}
-
-opr_suc()
-{
- log $LINENO "operation successful $SRC_VERSION to $NEW_DST_VERSION"
-}
-
-mod_log_path()
-{
- local dst_proc=$1
- local dst_log_path=$2
- ./bin/nStackCtrl --module setlog -n maspath -v ${dst_log_path} -p $dst_proc
- ret=$?
- if [ $ret -ne 0 ]; then
- log $LINENO "mod_log_path error err $ret code"
- return 1
- fi
- return 0
-}
-
-ini_file_path="invalid_path_upgrade"
-
-while getopts 's:d:t:l:i:' opt
-do
- case $opt in
- s)
- SRC_VER_PATH=`get_abs_path $OPTARG`
- ;;
- :)
- echo "-$OPTARG needs an argument"
- exit 1
- ;;
- d)
- DST_VER_PATH=`get_abs_path $OPTARG`
- ;;
- :)
- echo "-$OPTARG needs an argument"
- exit 1
- ;;
- t)
- UPG_RBK=$OPTARG
- ;;
- :)
- echo "-$OPTARG needs an argument"
- exit 1
- ;;
- l)
- LOG_PATH=`get_abs_path $OPTARG`
- ;;
- :)
- echo "-$OPTARG needs an argument"
- exit 1
- ;;
- i)
- ini_file_path=`get_abs_path $OPTARG`
- ;;
- :)
- echo "-$OPTARG needs an argument"
- exit 1
- ;;
- *)
- echo "command not recognized"
- usage
- exit 1
- ;;
- esac
-done
-
-if [ -z $ini_file_path ]; then
- hostinfo_path="invalid_path_upgrade"
- else
- hostinfo_path=$ini_file_path
-fi
-
-(
-flock -e -n 201
-if [ $? -eq 1 ]
-then
- log $LINENO "another upgrade process is running now, exit"
- exit 1
-fi
-
-if [ -n "${LOG_PATH}" ]; then
- modify_nstack_log_path ${LOG_PATH}
-fi
-modify_log_var
-) 201>>./uplockfile
-
-if [ -f "uplockfile" ]; then
- rm uplockfile
-fi
-
-. ./script/nstack_var.sh
-
-RESTART_MASTER=0
-WAIT_TIME=60
-
-log $LINENO "######################upgrade nstack######################"
-log $LINENO "src ver path ${SRC_VER_PATH},dst ver path ${DST_VER_PATH}, type ${UPG_RBK}, log path ${LOG_PATH}"
-
-upg_pre_chk
-ret=$?
-if [ $ret -ne 0 ]; then
- log $LINENO "pre_chk error err $ret code"
- exit 1
-fi
-
-if [ "${DST_VERSION}" = "${SRC_VERSION}" -a $VERSION_CHK -eq 1 ]; then
- log $LINENO "version equal ${DST_VERSION} ${SRC_VERSION}"
- exit 0
-fi
-log $LINENO "prepare ok"
-
-log $LINENO "src ver $SRC_VERSION with master path $MASTER_PATH,dst ver $DST_VERSION,dst run file $DST_RUN_FILE, type ${UPG_RBK}"
-run_upgrade
-ret=$?
-if [ $ret -ne 0 ]; then
- log $LINENO "run_proc error err $ret code"
- exit 1
-fi
-
-log $LINENO "wait new version start"
-sleep 2
-after_upg_chk
-ret=$?
-if [ $ret -ne 0 ]; then
- log $LINENO "after_chk error err $ret code"
- exit 1
-fi
-
-if [ $RESTART_MASTER -ne 0 ]; then
- log $LINENO "master has restart!"
- opr_suc
- exit 0
-fi
-
-if [ $UPG_MASTER -eq 0 ]; then
- if [ -n "${LOG_PATH}" ]; then
- mod_log_path 2 ${LOG_PATH}
- fi
- opr_suc
- exit 0
-fi
-
-run_upgrade_master
-ret=$?
-if [ $ret -ne 0 ]; then
- log $LINENO "run_proc master error err $ret code"
- exit 1
-fi
-
-log $LINENO "wait new version master start"
-sleep 2
-after_upg_master_chk
-ret=$?
-if [ $ret -ne 0 ]; then
- log $LINENO "after_chk master error err $ret code"
- exit 1
-fi
-
-opr_suc