-
Notifications
You must be signed in to change notification settings - Fork 112
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
manila share type: do not fail if share exists #2173
Conversation
Thanks for the PR! ❤️ |
@@ -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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/7f96838ee9d140debe350e3aafb01e44 ✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 35m 22s |
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
5c0d22e
to
d401503
Compare
Looks good now - @gouthampacha what do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great; thanks @queria
/lgtm |
[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 |
b797369
into
openstack-k8s-operators:main
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: