Commit 906a0346 authored by Bernardo Dal Seno's avatar Bernardo Dal Seno

QA: Added disk template to config

The disk templates used by the instances are tracked in the QA
configuration.  This will be used to selectively enable tests according to
the configuration.
Signed-off-by: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent e4c346a5
#
#
# Copyright (C) 2007, 2011, 2012 Google Inc.
# Copyright (C) 2007, 2011, 2012, 2013 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -218,6 +218,7 @@ def AcquireInstance():
inst = instances[0]
inst["_used"] = True
inst["_template"] = None
return inst
......@@ -225,6 +226,22 @@ def ReleaseInstance(inst):
inst["_used"] = False
def GetInstanceTemplate(inst):
"""Return the disk template of an instance.
"""
templ = inst["_template"]
assert templ is not None
return templ
def SetInstanceTemplate(inst, template):
"""Set the disk template for an instance.
"""
inst["_template"] = template
def AcquireNode(exclude=None):
"""Returns the least used node.
......
......@@ -75,6 +75,7 @@ def _DiskTest(node, disk_template):
AssertCommand(cmd)
_CheckSsconfInstanceList(instance["name"])
qa_config.SetInstanceTemplate(instance, disk_template)
return instance
except:
......@@ -631,8 +632,9 @@ def TestInstanceExportNoTarget(instance):
@InstanceCheck(None, INST_DOWN, FIRST_ARG)
def TestInstanceImport(newinst, node, expnode, name):
"""gnt-backup import"""
templ = constants.DT_PLAIN
cmd = (["gnt-backup", "import",
"--disk-template=plain",
"--disk-template=%s" % templ,
"--no-ip-check",
"--src-node=%s" % expnode["primary"],
"--src-dir=%s/%s" % (pathutils.EXPORT_DIR, name),
......@@ -640,6 +642,7 @@ def TestInstanceImport(newinst, node, expnode, name):
_GetGenericAddParameters(newinst, force_mac=constants.VALUE_GENERATE))
cmd.append(newinst["name"])
AssertCommand(cmd)
qa_config.SetInstanceTemplate(newinst, templ)
def TestBackupList(expnode):
......
#
#
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -551,6 +551,7 @@ def TestRapiNodeGroups():
def TestRapiInstanceAdd(node, use_client):
"""Test adding a new instance via RAPI"""
instance = qa_config.AcquireInstance()
qa_config.SetInstanceTemplate(instance, constants.DT_PLAIN)
try:
disk_sizes = [utils.ParseUnit(size) for size in qa_config.get("disk")]
disks = [{"size": size} for size in disk_sizes]
......@@ -751,6 +752,9 @@ def TestInterClusterInstanceMove(src_instance, dest_instance,
rapi_pw_file.write(_rapi_password)
rapi_pw_file.flush()
qa_config.SetInstanceTemplate(dest_instance,
qa_config.GetInstanceTemplate(src_instance))
# TODO: Run some instance tests before moving back
if snode is None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment