diff --git a/group_vars/rgws.yml.sample b/group_vars/rgws.yml.sample index 78e69513f..1200c0593 100644 --- a/group_vars/rgws.yml.sample +++ b/group_vars/rgws.yml.sample @@ -58,7 +58,7 @@ dummy: # Default values are based from: https://access.redhat.com/documentation/en-us/red_hat_ceph_storage/2/html/red_hat_ceph_storage_hardware_guide/minimum_recommendations # These options can be passed using the 'ceph_rgw_docker_extra_env' variable. #ceph_rgw_docker_memory_limit: "{{ ansible_memtotal_mb }}m" -#ceph_rgw_docker_cpu_limit: 1 +#ceph_rgw_docker_cpu_limit: 8 #ceph_rgw_docker_extra_env: #ceph_config_keys: [] # DON'T TOUCH ME diff --git a/roles/ceph-rgw/defaults/main.yml b/roles/ceph-rgw/defaults/main.yml index 6ab3946a5..f77c1f6ab 100644 --- a/roles/ceph-rgw/defaults/main.yml +++ b/roles/ceph-rgw/defaults/main.yml @@ -50,7 +50,7 @@ copy_admin_key: false # Default values are based from: https://access.redhat.com/documentation/en-us/red_hat_ceph_storage/2/html/red_hat_ceph_storage_hardware_guide/minimum_recommendations # These options can be passed using the 'ceph_rgw_docker_extra_env' variable. ceph_rgw_docker_memory_limit: "{{ ansible_memtotal_mb }}m" -ceph_rgw_docker_cpu_limit: 1 +ceph_rgw_docker_cpu_limit: 8 ceph_rgw_docker_extra_env: ceph_config_keys: [] # DON'T TOUCH ME diff --git a/roles/ceph-rgw/templates/ceph-radosgw.service.j2 b/roles/ceph-rgw/templates/ceph-radosgw.service.j2 index 862f81da8..5c4366429 100644 --- a/roles/ceph-rgw/templates/ceph-radosgw.service.j2 +++ b/roles/ceph-rgw/templates/ceph-radosgw.service.j2 @@ -1,6 +1,7 @@ [Unit] Description=Ceph RGW After=docker.service +{% set cpu_limit = ansible_processor_vcpus|int if ceph_rgw_docker_cpu_limit|int > ansible_processor_vcpus|int else ceph_rgw_docker_cpu_limit|int %} [Service] EnvironmentFile=-/etc/environment @@ -9,9 +10,9 @@ ExecStartPre=-/usr/bin/docker rm ceph-rgw-{{ ansible_hostname }} ExecStart=/usr/bin/docker run --rm --net=host \ --memory={{ ceph_rgw_docker_memory_limit }} \ {% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%} - --cpus={{ ceph_rgw_docker_cpu_limit }} \ + --cpus={{ cpu_limit }} \ {% else -%} - --cpu-quota={{ ceph_rgw_docker_cpu_limit * 100000 }} \ + --cpu-quota={{ cpu_limit * 100000 }} \ {% endif -%} {% if not containerized_deployment_with_kv -%} -v /var/lib/ceph:/var/lib/ceph:z \