From d0f7a47bf93fefa8ab088176d2d3699d80550c7f Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 7 May 2014 12:36:06 -0500 Subject: [PATCH] Add Remote.ensure_online() If the connection is alive, do nothing. If not, reconnect. Allow any exceptions to bubble up to the caller. This is intended to fix unhelpful 'Bad File Descriptor' errors we were seeing when VMs go down. Signed-off-by: Zack Cerza --- teuthology/orchestra/remote.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/teuthology/orchestra/remote.py b/teuthology/orchestra/remote.py index cc3d8af84e5f2..8a983b643e837 100644 --- a/teuthology/orchestra/remote.py +++ b/teuthology/orchestra/remote.py @@ -84,6 +84,10 @@ class Remote(object): return False return self.ssh.get_transport().is_active() + def ensure_online(self): + if not self.is_online: + return self.connect() + @property def system_type(self): """ -- 2.39.5