From f3556e44181cc60202fadc0e1c144869d0d4dd42 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 4 Mar 2025 14:22:22 +0530 Subject: [PATCH 1/3] cloudstack: add support for EL10 This adds support for Fedora 40 and (upcoming) EL10 distro to be used as mgmt/usage server, mysql/nfs & KVM host. Python3 version has changed to 3.12.9 which isn't automatically determining the python-path. Signed-off-by: Rohit Yadav --- agent/bindir/cloud-setup-agent.in | 13 +++++++++++++ agent/bindir/libvirtqemuhook.in | 13 +++++++++++++ client/bindir/cloud-setup-management.in | 14 ++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/agent/bindir/cloud-setup-agent.in b/agent/bindir/cloud-setup-agent.in index 18de64089ed0..9927c22eebcf 100755 --- a/agent/bindir/cloud-setup-agent.in +++ b/agent/bindir/cloud-setup-agent.in @@ -20,6 +20,19 @@ import os import logging import sys import socket + +# ---- This snippet of code adds the sources path and the waf configured PYTHONDIR to the Python path ---- +# ---- We do this so cloud_utils can be looked up in the following order: +# ---- 1) Sources directory +# ---- 2) waf configured PYTHONDIR +# ---- 3) System Python path +for pythonpath in ( + "@PYTHONDIR@", + os.path.join(os.path.dirname(__file__),os.path.pardir,os.path.pardir,"python","lib"), + ): + if os.path.isdir(pythonpath): sys.path.insert(0,pythonpath) +# ---- End snippet of code ---- + from cloudutils.cloudException import CloudRuntimeException, CloudInternalException from cloudutils.utilities import initLoging, bash from cloudutils.configFileOps import configFileOps diff --git a/agent/bindir/libvirtqemuhook.in b/agent/bindir/libvirtqemuhook.in index e17944d83537..4cc6ed7a1d28 100755 --- a/agent/bindir/libvirtqemuhook.in +++ b/agent/bindir/libvirtqemuhook.in @@ -20,6 +20,19 @@ import sys import os import subprocess from threading import Timer + +# ---- This snippet of code adds the sources path and the waf configured PYTHONDIR to the Python path ---- +# ---- We do this so cloud_utils can be looked up in the following order: +# ---- 1) Sources directory +# ---- 2) waf configured PYTHONDIR +# ---- 3) System Python path +for pythonpath in ( + "@PYTHONDIR@", + os.path.join(os.path.dirname(__file__),os.path.pardir,os.path.pardir,"python","lib"), + ): + if os.path.isdir(pythonpath): sys.path.insert(0,pythonpath) +# ---- End snippet of code ---- + from xml.dom.minidom import parse from cloudutils.configFileOps import configFileOps from cloudutils.networkConfig import networkConfig diff --git a/client/bindir/cloud-setup-management.in b/client/bindir/cloud-setup-management.in index 70e727b40b29..84c87ae2e442 100755 --- a/client/bindir/cloud-setup-management.in +++ b/client/bindir/cloud-setup-management.in @@ -16,13 +16,27 @@ # specific language governing permissions and limitations # under the License. +import os import sys +# ---- This snippet of code adds the sources path and the waf configured PYTHONDIR to the Python path ---- +# ---- We do this so cloud_utils can be looked up in the following order: +# ---- 1) Sources directory +# ---- 2) waf configured PYTHONDIR +# ---- 3) System Python path +for pythonpath in ( + "@PYTHONDIR@", + os.path.join(os.path.dirname(__file__),os.path.pardir,os.path.pardir,"python","lib"), + ): + if os.path.isdir(pythonpath): sys.path.insert(0,pythonpath) +# ---- End snippet of code ---- + from cloudutils.syscfg import sysConfigFactory from cloudutils.utilities import initLoging, UnknownSystemException from cloudutils.cloudException import CloudRuntimeException, CloudInternalException from cloudutils.globalEnv import globalEnv from cloudutils.serviceConfigServer import cloudManagementConfig from optparse import OptionParser + if __name__ == '__main__': initLoging("@MSLOGDIR@/setupManagement.log") glbEnv = globalEnv() From cde08198e939f8efd5b32faf5f4267c01443ada7 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 4 Mar 2025 14:23:48 +0530 Subject: [PATCH 2/3] python: WIP code, this fails right now Need to discuss/check if we can skip this code. Where/how is cgroup setup used with KVM agent. Signed-off-by: Rohit Yadav --- python/lib/cloudutils/serviceConfig.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/lib/cloudutils/serviceConfig.py b/python/lib/cloudutils/serviceConfig.py index 0b4820dd7b65..cd2c1043f3a2 100755 --- a/python/lib/cloudutils/serviceConfig.py +++ b/python/lib/cloudutils/serviceConfig.py @@ -437,6 +437,8 @@ def __init__(self, syscfg): def config(self): try: + # TODO: /etc/cgconfig.conf & /etc/cgrules.conf not available on F40/EL10 + # had to install: dnf install libcgroup libcgroup-tools cfo = configFileOps("/etc/cgconfig.conf", self) addConfig = "group virt {\n \ cpu {\n \ @@ -452,6 +454,7 @@ def config(self): cfgline = "root:/usr/sbin/libvirtd cpu virt/\n" cfo.add_lines(cfgline) + # TODO: This doesn't work on EL10/Fedora 40 self.syscfg.svo.stopService("cgred", True) if not self.syscfg.svo.enableService("cgred"): return False From 4ca70581f62e74d412b762eac68c6902993c042e Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Wed, 5 Mar 2025 15:41:00 +0530 Subject: [PATCH 3/3] prep cloudutils to be EL10 ready Fixes issue for Fedora, it was running old EL6 hooks which isn't applicable for modern Fedora version that are closer to EL8/9/10 Signed-off-by: Rohit Yadav --- python/lib/cloudutils/serviceConfig.py | 3 --- python/lib/cloudutils/syscfg.py | 7 ++++--- python/lib/cloudutils/utilities.py | 4 ++++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/python/lib/cloudutils/serviceConfig.py b/python/lib/cloudutils/serviceConfig.py index cd2c1043f3a2..0b4820dd7b65 100755 --- a/python/lib/cloudutils/serviceConfig.py +++ b/python/lib/cloudutils/serviceConfig.py @@ -437,8 +437,6 @@ def __init__(self, syscfg): def config(self): try: - # TODO: /etc/cgconfig.conf & /etc/cgrules.conf not available on F40/EL10 - # had to install: dnf install libcgroup libcgroup-tools cfo = configFileOps("/etc/cgconfig.conf", self) addConfig = "group virt {\n \ cpu {\n \ @@ -454,7 +452,6 @@ def config(self): cfgline = "root:/usr/sbin/libvirtd cpu virt/\n" cfo.add_lines(cfgline) - # TODO: This doesn't work on EL10/Fedora 40 self.syscfg.svo.stopService("cgred", True) if not self.syscfg.svo.enableService("cgred"): return False diff --git a/python/lib/cloudutils/syscfg.py b/python/lib/cloudutils/syscfg.py index fe68b02dfe8c..78cd58bfbd40 100755 --- a/python/lib/cloudutils/syscfg.py +++ b/python/lib/cloudutils/syscfg.py @@ -39,11 +39,11 @@ def getAgent(glbEnv): return sysConfigAgentUbuntu(glbEnv) elif distribution == "CentOS" or distribution == "RHEL5": return sysConfigEL5(glbEnv) - elif distribution == "Fedora" or distribution == "RHEL6": + elif distribution == "RHEL6": return sysConfigEL6(glbEnv) elif distribution == "RHEL7": return sysConfigEL7(glbEnv) - elif distribution in ["RHEL8", "RHEL9"]: + elif distribution in ["Fedora", "RHEL8", "RHEL9", "RHEL10"]: return sysConfigEL(glbEnv) elif distribution == "SUSE": return sysConfigSUSE(glbEnv) @@ -183,9 +183,10 @@ def __init__(self, glbEnv): networkConfigRedhat(self), libvirtConfigRedhat(self), firewallConfigAgent(self), + nfsConfig(self), cloudAgentConfig(self)] -#it covers RHEL6/Fedora13/Fedora14 +#it covers RHEL6 class sysConfigEL6(sysConfigAgentRedhatBase): def __init__(self, glbEnv): super(sysConfigEL6, self).__init__(glbEnv) diff --git a/python/lib/cloudutils/utilities.py b/python/lib/cloudutils/utilities.py index 5b07ff1eff6f..ce50516193e6 100755 --- a/python/lib/cloudutils/utilities.py +++ b/python/lib/cloudutils/utilities.py @@ -124,6 +124,10 @@ def __init__(self): version.find("Red Hat Enterprise Linux release 9") != -1 or version.find("Linux release 9.") != -1 or version.find("Linux release 9") != -1): self.distro = "RHEL9" + elif (version.find("Red Hat Enterprise Linux Server release 10") != -1 or version.find("Scientific Linux release 10") != -1 or + version.find("Red Hat Enterprise Linux release 10") != -1 or version.find("Linux release 10.") != -1 or + version.find("Linux release 10") != -1): + self.distro = "RHEL10" elif version.find("CentOS") != -1: self.distro = "CentOS" else: