Reset 'Verifying' notifications on verifier start.

If the stacktach verifier crashes, notifications
'in-flight' can be stuck in 'verifying' status'.

This change flips those back to 'pending' so they get
processed.

Change-Id: Ie4aabed0c4991429a3e18e3b28813917d822867a
This commit is contained in:
Monsyne Dragon 2016-03-07 18:05:00 +00:00
parent 5ac182ac4e
commit 0c8ee8fc40
2 changed files with 14 additions and 0 deletions

View File

@ -166,6 +166,7 @@ class Verifier(object):
def run(self): def run(self):
logger = _get_child_logger() logger = _get_child_logger()
self.run_startup()
if self.enable_notifications: if self.enable_notifications:
exchange_name = self.exchange() exchange_name = self.exchange()
exchange = message_service.create_exchange( exchange = message_service.create_exchange(
@ -219,6 +220,9 @@ class Verifier(object):
self._run() self._run()
return False return False
def run_startup(self):
pass
def verify_for_range(self, ending_max, callback=None): def verify_for_range(self, ending_max, callback=None):
pass pass

View File

@ -356,6 +356,16 @@ class NovaVerifier(base_verifier.Verifier):
models.InstanceExists.VERIFYING) models.InstanceExists.VERIFYING)
return count+sent_unverified_count return count+sent_unverified_count
def run_startup(self):
logger = _get_child_logger()
exists = models.InstanceExists.find(
ending_max=self._utcnow(), status=models.InstanceExists.VERIFYING)
count = exists.count()
if count > 0:
msg = "nova: Cleaning up %s exists stuck in VERIFYING status..." % count
logger.info(msg)
exists.update(status=models.InstanceExists.PENDING)
def reconcile_failed(self): def reconcile_failed(self):
for failed_exist in self.failed: for failed_exist in self.failed:
self.reconciler.failed_validation(failed_exist) self.reconciler.failed_validation(failed_exist)