Merge pull request #17 from dhellmann/more-debugging

More debugging changes
This commit is contained in:
markmcclain 2013-04-25 08:14:13 -07:00
commit 0cbf926bf0
2 changed files with 19 additions and 10 deletions

View File

@ -376,7 +376,11 @@ class Quantum(object):
device_owner=DEVICE_OWNER_ROUTER_MGT
)
response = self.api_client.create_port(dict(port=port_dict))
port = Port.from_dict(response['port'])
port_data = response.get('port')
if not port_data:
raise ValueError('No port data found for router %s network %s' %
(router_id, self.conf.management_network_id))
port = Port.from_dict(port_data)
args = dict(port_id=port.id, owner=DEVICE_OWNER_ROUTER_MGT)
self.api_client.add_interface_router(router_id, args)

View File

@ -47,17 +47,22 @@ class TaskManager(object):
LOG.info('Waiting on item')
task = self.task_queue.get()
try:
LOG.debug('starting %s', task)
task()
except Exception, e:
if isinstance(e, Warning):
LOG.warn('Task: %s' % task)
else:
LOG.exception('Task failed: %s' % task)
LOG.debug('success for task %s', task)
except Exception as e:
try:
if isinstance(e, Warning):
LOG.warn('Task: %s' % task)
else:
LOG.exception('Task failed: %s' % task)
if task.should_retry():
self.delay_queue.put(task)
else:
LOG.error('Task Error: %s' % task)
if task.should_retry():
self.delay_queue.put(task)
else:
LOG.error('Task Error: %s' % task)
except Exception as e2:
LOG.exception('Error processing exception in task')
def _requeue_failed(self):
while True: