@ -27,15 +27,19 @@ import xml.etree.cElementTree as ETree
|
||||
|
||||
sys.path.append(sys.path[0] + "/../")
|
||||
sys.path.append(os.path.realpath(os.path.dirname(__file__)) + "/../../lib")
|
||||
from gspylib.os.gsfile import g_file
|
||||
from gspylib.common.GaussLog import GaussLog
|
||||
from gspylib.common.DbClusterInfo import dbClusterInfo
|
||||
from gspylib.common.Common import DefaultValue
|
||||
from gspylib.common.VersionInfo import VersionInfo
|
||||
from gspylib.common.ErrorCode import ErrorCode
|
||||
from gspylib.common.ParameterParsecheck import Parameter
|
||||
from gspylib.os.gsOSlib import g_OSlib
|
||||
from gspylib.os.gsfile import g_Platform
|
||||
from domain_utils.cluster_file.config_param import ConfigParam
|
||||
from base_utils.os.env_util import EnvUtil
|
||||
from base_utils.os.file_util import FileUtil
|
||||
from domain_utils.cluster_file.version_info import VersionInfo
|
||||
from base_utils.os.net_util import NetUtil
|
||||
from base_utils.os.user_util import UserUtil
|
||||
from os_platform.linux_distro import LinuxDistro
|
||||
from domain_utils.cluster_os.cluster_user import ClusterUser
|
||||
|
||||
actioItemMap = {
|
||||
"Check_SysCtl_Parameter": ['/etc/sysctl.conf', False],
|
||||
@ -155,7 +159,7 @@ def checkNetWorkMTU():
|
||||
# Init cluster info
|
||||
DbClusterInfo = dbClusterInfo()
|
||||
DbClusterInfo.initFromStaticConfig(g_opts.user)
|
||||
localHost = DefaultValue.GetHostIpOrName()
|
||||
localHost = NetUtil.GetHostIpOrName()
|
||||
nodeIp = None
|
||||
for dbnode in DbClusterInfo.dbNodes:
|
||||
if (dbnode.name == localHost):
|
||||
@ -168,7 +172,7 @@ def checkNetWorkMTU():
|
||||
g_logger.log("Abnormal reason: Failed to obtain network"
|
||||
" card MTU value." + " Error: \n%s" % valueStr)
|
||||
return 1
|
||||
netParameter = DefaultValue.getConfigFilePara(configFile,
|
||||
netParameter = ConfigParam.getConfigFilePara(configFile,
|
||||
'/sbin/ifconfig')
|
||||
if (int(valueStr) != int(g_opts.mtuValue)):
|
||||
g_logger.log(" Abnormal: network '%s' 'mtu' value[%s:%s]"
|
||||
@ -202,7 +206,7 @@ def checkSysctlParameter(kernelParameter, isSet):
|
||||
patchlevel = ""
|
||||
|
||||
# get the suggest parameters and updata kernelParameter
|
||||
suggestParameterList = DefaultValue.getConfigFilePara(
|
||||
suggestParameterList = ConfigParam.getConfigFilePara(
|
||||
configFile, 'SUGGEST:%s' % actioItemMap["Check_SysCtl_Parameter"][0])
|
||||
kernelParameter.update(suggestParameterList)
|
||||
|
||||
@ -213,7 +217,7 @@ def checkSysctlParameter(kernelParameter, isSet):
|
||||
"'gs_checkos -i A10' or 'gs_checkos -i B4'.")
|
||||
kernelParameter.pop("fs.aio-max-nr")
|
||||
# Get OS version
|
||||
distname, version = g_Platform.dist()[0:2]
|
||||
distname, version = LinuxDistro.linux_distribution()[0:2]
|
||||
if (distname == "SuSE" and version == "11"):
|
||||
cmd = "grep -i 'PATCHLEVEL' /etc/SuSE-release |" \
|
||||
" awk -F '=' '{print $2}'"
|
||||
@ -448,7 +452,7 @@ def checkLimitsParameter(limitPara, isSet):
|
||||
limitPath = '/etc/security/limits.d/'
|
||||
nofiles = glob.glob("/etc/security/limits.d/*.conf")
|
||||
for conf in nofiles:
|
||||
g_file.changeMode(DefaultValue.HOSTS_FILE, conf)
|
||||
FileUtil.changeMode(DefaultValue.HOSTS_FILE, conf)
|
||||
SetLimitsConf(key[0], key[1],
|
||||
table[key].value_expected, conf)
|
||||
if os.path.isfile(os.path.join(limitPath, '91-nofile.conf')):
|
||||
@ -543,7 +547,7 @@ def getClusterUser():
|
||||
if not gphome or not os.path.exists(gphome):
|
||||
user = "*"
|
||||
return user
|
||||
user = g_OSlib.getPathOwner(gphome)[0]
|
||||
user = UserUtil.getPathOwner(gphome)[0]
|
||||
return user
|
||||
|
||||
|
||||
@ -561,10 +565,10 @@ def CheckSection(section, isSetting=False):
|
||||
# get the parameter and value about section from configuration file
|
||||
if (section == '/etc/security/limits.conf'):
|
||||
checkList = ['open files', 'pipe size']
|
||||
commParameterList = DefaultValue.getConfigFilePara(configFile,
|
||||
commParameterList = ConfigParam.getConfigFilePara(configFile,
|
||||
section, checkList)
|
||||
else:
|
||||
commParameterList = DefaultValue.getConfigFilePara(configFile,
|
||||
commParameterList = ConfigParam.getConfigFilePara(configFile,
|
||||
section)
|
||||
|
||||
# checking or setting the parameter what in the commParameterList
|
||||
@ -631,8 +635,8 @@ def checkParameter():
|
||||
|
||||
# check if user exist and is the right user
|
||||
if (g_opts.user != ''):
|
||||
DefaultValue.checkUser(g_opts.user)
|
||||
tmpDir = DefaultValue.getTmpDirFromEnv(g_opts.user)
|
||||
ClusterUser.checkUser(g_opts.user)
|
||||
tmpDir = EnvUtil.getTmpDirFromEnv(g_opts.user)
|
||||
if (not os.path.exists(tmpDir)):
|
||||
GaussLog.exitWithError(ErrorCode.GAUSS_502["GAUSS_50201"]
|
||||
% ("temporary directory[" + tmpDir + "]"))
|
||||
|
Reference in New Issue
Block a user