Restore openstack console log
This was omitted in the statemachine refactor because there is no unit test. It is restored as best as possible in the same state as before -- with no test. This should either have a test added to bring this functionality up to current standards, or deprecated. Change-Id: I891c9ef907f697e9d08eb29c98795d98bb771e18
This commit is contained in:
parent
77e2550326
commit
e1103a3b62
@ -1001,3 +1001,11 @@ class OpenStackAdapter(statemachine.Adapter):
|
||||
key = ('nodepool.provider.%s.leaked.floatingips'
|
||||
% self.provider.name)
|
||||
self._statsd.incr(key, did_clean)
|
||||
|
||||
def getConsoleLog(self, label, external_id):
|
||||
if not label.console_log:
|
||||
return None
|
||||
try:
|
||||
return self._client.get_server_console(external_id)
|
||||
except openstack.exceptions.OpenStackCloudException:
|
||||
return None
|
||||
|
@ -340,6 +340,21 @@ class StateMachineNodeLauncher(stats.StatsReporter):
|
||||
except Exception:
|
||||
self.log.exception("Exception while reporting stats:")
|
||||
|
||||
if isinstance(e, exceptions.LaunchKeyscanException):
|
||||
try:
|
||||
label = self.handler.pool.labels[node.type[0]]
|
||||
console = self.manager.adapter.getConsoleLog(
|
||||
label, node.external_id)
|
||||
if console:
|
||||
self.log.info('Console log from external id %s:',
|
||||
node.external_id)
|
||||
for line in console.splitlines():
|
||||
self.log.info(line.rstrip())
|
||||
except NotImplementedError:
|
||||
pass
|
||||
except Exception:
|
||||
self.log.exception("Exception while logging console:")
|
||||
|
||||
if self.attempts >= self.retries:
|
||||
node.state = zk.FAILED
|
||||
return True
|
||||
@ -1234,3 +1249,12 @@ class Adapter:
|
||||
:param external_id str: The external id of the image to delete
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
# The following method is optional
|
||||
def getConsoleLog(self, label, external_id):
|
||||
"""Return the console log from the specified server
|
||||
|
||||
:param label ConfigLabel: The label config for the node
|
||||
:param external_id str: The external id of the server
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
Loading…
x
Reference in New Issue
Block a user