diff --git a/configure.ac b/configure.ac index c1bcd56bd64662ed2e7aaf2c2c64317ff0509d01..d39cfaa35e1127087b2ba90f8f774b0837f6278c 100644 --- a/configure.ac +++ b/configure.ac @@ -76,6 +76,7 @@ AC_CONFIG_FILES([ lib/Makefile man/Makefile qa/Makefile + qa/hooks/Makefile scripts/Makefile test/Makefile tools/Makefile diff --git a/qa/Makefile.am b/qa/Makefile.am index 0c4d8453f8dedbeefb2b5b7f26992c8656429329..3f080ee4897632d1b893b1cea502df53218d7407 100644 --- a/qa/Makefile.am +++ b/qa/Makefile.am @@ -1,3 +1,4 @@ +SUBDIRS = hooks EXTRA_DIST = ganeti-qa.py qa-sample.yaml \ qa_cluster.py \ qa_config.py \ diff --git a/qa/hooks/Makefile.am b/qa/hooks/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..7f0c8a355704c9c1ea4c1d340d5bd563b983f9b0 --- /dev/null +++ b/qa/hooks/Makefile.am @@ -0,0 +1,2 @@ +EXTRA_DIST = datehook.py +CLEANFILES = *.py[co] diff --git a/qa/hooks/datehook.py b/qa/hooks/datehook.py new file mode 100644 index 0000000000000000000000000000000000000000..590bc855691e466a9c9e9668e80da3b4b86da978 --- /dev/null +++ b/qa/hooks/datehook.py @@ -0,0 +1,42 @@ +# Copyright (C) 2007 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + + +"""Example QA hook. + +""" + +from ganeti import utils + +import qa_utils +import qa_config + +from qa_utils import AssertEqual, StartSSH + + +class DateHook: + def run(self, ctx): + if ctx.name == 'cluster-init' and ctx.phase == 'pre': + self._CallDate(ctx) + + def _CallDate(self, ctx): + for node in qa_config.get('nodes'): + cmd = ['date'] + AssertEqual(StartSSH(node['primary'], + utils.ShellQuoteArgs(cmd)).wait(), 0) + +hook = DateHook