[AIM] Improve validation output

Validation now catches any exception that leaks from driver validation
methods, reports the error, and exits indicating failure.

Binding of ports during validation is more verbose, indicating which
ports its attempting to bind and how many failed. Failure to bind any
ports now results in a "failed binding ports" rather than "failed
unrepairable" result, along with additonal information on how to
proceed.

Change-Id: I85a180d2a06d7f4442c47424a1c02bc307d1fc0e
This commit is contained in:
Robert Kukura
2018-11-29 11:52:59 -05:00
parent 408a443a9b
commit 67e3b7ce3d
4 changed files with 29 additions and 3 deletions

View File

@@ -122,6 +122,9 @@ class ValidationManager(object):
raise RollbackTransaction()
except RollbackTransaction:
pass
except Exception as exc:
self.output("Validation failed with exception: %s" % exc)
return api.VALIDATION_FAILED_UNREPAIRABLE
# Bind unbound ports outside transaction.
if (self.repair and
@@ -225,6 +228,10 @@ class ValidationManager(object):
self.output("Failed UNREPAIRABLE due to %s" % reason)
self.result = api.VALIDATION_FAILED_UNREPAIRABLE
def bind_ports_failed(self, message):
self.output(message)
self.result = api.VALIDATION_FAILED_BINDING_PORTS
def _validate_aim_resources(self):
for resource_class in self._expected_aim_resources.keys():
self._validate_aim_resource_class(resource_class)

View File

@@ -22,6 +22,7 @@ VALIDATION_PASSED = "passed"
VALIDATION_REPAIRED = "repaired"
VALIDATION_FAILED_REPAIRABLE = "failed repairable"
VALIDATION_FAILED_UNREPAIRABLE = "failed unrepairable"
VALIDATION_FAILED_BINDING_PORTS = "failed binding ports"
@six.add_metaclass(abc.ABCMeta)