Skip to content

Commit 87fdb52

Browse files
committed
CLOUDSTACK-8443: don't try to fix co-mounted cgroups
This setting works on CentOS 6 / RHEL 6 but does nothing, as "cpu" cgroup is not mounted. On CentOS 7 / RHEL 7 systemd does mount cgroups and "cpu" is co-mounted with "cpuacc". Hence, if we specify "cpu" then this results in an error because it can only use them both, or none. By removing the setting, we rely on the default of qemu, which is: cgroup_controllers = ["cpu", "devices", "memory", "blkio", "cpuacct", "net_cls"] Only if they are really mounted, they will be used. So, this will work on both version 6 and 7. The 'fix script' didn't work well, as after a reboot you'd still have qemu throwing errors. Now we can handle the co-mountedcgroups.
1 parent 6d57a86 commit 87fdb52

4 files changed

Lines changed: 0 additions & 95 deletions

File tree

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
180180
private String _ovsPvlanVmPath;
181181
private String _routerProxyPath;
182182
private String _ovsTunnelPath;
183-
private String _setupCgroupPath;
184183
private String _host;
185184
private String _dcId;
186185
private String _pod;
@@ -699,17 +698,6 @@ public boolean configure(final String name, final Map<String, Object> params) th
699698
_hypervisorType = HypervisorType.KVM;
700699
}
701700

702-
//Verify that cpu,cpuacct cgroups are not co-mounted
703-
if(HypervisorType.LXC.equals(getHypervisorType())){
704-
_setupCgroupPath = Script.findScript(kvmScriptsDir, "setup-cgroups.sh");
705-
if (_setupCgroupPath == null) {
706-
throw new ConfigurationException("Unable to find the setup-cgroups.sh");
707-
}
708-
if(!checkCgroups()){
709-
throw new ConfigurationException("cpu,cpuacct cgroups are co-mounted");
710-
}
711-
}
712-
713701
_hypervisorURI = (String)params.get("hypervisor.uri");
714702
if (_hypervisorURI == null) {
715703
_hypervisorURI = LibvirtConnection.getHypervisorURI(_hypervisorType.toString());
@@ -3332,17 +3320,6 @@ public HypervisorType getHypervisorType(){
33323320
return _hypervisorType;
33333321
}
33343322

3335-
private boolean checkCgroups(){
3336-
final Script command = new Script(_setupCgroupPath, 5 * 1000, s_logger);
3337-
String result;
3338-
result = command.execute();
3339-
if (result != null) {
3340-
s_logger.debug("cgroup check failed:" + result);
3341-
return false;
3342-
}
3343-
return true;
3344-
}
3345-
33463323
public String mapRbdDevice(final KVMPhysicalDisk disk){
33473324
final KVMStoragePool pool = disk.getPool();
33483325
//Check if rbd image is already mapped

python/lib/cloud_utils.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -685,24 +685,6 @@ def execute(self):
685685
enable_service("cgred")
686686

687687

688-
class SetupCgroupControllers(ConfigTask):
689-
name = "qemu cgroup controllers setup"
690-
cfgline = "cgroup_controllers = [ \"cpu\" ]"
691-
filename = "/etc/libvirt/qemu.conf"
692-
693-
def done(self):
694-
try:
695-
return self.cfgline in file(self.filename,"r").read(-1)
696-
except IOError,e:
697-
if e.errno is 2: raise TaskFailed("qemu has not been properly installed on this system")
698-
raise
699-
700-
def execute(self):
701-
libvirtqemu = file(self.filename,"r").read(-1)
702-
libvirtqemu = libvirtqemu + "\n" + self.cfgline + "\n"
703-
file("/etc/libvirt/qemu.conf","w").write(libvirtqemu)
704-
705-
706688
class SetupSecurityDriver(ConfigTask):
707689
name = "security driver setup"
708690
cfgline = "security_driver = \"none\""
@@ -887,7 +869,6 @@ def config_tasks(brname, pubNic, prvNic):
887869
SetupNetworking(brname, pubNic, prvNic),
888870
SetupCgConfig(),
889871
SetupCgRules(),
890-
SetupCgroupControllers(),
891872
SetupSecurityDriver(),
892873
SetupLibvirt(),
893874
SetupLiveMigration(),

python/lib/cloudutils/serviceConfig.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,6 @@ def config(self):
493493
filename = "/etc/libvirt/qemu.conf"
494494

495495
cfo = configFileOps(filename, self)
496-
cfo.addEntry("cgroup_controllers", "[\"cpu\"]")
497496
cfo.addEntry("security_driver", "\"none\"")
498497
cfo.addEntry("user", "\"root\"")
499498
cfo.addEntry("group", "\"root\"")

scripts/vm/hypervisor/kvm/setup-cgroups.sh

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)