Revision 906a0346

b/qa/qa_config.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2007, 2011, 2012 Google Inc.
4
# Copyright (C) 2007, 2011, 2012, 2013 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
218 218

  
219 219
  inst = instances[0]
220 220
  inst["_used"] = True
221
  inst["_template"] = None
221 222
  return inst
222 223

  
223 224

  
......
225 226
  inst["_used"] = False
226 227

  
227 228

  
229
def GetInstanceTemplate(inst):
230
  """Return the disk template of an instance.
231

  
232
  """
233
  templ = inst["_template"]
234
  assert templ is not None
235
  return templ
236

  
237

  
238
def SetInstanceTemplate(inst, template):
239
  """Set the disk template for an instance.
240

  
241
  """
242
  inst["_template"] = template
243

  
244

  
228 245
def AcquireNode(exclude=None):
229 246
  """Returns the least used node.
230 247

  
b/qa/qa_instance.py
75 75
    AssertCommand(cmd)
76 76

  
77 77
    _CheckSsconfInstanceList(instance["name"])
78
    qa_config.SetInstanceTemplate(instance, disk_template)
78 79

  
79 80
    return instance
80 81
  except:
......
631 632
@InstanceCheck(None, INST_DOWN, FIRST_ARG)
632 633
def TestInstanceImport(newinst, node, expnode, name):
633 634
  """gnt-backup import"""
635
  templ = constants.DT_PLAIN
634 636
  cmd = (["gnt-backup", "import",
635
          "--disk-template=plain",
637
          "--disk-template=%s" % templ,
636 638
          "--no-ip-check",
637 639
          "--src-node=%s" % expnode["primary"],
638 640
          "--src-dir=%s/%s" % (pathutils.EXPORT_DIR, name),
......
640 642
         _GetGenericAddParameters(newinst, force_mac=constants.VALUE_GENERATE))
641 643
  cmd.append(newinst["name"])
642 644
  AssertCommand(cmd)
645
  qa_config.SetInstanceTemplate(newinst, templ)
643 646

  
644 647

  
645 648
def TestBackupList(expnode):
b/qa/qa_rapi.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
4
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
551 551
def TestRapiInstanceAdd(node, use_client):
552 552
  """Test adding a new instance via RAPI"""
553 553
  instance = qa_config.AcquireInstance()
554
  qa_config.SetInstanceTemplate(instance, constants.DT_PLAIN)
554 555
  try:
555 556
    disk_sizes = [utils.ParseUnit(size) for size in qa_config.get("disk")]
556 557
    disks = [{"size": size} for size in disk_sizes]
......
751 752
  rapi_pw_file.write(_rapi_password)
752 753
  rapi_pw_file.flush()
753 754

  
755
  qa_config.SetInstanceTemplate(dest_instance,
756
                                qa_config.GetInstanceTemplate(src_instance))
757

  
754 758
  # TODO: Run some instance tests before moving back
755 759

  
756 760
  if snode is None:

Also available in: Unified diff