107 Commits

Author SHA1 Message Date
binhong.hua
3d3f5f1613 add ulimit support for kolla_docker
By default, docker containers inherit ulimit from limits of docker
deamon. On CentOS 7, docker daemon default NOFILE is 1048576.
It can found in /usr/lib/systemd/system/docker.service.
The big limit will cause many problem. we should control it in
production environment.

Change-Id: Iab962446a94ef092977728259d9818b86cfa7f68
2019-01-24 10:54:14 +08:00
confi-surya
b41309ef16 Update hacking version
Use latest release 1.1.0 and compatible changes w.r.t pep8

Change-Id: Ie5e5417a1d8481bb59d516a320bd7cc1dd89591e
2018-12-27 04:44:49 +00:00
Mark Goddard
365bb5177d Create cells before starting nova services
Nova services may reasonably expect cell databases to exist when they
start. The current cell setup tasks in kolla run after the nova
containers have started, meaning that cells may or may not exist in the
database when they start, depending on timing. In particular, we are
seeing issues in kolla CI currently with jobs timing out waiting for
nova compute services to start. The following error is seen in the nova
logs of these jobs, which may or may not be relevant:

No cells are configured, unable to continue

This change creates the cell0 and cell1 databases prior to starting nova
services.

In order to do this, we must create new containers in which to run the
nova-manage commands, because the nova-api container may not yet exist.
This required adding support to the kolla_docker module for specifying a
command for the container to run that overrides the image's command.

We also add the standard output and error to the module's result when a
non-detached container is run. A secondary benefit of this is that the
output of bootstrap containers is now displayed in the Ansible output if
the bootstrapping command fails, which will help with debugging.

Change-Id: I2c1e991064f9f588f398ccbabda94f69dc285e61
Closes-Bug: #1808575
2018-12-14 19:26:42 +00:00
Eduardo Gonzalez
846c15d8e1 Allow set tty for containers
This change adds support to comfigure tty,
it was enabled by default but a recent patch
removed it. Some services such as Karaf in opendaylight
requires a TTY during startup.

Closes-Bug: #1806662
Change-Id: Ia4335523b727d0e45505cbb1efb40ccf04c27db7
2018-12-05 11:44:37 +00:00
Zuul
d0bb2fdcba Merge "Don't allocate pseudo-TTY when creating containers" 2018-11-19 12:18:15 +00:00
Rabi Mishra
48bae90e8f Don't allocate pseudo-TTY when creating containers
With a pseudo terminal, service is not treated as a daemon
and signals would not work as expected.

Change-Id: I16aa29a7924df51659d973a81d8005ae3d86f57b
Related-Bug: #1799642
2018-11-03 22:35:20 +05:30
caoyuan
8ee47ae3a2 Merge the merge_yaml and merge_config module into one
move the merge_yaml and merge_config module's DOCUMENTATION and
EXAMPLES into action_plugins.

Change-Id: I84c5b94afb870fc9a25838782389f7b1f8b882fd
Closes-Bug: #1799236
2018-10-31 10:13:00 +08:00
Eduardo Gonzalez
fffdc6b3e5 Remove_images in kolla_docker module
Add support to remove images from kolla_docker
ansible module.

Change-Id: Ib6bcb98b5b295a2d590df3013188913d1f7f3584
2018-09-14 17:14:25 +02:00
Eduardo Gonzalez
2e7da7a38f Fix kolla_docker ansible-doc examples
Missing the module name in the examples.

Change-Id: I7a60f92bd163688401ab5dd0f6cc9464ae934356
2018-08-09 17:07:03 +02:00
Zuul
fb708ccc0e Merge "Add check to ansible argument_spec" 2018-08-03 10:46:58 +00:00
Lakshmi Prasanna Goutham Pratapa
76210a2d85 Apply Resource Constraints to Openstack Services
This commit is to apply resource-constraints only to few OpenStack services.
Commit to apply constraints to other services will be made in coming commits.

Partially-Implements: blueprint resource-constraints

Change-Id: Icafa54baca24d2de64238222a5677b9d8b90e2aa
2018-07-25 17:05:04 +01:00
wu.chunyang
d6f8f697fe Add check to ansible argument_spec
module_name is required for kolla_toolbox,but this module does
not check this argument.

Change-Id: Iae256c0690b408a040b4e0b079525d3dab917e90
2018-07-25 14:10:21 +00:00
Lakshmi Prasanna Goutham Pratapa
297eb5e88f Add resource Constraints to Nova containers.
This commit will constrain the dimensions of service `Nova`
and sub-containers deployed along with it.

A user can give the dimension values in `/etc/kolla/globals.yml`
the data-types just like stated in this commit.

Reference-Docs:
https://docs.docker.com/config/containers/resource_constraints/

Added Test-cases for the same.

