Get console output for server before removing it
There are a lot of places where console logs for server will be
helpful. Collect console for all servers we going to delete in
debug mode.
Related-Prod: PRODX-3456
Change-Id: I0a3acc9d7263892f40465f9301764f5c84d4ba81
(cherry picked from commit 3577021a509c185e7b43f11a7d7b4ba65891827f)
diff --git a/tempest/lib/services/compute/servers_client.py b/tempest/lib/services/compute/servers_client.py
index 7e3b99f..58008aa 100644
--- a/tempest/lib/services/compute/servers_client.py
+++ b/tempest/lib/services/compute/servers_client.py
@@ -18,6 +18,7 @@
import copy
from urllib import parse as urllib
+from oslo_log import log as logging
from oslo_serialization import jsonutils as json
from tempest.lib.api_schema.response.compute.v2_1 import \
@@ -48,6 +49,9 @@
from tempest.lib.services.compute import base_compute_client
+LOG = logging.getLogger(__name__)
+
+
class ServersClient(base_compute_client.BaseComputeClient):
"""Service client for the resource /servers"""
@@ -167,6 +171,12 @@
API reference:
https://docs.openstack.org/api-ref/compute/#delete-server
"""
+ try:
+ console_out = self.get_console_output(server_id)
+ LOG.debug("Console log for server %s: %s", server_id, console_out)
+ except Exception as e:
+ LOG.debug("Failed to get console log for server %s: %s",
+ server_id, str(e))
resp, body = self.delete("servers/%s" % server_id)
self.validate_response(schema.delete_server, resp, body)
return rest_client.ResponseBody(resp, body)
@@ -730,6 +740,12 @@
API reference:
https://docs.openstack.org/api-ref/compute/#force-delete-server-forcedelete-action
"""
+ try:
+ console_out = self.get_console_output(server_id)
+ LOG.debug("Console log for server %s: %s", server_id, console_out)
+ except Exception as e:
+ LOG.debug("Failed to get console log for server %s: %s",
+ server_id, str(e))
return self.action(server_id, 'forceDelete', **kwargs)
def restore_soft_deleted_server(self, server_id, **kwargs):