-
Notifications
You must be signed in to change notification settings - Fork 92
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
DR-Failback errors when gathering/detecting HA VM as well as storage domains #649
DR-Failback errors when gathering/detecting HA VM as well as storage domains #649
Conversation
…domains Signed-off-by: Shubha Kulkarni <[email protected]>
a742dad
to
88fab7b
Compare
…domains Signed-off-by: Shubha Kulkarni <[email protected]>
Signed-off-by: Shubha Kulkarni <[email protected]>
Signed-off-by: Shubha Kulkarni <[email protected]>
May I request a review here? |
1 similar comment
May I request a review here? |
ovirt_storage_domain_info: | ||
pattern: > | ||
name={{ storage['dr_' + dr_source_map + '_name'] }} and | ||
datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and {{ dr_active_domain_search }} |
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.
Please fix 2 trailing spaces that cause ansible-lint 6
to fail, which breaks the CI.
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.
Updated.
@@ -2,23 +2,37 @@ | |||
- name: Remove valid storage domain main block | |||
block: | |||
- name: Fetch active/maintenance/detached storage domain for remove |
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.
This comment is relevant only if the next comment (with not-splitting the original code into 3 tasks) doesn't work...
Fix name from "Fetch active/maintenance/detached
" into "Fetch active
".
Since the "maintenance
" and "detached
" are now separate tasks.
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.
- name: Fetch active/maintenance/detached storage domain for remove | |
- name: Fetch active domain for remove |
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.
Updated
@@ -2,23 +2,37 @@ | |||
- name: Remove valid storage domain main block | |||
block: | |||
- name: Fetch active/maintenance/detached storage domain for remove | |||
ovirt_storage_domain_info: | |||
pattern: > |
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 must admit I don't have a vast Ansible experience, but could some "playing" with ()
be a more simple option to fix the original code instead of splitting the code into 3 tasks with some amount of duplicate code?
Not sure whether the following syntax will work:
pattern: >
name={{ storage['dr_' + dr_source_map + '_name'] }} and
(
(
datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and
(
{{ dr_active_domain_search }} or {{ dr_maintenance_domain_search }}
)
)
or
{{ dr_unattached_domain_search }}
)
If not then let's leave your solution with 3 separate tasks.
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 must admit I don't have a vast Ansible experience, but could some "playing" with
()
be a more simple option to fix the original code instead of splitting the code into 3 tasks with some amount of duplicate code? Not sure whether the following syntax will work:pattern: > name={{ storage['dr_' + dr_source_map + '_name'] }} and ( ( datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and ( {{ dr_active_domain_search }} or {{ dr_maintenance_domain_search }} ) ) or {{ dr_unattached_domain_search }} )
If not then let's leave your solution with 3 separate tasks.
Thanks for taking a look at the changes. I would have preferred to have one common condition as well. However, for readability and ease of maintenance sake, I feel my new approach is much simpler. I hope that works for you as well.
Sorry for keeping you waiting. |
…domains Signed-off-by: Shubha Kulkarni <[email protected]>
Signed-off-by: Shubha Kulkarni <[email protected]>
…domains Signed-off-by: Shubha Kulkarni <[email protected]>
Signed-off-by: Shubha Kulkarni <[email protected]>
…bhaOracle/ovirt-ansible-collection into sd-detection-during-failback
I made the changes based on the feedback. Can you please review/merge? |
/ost |
- name: Fetch active storage domain for remove | ||
ovirt_storage_domain_info: | ||
pattern: > | ||
name={{ storage['dr_' + dr_source_map + '_name'] }} and |
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.
1 small indentation fix: move 1 character to the left.
auth: "{{ ovirt_auth }}" | ||
register: storage_domain_info_active | ||
|
||
- name: Fetch maintenance storage domain for remove |
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.
This section (lines 28-34) seems duplicate (same as lines 12-18)?
AFAIU lines 28-34 should be removed.
auth: "{{ ovirt_auth }}" | ||
register: storage_domain_info_maintenance | ||
|
||
- name: Fetch detached storage domain for remove |
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.
This section (lines 20-26) seems duplicate (same as lines 4-10) + wrong name?
AFAIU lines 20-26 should be removed.
…domains Signed-off-by: Shubha Kulkarni <[email protected]>
name={{ storage['dr_' + dr_source_map + '_name'] }} and | ||
datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and {{ dr_active_domain_search }} | ||
auth: "{{ ovirt_auth }}" | ||
register: storage_domain_info_active |
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.
storage_domain_info_active
-->
storage_domain_info_detached
ovirt_storage_domain_info: | ||
pattern: > | ||
name={{ storage['dr_' + dr_source_map + '_name'] }} and | ||
datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and {{ dr_active_domain_search }} |
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.
datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and {{ dr_active_domain_search }}
-->
{{ dr_unattached_domain_search }}
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.
datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and {{ dr_active_domain_search }}
-->{{ dr_unattached_domain_search }}
Thanks for the feedback and review!!
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.
The last ones are the minuses of duplicate code :)
…domains Signed-off-by: Shubha Kulkarni <[email protected]>
roles/disaster_recovery/tasks/clean/remove_valid_filtered_master_domains.yml
Outdated
Show resolved
Hide resolved
roles/disaster_recovery/tasks/clean/remove_valid_filtered_master_domains.yml
Outdated
Show resolved
Hide resolved
…er_domains.yml move 1 character to the left Co-authored-by: Pavel Bar <[email protected]>
…er_domains.yml Remove redundant parts and trailing space Co-authored-by: Pavel Bar <[email protected]>
…domains Signed-off-by: Shubha Kulkarni <[email protected]>
…domains Signed-off-by: Shubha Kulkarni <[email protected]>
…domains Signed-off-by: Shubha Kulkarni <[email protected]>
…er_domains.yml move 1 character to the left Co-authored-by: Pavel Bar <[email protected]>
…er_domains.yml Remove redundant parts and trailing space Co-authored-by: Pavel Bar <[email protected]>
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.
@shubhaOracle did you perform any validations on your environment?
If not, can you please do and then acknowledge that it's working?
I probably don't have relevant permissions, since I don't see this magic button :) |
|
|
---> There are two issues that are fixed with this PR
Regarding commit messages - |
|
…ncorrect conditional checks. Failback operation with a Highly Available VM but encountered an Unexpected templating type error.Change attribute to list. Signed-off-by: Shubha Kulkarni <[email protected]>
…ncorrect conditional checks for detached storage domain. Failback operation with a Highly Available VM but encountered an Unexpected templating type error.Change attribute to list. Signed-off-by: Shubha Kulkarni <[email protected]>
…xed conditional checks for detached storage domains. Removed redundant variable quotes to detect Highly Available VM properly Signed-off-by: Shubha Kulkarni <[email protected]>
@shubhaOracle Could you please rebase on top of master branch? |
@shubhaOracle Hi, can it be closed if not relevant? |
Can be reopened if still relevant. |
DR-Failback errors when gathering/detecting HA VM as well as storage domains
Issue:
Storage domain detection was not finding any storage domains due to incorrect conditional checks.
Failback operation with a Highly Available VM but encountered an Unexpected templating type error occurred on that must be str, not list
Fix:
Created separate tasks for detecting domains in various states and fixed conditional checks.
Removed redundant variable quotes.
Signed-off-by: Shubha Kulkarni [email protected]