From 30989e699ee1ae370e537be1f7a0103276add5ba Mon Sep 17 00:00:00 2001
From: Alexander Schreiber <als@google.com>
Date: Tue, 18 Dec 2007 14:25:31 +0000
Subject: [PATCH] Internal API change for instance console access.

Change the internal hypervisor API for GetShellCommandForConsole, we
now call it with the instance instead of just the instance name.

This is a prep patch for HVM, since HVM needs more than just the instance
name to determine a way of console access.

(this is a resend due to mail adress tyop)

Reviewed-by: iustinp
---
 lib/cmdlib.py     | 2 +-
 lib/hypervisor.py | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 37b2bb968..5cdedf631 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -3143,7 +3143,7 @@ class LUConnectConsole(NoHooksLU):
     logger.Debug("connecting to console of %s on %s" % (instance.name, node))
 
     hyper = hypervisor.GetHypervisor()
-    console_cmd = hyper.GetShellCommandForConsole(instance.name)
+    console_cmd = hyper.GetShellCommandForConsole(instance)
     # build ssh cmdline
     argv = ["ssh", "-q", "-t"]
     argv.extend(ssh.KNOWN_HOSTS_OPTS)
diff --git a/lib/hypervisor.py b/lib/hypervisor.py
index 24efa0163..e2683c67d 100644
--- a/lib/hypervisor.py
+++ b/lib/hypervisor.py
@@ -110,7 +110,7 @@ class BaseHypervisor(object):
     raise NotImplementedError
 
   @staticmethod
-  def GetShellCommandForConsole(instance_name):
+  def GetShellCommandForConsole(instance):
     """Return a command for connecting to the console of an instance.
 
     """
@@ -320,11 +320,11 @@ class XenHypervisor(BaseHypervisor):
     return result
 
   @staticmethod
-  def GetShellCommandForConsole(instance_name):
+  def GetShellCommandForConsole(instance):
     """Return a command for connecting to the console of an instance.
 
     """
-    return "xm console %s" % instance_name
+    return "xm console %s" % instance.name
 
 
   def Verify(self):
@@ -496,7 +496,7 @@ class FakeHypervisor(BaseHypervisor):
     return result
 
   @staticmethod
-  def GetShellCommandForConsole(instance_name):
+  def GetShellCommandForConsole(instance):
     """Return a command for connecting to the console of an instance.
 
     """
-- 
GitLab