This is an automated email from the ASF dual-hosted git repository.
rafael pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/master by this push:
new e44fc4a add exitcode / distribution detection and remove export
CGROUP_DAEMON for RHEL7/CentOS7 (#2896)
e44fc4a is described below
commit e44fc4af68c6df56398c854121c892208733bc6e
Author: Sven Vogel <[email protected]>
AuthorDate: Wed Nov 7 21:22:20 2018 +0100
add exitcode / distribution detection and remove export CGROUP_DAEMON for
RHEL7/CentOS7 (#2896)
* task/add distribution detection, remove export CGROUP_DAEMON='cpu:/virt'
* taks/add exit values
* change exit codes
* split redhat and centos / change ubuntu to /etc/lsb-release file
* turn around centos and rhel, we need first check for centos then rhel
* set variable distro to None
---
python/lib/cloudutils/serviceConfig.py | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/python/lib/cloudutils/serviceConfig.py
b/python/lib/cloudutils/serviceConfig.py
index 2b27868..994c822 100755
--- a/python/lib/cloudutils/serviceConfig.py
+++ b/python/lib/cloudutils/serviceConfig.py
@@ -23,6 +23,32 @@ from configFileOps import configFileOps
import os
import shutil
+# exit() error constants
+Unknown = 0
+CentOS6 = 1
+CentOS7 = 2
+Ubuntu = 3
+RHEL6 = 4
+RHEL7 = 5
+distro = None
+
+#=================== DISTRIBUTION DETECTION =================
+if os.path.exists("/etc/centos-release"):
+ version = file("/etc/centos-release").readline()
+ if version.find("CentOS release 6") != -1:
+ distro = CentOS6
+ elif version.find("CentOS Linux release 7") != -1:
+ distro = CentOS7
+elif os.path.exists("/etc/redhat-release"):
+ version = file("/etc/redhat-release").readline()
+ if version.find("Red Hat Enterprise Linux Server release 6") != -1:
+ distro = RHEL6
+ elif version.find("Red Hat Enterprise Linux Server 7") != -1:
+ distro = RHEL7
+elif os.path.exists("/etc/lsb-release") and "Ubuntu" in
file("/etc/lsb-release").read(-1): distro = Ubuntu
+else: distro = Unknown
+#=================== DISTRIBUTION DETECTION =================
+
class serviceCfgBase(object):
def __init__(self, syscfg):
self.status = None
@@ -498,7 +524,8 @@ class libvirtConfigRedhat(serviceCfgBase):
configureLibvirtConfig(self.syscfg.env.secure, self)
cfo = configFileOps("/etc/sysconfig/libvirtd", self)
- cfo.addEntry("export CGROUP_DAEMON", "'cpu:/virt'")
+ if distro in (CentOS6,RHEL6):
+ cfo.addEntry("export CGROUP_DAEMON", "'cpu:/virt'")
cfo.addEntry("LIBVIRTD_ARGS", "-l")
cfo.save()