From 8c8d3f3e21999353f84edb837b7a161dda71d9b3 Mon Sep 17 00:00:00 2001 From: Dariusz Michaluk Date: Wed, 4 Mar 2015 10:26:16 +0100 Subject: [PATCH] Add timeout after zone start. [Bug/Feature] Add timeout after zone start. [Cause] N/A [Solution] N/A [Verification] Build, run server, run tests Change-Id: Ie6adace3d36ad98756d8efc823a056356f41d02d Signed-off-by: Dariusz Michaluk --- server/zone-admin.cpp | 13 +++++++++++++ server/zone-admin.hpp | 1 + 2 files changed, 14 insertions(+) diff --git a/server/zone-admin.cpp b/server/zone-admin.cpp index 519b172..8005fb4 100644 --- a/server/zone-admin.cpp +++ b/server/zone-admin.cpp @@ -35,6 +35,8 @@ #include #include +#include +#include namespace vasum { @@ -55,6 +57,7 @@ ZoneAdmin::ZoneAdmin(const std::string& zoneId, const ZoneConfig& config, const ZoneDynamicConfig& dynamicConfig) : mConfig(config), + mDynamicConfig(dynamicConfig), mZone(zonesPath, zoneId), mId(zoneId), mDetachOnExit(false), @@ -138,6 +141,16 @@ void ZoneAdmin::start() throw ZoneOperationException("Could not start zone"); } + // Wait until the full platform launch with graphical stack. + // VT should be activated by a graphical stack. + // If we do it with 'zoneToFocus.activateVT' before starting the graphical stack, + // graphical stack initialization failed and we finally switch to the black screen. + // Skip waiting when graphical stack is not running (unit tests). + if (mDynamicConfig.vt > 0) { + // TODO, timeout is a temporary solution + std::this_thread::sleep_for(std::chrono::milliseconds(4000)); + } + LOGD(mId << ": Started"); } diff --git a/server/zone-admin.hpp b/server/zone-admin.hpp index 44d2613..ade4585 100644 --- a/server/zone-admin.hpp +++ b/server/zone-admin.hpp @@ -166,6 +166,7 @@ public: private: const ZoneConfig& mConfig; + const ZoneDynamicConfig& mDynamicConfig; lxc::LxcZone mZone; const std::string mId; bool mDetachOnExit; -- 2.7.4