Allowing to restart docker nodes during simulation#38
Allowing to restart docker nodes during simulation#38lhoff94 wants to merge 1 commit intodiselab:masterfrom
Conversation
|
LGTM apart from some nit picks. Sure we cannot come up with a cleaner solution for 249-253? @arneboockmeyer, can the deletion of the veth pair be related to some kind of automatic clean up? |
|
I hacked up an example scenario based on the existing "basic_example.py" to replicate the behaviour that I described here: |
|
@arneboockmeyer will have a look :) |
This PR adds a command to the DockerNode allows restarting of a container during simulation e.g. by a workflow.
Using this function in a workflow enables the following use cases:
I have to admit lines 249-253 are a bit hacky. They are a workaround for a strange behavior where I couldn't get to the root cause.
If a DockerNode is stopped by calling .stop_docker_container() the veth pair that belongs to it is deleted as well (as far as I can tell by the operating system since there is no call to interface.remove_veth_pair()). The strange thing is that it only happens if the DockerNode is the last one defined in the Scenario. If it is not the last one, the veth_pair survives but is still connected to the namespace of the old container and therefore needs to be deleted and recreated as well.
I tried to find the cause for this behavior but couldn't identify if it's something the kernel or the docker daemon does. However, the solution that is implemented in this PR worked for me for a couple of months during which is used this feature extensively.