GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — add exitcode / distribution detection and remove export CGROUP_DAEMON… · DIMSI-IS/cloudstack@e44fc4a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • python/lib/cloudutils
    • serviceConfig.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎python/lib/cloudutils/serviceConfig.py‎

Copy file name to clipboardExpand all lines: python/lib/cloudutils/serviceConfig.py
+28-1Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,32 @@
2323
import os
2424
import shutil
2525

26+
# exit() error constants
27+
Unknown = 0
28+
CentOS6 = 1
29+
CentOS7 = 2
30+
Ubuntu = 3
31+
RHEL6 = 4
32+
RHEL7 = 5
33+
distro = None
34+
35+
#=================== DISTRIBUTION DETECTION =================
36+
if os.path.exists("/etc/centos-release"):
37+
version = file("/etc/centos-release").readline()
38+
if version.find("CentOS release 6") != -1:
39+
distro = CentOS6
40+
elif version.find("CentOS Linux release 7") != -1:
41+
distro = CentOS7
42+
elif os.path.exists("/etc/redhat-release"):
43+
version = file("/etc/redhat-release").readline()
44+
if version.find("Red Hat Enterprise Linux Server release 6") != -1:
45+
distro = RHEL6
46+
elif version.find("Red Hat Enterprise Linux Server 7") != -1:
47+
distro = RHEL7
48+
elif os.path.exists("/etc/lsb-release") and "Ubuntu" in file("/etc/lsb-release").read(-1): distro = Ubuntu
49+
else: distro = Unknown
50+
#=================== DISTRIBUTION DETECTION =================
51+
2652
class serviceCfgBase(object):
2753
def __init__(self, syscfg):
2854
self.status = None
@@ -498,7 +524,8 @@ def config(self):
498524
configureLibvirtConfig(self.syscfg.env.secure, self)
499525

500526
cfo = configFileOps("/etc/sysconfig/libvirtd", self)
501-
cfo.addEntry("export CGROUP_DAEMON", "'cpu:/virt'")
527+
if distro in (CentOS6,RHEL6):
528+
cfo.addEntry("export CGROUP_DAEMON", "'cpu:/virt'")
502529
cfo.addEntry("LIBVIRTD_ARGS", "-l")
503530
cfo.save()
504531

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.