82 Commits

Author SHA1 Message Date
Jenkins
a8433495dd Merge "Add graceful_timeout argument to kolla_docker" 2017-05-10 08:40:36 +00:00
Pavel Glushchak
87ce5cd603 kolla_toolbox: allow docker api version to be specified
When docker-py is newer than docker daemon following
APIError may be raised:

client is newer than server (client API version: 1.24, server API version: 1.22)

So it's better to pass api_version='auto' to docker client,
so client will discover suitable version if not specified.

Change-Id: Ib747ed91b315ca762936a6efa6b71a29b2d2ae1e
Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
2017-04-24 17:54:44 +03:00
Jenkins
93a220aaf9 Merge "Switch kolla_docker to rely on SHA256 for image changes" 2017-04-18 04:35:14 +00:00
Duong Ha-Quang
d929359550 Add graceful_timeout argument to kolla_docker
Currently, when stoping/restarting container, Kolla uses default timeout value
between SIGTERM and SIGKILL provided by docker which is 10 sec. But some
services require more than it to finish graceful shutdown progress.

This patchset adds graceful_timeout to kolla_docker to override the default
one.

Partial Implements: bp signaling-to-container

Change-Id: Ica0b48a53c650cc23dfa1955027d2cf936a5932f
2017-04-13 16:53:14 +07:00
Mohammed Naser
27d675ea13
Switch kolla_docker to rely on SHA256 for image changes
At the moment, the process to determine if an image has
changed or not relies on the Docker API which depending
on the Docker release server can return different results.

This patch addresses this issue by grabbing the SHA256
of the image before pulling (defaulting to None if it does
not exist) and then comparing it after the pull is complete
which should always be successful at determining if the
image did change or not.

The test for unknown status images is removed because this
is not a possible scenario as we do not rely on status
anymore except for failures (which are still tested).

Change-Id: Ia60a7f34420b02f50597dddb96a4c36ff3996612
Closes-Bug: #1668059
2017-04-06 16:34:01 -04:00
Mohammed Naser
108613507c
Fix documentation for kolla_docker image pulling
The example to pull images is incorrect, this patch
addresses it and corrects it accordingly.

Change-Id: Ice79e7f73d99c024781cb379d190f6d05e1a34a9
2017-04-06 13:40:22 -04:00
Jenkins
60379615f3 Merge "Fix the incompatible of docker-py 2.0.0" 2017-03-09 17:34:43 +00:00
Jeffrey Zhang
78e5c865f4 Fix the incompatible of docker-py 2.0.0
docker-py 2.0.0 is released with renaming docker.Client to
docker.APIClient. and with a new python package name "docker" rather
than "docker-py".
This patch support docker and docker-py packages.

Change-Id: Ib4400a4d2ce803191ee6215c5b28f0052970332c
Closes-Bug: #1668346
2017-03-05 13:35:23 +08:00
Chao Guo
03ddc1be8e Add empty volume item check in kolla_docker module
A empty docker volume item will cause start_container to fail.
This bug is not triggered in current kolla deployment scripts, but
only if you pass a empty volume item to kolla_docker module.
E.g. Using a if expression in items of volumes list while calling
start_container. Like the one in start.yml of iscsi and cinder.

Change-Id: I389246fb9650ab5304463e943459ecb68706167f
2017-02-21 17:17:39 +08:00
Abel Lopez
8b90fb6d47
Change python interpreter
There is inconsistent use of either `/usr/bin/python` or
`/usr/bin/env python`. This makes for unexpected results when a
user might be using a virtualenv.

Change-Id: Ibb030f920a8869f9113ade70b66a921cc815060d
2017-02-16 13:39:36 -08:00
Jeffrey Zhang
950feb1e1c Do not check security opt in some case in kolla_docker module
Security opt is disable when using host ipc or host pid or
privileged[0].

[0]
https://github.com/docker/docker/blob/master/daemon/create.go#L161,L164

Change-Id: I83d7c74aaeb5c59981c76464e69d5b5baa00fefb
2017-02-08 10:36:37 +08:00
Mauricio Lima
4957752286 Fix parameter issue in cinder handlers
Co-Authored-By: Jeffrey Zhang <jeffrey.zhang@99cloud.net>
Change-Id: I92c0757af6567cbb4ff338493df9931ebef3366c
2017-02-04 15:55:29 +08:00
Jenkins
6c33871071 Merge "Create a new container when restart a container when necessary" 2017-02-04 06:09:11 +00:00
Jeffrey Zhang
a3acd2c439 Fix the pid_mode and ipc_mode value check for kolla_docker module
bypass_checks is disabled by Ib2e19794bbe804470a880253d5870254041358c8 .
But we use pid_mode: "{{ service.pid_mode | default('') }}" pattern in
the yaml file. whereas pid_mode only support "host" value, this patch
add '' as a choice of these two parameters.

Change-Id: Ib83ed5e437ca868f0e42ce740ad1125d2fa48ff4
2017-02-03 15:56:10 +08:00
Jenkins
62c0057bf5 Merge "Use required_if in kolla_docker.py" 2017-02-03 04:18:36 +00:00
Jeffrey Zhang
869abbbed4 Create a new container when restart a container when necessary
Recreate and start a new container when container parameter is changed
in COPY_ALWAYS strategy.

