diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 438fa7d708c9c447fad597e82860dc5a760140d4..9db397bb8170a904ede35d194f254058a79a374b 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -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) diff --git a/lib/hypervisor/hv_base.py b/lib/hypervisor/hv_base.py index 68766908e742536259766f1772d267cbe6a16afe..9b9b54251f6b0b740289fee47c1beee25263e7d0 100644 --- a/lib/hypervisor/hv_base.py +++ b/lib/hypervisor/hv_base.py @@ -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. """ diff --git a/lib/hypervisor/hv_fake.py b/lib/hypervisor/hv_fake.py index 52ef62826c029008b897b54b54745fe4046bce7c..a1daf017384113258acbe0a7c904aa8932ad730b 100644 --- a/lib/hypervisor/hv_fake.py +++ b/lib/hypervisor/hv_fake.py @@ -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. """ diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index 13bc8d4ab6e5e0b730ad313d022ec613405ee058..a2a25841028a62a31470bf8b39806508662dcfd2 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -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. """ diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py index c8dd58107128074323c0e83cf5463848a3316d5a..8b66b4aa77b972901dcf32331d31b45ddde57300 100644 --- a/lib/hypervisor/hv_xen.py +++ b/lib/hypervisor/hv_xen.py @@ -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. """