X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/7f69aabb65aaba2bbf1aa1468fa5b85ced93ef78..1b9c867c4fea4d40cebdc62982f5a46040cb4914:/qa/qa_instance.py diff --git a/qa/qa_instance.py b/qa/qa_instance.py index fcd54d2..b8c692e 100644 --- a/qa/qa_instance.py +++ b/qa/qa_instance.py @@ -111,9 +111,11 @@ def TestInstanceReboot(instance): """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) @@ -127,15 +129,11 @@ def TestInstanceReinstall(instance): 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)]: @@ -158,6 +156,20 @@ def TestInstanceFailover(instance): 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() @@ -215,7 +227,8 @@ def TestInstanceConvertDisk(instance, snode): 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) @@ -267,7 +280,7 @@ def TestReplaceDisks(instance, pnode, snode, othernode): def TestInstanceExport(instance, node): - """gnt-backup export""" + """gnt-backup export -n ...""" master = qa_config.GetMasterNode() cmd = ['gnt-backup', 'export', '-n', node['primary'], instance['name']] @@ -277,6 +290,25 @@ def TestInstanceExport(instance, node): 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() @@ -284,6 +316,7 @@ def TestInstanceImport(node, newinst, expnode, name): 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']] +