Commit 8659b73e authored by Guido Trotter's avatar Guido Trotter
Browse files

Convert LUConnectConsole to concurrency

For ConnectConsole we just need to lock the instance we're connecting
to. We make a few rpcs to its primary node, but node daemons can now
handle multiple queries and nodes cannot be removed till they have
instances on them anyway. Note that since we return the ssh command, and
that's executed outside of the ganeti daemon, without any locks held,
the instance can then be subject to operations while we're connected to
it, but that was the previous behavior as well.

Reviewed-by: iustinp
parent 43905206
......@@ -3354,6 +3354,10 @@ class LUConnectConsole(NoHooksLU):
_OP_REQP = ["instance_name"]
REQ_BGL = False
def ExpandNames(self):
def CheckPrereq(self):
"""Check prerequisites.
......@@ -3361,12 +3365,9 @@ class LUConnectConsole(NoHooksLU):
This checks that the instance is in the cluster.
instance = self.cfg.GetInstanceInfo(
if instance is None:
raise errors.OpPrereqError("Instance '%s' not known" %
self.instance = instance
self.instance = self.cfg.GetInstanceInfo(self.op.instance_name)
assert self.instance is not None, \
"Cannot retrieve locked instance %s" % self.op.instance_name
def Exec(self, feedback_fn):
"""Connect 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