rafaelweingartner closed pull request #2896: add exitcode / distribution 
detection and remove export CGROUP_DAEMON for RHEL7/CentOS7
URL: https://github.com/apache/cloudstack/pull/2896
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/python/lib/cloudutils/serviceConfig.py 
b/python/lib/cloudutils/serviceConfig.py
index 2b27868db05..994c822ca01 100755
--- a/python/lib/cloudutils/serviceConfig.py
+++ b/python/lib/cloudutils/serviceConfig.py
@@ -23,6 +23,32 @@
 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 @@ def config(self):
             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()
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to