]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
containers: use --cpus instead --cpu-quota
authorGuillaume Abrioux <gabrioux@redhat.com>
Fri, 10 Jan 2020 09:55:06 +0000 (10:55 +0100)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Thu, 28 Jan 2021 21:37:50 +0000 (16:37 -0500)
When using docker 1.13.1, the current condition:

```
{% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('13', '>=')) or container_binary == 'podman' -%}
```

is wrong because it compares the first digit (1) whereas it should
compare the second one.
It means we always use `--cpu-quota` although documentation recommend
using `--cpus` when docker version is 1.13.1 or higher.

From the doc:
> --cpu-quota=<value> Impose a CPU CFS quota on the container. The number of
> microseconds per --cpu-period that the container is limited to before
> throttled. As such acting as the effective ceiling.
> If you use Docker 1.13 or higher, use --cpus instead.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 3e262e072b0e86bbb431c47bc691bcad70783443)

infrastructure-playbooks/docker-to-podman.yml
roles/ceph-container-common/tasks/main.yml
roles/ceph-iscsi-gw/templates/rbd-target-api.service.j2
roles/ceph-iscsi-gw/templates/rbd-target-gw.service.j2
roles/ceph-iscsi-gw/templates/tcmu-runner.service.j2
roles/ceph-mds/templates/ceph-mds.service.j2
roles/ceph-mgr/templates/ceph-mgr.service.j2
roles/ceph-mon/templates/ceph-mon.service.j2
roles/ceph-osd/templates/ceph-osd.service.j2
roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2
roles/ceph-rgw/templates/ceph-radosgw.service.j2

index 80a28ada4b0f961bf23193fb7d29ddb538492dd6..a6d2cb703834989057bbfd978aab415f1f45751f 100644 (file)
     - import_role:
         name: ceph-handler
 
-    - name: with docker configuration
-      when: container_binary == 'docker'
-      block:
-        - name: get docker version
-          command: docker --version
-          changed_when: false
-          check_mode: no
-          register: ceph_docker_version
-
-        - name: set_fact ceph_docker_version ceph_docker_version.stdout.split
-          set_fact:
-            ceph_docker_version: "{{ ceph_docker_version.stdout.split(' ')[2] }}"
-
     - name: set_fact docker2podman and container_binary
       set_fact:
         docker2podman: True
index f575b2fb62cce485e07e6d1cdfcc6314eefd34a3..aa9139b0dac10095dd1fd3087fac98282b7584a1 100644 (file)
@@ -2,19 +2,6 @@
 - name: include prerequisites.yml
   include_tasks: prerequisites.yml
 
-- name: get docker version
-  block:
-    - name: get docker version
-      command: docker --version
-      changed_when: false
-      check_mode: no
-      register: ceph_docker_version
-
-    - name: set_fact ceph_docker_version ceph_docker_version.stdout.split
-      set_fact:
-        ceph_docker_version: "{{ ceph_docker_version.stdout.split(' ')[2] }}"
-  when: container_binary == 'docker'
-
 - name: include registry.yml
   include_tasks: registry.yml
   when: ceph_docker_registry_auth | bool
index 3f2f594f036e48c9d55d5db51872448889a3e9f7..484b0f93e02537b8399c3a02361ff0d31409098b 100644 (file)
@@ -21,11 +21,7 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm \
   -d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
 {% endif %}
   --memory={{ ceph_rbd_target_api_docker_memory_limit }} \
-  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ ceph_rbd_target_api_docker_cpu_limit }} \
-  {% else -%}
-  --cpu-quota={{ ceph_rbd_target_api_docker_cpu_limit * 100000 }} \
-  {% endif -%}
   -v /etc/localtime:/etc/localtime:ro \
   --privileged \
   --net=host \
index ef56edb3c61b05ce0e4ce4e7e23ef06d76b3291b..b6baf8c3238995cd2a509877e7e63bea99621cce 100644 (file)
@@ -21,11 +21,7 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm \
   -d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
 {% endif %}
   --memory={{ ceph_rbd_target_gw_docker_memory_limit }} \
-  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ ceph_rbd_target_gw_docker_cpu_limit }} \
-  {% else -%}
-  --cpu-quota={{ ceph_rbd_target_gw_docker_cpu_limit * 100000 }} \
-  {% endif -%}
   -v /etc/localtime:/etc/localtime:ro \
   --privileged \
   --net=host \
index b488acf1e18175a6487a8dd298f52ef3e0a35f2f..5809ed3569052b24941314a6025baa519ebe6572 100644 (file)
@@ -21,11 +21,7 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm \
   -d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
 {% endif %}
   --memory={{ ceph_tcmu_runner_docker_memory_limit }} \
