Commit 5431b2e4 authored by Guido Trotter's avatar Guido Trotter
Browse files

GetShellCommand: get hvparams and beparams

Sometimes the hypervisor will use the instance hv and/or be parameters
to determine the best shell command. This is not possible, though,
currently, as the instance hv/beparams are not filled, so we have to
pass the filled versions separately.

Reviewed-by: iustinp
parent e9ce0a64
......@@ -4701,7 +4701,12 @@ class LUConnectConsole(NoHooksLU):
logging.debug("Connecting to console of %s on %s", instance.name, node)
hyper = hypervisor.GetHypervisor(instance.hypervisor)
console_cmd = hyper.GetShellCommandForConsole(instance)
cluster = self.cfg.GetClusterInfo()
# beparams and hvparams are passed separately, to avoid editing the
# instance and then saving the defaults in the instance itself.
hvparams = cluster.FillHV(instance)
beparams = cluster.FillBE(instance)
console_cmd = hyper.GetShellCommandForConsole(instance, hvparams, beparams)
# build ssh cmdline
return self.ssh.BuildCmd(node, "root", console_cmd, batch=True, tty=True)
......
......@@ -85,7 +85,7 @@ class BaseHypervisor(object):
raise NotImplementedError
@classmethod
def GetShellCommandForConsole(cls, instance):
def GetShellCommandForConsole(cls, instance, hvparams, beparams):
"""Return a command for connecting to the console of an instance.
"""
......
......@@ -204,7 +204,7 @@ class FakeHypervisor(hv_base.BaseHypervisor):
return result
@classmethod
def GetShellCommandForConsole(cls, instance):
def GetShellCommandForConsole(cls, instance, hvparams, beparams):
"""Return a command for connecting to the console of an instance.
"""
......
......@@ -582,7 +582,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
return result
@classmethod
def GetShellCommandForConsole(cls, instance):
def GetShellCommandForConsole(cls, instance, hvparams, beparams):
"""Return a command for connecting to the console of an instance.
"""
......
......@@ -233,7 +233,7 @@ class XenHypervisor(hv_base.BaseHypervisor):
return result
@classmethod
def GetShellCommandForConsole(cls, instance):
def GetShellCommandForConsole(cls, instance, hvparams, beparams):
"""Return a command for connecting to the console of an instance.
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment