add support for FusionOS platform

This commit is contained in:
junhangis
2022-08-27 10:55:55 +08:00
parent dd319b962d
commit 3c6a24a304
14 changed files with 58 additions and 27 deletions

View File

@ -48,7 +48,7 @@ done
PLAT_FORM_STR=$(sh "${ROOT_DIR}/build/get_PlatForm_str.sh")
if [ "${PLAT_FORM_STR}"x == "Failed"x ]; then
echo "We only support openEuler(aarch64), EulerOS(aarch64), CentOS platform."
echo "We only support openEuler(aarch64), EulerOS(aarch64), FusionOS, CentOS platform."
exit 1;
fi
@ -62,6 +62,8 @@ if [ X$(echo $PLAT_FORM_STR | grep "centos") != X"" ]; then
dist_version="CentOS"
elif [ X$(echo $PLAT_FORM_STR | grep "openeuler") != X"" ]; then
dist_version="openEuler"
elif [ X$(echo $PLAT_FORM_STR | grep "fusionos") != X"" ]; then
dist_version="FusionOS"
elif [ X$(echo $PLAT_FORM_STR | grep "euleros") != X"" ]; then
dist_version="EulerOS"
elif [ X$(echo $PLAT_FORM_STR | grep "ubuntu") != X"" ]; then
@ -69,7 +71,7 @@ elif [ X$(echo $PLAT_FORM_STR | grep "ubuntu") != X"" ]; then
elif [ X$(echo $PLAT_FORM_STR | grep "asianux") != X"" ]; then
dist_version="Asianux"
else
echo "We only support openEuler(aarch64), EulerOS(aarch64), CentOS, Ubuntu(x86) platform."
echo "We only support openEuler(aarch64), EulerOS(aarch64), FusionOS, CentOS, Ubuntu(x86) platform."
echo "Kernel is $kernel"
exit 1
fi

View File

@ -27,6 +27,10 @@ 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 = "fusionos"x ] && [ "$cpu_arc"x = "aarch64"x ]; then
os_str=fusionos_aarch64
elif [ "$os_name"x = "fusionos"x ] && [ "$cpu_arc"x = "x86_64"x ]; then
os_str=fusionos_x86_64
elif [ "$os_name"x = "ubuntu"x ] && [ "$cpu_arc"x = "x86_64"x ]; then
os_str=ubuntu18.04_x86_64
elif [ "$os_name"x = "asianux"x ] && [ "$cpu_arc"x = "x86_64"x ]; then

View File

@ -28,4 +28,4 @@ class CommConstants:
UPGRADE_SQL_FILE = "upgrade_sql.tar.gz"
# not support grep upgrade
FIRST_GREY_UPGRADE_NUM = -1
DIST_NAME_TUPLE = ("redhat", "euleros", "centos", "openEuler")
DIST_NAME_TUPLE = ("redhat", "euleros", "centos", "openEuler", "FusionOS")

View File

@ -83,7 +83,7 @@ class OsFile:
return init_system_file
if distname == "SuSE" and os.path.isfile(init_file_suse):
init_file = init_file_suse
elif distname in ("redhat", "centos", "euleros", "oracle", "openEuler") \
elif distname in ("redhat", "centos", "euleros", "oracle", "openEuler", "FusionOS") \
and os.path.isfile(init_file_redhat):
init_file = init_file_redhat
elif distname == "kylin" and os.path.isfile(init_file_kylin):

View File

@ -316,7 +316,7 @@ General options:
group = grp.getgrgid(pwd.getpwnam(self.user).pw_gid).gr_name
distname, version, idnum = LinuxDistro.linux_distribution()
# check if OS version is redhat or Euler
if (distname in ("redhat", "euleros", "centos", "openEuler")):
if (distname in ("redhat", "euleros", "centos", "openEuler", "FusionOS")):
if (self.deleteGroup != True and self.deleteUser == True
and self.user == group):
GaussLog.exitWithError(ErrorCode.GAUSS_500["GAUSS_50001"] %

View File

@ -592,7 +592,7 @@ class DefaultValue():
NetWorkConfFile = ""
distname, version, idnum = LinuxDistro.linux_distribution()
distname = distname.lower()
if (distname in ("redhat", "centos", "euleros", "openEuler")):
if (distname in ("redhat", "centos", "euleros", "openEuler", "fusionos")):
NetWorkConfFile = "%s/ifcfg-%s" % (RedHatNetWorkConfPath,
networkCardNum)
else:
@ -601,7 +601,7 @@ class DefaultValue():
if (not os.path.exists(NetWorkConfFile)):
if (distname in (
"redhat", "centos", "euleros", "openeuler")):
"redhat", "centos", "euleros", "openeuler", "fusionos")):
cmd = "find %s -iname 'ifcfg-*-%s' -print" % (
RedHatNetWorkConfPath, networkCardNum)
elif (distname == "debian" and version == "buster/sid"):
@ -784,7 +784,7 @@ class DefaultValue():
"""
distname, version, _ = LinuxDistro.linux_distribution()
if (distname.lower() in ("suse", "redhat", "centos", "euleros",
"openeuler")):
"openeuler", "fusionos")):
cmd = g_file.SHELL_CMD_DICT["checkPassword"] % (checkUser,
"'^Last.*Change'")
else:
@ -805,7 +805,7 @@ class DefaultValue():
if ("password must be changed" in result):
raise Exception(ErrorCode.GAUSS_503["GAUSS_50307"])
if (distname.lower() in ("redhat", "centos", "euleros",
"openeuler")):
"openeuler", "fusionos")):
if ("password must be changed" in result):
raise Exception(ErrorCode.GAUSS_503["GAUSS_50307"])
@ -881,7 +881,7 @@ class DefaultValue():
return initSystemFile
if (distname == "SuSE" and os.path.isfile(initFileSuse)):
initFile = initFileSuse
elif (distname in ("redhat", "centos", "euleros", "openEuler") and
elif (distname in ("redhat", "centos", "euleros", "openEuler", "FusionOS") and
os.path.isfile(initFileRedhat)):
initFile = initFileRedhat
elif (distname == "debian" and version == "buster/sid" and

View File

@ -631,7 +631,7 @@ def isSupportSystemOs():
output : NA
"""
osName = LinuxDistro.linux_distribution()[0]
if osName in ["redhat", "centos", "euleros", "openEuler"]:
if osName in ["redhat", "centos", "euleros", "openEuler", "FusionOS"]:
return True
else:
return False
@ -809,7 +809,7 @@ def getOSInitFile():
if (distname == "SuSE" and os.path.isfile(initFileSuse)):
initFile = initFileSuse
elif (distname in (
"redhat", "centos", "euleros", "openEuler") and os.path.isfile(
"redhat", "centos", "euleros", "openEuler", "FusionOS") and os.path.isfile(
initFileRedhat)):
initFile = initFileRedhat
else:

View File

@ -68,7 +68,7 @@ class CheckBond(BaseItem):
ifcfgFileRedhat = "/etc/sysconfig/network-scripts/ifcfg-%s" \
% networkCards
distname, version, idnum = LinuxDistro.linux_distribution()
if (distname in ["redhat", "centos", "euleros", "openEuler"]):
if (distname in ["redhat", "centos", "euleros", "openEuler", "FusionOS"]):
cmd = "echo BONDING_MODULE_OPTS='mode=%d " \
"miimon=100 use_carrier=0' >> %s " % (1, ifcfgFileRedhat)
else:

View File

@ -51,6 +51,9 @@ class CheckOSVer(BaseItem):
elif distName == "openeuler":
self.result.rst = ResultStatus.OK
self.result.val = "The current OS is openEuler %s." % version
elif distName == "fusionos":
self.result.rst = ResultStatus.OK
self.result.val = "The current OS is FusionOS %s." % version
else:
self.result.rst = ResultStatus.NG
self.result.val = "The current OS[%s %s] " \
@ -70,7 +73,7 @@ class CheckOSVer(BaseItem):
analysis = ""
VerGroupDisk = {'RedHat6': [], 'RedHat7': [], 'Euler': [],
'SuSE11SP1': [], 'SuSE11SP234': [], 'SuSE12': [],
'openEuler': []}
'openEuler': [], 'FusionOS': []}
for v in itemResult.getLocalItems():
analysis += "%s: %s\n" % (v.host, v.val)
verInfo = v.val.strip().split(' ')[4:]
@ -84,6 +87,8 @@ class CheckOSVer(BaseItem):
VerGroupDisk['Euler'].append(verInfo)
elif verInfo[0] == "openEuler":
VerGroupDisk['openEuler'].append(verInfo)
elif verInfo[0] == "FusionOS":
VerGroupDisk['FusionOS'].append(verInfo)
elif verInfo[0] == "SuSE":
if verInfo[1] == "11.1":
VerGroupDisk['SuSE11SP1'].append(verInfo)

View File