-  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ ceph_tcmu_runner_docker_cpu_limit }} \
-  {% else -%}
-  --cpu-quota={{ ceph_tcmu_runner_docker_cpu_limit * 100000 }} \
-  {% endif -%}
   -v /etc/localtime:/etc/localtime:ro \
   --privileged \
   --net=host \
index fa84c6bf72f3e07b0f2a0bc179906fecac65ae46..6d60fd25af3962a0e63c7ce22462147124ceb2e6 100644 (file)
@@ -22,11 +22,7 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
   -d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
 {% endif %}
   --memory={{ ceph_mds_docker_memory_limit }} \
-  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ cpu_limit }} \
-  {% else -%}
-  --cpu-quota={{ cpu_limit * 100000 }} \
-  {% endif -%}
   -v /var/lib/ceph:/var/lib/ceph:z \
   -v /etc/ceph:/etc/ceph:z \
   -v /var/run/ceph:/var/run/ceph:z \
index d187c2aba41c2a0be3834ffe2e8e6476fd4a80ea..5e4874837e9359e892c3570a39c281f96dac57cf 100644 (file)
@@ -21,11 +21,7 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
   -d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
 {% endif %}
   --memory={{ ceph_mgr_docker_memory_limit }} \
-  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ ceph_mgr_docker_cpu_limit }} \
-  {% else -%}
-  --cpu-quota={{ ceph_mgr_docker_cpu_limit * 100000 }} \
-  {% endif -%}
   -v /var/lib/ceph:/var/lib/ceph:z,rshared \
   -v /etc/ceph:/etc/ceph:z \
   -v /var/run/ceph:/var/run/ceph:z \
index a961bf220a0b897255a829df8ff30583c31e446a..a0f47786e04f51438a6c6f9835f47889b580539d 100644 (file)
@@ -20,11 +20,7 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm --name ceph-mon-%i \
   -d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
 {% endif %}
   --memory={{ ceph_mon_docker_memory_limit }} \
-{% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ ceph_mon_docker_cpu_limit }} \
-{% else -%}
-  --cpu-quota={{ ceph_mon_docker_cpu_limit * 100000 }} \
-{% endif -%}
   -v /var/lib/ceph:/var/lib/ceph:z,rshared \
   -v /etc/ceph:/etc/ceph:z \
   -v /var/run/ceph:/var/run/ceph:z \
index 73f8190d2edb862a9f2fe833e3f7185d44fcbaa5..32d78a5668b2c03e1ef942311f26e30a04684cb2 100644 (file)
@@ -34,11 +34,7 @@ numactl \
   {% if osd_objectstore == 'filestore' -%}
   --memory={{ ceph_osd_docker_memory_limit }} \
   {% endif -%}
-  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ cpu_limit }} \
-  {% else -%}
-  --cpu-quota={{ cpu_limit * 100000 }} \
-  {% endif -%}
   {% if ceph_osd_docker_cpuset_cpus is defined -%}
   --cpuset-cpus='{{ ceph_osd_docker_cpuset_cpus }}' \
   {% endif -%}
index 191100bec1152aadce3820e82a498064191fcc4a..830d29ae245bfdc73487cbfd98a8f628ab7e50ef 100644 (file)
@@ -21,11 +21,7 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
   -d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
 {% endif %}
   --memory={{ ceph_rbd_mirror_docker_memory_limit }} \
-  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ ceph_rbd_mirror_docker_cpu_limit }} \
-  {% else -%}
-  --cpu-quota={{ ceph_rbd_mirror_docker_cpu_limit * 100000 }} \
-  {% endif -%}
   -v /var/lib/ceph:/var/lib/ceph:z \
   -v /etc/ceph:/etc/ceph:z \
   -v /var/run/ceph:/var/run/ceph:z \
index aaa8f3a1f82410e83b0c248e776eccbdc54b95e1..54bd5b0c10d1071df1238f9e535477509f51945f 100644 (file)
@@ -22,11 +22,7 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
   -d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
 {% endif %}
   --memory={{ ceph_rgw_docker_memory_limit }} \
-  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ cpu_limit }} \
-  {% else -%}
-  --cpu-quota={{ cpu_limit * 100000 }} \
-  {% endif -%}
   {% if ceph_rgw_docker_cpuset_cpus is defined -%}
   --cpuset-cpus="{{ ceph_rgw_docker_cpuset_cpus }}" \
   {% endif -%}