]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Use read-only conserver sessions when appropriate
authorZack Cerza <zack@redhat.com>
Wed, 24 Aug 2016 17:57:40 +0000 (11:57 -0600)
committerZack Cerza <zack@redhat.com>
Wed, 31 Aug 2016 21:18:57 +0000 (15:18 -0600)
Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/orchestra/console.py
teuthology/orchestra/test/test_console.py

index 65dca8cdde64229e44949a905c74d1241a6eb9fd..0c02f048d70dc7bcf61ad21aedfbf4a37fcf02da 100644 (file)
@@ -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(
index 78d23b09818be992136df954a01af996ac17a9c6..b182e605dabc64a2814e2e8e67eb8424a0207bb1 100644 (file)
@@ -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,
         )