from qa_utils import AssertEqual, StartSSH
-@qa_utils.DefineHook('node-add')
-def _NodeAdd(node):
+def _NodeAdd(node, readd=False):
master = qa_config.GetMasterNode()
- if node.get('_added', False):
+ if not readd and node.get('_added', False):
raise qa_error.Error("Node %s already in cluster" % node['primary'])
+ elif readd and not node.get('_added', False):
+ raise qa_error.Error("Node %s not yet in cluster" % node['primary'])
- cmd = ['gnt-node', 'add']
+ cmd = ['gnt-node', 'add', "--no-ssh-key-check"]
if node.get('secondary', None):
cmd.append('--secondary-ip=%s' % node['secondary'])
+ if readd:
+ cmd.append('--readd')
cmd.append(node['primary'])
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
node['_added'] = True
-@qa_utils.DefineHook('node-remove')
def _NodeRemove(node):
master = qa_config.GetMasterNode()
master = qa_config.GetMasterNode()
for node in qa_config.get('nodes'):
if node != master:
- _NodeAdd(node)
+ _NodeAdd(node, readd=False)
def TestNodeRemoveAll():
_NodeRemove(node)
-@qa_utils.DefineHook('node-info')
+def TestNodeReadd(node):
+ """gnt-node add --readd"""
+ _NodeAdd(node, readd=True)
+
+
def TestNodeInfo():
"""gnt-node info"""
master = qa_config.GetMasterNode()
utils.ShellQuoteArgs(cmd)).wait(), 0)
-@qa_utils.DefineHook('node-volumes')
def TestNodeVolumes():
"""gnt-node volumes"""
master = qa_config.GetMasterNode()
utils.ShellQuoteArgs(cmd)).wait(), 0)
-@qa_utils.DefineHook('node-failover')
def TestNodeFailover(node, node2):
"""gnt-node failover"""
master = qa_config.GetMasterNode()
utils.ShellQuoteArgs(cmd)).wait(), 0)
-@qa_utils.DefineHook('node-evacuate')
def TestNodeEvacuate(node, node2):
"""gnt-node evacuate"""
master = qa_config.GetMasterNode()