Revision 5d831182 qa/qa_rapi.py

b/qa/qa_rapi.py
39 39
import qa_error
40 40

  
41 41
from qa_utils import (AssertEqual, AssertNotEqual, AssertIn, AssertMatch,
42
                      StartSSH)
42
                      StartLocalCommand)
43 43

  
44 44

  
45 45
_rapi_ca = None
46 46
_rapi_client = None
47
_rapi_username = None
48
_rapi_password = None
47 49

  
48 50

  
49 51
def Setup(username, password):
......
52 54
  """
53 55
  global _rapi_ca
54 56
  global _rapi_client
57
  global _rapi_username
58
  global _rapi_password
59

  
60
  _rapi_username = username
61
  _rapi_password = password
55 62

  
56 63
  master = qa_config.GetMasterNode()
57 64

  
......
332 339
  _WaitForRapiJob(job_id)
333 340

  
334 341
  qa_config.ReleaseInstance(instance)
342

  
343

  
344
def TestInterClusterInstanceMove(src_instance, dest_instance, pnode, snode):
345
  """Test tools/move-instance"""
346
  master = qa_config.GetMasterNode()
347

  
348
  rapi_pw_file = tempfile.NamedTemporaryFile()
349
  rapi_pw_file.write(_rapi_password)
350
  rapi_pw_file.flush()
351

  
352
  # TODO: Run some instance tests before moving back
353
  for srcname, destname in [(src_instance["name"], dest_instance["name"]),
354
                            (dest_instance["name"], src_instance["name"])]:
355
    cmd = [
356
      "../tools/move-instance",
357
      "--verbose",
358
      "--src-ca-file=%s" % _rapi_ca.name,
359
      "--src-username=%s" % _rapi_username,
360
      "--src-password-file=%s" % rapi_pw_file.name,
361
      "--dest-instance-name=%s" % destname,
362
      "--dest-primary-node=%s" % pnode["primary"],
363
      "--dest-secondary-node=%s" % snode["primary"],
364

  
365
      master["primary"],
366
      master["primary"],
367
      srcname,
368
      ]
369

  
370
    AssertEqual(StartLocalCommand(cmd).wait(), 0)

Also available in: Unified diff