mirror of https://github.com/apache/cloudstack.git
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
This commit is contained in:
parent
f18326880b
commit
e44fc4af68
|
|
@ -23,6 +23,32 @@ from configFileOps import configFileOps
|
||||||
import os
|
import os
|
||||||
import shutil
|
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):
|
class serviceCfgBase(object):
|
||||||
def __init__(self, syscfg):
|
def __init__(self, syscfg):
|
||||||
self.status = None
|
self.status = None
|
||||||
|
|
@ -498,7 +524,8 @@ class libvirtConfigRedhat(serviceCfgBase):
|
||||||
configureLibvirtConfig(self.syscfg.env.secure, self)
|
configureLibvirtConfig(self.syscfg.env.secure, self)
|
||||||
|
|
||||||
cfo = configFileOps("/etc/sysconfig/libvirtd", 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.addEntry("LIBVIRTD_ARGS", "-l")
|
||||||
cfo.save()
|
cfo.save()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue