[Bug/Feature] Waiting for a dbus connection could take a long time.
[Cause] The container was CPU throttled immediately after its
start, this made it boot very slowly.
[Solution] Throttle the container after the dbus connection is made.
[Verification] Built, installed and run tests.
Change-Id: I9d69981bfd14820f71f1053a498b37b47a5bcfb1
Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@partner.samsung.com>
}
LOGD(mId << ": Started");
- // TODO: the container should be started in the background,
- // unfortunately libvirt doesn't allow us to set cgroups
- // before the start, hence we do it immediately afterwards
- LOGD(mId << ": Sending to the background");
- setSchedulerLevel(SchedulerLevel::BACKGROUND);
}
mConnection.initialize(mConfig.runMountPoint);
mAdmin->start();
mConnection.connect();
+
+ // Send to the background only after we're connected,
+ // otherwise it'd take ages.
+ LOGD(getId() << ": Sending to the background");
+ goBackground();
}
void Container::stop()
ContainerAdmin ca(config);
BOOST_REQUIRE_NO_THROW(ca.start());
ensureStarted();
- BOOST_REQUIRE(ca.getSchedulerQuota() == config.cpuQuotaBackground);
BOOST_REQUIRE_NO_THROW(ca.setSchedulerLevel(SchedulerLevel::FOREGROUND));
BOOST_REQUIRE(ca.getSchedulerQuota() == config.cpuQuotaForeground);
BOOST_REQUIRE_NO_THROW(ca.setSchedulerLevel(SchedulerLevel::BACKGROUND));