diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 37b2bb96821d2c80b40d18f96e94997770fe8654..5cdedf6311c12f6206ef3545ac1d3ffc28e3dae9 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 24efa016300cff93ad6092ed3bc55fc6bb598d27..e2683c67d4d7620c572a7393468cb792c8df9aa4 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.
 
     """