diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index 5c5023fa5333283193e3103313625cdcc644393d..851937cfaf0ef25b942264ec11c09e650465a267 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -105,6 +105,10 @@ def SetupCluster(rapi_user, rapi_secret): else: # consider the nodes are already there qa_node.MarkNodeAddedAll() + + # enable the watcher (unconditionally) + RunTest(qa_daemon.TestResumeWatcher) + if qa_config.TestEnabled('node-info'): RunTest(qa_node.TestNodeInfo) @@ -274,8 +278,8 @@ def RunDaemonTests(instance, pnode): consecutive_failures = \ qa_config.TestEnabled('instance-consecutive-failures') + RunTest(qa_daemon.TestPauseWatcher) if automatic_restart or consecutive_failures: - qa_daemon.PrintCronWarning() if automatic_restart: RunTest(qa_daemon.TestInstanceAutomaticRestart, pnode, instance) @@ -283,6 +287,8 @@ def RunDaemonTests(instance, pnode): if consecutive_failures: RunTest(qa_daemon.TestInstanceConsecutiveFailures, pnode, instance) + RunTest(qa_daemon.TestResumeWatcher) + def RunHardwareFailureTests(instance, pnode, snode): """Test cluster internal hardware failure recovery. @@ -349,7 +355,7 @@ def main(): SetupCluster(rapi_user, rapi_secret) # Load RAPI certificate - qa_rapi.Setup(rapi_user, rapi_secret) + #qa_rapi.Setup(rapi_user, rapi_secret) RunClusterTests() RunOsTests() diff --git a/qa/qa_daemon.py b/qa/qa_daemon.py index 4817bfef078a877885a5cd25fbb168f006966a9b..dd7fadbbba0866a5ddc6538a3e3c8adf3330da1c 100644 --- a/qa/qa_daemon.py +++ b/qa/qa_daemon.py @@ -1,7 +1,7 @@ # # -# Copyright (C) 2007 Google Inc. +# Copyright (C) 2007, 2008, 2009, 2010 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ import qa_config import qa_utils import qa_error -from qa_utils import AssertEqual, StartSSH +from qa_utils import AssertEqual, AssertMatch, StartSSH, GetCommandOutput def _InstanceRunning(node, name): @@ -89,19 +89,41 @@ def _RunWatcherDaemon(): """ master = qa_config.GetMasterNode() - cmd = ['ganeti-watcher', '-d'] - AssertEqual(StartSSH(master['primary'], + cmd = ["ganeti-watcher", "-d", "--ignore-pause"] + AssertEqual(StartSSH(master["primary"], utils.ShellQuoteArgs(cmd)).wait(), 0) -def PrintCronWarning(): - """Shows a warning about the cron job. +def TestPauseWatcher(): + """Tests and pauses the watcher. """ - msg = ("For the following tests it's recommended to turn off the" - " ganeti-watcher cronjob.") - print - print qa_utils.FormatWarning(msg) + master = qa_config.GetMasterNode() + + cmd = ["gnt-cluster", "watcher", "pause", "4h"] + AssertEqual(StartSSH(master["primary"], + utils.ShellQuoteArgs(cmd)).wait(), 0) + + cmd = ["gnt-cluster", "watcher", "info"] + output = GetCommandOutput(master["primary"], + utils.ShellQuoteArgs(cmd)) + AssertMatch(output, r"^.*\bis paused\b.*") + + +def TestResumeWatcher(): + """Tests and unpauses the watcher. + + """ + master = qa_config.GetMasterNode() + + cmd = ["gnt-cluster", "watcher", "continue"] + AssertEqual(StartSSH(master["primary"], + utils.ShellQuoteArgs(cmd)).wait(), 0) + + cmd = ["gnt-cluster", "watcher", "info"] + output = GetCommandOutput(master["primary"], + utils.ShellQuoteArgs(cmd)) + AssertMatch(output, r"^.*\bis not paused\b.*") def TestInstanceAutomaticRestart(node, instance):