@ -47,7 +47,7 @@ from netifaces import interfaces, ifaddresses, AF_INET, AF_INET6
_supported_dists = (
'SuSE', 'debian', 'fedora', 'redhat', 'centos', 'euleros', "openEuler",
'mandrake', 'mandriva', 'rocks', 'slackware', 'yellowdog', 'gentoo',
'UnitedLinux', 'turbolinux')
'FusionOS', 'UnitedLinux', 'turbolinux')
_release_filename = re.compile(r'(\w+)[-_](release|version)')
_lsb_release_version = re.compile(r'(.+)'
' release '
@ -61,12 +61,13 @@ SUSE = "suse"
REDHAT = "redhat"
CENTOS = "centos"
EULEROS = "euleros"
FUSIONOS = "fusionos"
KYLIN = "kylin"
OPENEULER = "openeuler"
ASIANUX = "asianux"
DEBIAN = "debian"
UBUNTU = "ubuntu"
SUPPORT_WHOLE_PLATFORM_LIST = [SUSE, REDHAT, CENTOS, EULEROS,
SUPPORT_WHOLE_PLATFORM_LIST = [SUSE, REDHAT, CENTOS, EULEROS, FUSIONOS,
OPENEULER, KYLIN, ASIANUX, DEBIAN, UBUNTU]
# RedhatX platform
SUPPORT_RHEL_SERIES_PLATFORM_LIST = [REDHAT, CENTOS, "kylin", "asianux"]
@ -96,6 +97,7 @@ COLON = ":"
PAK_CENTOS = "CentOS"
PAK_EULER = "Euler"
PAK_OPENEULER = "openEuler"
PAK_FUSIONOS = "FusionOS"
PAK_REDHAT = "RedHat"
PAK_ASIANUX = "Asianux"
PAK_UBUNTU = "Ubuntu"
@ -105,7 +107,7 @@ PAK_SUSE = "SUSE"
_supported_dists = (
'SuSE', 'debian', 'fedora', 'redhat', 'centos', 'euleros', "openEuler",
'mandrake', 'mandriva', 'rocks', 'slackware', 'yellowdog', 'gentoo',
'UnitedLinux', 'turbolinux', 'kylin', 'asianux', 'ubuntu')
'FusionOS', 'UnitedLinux', 'turbolinux', 'kylin', 'asianux', 'ubuntu')
_release_filename = re.compile(r'(\w+)[-_](release|version)')
_lsb_release_version = re.compile(r'(.+)'
' release '
@ -1537,6 +1539,12 @@ class LinuxPlatform(GenericPlatform):
prefixStr, packageVersion,
PAK_OPENEULER,
BIT_VERSION, postfixStr))
elif distname in FUSIONOS:
fileName = os.path.join(dirName, "./../../../",
"%s-%s-%s-%s.%s" % (
prefixStr, packageVersion,
PAK_FUSIONOS,
BIT_VERSION, postfixStr))
elif distname in DEBIAN and (version == "buster/sid"):
fileName = os.path.join(dirName, "./../../../",
"%s-%s-%s-%s.%s" % (
@ -1782,7 +1790,7 @@ class RHELPlatform(LinuxPlatform):
(distName.lower() == CENTOS and version[0:3] ==
SUPPORT_EULEROS_VERSION_LIST and
os.path.isfile(os.path.join("/etc", "euleros-release"))) or
distName.lower() == OPENEULER):
(distName.lower() == OPENEULER) or (distName.lower() == FUSIONOS)):
return True
else:
return False
@ -1911,6 +1919,7 @@ class RHELPlatform(LinuxPlatform):
(distName.lower() in SUPPORT_RHEL_SERIES_PLATFORM_LIST and
version[0:3] in SUPPORT_RHEL_SERIES_VERSION_LIST)) or
(distName.lower() == OPENEULER) or
(distName.lower() == FUSIONOS) or
(distName.lower() == DEBIAN and version == "buster/sid")
)):
return distName.lower(), version[0:3]

View File

@ -661,7 +661,7 @@ def disRemoveIPC():
"""
g_logger.debug("disbale RemoveIPC.")
distName = g_Platform.getCurrentPlatForm()[0]
if distName.upper() in ("OPENEULER", "KYLIN"):
if distName.upper() in ("OPENEULER", "FUSIONOS", "KYLIN"):
cmd = "setenforce 0"
subprocess.getstatusoutput(cmd)
initFile = "/usr/lib/systemd/system/systemd-logind.service"
@ -1391,7 +1391,7 @@ def collectfirewall():
"""
data = firewall()
distname = LinuxDistro.linux_distribution()[0]
if distname in ("redhat", "centos", "euleros", "openEuler"):
if distname in ("redhat", "centos", "euleros", "openEuler", "FusionOS"):
data.distname = distname.upper()
if g_Platform.isPlatFormEulerOSOrRHEL7X():
cmd = "systemctl status firewalld.service"
@ -1406,7 +1406,7 @@ def collectfirewall():
data.errormsg = output
return data
if distname in ("redhat", "centos", "euleros", "openEuler"):
if distname in ("redhat", "centos", "euleros", "openEuler", "FusionOS"):
if g_Platform.isPlatFormEulerOSOrRHEL7X():
if (output.strip()).find("Active: "
"active (running)") > 0:
@ -1791,7 +1791,7 @@ def CheckPlatformInfo():
data.bits)
g_logger.log("False %s %s" % (data.distname, platform_str))
return
elif (data.distname == "euleros" or data.distname == "openEuler" or data.distname == "kylin"):
elif (data.distname == "euleros" or data.distname == "openEuler" or data.distname == "FusionOS" or data.distname == "kylin"):
mixed_type = "%s" % data.distname
platform_str = "%s_%s_%s" % (data.distname, data.version, data.bits)
elif (data.distname == "debian" or data.version == "buster/sid"):

