From: Zack Cerza Date: Wed, 24 Aug 2016 17:57:40 +0000 (-0600) Subject: Use read-only conserver sessions when appropriate X-Git-Tag: 1.1.0~537^2~6 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=8877a3ce4a402ac113f3c53982923ee87bb0eb03;p=teuthology.git Use read-only conserver sessions when appropriate Signed-off-by: Zack Cerza --- diff --git a/teuthology/orchestra/console.py b/teuthology/orchestra/console.py index 65dca8cdde..0c02f048d7 100644 --- a/teuthology/orchestra/console.py +++ b/teuthology/orchestra/console.py @@ -65,16 +65,17 @@ class PhysicalConsole(): logfile=self.logfile, ) - def _get_console(self): - cmd = self._console_command() + def _get_console(self, readonly=True): + cmd = self._console_command(readonly=readonly) child = self._pexpect_spawn(cmd) return child - def _console_command(self): + def _console_command(self, readonly=True): if self.has_conserver: - return 'console -M {master} -p {port} {host}'.format( + return 'console -M {master} -p {port} {ro}{host}'.format( master=self.conserver_master, port=self.conserver_port, + ro='-s ' if readonly else '', host=self.shortname, ) else: @@ -127,7 +128,7 @@ class PhysicalConsole(): for i in range(0, attempts): start = time.time() while time.time() - start < t: - child = self._get_console() + child = self._get_console(readonly=False) child.send('\n') log.debug('expect: {s} login'.format(s=self.shortname)) r = child.expect( diff --git a/teuthology/orchestra/test/test_console.py b/teuthology/orchestra/test/test_console.py index 78d23b0981..b182e605da 100644 --- a/teuthology/orchestra/test/test_console.py +++ b/teuthology/orchestra/test/test_console.py @@ -12,7 +12,7 @@ class TestConsole(object): class TestPhysicalConsole(TestConsole): klass = console.PhysicalConsole ipmi_cmd_templ = 'ipmitool -H {h}.{d} -I lanplus -U {u} -P {p} {c}' - conserver_cmd_templ = 'console -M {m} -p {p} {h}' + conserver_cmd_templ = 'console -M {m} -p {p} {ro}{h}' def setup(self): self.hostname = 'host' @@ -34,6 +34,14 @@ class TestPhysicalConsole(TestConsole): assert console_cmd == self.conserver_cmd_templ.format( m=teuth_config.conserver_master, p=teuth_config.conserver_port, + ro='-s ', + h=self.hostname, + ) + console_cmd = cons._console_command(readonly=False) + assert console_cmd == self.conserver_cmd_templ.format( + m=teuth_config.conserver_master, + p=teuth_config.conserver_port, + ro='', h=self.hostname, )