support ubuntu system

This commit is contained in:
zhengxue
2021-04-13 22:56:32 +08:00
parent d333de5e54
commit 5f830fc34c
5 changed files with 52 additions and 6 deletions

View File

@ -64,8 +64,10 @@ elif [ X$(echo $PLAT_FORM_STR | grep "openeuler") != X"" ]; then
dist_version="openEuler"
elif [ X$(echo $PLAT_FORM_STR | grep "euleros") != X"" ]; then
dist_version="EulerOS"
elif [ X$(echo $PLAT_FORM_STR | grep "ubuntu") != X"" ]; then
dist_version="Ubuntu"
else
echo "We only support openEuler(aarch64), EulerOS(aarch64), CentOS platform."
echo "We only support openEuler(aarch64), EulerOS(aarch64), CentOS, Ubuntu(x86) platform."
echo "Kernel is $kernel"
exit 1
fi

View File

@ -27,6 +27,8 @@ function get_os_str() {
os_str=openeuler_aarch64
elif [ "$os_name"x = "openEuler"x ] && [ "$cpu_arc"x = "x86_64"x ]; then
os_str=openeuler_x86_64
elif [ "$os_name"x = "ubuntu"x ] && [ "$cpu_arc"x = "x86_64"x ]; then
os_str=ubuntu18.04_x86_64
else
os_str="Failed"
fi

View File

@ -797,6 +797,7 @@ class DefaultValue():
"""
SuSENetWorkConfPath = "/etc/sysconfig/network"
RedHatNetWorkConfPath = "/etc/sysconfig/network-scripts"
UbuntuNetWorkConfPath = "/etc/network"
NetWorkConfFile = ""
distname, version, idnum = g_Platform.dist()
distname = distname.lower()
@ -812,6 +813,9 @@ class DefaultValue():
"redhat", "centos", "euleros", "openeuler")):
cmd = "find %s -iname 'ifcfg-*-%s' -print" % (
RedHatNetWorkConfPath, networkCardNum)
elif (distname == "debian" and version == "buster/sid"):
cmd = "find %s -iname 'ifcfg-*-%s' -print" % (
UbuntuNetWorkConfPath, networkCardNum)
else:
cmd = "find %s -iname 'ifcfg-*-%s' -print" % (
SuSENetWorkConfPath, networkCardNum)
@ -889,6 +893,12 @@ class DefaultValue():
# get local host by os function
hostIp = socket.gethostbyname(hostname)
# due to two loopback address in ubuntu, 127.0.1.1 are choosed by hostname.
# there is need to choose 127.0.0.1
version = g_Platform.dist()[1].split('/')[0]
if version == "buster" and hostIp == "127.0.1.1":
hostIp = "127.0.0.1"
return hostIp
@staticmethod
@ -1468,9 +1478,10 @@ class DefaultValue():
systemDir = "/usr/lib/systemd/system/"
systemFile = "/usr/lib/systemd/system/gs-OS-set.service"
# OS init file
# now we only support SuSE and RHEL/CentOS
# now we only support SuSE, RHEL/CentOS and Ubuntu
initFileSuse = "/etc/init.d/boot.local"
initFileRedhat = "/etc/rc.d/rc.local"
initFileUbuntu = "/lib/systemd/system/rc.local.service"
# system init file
initSystemFile = "/usr/local/gauss/script/gauss-OS-set.sh"
initSystemPath = "/usr/local/gauss/script"
@ -1515,6 +1526,9 @@ class DefaultValue():
elif (distname in ("redhat", "centos", "euleros", "openEuler") and
os.path.isfile(initFileRedhat)):
initFile = initFileRedhat
elif (distname == "debian" and version == "buster/sid" and
os.path.isfile(initFileUbuntu)):
initFile = initFileUbuntu
else:
initFile = ""

View File

@ -100,8 +100,10 @@ EULEROS = "euleros"
KYLIN = "kylin"
OPENEULER = "openeuler"
ASIANUX = "asianux"
DEBIAN = "debian"
UBUNTU = "ubuntu"
SUPPORT_WHOLE_PLATFORM_LIST = [SUSE, REDHAT, CENTOS, EULEROS,
OPENEULER, KYLIN, ASIANUX]
OPENEULER, KYLIN, ASIANUX, DEBIAN, UBUNTU]
# RedhatX platform
SUPPORT_RHEL_SERIES_PLATFORM_LIST = [REDHAT, CENTOS, "kylin", "asianux"]
SUPPORT_RHEL6X_VERSION_LIST = ["6.4", "6.5", "6.6", "6.7", "6.8", "6.9", "10"]
@ -129,12 +131,13 @@ PAK_EULER = "Euler"
PAK_OPENEULER = "openEuler"
PAK_REDHAT = "RedHat"
PAK_ASIANUX = "asianux"
PAK_UBUNTU = "Ubuntu"
#######################################################
_supported_dists = (
'SuSE', 'debian', 'fedora', 'redhat', 'centos', 'euleros', "openEuler",
'mandrake', 'mandriva', 'rocks', 'slackware', 'yellowdog', 'gentoo',
'UnitedLinux', 'turbolinux', 'kylin', 'asianux')
'UnitedLinux', 'turbolinux', 'kylin', 'asianux', 'ubuntu')
_release_filename = re.compile(r'(\w+)[-_](release|version)')
_lsb_release_version = re.compile(r'(.+)'
' release '
@ -1561,6 +1564,12 @@ class LinuxPlatform(GenericPlatform):
prefixStr, packageVersion,
PAK_OPENEULER,
BIT_VERSION, postfixStr))
elif distname in DEBIAN and (version == "buster/sid"):
fileName = os.path.join(dirName, "./../../../",
"%s-%s-%s-%s.%s" % (
prefixStr, packageVersion,
PAK_UBUNTU,
BIT_VERSION, postfixStr))
else:
raise Exception(ErrorCode.GAUSS_519["GAUSS_51900"] +
"Supported platforms are: %s." % str(
@ -1853,8 +1862,13 @@ class RHELPlatform(LinuxPlatform):
input : action
output : str
"""
# get system information
distname, version = g_Platform.dist()[0:2]
if self.isSupportSystemctl():
return self.getSystemctlCmd("crond.service", action)
elif distname == "debian" and version == "buster/sid":
return self.getServiceCmd("cron", action)
else:
return self.getServiceCmd("crond", action)
@ -1917,12 +1931,14 @@ class RHELPlatform(LinuxPlatform):
try:
distName, version, currentId = dist()
bits = platform.architecture()[0]
if ((bits == BIT_VERSION and
((distName.lower() == EULEROS and version[0:3] in
SUPPORT_EULEROS_VERSION_LIST) or
(distName.lower() in SUPPORT_RHEL_SERIES_PLATFORM_LIST and
version[0:3] in SUPPORT_RHEL_SERIES_VERSION_LIST)) or
(distName.lower() == OPENEULER)
(distName.lower() == OPENEULER) or
(distName.lower() == DEBIAN and version == "buster/sid")
)):
return distName.lower(), version[0:3]
else:
@ -1935,6 +1951,10 @@ class RHELPlatform(LinuxPlatform):
" The current system is: %s%s%s" % (
distName.lower(),
version[0:3], currentId))
if distName.lower() == DEBIAN:
raise Exception(ErrorCode.GAUSS_519["GAUSS_51900"] +
" The current system is: %s/%s" % (
distName.lower(), version))
else:
raise Exception(ErrorCode.GAUSS_519["GAUSS_51900"] +
" The current system is: %s%s" % (
@ -1974,6 +1994,7 @@ class UserPlatform():
# SuSE11 sp1/2/3/4 64bit
# SuSE12 sp0/1/2/3 64bit
# Kylin "10" 64bit
# Ubuntu "18.04" 64bit
distName, version, idNum = dist()
if distName.lower() not in SUPPORT_WHOLE_PLATFORM_LIST:
raise Exception(ErrorCode.GAUSS_519["GAUSS_51900"] +

View File

@ -1696,7 +1696,11 @@ def CheckIOSchedulers(isSetting=False):
input : Bool
output : NA
"""
# The IO Schedulers in ubuntu system is default value,
# so that it cannot be modified
distname, version = g_Platform.dist()[0:2]
if distname == "debian" and version == "buster/sid":
return
data = collectIOschedulers()
for dev in list(data.devices.keys()):
expectedScheduler = "deadline"
@ -1926,6 +1930,9 @@ def CheckPlatformInfo():
elif (data.distname == "euleros" or data.distname == "openEuler" or data.distname == "kylin"):
mixedType = "%s" % data.distname
platformStr = "%s_%s_%s" % (data.distname, data.version, data.bits)
elif (data.distname == "debian" or data.version == "buster/sid"):
mixedType = "%s" % data.distname
platformStr = "%s_%s_%s" % (data.distname, data.version, data.bits)
else:
platformStr = "%s_%s_%s" % (data.distname, data.version, data.bits)
g_logger.log("False unknown %s" % platformStr)