Commit a47ec65f authored by Swann Perarnau's avatar Swann Perarnau
Browse files

[fix] remove container ownership concept

Make it so that the daemon will delete containers when all commands it
is aware of are finished, instead of relying on a single owner that
needs to be tracked.

This simplifies the handling to multiple commands in the same container,
and should not impact the rest.
parent f81b95e0
......@@ -25,7 +25,6 @@ logger = logging.getLogger('nrm')
class Daemon(object):
def __init__(self): = 100.0
self.container_owner = dict()
def do_downstream_receive(self, parts):"receiving downstream message: %r", parts)
......@@ -89,7 +88,7 @@ class Daemon(object):
pid, container = self.container_manager.create(params)
container_uuid = container.uuid
if len(container.processes.keys()) == 1:
if len(container.processes) == 1:
if container.power['policy']:
container.power['manager'] = PowerPolicyManager(
......@@ -108,7 +107,6 @@ class Daemon(object):
self.container_owner[container.uuid] = client
# now deal with the process itself
update = {'api': 'up_rpc_rep',
......@@ -215,9 +213,9 @@ class Daemon(object):"Process %s in Container %s has finised.",
pid, container.uuid)
# if this process was owner of the container,
# if this is the last process in the container,
# kill everything
if self.container_owner[container.uuid] == clientid:
if len(container.processes) == 0:
# deal with container exit
msg = {'api': 'up_pub',
'type': 'container_exit',
......@@ -244,7 +242,6 @@ class Daemon(object):
del self.container_owner[container.uuid]
logger.debug("child update ignored")
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