Partially-Implements: blueprint resource-constraints
Change-Id: I6458d8fb7b26a6e7c3a9fd0d674d9cf129b0bf5d
2018-07-12 23:24:05 +05:30
Jorge Niedbalski
044e82ccfe Increase timeout for kolla_toolbox module.
This patch increases the default timeout for
the kolla_toolbox ansible module when talking
with the docker API from the default 60 to 180 secs.

This is required on slower deployments,
specially when bootstraping an environment and fernet
tokes are in usage. For faster deployments this will
be harmless, but for slower deployments this would be
beneficial.

Bug: #1767136
Change-Id: I0391715b16cf86d6c27fecf8a666de64f2735a7d
Signed-off-by: Jorge Niedbalski <jorge.niedbalski@linaro.org>
2018-04-26 13:02:24 -03:00
Zuul
d2f5570823 Merge "Fix ipc_mode comparison in the latest docker" 2018-04-09 12:17:53 +00:00
wangwei
193ce726c2 Fix ipc_mode comparison in the latest docker
In old docker, if you do not specify ipc_mode, the default value is empty,
but in the latest docker, such as 17.09.0, if not specified, the default
is "IpcMode": "shareable", which will cause all containers to be deleted
and re-create when to redeploy or upgrade. This commit solves the
problem.

Change-Id: Ia8269b9c8066880e4aee23d6fdea8d9c04c41e44
Closes-Bug: #1747586
2018-04-06 13:35:43 +00:00
Jeffrey Zhang
20c5e8fe13 Update ceph client.admin caps during upgrade
When upgrade from ceph Jewel to ceph luminous, the client.admin caps
should add `mgr 'allow *'` caps

Change-Id: Ia4cb7a59d4cf215a1dce1efe31e00f1401e0b753
Closes-Bug: #1750967
2018-03-30 08:07:18 +00:00
Jeffrey Zhang
d741eed94f Make kollda_docker works with new released python docker 3.0 package
the wait function in docker 3.0 return a dict now.

Closes-Bug: #1746748
Change-Id: Ice87128a936e36a0d7eb75c1ffd57dae39d89a64
2018-02-01 23:27:46 +08:00
Eduardo Gonzalez
448a10df6c Add container state check in kolla_docker
Missing container status check in recreate_or_restart_container,
this causes if the container is not running (kolla-ansible stop),
to not be started with deploy/reconfigure/upgrade if any other param
changes.

Change-Id: I5cff5f367e963ba8b1807ec46469da817e40e468
Closes-Bug: #1714015
2018-01-26 07:30:11 +00:00
Jenkins
1ab6822d99 Merge "Stop and start container rather than use restart directly" 2017-07-31 13:12:38 +00:00
Jeffrey Zhang
ea1ae405ba Assume the container is removed if it is not show in docker ps
In some case, docker can not remove container and raise following error
message:

    Unable to remove filesystem for xxx remove
    /var/lib/docker/containers/xxx/shm: device or resource busy

But the container is removed. This patch assumes container is
removed if only container name is not shown in docker ps.

Closes-Bug: #1662598
Change-Id: I079d5ec6178018403ec7a49c975f137e27eb9ad4
2017-07-28 17:30:11 +08:00
Jeffrey Zhang
7f2ade5b5a Stop and start container rather than use restart directly
Docker has an issue[0] when restart container. But stop then start
works.

[0] https://github.com/moby/moby/issues/29704

Change-Id: If0a9c0c257cd72209be8e138a1f0b8871500e089
Closes-Bug: #1707097
2017-07-28 17:26:27 +08:00
Jenkins
cd20a68635 Merge "Remove warning during kolla_docker execution" 2017-07-24 10:42:00 +00:00
Bertrand Lallau
2d424ffb14 Remove warning during kolla_docker execution
Ansible check if modules parameters are named like
%password% and allow to hidden log param in this case.
This requires adding "no_log" parameters.
This patch just add "no_log" param in order to avoid
this warning.

Change-Id: I9c1df1093e0fd101090292d6e8bf3527f99aeb17
Closes-Bug: #1702244
2017-07-14 18:43:45 +02:00
Hongbin Lu
3daeea37ea Upgrade from docker-py to docker
The pypi package 'docker-py' [1] has been renamed to 'docker' [2].
It is better to move to the new 'docker' package because the old
package will be deprecated and all the new features will go into
the new package only.

Package 'docker' has been added to requirements [3]. The old
package 'docker-py' is still allowed to be in the global requirements
during the transition period but it should be removed after all or
most of the projects finsih the migration.

[1] https://pypi.python.org/pypi/docker-py
[2] https://pypi.python.org/pypi/docker
[3] https://review.openstack.org/#/c/423715/

Change-Id: Ibcd5a57a1fbf55dcc5a690e41f20917f95b63da0
2017-07-10 14:19:28 +00:00
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