View File

@ -27,11 +27,12 @@ CENTOS = "centos"
EULEROS = "euleros"
KYLIN = "kylin"
OPENEULER = "openeuler"
FUSIONOS = "fusionos"
ASIANUX = "asianux"
DEBIAN = "debian"
UBUNTU = "ubuntu"
SUPPORT_WHOLE_PLATFORM_LIST = [SUSE, REDHAT, CENTOS, EULEROS, OPENEULER, KYLIN,
ASIANUX, DEBIAN, UBUNTU]
FUSIONOS, 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"]
@ -60,6 +61,7 @@ COLON = ":"
PAK_CENTOS = "CentOS"
PAK_EULER = "Euler"
PAK_OPENEULER = "openEuler"
PAK_FUSIONOS = "FusionOS"
PAK_REDHAT = "RedHat"
PAK_ASIANUX = "Asianux"
PAK_UBUNTU = "Ubuntu"
@ -71,4 +73,4 @@ PAK_DEBIAN = "Debian"
_supported_dists = (
'SuSE', 'debian', 'fedora', 'redhat', 'centos', 'euleros', "openEuler",
'mandrake', 'mandriva', 'rocks', 'slackware', 'yellowdog', 'gentoo',
'UnitedLinux', 'turbolinux', 'ubuntu', 'kylin', 'asianux')
"FusionOS", 'UnitedLinux', 'turbolinux', 'ubuntu', 'kylin', 'asianux')

View File

@ -25,7 +25,8 @@ from gspylib.common.ErrorCode import ErrorCode
from os_platform.common import REDHAT, PAK_REDHAT, BIT_VERSION, \
CENTOS, PAK_EULER, PAK_CENTOS, ASIANUX, SUSE, PAK_ASIANUX, \
EULEROS, OPENEULER, KYLIN, PAK_OPENEULER, SUPPORT_WHOLE_PLATFORM_LIST,\
BLANK_SPACE, PAK_UBUNTU, DEBIAN, PAK_KYLIN, PAK_SUSE, PAK_DEBIAN
BLANK_SPACE, PAK_UBUNTU, DEBIAN, PAK_KYLIN, PAK_SUSE, PAK_DEBIAN, \
FUSIONOS, PAK_FUSIONOS
from os_platform.linux_distro import LinuxDistro
@ -224,6 +225,11 @@ class LinuxPlatform(object):
self.package_file_path(prefix_str, packageVersion, PAK_OPENEULER, postfix_str)
]
elif distname == FUSIONOS:
file_name_list = [
self.package_file_path(prefix_str, packageVersion, PAK_FUSIONOS, postfix_str)
]
else:
raise Exception(ErrorCode.GAUSS_519["GAUSS_51900"] +
"Supported platforms are: %s." % str(

View File

@ -24,7 +24,7 @@ import os
import platform
from gspylib.common.ErrorCode import ErrorCode
from os_platform.common import BIT_VERSION, EULEROS, SUPPORT_EULEROS_VERSION_LIST, \
SUPPORT_RHEL_SERIES_PLATFORM_LIST, \
FUSIONOS, SUPPORT_RHEL_SERIES_PLATFORM_LIST, \
SUPPORT_RHEL_SERIES_VERSION_LIST, OPENEULER, CENTOS, \
SUPPORT_RHEL7X_VERSION_LIST, DEBIAN, BLANK_SPACE
from os_platform.linux_distro import LinuxDistro
@ -58,7 +58,9 @@ class RHELPlatform(LinuxPlatform):
(dist_name.lower() == CENTOS and version[0:3] ==
SUPPORT_EULEROS_VERSION_LIST and
os.path.isfile(os.path.join("/etc", "euleros-release"))) or
dist_name.lower() == OPENEULER):
(dist_name.lower() == OPENEULER) or
(dist_name.lower() == FUSIONOS)
):
return True
return False
@ -168,6 +170,7 @@ class RHELPlatform(LinuxPlatform):
(dist_name.lower() in SUPPORT_RHEL_SERIES_PLATFORM_LIST and
version[0:3] in SUPPORT_RHEL_SERIES_VERSION_LIST)) or
(dist_name.lower() == OPENEULER) or
(dist_name.lower() == FUSIONOS) or
(dist_name.lower() == DEBIAN and version == "buster/sid")
)):
return dist_name.lower(), version[0:3]