1 # Copyright (C) 2007 Google Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 from ganeti import utils
24 from qa_utils import AssertEqual, StartSSH
28 master = qa_config.GetMasterNode()
30 if node.get('_added', False):
31 raise qa_error.Error("Node %s already in cluster" % node['primary'])
33 cmd = ['gnt-node', 'add']
34 if node.get('secondary', None):
35 cmd.append('--secondary-ip=%s' % node['secondary'])
36 cmd.append(node['primary'])
37 AssertEqual(StartSSH(master['primary'],
38 utils.ShellQuoteArgs(cmd)).wait(), 0)
43 def _NodeRemove(node):
44 master = qa_config.GetMasterNode()
46 cmd = ['gnt-node', 'remove', node['primary']]
47 AssertEqual(StartSSH(master['primary'],
48 utils.ShellQuoteArgs(cmd)).wait(), 0)
49 node['_added'] = False
53 """Adding all nodes to cluster."""
54 master = qa_config.GetMasterNode()
55 for node in qa_config.get('nodes'):
60 def TestNodeRemoveAll():
61 """Removing all nodes from cluster."""
62 master = qa_config.GetMasterNode()
63 for node in qa_config.get('nodes'):
70 master = qa_config.GetMasterNode()
72 cmd = ['gnt-node', 'info']
73 AssertEqual(StartSSH(master['primary'],
74 utils.ShellQuoteArgs(cmd)).wait(), 0)
77 def TestNodeVolumes():
78 """gnt-node volumes"""
79 master = qa_config.GetMasterNode()
81 cmd = ['gnt-node', 'volumes']
82 AssertEqual(StartSSH(master['primary'],
83 utils.ShellQuoteArgs(cmd)).wait(), 0)