Add console_output compute feature flag
Not all hypervisors support getting serial console logs. This adds
a new compute feature flag. It skips tests that stress this call and
avoids logging console logs to debug if it is not supported.
Change-Id: Icc37e9f3497fb7bd72f359197663c71abbf16921
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 96ef11a..75ab72e 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -405,6 +405,10 @@
# password? (boolean value)
#change_password=false
+# Does the test environment support obtaining instance serial
+# console output? (boolean value)
+#console_output=true
+
# Does the test environment support resizing? (boolean value)
#resize=false
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index ee525e7..1f07703 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -348,6 +348,8 @@
lines = len(output.split('\n'))
self.assertEqual(lines, 10)
+ @testtools.skipUnless(CONF.compute_feature_enabled.console_output,
+ 'Console output not supported.')
@test.attr(type='gate')
def test_get_console_output(self):
# Positive test:Should be able to GET the console output
@@ -364,6 +366,8 @@
self.wait_for(self._get_output)
+ @testtools.skipUnless(CONF.compute_feature_enabled.console_output,
+ 'Console output not supported.')
@test.attr(type='gate')
def test_get_console_output_server_id_in_shutoff_status(self):
# Positive test:Should be able to GET the console output
diff --git a/tempest/api/compute/v3/servers/test_server_actions.py b/tempest/api/compute/v3/servers/test_server_actions.py
index 4404043..36ad3b6 100644
--- a/tempest/api/compute/v3/servers/test_server_actions.py
+++ b/tempest/api/compute/v3/servers/test_server_actions.py
@@ -339,6 +339,8 @@
lines = len(output.split('\n'))
self.assertEqual(lines, 10)
+ @testtools.skipUnless(CONF.compute_feature_enabled.console_output,
+ 'Console output not supported.')
@test.attr(type='gate')
def test_get_console_output(self):
# Positive test:Should be able to GET the console output
@@ -355,6 +357,8 @@
self.wait_for(self._get_output)
+ @testtools.skipUnless(CONF.compute_feature_enabled.console_output,
+ 'Console output not supported.')
@test.attr(type='gate')
def test_get_console_output_server_id_in_shutoff_status(self):
# Positive test:Should be able to GET the console output
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index 27c6196..7b895d6 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -66,16 +66,17 @@
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
_, resources = cls.client.list_resources(cls.stack_identifier)
except exceptions.TimeoutException as e:
- # attempt to log the server console to help with debugging
- # the cause of the server not signalling the waitcondition
- # to heat.
- resp, body = cls.client.get_resource(cls.stack_identifier,
- 'Server')
- server_id = body['physical_resource_id']
- LOG.debug('Console output for %s', server_id)
- resp, output = cls.servers_client.get_console_output(
- server_id, None)
- LOG.debug(output)
+ if CONF.compute_feature_enabled.console_output:
+ # attempt to log the server console to help with debugging
+ # the cause of the server not signalling the waitcondition
+ # to heat.
+ resp, body = cls.client.get_resource(cls.stack_identifier,
+ 'Server')
+ server_id = body['physical_resource_id']
+ LOG.debug('Console output for %s', server_id)
+ resp, output = cls.servers_client.get_console_output(
+ server_id, None)
+ LOG.debug(output)
raise e
cls.test_resources = {}
diff --git a/tempest/config.py b/tempest/config.py
index 7d195bf..9fb96cc 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -280,6 +280,10 @@
default=False,
help="Does the test environment support changing the admin "
"password?"),
+ cfg.BoolOpt('console_output',
+ default=True,
+ help="Does the test environment support obtaining instance "
+ "serial console output?"),
cfg.BoolOpt('resize',
default=False,
help="Does the test environment support resizing?"),
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 606208e..d8af83d 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -490,6 +490,9 @@
return linux_client
def _log_console_output(self, servers=None):
+ if not CONF.compute_feature_enabled.console_output:
+ LOG.debug('Console output not supported, cannot log')
+ return
if not servers:
servers = self.compute_client.servers.list()
for server in servers: