[autotest] Check server database before services start
Add code in scheduler, host scheduler and suite scheduler, to check if the
server has required role in server database, if use_server_db is set to True
in global config.
scheduler will also get the drone list from server database. Drone manager will
load drone attributes like max_processes from server database.
BUG=chromium:422535
CQ-DEPEND=CL:232003
TEST=setup local server database, add servers for scheduler, host scheduler and
drone. Check following conditions:
1. Disable use_server_db, make sure all services can start and run tests.
2. Enable use_server_db, make sure all services can start and run tests.
3. Add a new server to be configured as primary of scheduler, host scheduler
and suite scheduler, try to start each service in a different server.
Confirm that the service can't start.
Change-Id: I5105f6de7ed959c76ed6b920240f1ba5898bebd6
Reviewed-on: https://chromium-review.googlesource.com/232525
Reviewed-by: Dan Shi <dshi@chromium.org>
Commit-Queue: Dan Shi <dshi@chromium.org>
Trybot-Ready: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
diff --git a/cli/server.py b/cli/server.py
index eccb5b8..e0c5717 100644
--- a/cli/server.py
+++ b/cli/server.py
@@ -23,6 +23,8 @@
from autotest_lib.cli import action_common
from autotest_lib.cli import topic_common
from autotest_lib.client.common_lib import error
+# The django setup is moved here as test_that uses sqlite setup. If this line
+# is in server_manager, test_that unittest will fail.
from autotest_lib.frontend import setup_django_environment
from autotest_lib.site_utils import server_manager
from autotest_lib.site_utils import server_manager_utils