]> 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, 16 Jan 2020 18:51:43 +0000 (13:51 -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>
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-run.sh.j2
roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2
roles/ceph-rgw/templates/ceph-radosgw.service.j2

index b39ec57496f79a92e0c5f2aba01c0ef40e0b4ed8..fdcb11a8fdbf8a1a3a72bbb3f983a04d8141c928 100644 (file)
     - import_role:
         name: ceph-handler
 
-    - 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] }}"
-
 
   tasks:
     - name: set_fact container_binary, container_binding_name, container_service_name, container_package_name
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 b2cd2b4e021b4e2d2cf86bf599ee141e8a698d57..498922aa316efa2ea4820e475348e30471c69441 100644 (file)
@@ -12,11 +12,7 @@ ExecStartPre=-/usr/bin/{{ container_binary }} stop rbd-target-api
 ExecStartPre=-/usr/bin/{{ container_binary }} rm rbd-target-api
 ExecStart=/usr/bin/{{ container_binary }} run --rm \
   --memory={{ ceph_rbd_target_api_docker_memory_limit }} \
-  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('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 \
   --cap-add=ALL \
index a69e9ac8a8c550c7e8c61d1b9081f361431ae80b..25503cee4fde1ce6b93aa271cf25255b5658e577 100644 (file)
@@ -12,11 +12,7 @@ ExecStartPre=-/usr/bin/{{ container_binary }} stop rbd-target-gw
 ExecStartPre=-/usr/bin/{{ container_binary }} rm rbd-target-gw
 ExecStart=/usr/bin/{{ container_binary }} run --rm \
   --memory={{ ceph_rbd_target_gw_docker_memory_limit }} \
-  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('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 \
   --cap-add=ALL \
index 36a78b3df0db7f8eb903e5fb87b98469e09a5c80..23803d036917fcd86f6ada85b05ba7005f76b377 100644 (file)
@@ -12,11 +12,7 @@ ExecStartPre=-/usr/bin/{{ container_binary }} stop tcmu-runner
 ExecStartPre=-/usr/bin/{{ container_binary }} rm tcmu-runner
 ExecStart=/usr/bin/{{ container_binary }} run --rm \
   --memory={{ ceph_tcmu_runner_docker_memory_limit }} \
-  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('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 c1ea65b7ed45fe11f7888c44ff0bbf86fd7c874c..2feccc600905022bcfed542759b1d77eab651955 100644 (file)
@@ -13,11 +13,7 @@ ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-mds-{{ ansible_hostname
 ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-mds-{{ ansible_hostname }}
 ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
   --memory={{ ceph_mds_docker_memory_limit }} \
-  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('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 f6430ccc93a31c33807f3c143d629f48216ba39d..b7af6e04b2f09a47114dc195ad79bc1890222421 100644 (file)
@@ -12,11 +12,7 @@ ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-mgr-{{ ansible_hostname
 ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-mgr-{{ ansible_hostname }}
 ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
   --memory={{ ceph_mgr_docker_memory_limit }} \
-  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('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 \
   -v /etc/ceph:/etc/ceph:z \
   -v /var/run/ceph:/var/run/ceph:z \
index 68f7b587dec7072e623ac76c70fdd454530fe016..f9a01b1b3e07e6230100406c0fbd0c9f2e6c59f3 100644 (file)
@@ -12,11 +12,7 @@ ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-mon-%i
 ExecStartPre=/bin/sh -c '"$(command -v mkdir)" -p /etc/ceph /var/lib/ceph/mon'
 ExecStart=/usr/bin/{{ container_binary }} run --rm --name ceph-mon-%i \
   --memory={{ ceph_mon_docker_memory_limit }} \
-{% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('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 \
   -v /etc/ceph:/etc/ceph:z \
   -v /var/run/ceph:/var/run/ceph:z \
index 0c2cab34864c6022e39d94a2cd628b33720c1a7e..9b3bd6e9e14d4dc22ee93795a4727ab201560937 100644 (file)
@@ -20,11 +20,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_compare('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 5223588c87e40573c956075b61b420b429047c29..42cac9a2de08224a057c991469f9c4fa992c0ba3 100644 (file)
@@ -12,11 +12,7 @@ ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-rbd-mirror-{{ ansible_ho
 ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-rbd-mirror-{{ ansible_hostname }}
 ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
   --memory={{ ceph_rbd_mirror_docker_memory_limit }} \
-  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('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 aa9422aab2d9760002d4322d61f73c1ec081129b..99586ad93c5b53a82f694b8e9a17bc1cee085391 100644 (file)
@@ -13,11 +13,7 @@ ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-rgw-{{ ansible_hostname
 ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-rgw-{{ ansible_hostname }}-${INST_NAME}
 ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
   --memory={{ ceph_rgw_docker_memory_limit }} \
-  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('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 -%}