Statistics
| Branch: | Tag: | Revision:

root / qa / qa_monitoring.py @ 2129c5ff

History | View | Annotate | Download (1.8 kB)

1 a5877534 Michele Tartara
#
2 a5877534 Michele Tartara
#
3 a5877534 Michele Tartara
4 a5877534 Michele Tartara
# Copyright (C) 2007, 2011, 2012, 2013 Google Inc.
5 a5877534 Michele Tartara
#
6 a5877534 Michele Tartara
# This program is free software; you can redistribute it and/or modify
7 a5877534 Michele Tartara
# it under the terms of the GNU General Public License as published by
8 a5877534 Michele Tartara
# the Free Software Foundation; either version 2 of the License, or
9 a5877534 Michele Tartara
# (at your option) any later version.
10 a5877534 Michele Tartara
#
11 a5877534 Michele Tartara
# This program is distributed in the hope that it will be useful, but
12 a5877534 Michele Tartara
# WITHOUT ANY WARRANTY; without even the implied warranty of
13 a5877534 Michele Tartara
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 a5877534 Michele Tartara
# General Public License for more details.
15 a5877534 Michele Tartara
#
16 a5877534 Michele Tartara
# You should have received a copy of the GNU General Public License
17 a5877534 Michele Tartara
# along with this program; if not, write to the Free Software
18 a5877534 Michele Tartara
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 a5877534 Michele Tartara
# 02110-1301, USA.
20 a5877534 Michele Tartara
21 a5877534 Michele Tartara
22 a5877534 Michele Tartara
"""Monitoring related QA tests.
23 a5877534 Michele Tartara

24 a5877534 Michele Tartara
"""
25 a5877534 Michele Tartara
26 b8669a69 Jose A. Lopes
from ganeti import _constants
27 0511ce91 Michele Tartara
from ganeti import constants
28 a5877534 Michele Tartara
29 a5877534 Michele Tartara
import qa_config
30 a5877534 Michele Tartara
31 a5877534 Michele Tartara
from qa_utils import AssertCommand
32 a5877534 Michele Tartara
from qa_instance_utils import CreateInstanceByDiskTemplate, \
33 a5877534 Michele Tartara
                              RemoveInstance
34 a5877534 Michele Tartara
35 b8669a69 Jose A. Lopes
MON_COLLECTOR = _constants.PKGLIBDIR + "/mon-collector"
36 a5877534 Michele Tartara
37 a5877534 Michele Tartara
38 a5877534 Michele Tartara
def TestInstStatusCollector():
39 a5877534 Michele Tartara
  """Test the Xen instance status collector.
40 a5877534 Michele Tartara

41 a5877534 Michele Tartara
  """
42 0511ce91 Michele Tartara
  enabled_hypervisors = qa_config.GetEnabledHypervisors()
43 2c4f480d Thomas Thrainer
44 0511ce91 Michele Tartara
  is_xen = (constants.HT_XEN_PVM in enabled_hypervisors or
45 0511ce91 Michele Tartara
            constants.HT_XEN_HVM in enabled_hypervisors)
46 2c4f480d Thomas Thrainer
  if not is_xen:
47 2c4f480d Thomas Thrainer
    return
48 0511ce91 Michele Tartara
49 a5877534 Michele Tartara
  # Execute on master on an empty cluster
50 2c4f480d Thomas Thrainer
  AssertCommand([MON_COLLECTOR, "inst-status-xen"])
51 a5877534 Michele Tartara
52 a5877534 Michele Tartara
  #Execute on cluster with instances
53 a5877534 Michele Tartara
  node1 = qa_config.AcquireNode()
54 a5877534 Michele Tartara
  node2 = qa_config.AcquireNode()
55 a5877534 Michele Tartara
  template = qa_config.GetDefaultDiskTemplate()
56 a5877534 Michele Tartara
57 a5877534 Michele Tartara
  instance = CreateInstanceByDiskTemplate([node1, node2], template)
58 2c4f480d Thomas Thrainer
  AssertCommand([MON_COLLECTOR, "inst-status-xen"], node=node1)
59 2c4f480d Thomas Thrainer
  AssertCommand([MON_COLLECTOR, "inst-status-xen"], node=node2)
60 a5877534 Michele Tartara
  RemoveInstance(instance)
61 a5877534 Michele Tartara
62 a5877534 Michele Tartara
  node1.Release()
63 a5877534 Michele Tartara
  node2.Release()