Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1808424

Summary: Validation for CephExtraKeys and CephExternalMultiConfig
Product: Red Hat OpenStack Reporter: John Fulton <johfulto>
Component: openstack-tripleo-validationsAssignee: John Fulton <johfulto>
Status: CLOSED DUPLICATE QA Contact: Yogev Rabl <yrabl>
Severity: low Docs Contact:
Priority: high    
Version: 16.0 (Train)CC: fpantano, gcharot, gfidente, jjoyce, jschluet, pgrist, slinaber, tvignaud
Target Milestone: z5Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-14 14:33:26 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:
Bug Depends On:    
Bug Blocks: 1802774    

Description John Fulton 2020-02-28 13:52:34 UTC
If the contents of CephExternalMultiConfig and CephExtraKeys are not valid the deployment will fail. Users can read the failure message and determine how to get the format valid but it requires some understanding of how ceph-ansible works. It would be nicer if there was a validation to help the user.


Inspect the contents of CephExtraKeys to ensure we have name, caps, mode, key.
Ensure caps has mgr, mon, osd. Ensure key matches "^[a-zA-Z0-9+/]{38}==$". etc
and give a meaningful error message to help the user understand more exactly
where inside of CephExtraKeys they had the problem.

  CephExtraKeys:
        - name: "client.glance"
          caps:
            mgr: "allow *"
            mon: "profile rbd"
            osd: "profile rbd pool=images"
          key: "AQBRgQ9eAAAAABAAv84zEilJYZPNuJ0Iwn9Ndg=="
          mode: "0600"

Similarly we could validate CephExternalMultiConfig. E.g. if a user doesn't supply
the "cluster" parameter then this loop will fail but the user probably wouldn't
understand why without reading the code.

 https://review.opendev.org/#/c/702143/23/tripleo_ansible/roles/tripleo_ceph_work_dir/tasks/prepare.yml

So we should ensure they have all the paramters like this:

  CephExternalMultiConfig:
    - cluster: 'ceph2'
      fsid: 'af25554b-42f6-4d2b-9b9b-d08a1132d3e8'
      external_cluster_mon_ips: '172.18.0.5,172.18.0.6,172.18.0.7'
      keys:
        - name: "client.openstack"
          caps:
            mgr: "allow *"
            mon: "profile rbd"
            osd: "osd: profile rbd pool=volumes, profile rbd pool=backups, profile rbd pool=vms, profile rbd pool=images"
          key: "AQCwmeRcAAAAABAA6SQU/bGqFjlfLro5KxrB1Q=="
          mode: "0600"
      dashboard_enabled: false
    - cluster: 'ceph3'
      fsid: 'e2cba068-5f14-4b0f-b047-acf375c0004a'
      external_cluster_mon_ips: '172.18.0.8,172.18.0.9,172.18.0.10'
      keys:
        - name: "client.openstack"
          caps:
            mgr: "allow *"
            mon: "profile rbd"
            osd: "osd: profile rbd pool=volumes, profile rbd pool=backups, profile rbd pool=vms, profile rbd pool=images"
          key: "AQCwmeRcAAAAABAA6SQU/bGqFjlfLro5KxrB2Q=="
          mode: "0600"
      dashboard_enabled: false

Loop through it to:

- ensure the fsid is a valid uuid
- ensure the key matches "^[a-zA-Z0-9+/]{38}==$"
- ensure external_cluster_mon_ips is valid
- etc.

Then if they don't match, we say what field failed for what reason.

More indepth descriptions of these lists of maps can be found at
https://review.opendev.org/#/c/707847/

Comment 2 John Fulton 2020-07-16 14:41:34 UTC
One could validation this bug with a positive test by using generating valid input with the result of bug 1857776
One could validation this bug with a series of negative tests by using generating valid input with the result of bug 1857776 and the modifying the output to have invalid syntax

Comment 8 John Fulton 2021-01-14 14:33:26 UTC
As per a conversation with PM, now that 1857776 is resolved and docs [1] have our users generating these files automatically, the probability of encountering the situation this BZ was opened to prevent is eliminated. Thus, from a practical point of view this bug is no longer necessary.

[1] https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.1/html/distributed_compute_node_and_storage_deployment/assembly_deploying-storage-at-the-edge#deploying_edge_sites_with_storage

*** This bug has been marked as a duplicate of bug 1857776 ***