def queue_txn(self, txn): # Even if we aren't started, we can queue a transaction and it will # run when we are started try: self.txns.put(txn, timeout=self.timeout) except queue.Full: raise exceptions.TimeoutException(commands=txn.commands, timeout=self.timeout)
def commit(self): self.ovsdb_connection.queue_txn(self) try: result = self.results.get(timeout=self.timeout) except Queue.Empty: raise exceptions.TimeoutException(commands=self.commands, timeout=self.timeout) if isinstance(result, idlutils.ExceptionResult): if self.log_errors: LOG.error(result.tb) if self.check_error: raise result.ex return result
def do_post_commit(self, txn): next_cfg = txn.get_increment_new_value() while not self.timeout_exceeded(): self.api.idl.run() if self.vswitchd_has_completed(next_cfg): failed = self.post_commit_failed_interfaces(txn) if failed: raise VswitchdInterfaceAddException( ifaces=", ".join(failed)) break self.ovsdb_connection.poller.timer_wait(self.time_remaining() * 1000) self.api.idl.wait(self.ovsdb_connection.poller) self.ovsdb_connection.poller.block() else: raise exceptions.TimeoutException(commands=self.commands, timeout=self.timeout)