From 5431b2e45a31239ed3190503a872d5cedc8f58a4 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Thu, 29 Jan 2009 15:47:06 +0000 Subject: [PATCH] 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 --- lib/cmdlib.py | 7 ++++++- lib/hypervisor/hv_base.py | 2 +- lib/hypervisor/hv_fake.py | 2 +- lib/hypervisor/hv_kvm.py | 2 +- lib/hypervisor/hv_xen.py | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 438fa7d70..9db397bb8 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 68766908e..9b9b54251 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 52ef62826..a1daf0173 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 13bc8d4ab..a2a258410 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 c8dd58107..8b66b4aa7 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. """ -- GitLab