Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

manila share type: do not fail if share exists #2173

Merged

Conversation

queria
Copy link
Contributor

@queria queria commented Jul 29, 2024

When cifmw deployment/reproducer is rerun (e.g. for scale-out), it always fails in manila-create-default-resources hook since the default share already exists.

OSPRH-8983

As a pull request owner and reviewers, I checked that:

  • Appropriate testing is done and actually running
  • Appropriate documentation exists and/or is up-to-date:
    • README in the role
    • Content of the docs/source is reflecting the changes

@github-actions github-actions bot marked this pull request as draft July 29, 2024 11:46
Copy link

Thanks for the PR! ❤️
I'm marking it as a draft, once your happy with it merging and the PR is passing CI, click the "Ready for review" button below.

@@ -11,3 +11,8 @@
oc -n {{ namespace }} exec -it pod/openstackclient \
-- openstack share type create default false \
--snapshot-support True --create-share-from-snapshot-support True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would make it sense to split it into the create (and not fail if it exists)) and one to assign the additional spec

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes; wouldn't it?

---
- name: Create Manila resources needed for tempest run
  hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
  gather_facts: false
  vars:
    share_type_name: "default"
    driver_handles_share_servers: "False"
    extra_specs:
      snapshot_support: "True"
      create_share_from_snapshot_support: "True"
  tasks:
    - name: Check if the Manila share type already exists
       environment:
        KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
        PATH: "{{ cifmw_path }}"
      ansible.builtin.shell: |
        oc -n {{ namespace }} exec -it pod/openstackclient \
        -- openstack share type list -f value -c Name | grep -w "{{ share_type_name }}"
      register: share_type_exists
      ignore_errors: true
    - name: Create the Manila share type if it does not exist
      environment:
        KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
        PATH: "{{ cifmw_path }}"
      ansible.builtin.shell: |
        oc -n {{ namespace }} exec -it pod/openstackclient \
        openstack share type create "{{ share_type_name }}" \
           "{{ driver_handles_share_servers }}" \
           {{ ' '.join('--extra-specs ' + k + '=' + v for k, v in extra_specs.items()) }}
      when: share_type_exists.rc != 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm this seems as just more verbose 'exists - or create',
it does not cover the case when it may exist but without expected properties

what tosky suggests (and i agree its at least safer) is more like:

  • share type create (failed_when: failed && not already-exists)
  • share type update to set properties // assuming this does not fail if properties already match (will check)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated this to align with both - to do create|ignore-existing + update properties ... and use the syntax/approach based on vars for name and extra_specs dictionary.

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/7f96838ee9d140debe350e3aafb01e44

✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 35m 22s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 11m 23s
cifmw-crc-podified-edpm-baremetal RETRY_LIMIT in 10m 34s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 9m 40s
cifmw-pod-pre-commit FAILURE in 8m 05s

When cifmw deployment/reproducer is rerun (e.g. for scale-out),
it always fails in manila-create-default-resources hook since
the default share already exists.

OSPRH-8983
@queria queria force-pushed the manila-share-rerun branch from 5c0d22e to d401503 Compare July 31, 2024 10:44
@queria queria marked this pull request as ready for review August 1, 2024 09:24
@tosky
Copy link
Contributor

tosky commented Aug 1, 2024

Looks good now - @gouthampacha what do you think?

Copy link
Contributor

@gouthampacha gouthampacha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great; thanks @queria

@gouthampacha
Copy link
Contributor

/lgtm

Copy link
Contributor

openshift-ci bot commented Aug 1, 2024

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit b797369 into openstack-k8s-operators:main Aug 1, 2024
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants