"""gnt-instance reboot"""
master = qa_config.GetMasterNode()
- for reboottype in ["soft", "hard", "full"]:
- cmd = ['gnt-instance', 'reboot', '--type=%s' % reboottype,
- instance['name']]
+ options = qa_config.get('options', {})
+ reboot_types = options.get("reboot-types", constants.REBOOT_TYPES)
+
+ for rtype in reboot_types:
+ cmd = ['gnt-instance', 'reboot', '--type=%s' % rtype, instance['name']]
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
utils.ShellQuoteArgs(cmd)).wait(), 0)
-def TestInstanceRename(instance):
+def TestInstanceRename(instance, rename_target):
"""gnt-instance rename"""
master = qa_config.GetMasterNode()
rename_source = instance['name']
- rename_target = qa_config.get('rename', None)
- if rename_target is None:
- print qa_utils.FormatError('"rename" entry is missing')
- return
for name1, name2 in [(rename_source, rename_target),
(rename_target, rename_source)]:
utils.ShellQuoteArgs(cmd)).wait(), 0)
+def TestInstanceMigrate(instance):
+ """gnt-instance migrate"""
+ master = qa_config.GetMasterNode()
+
+ cmd = ["gnt-instance", "migrate", "--force", instance["name"]]
+ AssertEqual(StartSSH(master["primary"],
+ utils.ShellQuoteArgs(cmd)).wait(), 0)
+
+ # ... and back
+ cmd = ["gnt-instance", "migrate", "--force", instance["name"]]
+ AssertEqual(StartSSH(master["primary"],
+ utils.ShellQuoteArgs(cmd)).wait(), 0)
+
+
def TestInstanceInfo(instance):
"""gnt-instance info"""
master = qa_config.GetMasterNode()
cmd = ['gnt-instance', 'modify', '-t', 'plain', instance['name']]
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
- cmd = ['gnt-instance', 'modify', '-t', 'drbd', '-n', snode, instance['name']]
+ cmd = ['gnt-instance', 'modify', '-t', 'drbd', '-n', snode['primary'],
+ instance['name']]
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
def TestInstanceExport(instance, node):
- """gnt-backup export"""
+ """gnt-backup export -n ..."""
master = qa_config.GetMasterNode()
cmd = ['gnt-backup', 'export', '-n', node['primary'], instance['name']]
return qa_utils.ResolveInstanceName(instance)
+def TestInstanceExportWithRemove(instance, node):
+ """gnt-backup export --remove-instance"""
+ master = qa_config.GetMasterNode()
+
+ cmd = ['gnt-backup', 'export', '-n', node['primary'], "--remove-instance",
+ instance['name']]
+ AssertEqual(StartSSH(master['primary'],
+ utils.ShellQuoteArgs(cmd)).wait(), 0)
+
+
+def TestInstanceExportNoTarget(instance):
+ """gnt-backup export (without target node, should fail)"""
+ master = qa_config.GetMasterNode()
+
+ cmd = ["gnt-backup", "export", instance["name"]]
+ AssertNotEqual(StartSSH(master['primary'],
+ utils.ShellQuoteArgs(cmd)).wait(), 0)
+
+
def TestInstanceImport(node, newinst, expnode, name):
"""gnt-backup import"""
master = qa_config.GetMasterNode()
cmd = (['gnt-backup', 'import',
'--disk-template=plain',
'--no-ip-check',
+ '--net', '0:mac=generate',
'--src-node=%s' % expnode['primary'],
'--src-dir=%s/%s' % (constants.EXPORT_DIR, name),
'--node=%s' % node['primary']] +