Commit Graph

12 Commits

Author SHA1 Message Date
Sean McGinnis 45fd25c572 Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I6245a207ec65df0ef11a798b4cffe3157abccb73
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
Co-Authored-By: Spyros Trigazis <spyridon.trigazis@cern.ch>
2020-04-29 17:10:23 +03:00
yatin dd7ed64690 Update minimum version of docker in unit tests
python docker version in u-c is bumped to 3.1.1 in [1].
Till 2.7.0 if MINIMUM_DOCKER_API_VERSION it just reported
warning but since 3.0.0 it reports Error, see [2]. This
patch bumps the expected version to 1.21 which is same
docker version used in magnum and supported by current
python docker.

[1] https://review.openstack.org/#/c/551428/
[2] df8422d079

Change-Id: Id93c5f70504c7d686dbd1b3d9bdfc1ef657d9287
2018-03-15 12:04:30 +05:30
Spyros Trigazis (strigazi) 1e0785c320 Move to docker python SDK 2.x.x
Since we use docker >= 12.1 we can move to docker python SDK 2.x.x.
Docker 2.x.x is backwards compatible with older docker versions
using the APIClient instead of the DockerClient [1].

[1] https://docker-py.readthedocs.io/en/stable/api.html

Change-Id: I9e50a877de6e0a8c3ba56c2d7ebbbe336972a146
Close-Bug: #1696862
2017-06-09 15:03:25 +00:00
Hieu LE 6d6cfb87b6 Centralize config option: docker section
Centralize config option of docker section.
Replace oslo_conf cfg to magnum.conf.

Change-Id: Ic8b2b2f0f9bfc6b02d75f57fab00c548b9d8f482
Implements: blueprint centralize-config-magnum
2016-09-22 05:57:31 +00:00
Tom Cammann 40aa6550f1 Remove container object
Following on from removing the k8s specific APIs in
I1f6f04a35dfbb39f217487fea104ded035b75569 the objects associated with
these APIs need removal.

Remove the container object, drop the db table and remove references to
the container object. The docker_conductor has also been removed as this
was used for managing containers using Magnum objects.

Change-Id: I288fa7a9717519b1ae8195820975676d99b4d6d2
Partially-Implements: blueprint delete-container-endpoint
Co-Authored-By: Spyros Trigazis <strigazi@gmail.com>
2016-08-01 16:16:20 +02:00
Eli Qiao 6b72bf8546 Cleanup container client api rewrite function
Docker client api has this decorator utils.check_resource for
pause/unpause action when we pass a container dict as the parameter
of `action` method.

Also cleanup logs method

Change-Id: I64983c5b07bcda049d9a5df054238703ef345055
2016-03-23 10:52:19 +08:00
Eli Qiao b0ce382cf1 Use bay to init K8sAPI instead of bay_uuid
This patch aimed to reduce db call count when we invode k8sAPI.

For those user using bay name to do pod/rc/service operations, we
can saving a db call.

Change-Id: I1488d0526e1d444cb681b408f8a13ce25b4aee6f
2016-03-22 06:30:08 +08:00
Eli Qiao 2dfaa2e92b Pass host_config if docker api version >=1.19
mem_limit and memswap_limit are moved to host_config in docker client
api for API version >= 1.19

427e3a6023

Closes-Bug: #1557895
Change-Id: I34e5e49ae650219f986a2b0032df65672c319ec6
2016-03-17 08:59:49 +08:00
Hua Wang 292a195242 Remove hardcoded default docker client setting
This patch removes Hardcoded docker client settings and move them to configure
setting. Changes default value of DEFAULT_DOCKER_TIMEOUT from 10 to 60.

DEFAULT_DOCKER_TIMEOUT = 10 is too short, it brings troubles in some bad
networking environment (or bad performance swarm master), and this won't work
on gate.

The docker-py client's default value: DEFAULT_TIMEOUT_SECONDS = 60,
Suggest we set DEFAULT_DOCKER_TIMEOUT = 60,  as long as our rpc time_out.

There is a circle reference between magnum/common/docker_utils.py and
magnum/conductor/handlers/common/docker_client.py, so I merge them.

Co-Authored-By: Eli Qiao <liyong.qiao@intel.com>

Change-Id: I6046376cbf5eec6b0102956fd4e4f38b958dd80c
Closes-Bug: #1519714
2015-11-27 02:18:20 +00:00
Eli Qiao e36911f429 Swarm: Map master address to api_address based on TLS
api_address is a API address instead of master node's IP address.
This patch fix it by adding a new OutputMapping, it will help to handle
the mapping from master address to api_address.

Also test cases added.

Closes-Bug: #1514311
Change-Id: I47baf92dd466150adbd75746d0cb804d108f7d5f
2015-11-10 11:53:49 +08:00
lei-zhang-99cloud cb46cfafa8 Fix order of arguments in assertEqual
Some tests used incorrect order assertEqual(observed, expected).
The correct order expected by testtools is
assertEqual(expected, observed).
This patch fix the issue in the module magnum/tests/unit/common/.

Change-Id: Ib92006145171d265b836e0fc9951583414d83952
Partial-Bug: #1259292
2015-10-10 18:11:18 +08:00
Hongbin Lu 49cf17c12d Move 'docker_for_container' to a common module
This method is for obtaining a docker client that is used to
communicate with a swarm bay. Pulling it out of docker conductor
allows it to be reused later.

Change-Id: I495835595ee049103f97ee8b5bfe9eb74fe9ad45
Partial-Bug: #1503460
2015-10-07 10:49:51 -04:00