Change-Id: I1e45c0dc34a93a18b664109823d6fd5b88c331a2
Closes-Bug: #1659799
2017-02-02 17:08:38 +08:00
Jenkins
8884422f3d Merge "Refactor register.yml files" 2017-01-26 18:48:59 +00:00
Jeffrey Zhang
8155d74d8d Refactor register.yml files
Co-Authored-By: Mauricio Lima <mauriciolimab@gmail.com>
Change-Id: I9a4a6b6523dee4b388513386b7d85d421f2b7b89
2017-01-26 17:10:27 +00:00
Jeffrey Zhang
35f9335572 Optimize reconfigure action for nova
Change-Id: Ida7c955d9ddf7b7dc3289001958326c38c62d0c9
Partially-implements: blueprint better-reconfigure
2017-01-25 13:20:06 +08:00
Jenkins
e7d59dbb03 Merge "Fix the kolla_toolbox module do not work on docker engine 1.10" 2017-01-23 12:14:21 +00:00
zhuzeyu
42e7b747e4 Use required_if in kolla_docker.py
Replace the original code with required_if when Ansible 2.0 lands

Change-Id: Ib2e19794bbe804470a880253d5870254041358c8
2017-01-23 12:07:13 +08:00
Jeffrey Zhang
1aaca08b48 Fix the kolla_toolbox module do not work on docker engine 1.10
docker engine 1.10 and docker engine 1.12 have different response for
list containers. Use status=running filter instead. It is provided by
all docker version.

Closes-Bug: #1658015
Change-Id: I54df4b08f215322d97d604ebd84e04255a359ef6
2017-01-20 08:57:06 +00:00
Jeffrey Zhang
69b985f1b6 Fix docker restart policy issue on docker engine 1.13
Docker v1.25 api now validates restart policies[0]

[0] https://github.com/docker/docker/blob/master/docs/api/version-history.md

Change-Id: Idc90cb99cf38ab1e637568ee5dbe5adcb2fa5b78
Closes-Bug: #1657946
2017-01-20 16:32:31 +08:00
Jenkins
3f8cb8adda Merge "Refactor bootstrap.yml file" 2017-01-18 10:17:50 +00:00
Jeffrey Zhang
7233b45d29 Refactor bootstrap.yml file
Change-Id: I00d2dcb0895548ba169ab85764cf546c2214cbf5
2017-01-12 23:37:50 +08:00
Jenkins
3b2fcf7674 Merge "Fix python3 compatibility in kolla_docker" 2017-01-05 10:07:44 +00:00
Jeffrey Zhang
d37da2cfa9 Optimize reconfigure action for glance
Partically-implements: blueprint better-reconfigure
Change-Id: I89e30e8b87f24a621c521d915842a4af0042d6fe
2017-01-02 10:58:43 +08:00
Jeffrey Zhang
eb4313ca49 Move glance precheck into its own role
Depends-On: I0773851b61d341117ab214382856a9036aca51bb
Change-Id: I060e21ada928577e833de2782be5ea570be32730
Partially-implements: blueprint condition-pre-check
2016-11-29 09:56:45 +08:00
Paul Bourke
17ec0f62f4 Fix python3 compatibility in kolla_docker
When using stream=True with docker-py it returns byte arrays rather than
strings.

Change-Id: I8eb6707ba2b122cf779135173abafe874b7223d2
Closes-Bug: #1643740
2016-11-25 10:53:36 +00:00
maniram477
6275f7090b Corrects typo "requried" in kolla_docker.py
The parameter "required=True" is mistyped as "requried=True"
in ansible/library/kolla_docker.py and tests/test_kolla_docker.py

Closes bug: 1640423

Change-Id: I64c333275b9eb3eff5b1c0fa5d550f478e68020d
2016-11-09 15:18:22 +05:30
Sajauddin Mohammad
3f134d0f53 Changed docker_restart_policy to unless-stopped
Current implementation has docker_restart_policy "always" and
docker_restart_policy_retry:"10" which should be mutually exclusive.
"unless-stopped" will restart the containers on any exit state
but not start on daemon startup if container was put to stopped state before.
Closes-Bug: #1621187

Change-Id: I4d881cd123a55625121b7a9047385e9b54e2e129
2016-09-26 04:32:28 -04:00
Sean Mooney
d7dfae75b2 generate bifrost yaml configs
- This change indroduces a merge_yaml action_plugin
- This change generates bifrost yaml configs.

Change-Id: I9814e6a5d55cbd46c4b60c06ed70ed54a575bd2f
Implements: blueprint bifrost-support
2016-08-31 13:06:41 +00:00
Jenkins
0b7e853784 Merge "Fix the variable name mismatch" 2016-08-19 04:03:14 +00:00
Jenkins
55ddbad92a Merge "Modify some spelling mistakes" 2016-08-15 15:42:22 +00:00
Lu lei
9fd70b425f Modify some spelling mistakes
Fix a spelling error, and modify some words.

