X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/7910e7a55004a75a909de7dd9a1b657ab09a6875..cd098c41522469e462efeb1e157a8718ff7b7809:/qa/qa_instance.py?ds=sidebyside diff --git a/qa/qa_instance.py b/qa/qa_instance.py index e9ea788..af3afeb 100644 --- a/qa/qa_instance.py +++ b/qa/qa_instance.py @@ -41,9 +41,10 @@ def _GetDiskStatePath(disk): def _GetGenericAddParameters(): - return ['--os-size=%s' % qa_config.get('os-size'), - '--swap-size=%s' % qa_config.get('swap-size'), - '--memory=%s' % qa_config.get('mem')] + params = ['-B', '%s=%s' % (constants.BE_MEMORY, qa_config.get('mem'))] + for idx, size in enumerate(qa_config.get('disk')): + params.extend(["--disk", "%s:size=%s" % (idx, size)]) + return params def _DiskTest(node, disk_template): @@ -66,20 +67,17 @@ def _DiskTest(node, disk_template): raise -@qa_utils.DefineHook('instance-add-plain-disk') def TestInstanceAddWithPlainDisk(node): """gnt-instance add -t plain""" return _DiskTest(node['primary'], 'plain') -@qa_utils.DefineHook('instance-add-drbd-disk') def TestInstanceAddWithDrbdDisk(node, node2): """gnt-instance add -t drbd""" return _DiskTest("%s:%s" % (node['primary'], node2['primary']), 'drbd') -@qa_utils.DefineHook('instance-remove') def TestInstanceRemove(instance): """gnt-instance remove""" master = qa_config.GetMasterNode() @@ -91,7 +89,6 @@ def TestInstanceRemove(instance): qa_config.ReleaseInstance(instance) -@qa_utils.DefineHook('instance-startup') def TestInstanceStartup(instance): """gnt-instance startup""" master = qa_config.GetMasterNode() @@ -101,7 +98,6 @@ def TestInstanceStartup(instance): utils.ShellQuoteArgs(cmd)).wait(), 0) -@qa_utils.DefineHook('instance-shutdown') def TestInstanceShutdown(instance): """gnt-instance shutdown""" master = qa_config.GetMasterNode() @@ -111,7 +107,17 @@ def TestInstanceShutdown(instance): utils.ShellQuoteArgs(cmd)).wait(), 0) -@qa_utils.DefineHook('instance-reinstall') +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']] + AssertEqual(StartSSH(master['primary'], + utils.ShellQuoteArgs(cmd)).wait(), 0) + + def TestInstanceReinstall(instance): """gnt-instance reinstall""" master = qa_config.GetMasterNode() @@ -121,7 +127,6 @@ def TestInstanceReinstall(instance): utils.ShellQuoteArgs(cmd)).wait(), 0) -@qa_utils.DefineHook('instance-failover') def TestInstanceFailover(instance): """gnt-instance failover""" master = qa_config.GetMasterNode() @@ -130,8 +135,12 @@ def TestInstanceFailover(instance): AssertEqual(StartSSH(master['primary'], utils.ShellQuoteArgs(cmd)).wait(), 0) + # ... and back + cmd = ['gnt-instance', 'failover', '--force', instance['name']] + AssertEqual(StartSSH(master['primary'], + utils.ShellQuoteArgs(cmd)).wait(), 0) + -@qa_utils.DefineHook('instance-info') def TestInstanceInfo(instance): """gnt-instance info""" master = qa_config.GetMasterNode() @@ -141,27 +150,36 @@ def TestInstanceInfo(instance): utils.ShellQuoteArgs(cmd)).wait(), 0) -@qa_utils.DefineHook('instance-modify') def TestInstanceModify(instance): """gnt-instance modify""" master = qa_config.GetMasterNode() + # Assume /sbin/init exists on all systems + test_kernel = "/sbin/init" + test_initrd = test_kernel + orig_memory = qa_config.get('mem') orig_bridge = qa_config.get('bridge', 'xen-br0') args = [ - ["--memory", "128"], - ["--memory", str(orig_memory)], - ["--cpu", "2"], - ["--cpu", "1"], - ["--bridge", "xen-br1"], - ["--bridge", orig_bridge], - ["--kernel", "/dev/null"], - ["--kernel", "default"], - ["--initrd", "/dev/null"], - ["--initrd", "none"], - ["--initrd", "default"], - ["--hvm-boot-order", "acn"], - ["--hvm-boot-order", "default"], + ["-B", "%s=128" % constants.BE_MEMORY], + ["-B", "%s=%s" % (constants.BE_MEMORY, orig_memory)], + ["-B", "%s=2" % constants.BE_VCPUS], + ["-B", "%s=1" % constants.BE_VCPUS], + ["-B", "%s=%s" % (constants.BE_VCPUS, constants.VALUE_DEFAULT)], + + ["-H", "%s=%s" % (constants.HV_KERNEL_PATH, test_kernel)], + ["-H", "%s=%s" % (constants.HV_KERNEL_PATH, constants.VALUE_DEFAULT)], + ["-H", "%s=%s" % (constants.HV_INITRD_PATH, test_initrd)], + ["-H", "no_%s" % (constants.HV_INITRD_PATH, )], + ["-H", "%s=%s" % (constants.HV_INITRD_PATH, constants.VALUE_DEFAULT)], + + # TODO: bridge tests + #["--bridge", "xen-br1"], + #["--bridge", orig_bridge], + + # TODO: Do these tests only with xen-hvm + #["-H", "%s=acn" % constants.HV_BOOT_ORDER], + #["-H", "%s=%s" % (constants.HV_BOOT_ORDER, constants.VALUE_DEFAULT)], ] for alist in args: cmd = ['gnt-instance', 'modify'] + alist + [instance['name']] @@ -174,7 +192,6 @@ def TestInstanceModify(instance): utils.ShellQuoteArgs(cmd)).wait(), 0) -@qa_utils.DefineHook('instance-list') def TestInstanceList(): """gnt-instance list""" master = qa_config.GetMasterNode() @@ -184,7 +201,6 @@ def TestInstanceList(): utils.ShellQuoteArgs(cmd)).wait(), 0) -@qa_utils.DefineHook('instance-console') def TestInstanceConsole(instance): """gnt-instance console""" master = qa_config.GetMasterNode() @@ -194,7 +210,6 @@ def TestInstanceConsole(instance): utils.ShellQuoteArgs(cmd)).wait(), 0) -@qa_utils.DefineHook('instance-replace-disks') def TestReplaceDisks(instance, pnode, snode, othernode): """gnt-instance replace-disks""" master = qa_config.GetMasterNode() @@ -223,7 +238,6 @@ def TestReplaceDisks(instance, pnode, snode, othernode): utils.ShellQuoteArgs(cmd)).wait(), 0) -@qa_utils.DefineHook('backup-export') def TestInstanceExport(instance, node): """gnt-backup export""" master = qa_config.GetMasterNode() @@ -235,7 +249,6 @@ def TestInstanceExport(instance, node): return qa_utils.ResolveInstanceName(instance) -@qa_utils.DefineHook('backup-import') def TestInstanceImport(node, newinst, expnode, name): """gnt-backup import""" master = qa_config.GetMasterNode() @@ -252,7 +265,6 @@ def TestInstanceImport(node, newinst, expnode, name): utils.ShellQuoteArgs(cmd)).wait(), 0) -@qa_utils.DefineHook('backup-list') def TestBackupList(expnode): """gnt-backup list""" master = qa_config.GetMasterNode()