Commit e1a88f0f authored by Daniele Venzano's avatar Daniele Venzano

Catch a requests exception that docker-py does not catch

parent 9bdb21b0
...@@ -338,6 +338,8 @@ class SwarmClient: ...@@ -338,6 +338,8 @@ class SwarmClient:
ret = self.cli.containers.list(all=True) ret = self.cli.containers.list(all=True)
except docker.errors.APIError as ex: except docker.errors.APIError as ex:
raise ZoeException(str(ex)) raise ZoeException(str(ex))
except requests.exceptions.RequestException as ex:
raise ZoeException(str(ex))
conts = [] conts = []
for cont_info in ret: for cont_info in ret:
match = True match = True
......
"""Classes to hold the system state and simulated container/service placements""" """Classes to hold the system state and simulated container/service placements"""
import logging
from zoe_lib.state.sql_manager import Execution, Service from zoe_lib.state.sql_manager import Execution, Service
from zoe_master.stats import ClusterStats, NodeStats from zoe_master.stats import ClusterStats, NodeStats
log = logging.getLogger(__name__)
class SimulatedNode: class SimulatedNode:
"""A simulated node where containers can be run""" """A simulated node where containers can be run"""
...@@ -72,6 +76,7 @@ class SimulatedPlatform: ...@@ -72,6 +76,7 @@ class SimulatedPlatform:
candidate_nodes.append(node) candidate_nodes.append(node)
if len(candidate_nodes) == 0: # this service does not fit anywhere if len(candidate_nodes) == 0: # this service does not fit anywhere
self.deallocate_essential(execution) self.deallocate_essential(execution)
log.debug('Cannot fit essential service {}, bailing out'.format(service.id))
return False return False
candidate_nodes.sort(key=lambda n: n.container_count) # smallest first candidate_nodes.sort(key=lambda n: n.container_count) # smallest first
candidate_nodes[0].service_add(service) candidate_nodes[0].service_add(service)
......
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