!532 在gs_preinstall中检查dss_home路径是否是datanode的路径子集

Merge pull request !532 from zhangao/master_devdsschongdie
This commit is contained in:
opengauss_bot 2023-08-12 07:39:18 +00:00 committed by Gitee
commit c03c8179d1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 34 additions and 3 deletions

View File

@ -93,6 +93,8 @@ from gspylib.common.Common import DefaultValue
from gspylib.common.ErrorCode import ErrorCode
from gspylib.common.ParallelBaseOM import ParallelBaseOM
from gspylib.common.ParameterParsecheck import Parameter
from gspylib.common.DbClusterInfo import dbNodeInfo, \
dbClusterInfo, compareObject
from impl.preinstall.OLAP.PreinstallImplOLAP import PreinstallImplOLAP
from gspylib.threads.SshTool import SshTool
from domain_utils.cluster_file.cluster_config_file import ClusterConfigFile
@ -576,7 +578,33 @@ General options:
sys.path.insert(0, lib_path)
if gsom_path == DefaultValue.ROOT_SCRIPTS_PATH:
self.is_new_root_path = True
def checkIfNest(self):
"""
function: check syncNode
"""
clusterInfo = dbClusterInfo()
clusterInfo.initFromXml(self.xmlFile)
dbNodes = clusterInfo.dbNodes
# get the dss_home path
dss_home_path = clusterInfo.dss_home
for dbinfo in dbNodes:
if dbinfo is None:
break
datanodes = dbinfo.datanodes
# check if subdir_path starts with parentdir_path
for datainfo in datanodes:
parentdir_path = os.path.normpath(datainfo.datadir)
subdir_path = os.path.normpath(dss_home_path)
if not parentdir_path.endswith(os.path.sep):
parentdir_path += os.path.sep
if not subdir_path.endswith(os.path.sep):
subdir_path += os.path.sep
if subdir_path.startswith(parentdir_path):
GaussLog.exitWithError(ErrorCode.GAUSS_502["GAUSS_50240"] % dss_home_path)
def clearHistTimeFormat():
cmd = "sed -i '/HISTTIMEFORMAT=/d' /etc/profile"
@ -603,6 +631,8 @@ if __name__ == '__main__':
preinstall.parseCommandLine()
# check parameters
preinstall.checkParameter()
# check if the path between dss and datanode is nested
preinstall.checkIfNest()
# check expect
preinstall.check_expect()
# init global variables

View File

@ -190,8 +190,9 @@ class ErrorCode():
'GAUSS_50238': "[GAUSS-50238] : Check integrality of bin ",
"file %s failed."
'GAUSS_50239': "[GAUSS-50239] : %s should be set in scene config "
"file."
"file.",
'GAUSS_50240': "[GAUSS-50240] : %s, it not allowed that directory dss_home_path is a subset"
"of Directory datanode_path."
}
###########################################################################