Bump timeout and Docker API version

Version 1.19 from the docker-py client
https://github.com/docker/docker-py/blob/master/docker/constants.py#L1

Our timeout is twice that of the default in docker-py

Closes-Bug: #1440969
Change-Id: I45427b6536586bdd2d154ec4e9634f7ce4e3c28d
This commit is contained in:
Davanum Srinivas 2015-09-04 11:27:02 -07:00
parent 9b52cae2d4
commit 523a1463e5
4 changed files with 20 additions and 6 deletions

View File

@ -15,7 +15,7 @@ bash -xe $SCRIPTDIR/prepare_devstack.sh
export DEVSTACK_GATE_VIRT_DRIVER=docker
export KEEP_LOCALRC=1
export DEVSTACK_GATE_TEMPEST_REGEX='^(?!.*?(volume|resize|suspend|rescue|cinder|migrate|object_storage)).*'
export DEVSTACK_GATE_TEMPEST_REGEX='^(?!.*?(boto|volume|resize|suspend|rescue|cinder|migrate|object_storage)).*'
export DEVSTACK_GATE_TEMPEST=1
export DEVSTACK_GATE_TEMPEST_FULL=0

View File

@ -83,7 +83,6 @@ class MockClient(object):
data = {
'Hostname': args['hostname'],
'User': '',
'Memory': args['mem_limit'],
'MemorySwap': 0,
'AttachStdin': False,
'AttachStdout': False,

View File

@ -24,6 +24,8 @@ from docker import client
from docker import tls
CONF = cfg.CONF
DEFAULT_TIMEOUT_SECONDS = 120
DEFAULT_DOCKER_API_VERSION = '1.19'
def filter_data(f):
@ -68,8 +70,8 @@ class DockerHTTPClient(client.Client):
ssl_config = False
super(DockerHTTPClient, self).__init__(
base_url=url,
version='1.13',
timeout=10,
version=DEFAULT_DOCKER_API_VERSION,
timeout=DEFAULT_TIMEOUT_SECONDS,
tls=ssl_config
)
self._setup_decorators()

View File

@ -25,6 +25,7 @@ import time
import uuid
from docker import errors
from docker import utils as docker_utils
from oslo_config import cfg
from oslo_log import log
from oslo_serialization import jsonutils
@ -728,8 +729,20 @@ class DockerDriver(driver.ComputeDriver):
def _create_container(self, instance, image_name, args):
name = "nova-" + instance['uuid']
args.update({'name': self._encode_utf8(name)})
return self.docker.create_container(image_name, **args)
hostname = args.pop('hostname', None)
cpu_shares = args.pop('cpu_shares', None)
network_disabled = args.pop('network_disabled', False)
environment = args.pop('environment', None)
command = args.pop('command', None)
host_config = docker_utils.create_host_config(**args)
return self.docker.create_container(image_name,
name=self._encode_utf8(name),
hostname=hostname,
cpu_shares=cpu_shares,
network_disabled=network_disabled,
environment=environment,
command=command,
host_config=host_config)
def get_host_uptime(self):
return hostutils.sys_uptime()