Merge "container connect both bridge and kuryr network in Rally"

This commit is contained in:
Jenkins 2017-04-24 14:23:21 +00:00 committed by Gerrit Code Review
commit 3e2891d6fc
3 changed files with 11 additions and 8 deletions

View File

@ -70,9 +70,11 @@ class DockerNetworkContext(context.Context):
driver="kuryr",
ipam=ipam)
self.context["netid"] = res.get("Id")
self.context["netname"] = "kuryr_network"
else:
res = docker_client.create_network(name="docker_network")
self.context["netid"] = res.get("Id")
self.context["netname"] = "docker_network"
LOG.debug("Container network id is '%s'" % self.context["netid"])
except Exception as e:
msg = "Can't create docker network: %s" % e.message

View File

@ -24,7 +24,7 @@ class Kuryr(utils.KuryrScenario):
def __init__(self, context=None, admin_clients=None, clients=None):
super(Kuryr, self).__init__(context, admin_clients, clients)
@scenario.configure(context={"cleanup": ["kuryr"]})
@scenario.configure()
def list_networks(self, network_list_args=None):
"""List the networks.
@ -40,7 +40,7 @@ class Kuryr(utils.KuryrScenario):
"""
self._list_networks(network_list_args or {})
@scenario.configure(context={"cleanup": ["kuryr"]})
@scenario.configure()
def create_and_delete_networks_with_kuryr(self, network_create_args=None):
"""Create and delete a network with kuryr.
@ -53,7 +53,7 @@ class Kuryr(utils.KuryrScenario):
network_create_args=network_create_args or {})
self._delete_network(network)
@scenario.configure(context={"cleanup": ["kuryr"]})
@scenario.configure()
def create_and_delete_networks_without_kuryr(self,
network_create_args=None):
"""Create and delete a network without kuryr.
@ -67,7 +67,7 @@ class Kuryr(utils.KuryrScenario):
network_create_args=network_create_args or {})
self._delete_network(network)
@scenario.configure(context={"cleanup": ["kuryr"]})
@scenario.configure()
def start_and_stop_containers(self, container_create_args=None):
"""Start and stop container on docker network.

View File

@ -79,14 +79,15 @@ class KuryrScenario(scenario.OpenStackScenario):
@atomic.action_timer("kuryr.start_container")
def _start_container(self, container_create_args=None):
"""Start Container on docker network."""
network_config = self.docker_client.create_networking_config(
{self.context.get("netname"):
self.docker_client.create_endpoint_config()})
container = self.docker_client.create_container(
image='kuryr/busybox',
command='/bin/sleep 600')
command='/bin/sleep 600',
networking_config=network_config)
container_id = container.get('Id')
self.docker_client.start(container=container_id)
net_id = self.context.get("netid")
self.docker_client.connect_container_to_network(container_id,
net_id)
return container_id
@atomic.action_timer("kuryr.stop_container")