Internal API change for instance console access.
authorAlexander Schreiber <als@google.com>
Tue, 18 Dec 2007 14:25:31 +0000 (14:25 +0000)
committerAlexander Schreiber <als@google.com>
Tue, 18 Dec 2007 14:25:31 +0000 (14:25 +0000)
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
lib/hypervisor.py

index 37b2bb9..5cdedf6 100644 (file)
@@ -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)
index 24efa01..e2683c6 100644 (file)
@@ -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.
 
     """