TrivialFix

Change-Id: Ieb55bd2679291ab61080b55feaaaf3c494939978
2016-08-04 10:05:55 +08:00
MD NADEEM
c91724bbda Fix the variable name mismatch
Change-Id: I354d7350671bf6a6d6fb432b074144b4e02cd154
Closes-Bug: #1608841
2016-08-02 14:04:14 +05:30
Jeffrey Zhang
ae34973d35 Fix the kolla_docker issue with docker 1.12
After docker 1.12, the RepoTags will be None rather than [] in the
image list API. This PS will handle the both case.

Change-Id: Ie2da44b44229c2f190550755b50876f607f9cc0c
Closes-Bug: #1608358
2016-08-01 13:41:05 +08:00
qinchunhua
1bddef94cb Python 3: dict.iteritems()
Replace dict.iteritems() with dict.items(). The Python 3 dict
type has no iteritems() method, the old iteritems() method was
renamed to items().

TrivialFix.

Change-Id: I2137e72554fd16d2c70e50306e4f57d27e35bcd3
2016-07-26 12:42:07 +00:00
MD NADEEM
f5b04c97eb Added unit test for image operation
Change-Id: I44a5ba649d73f4ca2d48065625c8d67445576944
Partially-Implements: blueprint ansible-unit-tests
2016-06-28 10:57:47 +00:00
MD NADEEM
3321049158 Fix container stop exeption
Change-Id: I1d59ed9089def808bab31d97ba4cba9e8592b568
Closes-Bug: #1595814
2016-06-27 03:03:43 +00:00
Jeffrey Zhang
476da0f43a Log the traceback in the kolla libraries
The traceback is logged also and will be helpful when the
library failed. We can get which line is failed from the log.

TrivialFix

Change-Id: Ia417232007e2f34c83d2e7cad6ed08dee49ce836
2016-05-31 01:40:55 +00:00
Jeffrey Zhang
3545e6d503 Fix the incompatibility for ansible 2.1.0
Ansible 2.1.0 has lots of change and the plugin is not compatible
between 2.0.0 and 2.1.0. This change fix the gap.

* fix the signature change for _make_tmp_path in ansible 2.1.0
* fix the common_options in the kolla_docker.py

Change-Id: I05f5f05581c8bd625cd868fa0db549d0c60a7043
Closes-Bug: #1586018
2016-05-30 23:02:09 +08:00
Jeffrey Zhang
491822c510 Bump the ansible to 2
DocImpact

Change-Id: I3cdfbf84919de80f535c030bd146787ecda40dec
partial-Implements: blueprint ansible2
2016-05-24 19:53:31 +08:00
Serguei Bezverkhi
a08a762f30 Adding ability to specify capabilities and security
This patch adds ability to specify required capabilities and security
mode for a specific docker container.

Change-Id: Ib8c15a8e354178bedd31ebb31a64618431f0e135
Closes-Bug: #1572648
2016-05-03 15:24:16 -04:00
Jeffrey Zhang
9575417b15 Fix the upgrade issue when image id is the same
When image id is the same, the container won't re-create with the
latest image tag.

Change-Id: I402ad275c388006248cb559851b01b0b963cf170
Closes-Bug: #1569723
2016-04-13 17:56:29 +08:00
Carlos Cesario
08b08c78b5 Identify container through PS1 shell variable
As suggested it was created the variable KOLLA_SERVICE_NAME to identify
the container service name through  PS1 shell variable.
This method it was previously discussed in IRC.
https://goo.gl/k7AdEg

The other option it was usage hostname param in kolla_docker, but
currently docker does not support it due this issue:
https://github.com/docker/compose/issues/2460

The final result is like this:

$ docker exec -it heka /bin/bash
(heka)[heka@kolla-control /]$

$ docker exec -it mariadb /bin/bash
(mariadb)[mysql@kolla-control /]$

More details can be accessed through this link
http://paste.openstack.org/show/493689/

Closes-Bug: #1557454
Change-Id: I6aab8d640a8ebb17baa9d6d4f1edd6e331674713
2016-04-11 17:50:04 -03:00
Jenkins
251b498c72 Merge "Fix the wrong refer self in kolla_docker.py" 2016-03-30 05:22:21 +00:00
Jeffrey Zhang
1fc0003aee Fix the wrong refer self in kolla_docker.py
Change-Id: Ia5bcfa7253fc5a471a089339c52883af05623068
Closes-Bug: #1562345
2016-03-27 00:37:52 +08:00
Nguyen Hung Phuong
328a7e8898 Fix typos in Kolla
TrivialFix

Change-Id: I21f51811ec4256d9b6b2e219de6201e4811dfc5a
2016-03-26 08:06:49 +00:00
Serguei Bezverkhi
f97fecd736 Set --ipc option to "host" for kolla_docker
This change will enable to lvm commands running in a container
communicate with udev process running on a host.

Partially-Implements: blueprint iscsi-lvm2-docker

Change-Id: If780710bb81adaee44ce0d291e22ce91ec6436aa
2016-03-16 12:30:52 -04:00