Bug 2188319

Summary: [CEE/sd][cephadm-ansible] Unable to set & get global configuration values via cephadm-ansible module ceph_config
Product: [Red Hat Storage] Red Hat Ceph Storage Reporter: Tridibesh Chakraborty <trchakra>
Component: CephadmAssignee: Guillaume Abrioux <gabrioux>
Status: CLOSED ERRATA QA Contact: Mohit Bisht <mobisht>
Severity: medium Docs Contact: Ranjini M N <rmandyam>
Priority: unspecified    
Version: 5.3CC: cephqe-warriors, gabrioux, lob+redhat, mobisht, rmandyam, tpetr, tserlin, vereddy
Target Milestone: ---   
Target Release: 5.3z3   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: cephadm-ansible-1.15.0-1.el8cp Doc Type: Bug Fix
Doc Text:
Cause: `ceph config get` doesn't allow getting value when entity is 'global' Consequence: it makes the module fail because the module first tries to get the current value of the option for idempotency concern Fix: makes the module check in `ceph config dump` instead. Result: Setting or getting global configuration works.
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-23 00:19:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tridibesh Chakraborty 2023-04-20 12:56:34 UTC
Description of problem:

Customer is unable to set/get Global configurations via cephadm-ansible module ceph_config. It is failing complaining that it is unable to get the current value of the global configuration value, hence it is failing. 

~~~
fatal: [rhcs5-admin]: FAILED! => changed=false 
  ansible_facts:
    discovered_interpreter_python: /usr/libexec/platform-python
  msg: Can't get current value. who=global option=osd_pool_default_size
  rc: 1
~~~

Version-Release number of selected component (if applicable):
RHCS : 16.2.10-160.el8cp
Cephadm-ansible: 1.14.0-1.el8cp
cephadm: 16.2.10-160.el8cp

How reproducible:

- It is happening all the time in both customer environment and in my test lab


Steps to Reproduce:
1. Install cephadm and cephadm-ansible
2. Write a playbook with the task using ceph_config module
3. Use global on the `who`section to set/get any global configuration value (e.g. osd_pool_default_size)
4. Run the playbook to set/get the value
5. It will fail complaining below message 
~~~
msg: Can't get current value. who=global option=osd_pool_default_size
~~~
6. If I change it from global to any other type e.g. osd or mon, the playbook is running successfully

Actual results:
The ansible playbook is failing to set/get any global configuration value

Expected results:
The playbook should be able to set/get the value

Additional info:

If I run `ceph config set global <option> <value>`, it is successfully setting the value, where as playbook is failing for the same. 

~~~
[root@rhcs5-admin cephadm-ansible]# ceph config set global osd_pool_default_size 2
[root@rhcs5-admin cephadm-ansible]# ceph config dump |grep osd_pool_default_size
global                advanced  osd_pool_default_size                  2                                                                                                                   
[root@rhcs5-admin cephadm-ansible]# 
~~~

I have an observation, although the set value is showing in `ceph config dump`, I am unable to get the same via `ceph config get global <option>` command. It is failing throwing the error `Error EINVAL: unrecognized entity 'global'`. It is working fine for other types like mon, osd etc. So I am assuming as the config get command is not working for global configs, the playbook is unable to fetch the current value and failing to set it. 

~~~
[root@rhcs5-admin cephadm-ansible]# ceph config get global osd_pool_default_size
Error EINVAL: unrecognized entity 'global'
[root@rhcs5-admin cephadm-ansible]# ceph config get osd osd_pool_default_size
2
[root@rhcs5-admin cephadm-ansible]# 
~~~

Also, I have couple of observations from the /usr/share/cephadm-ansible/library/ceph_config.py file

If I see the description of `who` I can see it is pointing to daemons. So if it is true, then I guess we can't set global config values. We need to use `mon`, `mgr`, `osd`, `client` etc, not `global`.

~~~
    who:
        description:
            - which daemon the configuration should be set to
        required: true
~~~

Then we need to modify the example section in the file where it gives example of fetching a global config value. Also, in get operation, I believe `value` should not be there. This might be a typo. 

~~~
- name: get osd_pool_default_size value
  ceph_config:
    action: get
    who: global
    option: osd_pool_default_size
    value: 1    <== Might be a typo
~~~

In this case also, customer may still want to set global values via cephadm-ansible playbook. 

If the ceph_config module is supposed to set/get global config values, then we need this to be fixed as it is failing. 

Please note, I have tested the same on RHCS 6 and it is failing there also.

Comment 18 errata-xmlrpc 2023-05-23 00:19:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Red Hat Ceph Storage 5.3 Bug Fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:3259