From 46f9a94845d9660b72c752c42b7506632eab49d9 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Mon, 1 Nov 2010 13:59:47 +0100
Subject: [PATCH] Change qa_utils.ResolveInstanceName to take name
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

… instead of an object. Allows it to be used in places where
only the name is available.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 qa/qa_daemon.py   | 4 ++--
 qa/qa_instance.py | 4 ++--
 qa/qa_utils.py    | 5 ++++-
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/qa/qa_daemon.py b/qa/qa_daemon.py
index dd7fadbbb..a092803dd 100644
--- a/qa/qa_daemon.py
+++ b/qa/qa_daemon.py
@@ -131,7 +131,7 @@ def TestInstanceAutomaticRestart(node, instance):
 
   """
   master = qa_config.GetMasterNode()
-  inst_name = qa_utils.ResolveInstanceName(instance)
+  inst_name = qa_utils.ResolveInstanceName(instance["name"])
 
   _ResetWatcherDaemon()
   _XmShutdownInstance(node, inst_name)
@@ -152,7 +152,7 @@ def TestInstanceConsecutiveFailures(node, instance):
 
   """
   master = qa_config.GetMasterNode()
-  inst_name = qa_utils.ResolveInstanceName(instance)
+  inst_name = qa_utils.ResolveInstanceName(instance["name"])
 
   _ResetWatcherDaemon()
 
diff --git a/qa/qa_instance.py b/qa/qa_instance.py
index b8c692e9a..dcd537ffa 100644
--- a/qa/qa_instance.py
+++ b/qa/qa_instance.py
@@ -287,7 +287,7 @@ def TestInstanceExport(instance, node):
   AssertEqual(StartSSH(master['primary'],
                        utils.ShellQuoteArgs(cmd)).wait(), 0)
 
-  return qa_utils.ResolveInstanceName(instance)
+  return qa_utils.ResolveInstanceName(instance["name"])
 
 
 def TestInstanceExportWithRemove(instance, node):
@@ -340,7 +340,7 @@ def _TestInstanceDiskFailure(instance, node, node2, onmaster):
   master = qa_config.GetMasterNode()
   sq = utils.ShellQuoteArgs
 
-  instance_full = qa_utils.ResolveInstanceName(instance)
+  instance_full = qa_utils.ResolveInstanceName(instance["name"])
   node_full = qa_utils.ResolveNodeName(node)
   node2_full = qa_utils.ResolveNodeName(node2)
 
diff --git a/qa/qa_utils.py b/qa/qa_utils.py
index afcc19101..de487947f 100644
--- a/qa/qa_utils.py
+++ b/qa/qa_utils.py
@@ -209,8 +209,11 @@ def _ResolveName(cmd, key):
 def ResolveInstanceName(instance):
   """Gets the full name of an instance.
 
+  @type instance: string
+  @param instance: Instance name
+
   """
-  return _ResolveName(['gnt-instance', 'info', instance['name']],
+  return _ResolveName(['gnt-instance', 'info', instance],
                       'Instance name')
 
 
-- 
GitLab