Commit 98eb9f62 authored by Vincent Pelletier's avatar Vincent Pelletier

Simplify code in storage node app.run method.

Also, make logging done when catching OperationFailure exception consistent
with logging done when catching PrimaryFailure exception.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1687 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent c1c5e475
...@@ -144,23 +144,17 @@ class Application(object): ...@@ -144,23 +144,17 @@ class Application(object):
# look for the primary master # look for the primary master
self.connectToPrimary() self.connectToPrimary()
self.operational = False self.operational = False
try:
while True:
try:
# check my state # check my state
node = self.nm.getByUUID(self.uuid) node = self.nm.getByUUID(self.uuid)
if node is not None and node.isHidden(): if node is not None and node.isHidden():
self.wait() self.wait()
try:
self.verifyData() self.verifyData()
self.initialize() self.initialize()
self.doOperation() self.doOperation()
raise RuntimeError, 'should not reach here' raise RuntimeError, 'should not reach here'
except OperationFailure: except OperationFailure, msg:
logging.error('operation stopped') logging.error('operation stopped: %s', msg)
# XXX still we can receive answer packet here
# this must be handle in order not to fail
self.operational = False
except PrimaryFailure, msg: except PrimaryFailure, msg:
logging.error('primary master is down: %s', msg) logging.error('primary master is down: %s', msg)
self.master_node = None self.master_node = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment