-
Notifications
You must be signed in to change notification settings - Fork 347
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
vmware_cluster_ha - add set of heartbeat datastores #1732
Open
Nina2244
wants to merge
11
commits into
ansible-collections:main
Choose a base branch
from
it-at-m:vmware_cluster_ha
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8989abb
Add the possibility to set the heartbeat datastores of an cluster
a8799c4
Add the changelog File
e343d4c
replace False/True with false/true
981647e
Add the Pull Request Nr
4744cda
Missing ask for len
e815086
add the thing @mariolenz wanted and the posibility to set the hb ds c…
97f93ab
self to much
d91984b
Merge branch 'ansible-collections:main' into vmware_cluster_ha
Nina2244 d1f53ba
Merge branch 'ansible-collections:main' into vmware_cluster_ha
Nina2244 3039365
Merge branch 'ansible-collections:main' into vmware_cluster_ha
Nina2244 d6b8ae5
Merge branch 'ansible-collections:main' into vmware_cluster_ha
Nina2244 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
minor_changes: | ||
- vmware_cluster_ha - Add the possibility to set the heartbeat datastores of an cluster. (https://github.com/ansible-collections/community.vmware/pull/1732) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -172,6 +172,20 @@ | |||||||
- A dictionary of advanced HA settings. | ||||||||
default: {} | ||||||||
type: dict | ||||||||
heartbeat_datastores: | ||||||||
description: | ||||||||
- A list of the heartbeat datastores. | ||||||||
- If list ist [] then all datastores of the cluster will be set as heartbeat_datastores. | ||||||||
type: list | ||||||||
elements: str | ||||||||
heartbeat_datastore_candidate_policy: | ||||||||
description: | ||||||||
- Heartbeat datastore selection policy | ||||||||
- allFeasibleDs -> Automatically select datastores accessible from the hosts. Causes that C(heartbeat_datastores) will be ignored. | ||||||||
- userSelectedDs -> Use datastores only from the specified list. | ||||||||
- allFeasibleDsWithUserPreference -> Use datastores from the specified list and complement automatically if needed. | ||||||||
type: str | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
choices: ['allFeasibleDs', 'userSelectedDs', 'allFeasibleDsWithUserPreference'] | ||||||||
apd_response: | ||||||||
description: | ||||||||
- VM storage protection setting for storage failures categorized as All Paths Down (APD). | ||||||||
|
@@ -256,6 +270,7 @@ | |||||||
vmware_argument_spec, | ||||||||
wait_for_task, | ||||||||
option_diff, | ||||||||
find_datastore_by_name, | ||||||||
) | ||||||||
from ansible.module_utils._text import to_native | ||||||||
|
||||||||
|
@@ -293,6 +308,22 @@ def __init__(self, module): | |||||||
else: | ||||||||
self.changed_advanced_settings = None | ||||||||
|
||||||||
if self.params.get('heartbeat_datastore_candidate_policy') == "allFeasibleDs": | ||||||||
self.heartbeat_datastores_var = None | ||||||||
else: | ||||||||
self.heartbeat_datastores_var = self.params.get('heartbeat_datastores') | ||||||||
|
||||||||
if self.heartbeat_datastores_var == []: | ||||||||
self.heartbeat_datastores = self.cluster.datastore | ||||||||
else: | ||||||||
self.heartbeat_datastores = [] | ||||||||
for ds_name in (self.heartbeat_datastores_var or []): | ||||||||
ds = find_datastore_by_name(self.content, ds_name, self.datacenter) | ||||||||
if ds is None: | ||||||||
self.module.fail_json(msg="Datastore %s does not exist." % ds_name) | ||||||||
else: | ||||||||
self.heartbeat_datastores.append(ds) | ||||||||
|
||||||||
def get_failover_hosts(self): | ||||||||
""" | ||||||||
Get failover hosts for failover_host_admission_control policy | ||||||||
|
@@ -324,6 +355,10 @@ def check_ha_config_diff(self): | |||||||
das_config.vmMonitoring != self.params.get("ha_vm_monitoring") | ||||||||
or das_config.hostMonitoring != self.params.get("ha_host_monitoring") | ||||||||
or das_config.admissionControlEnabled != self.ha_admission_control | ||||||||
or self.params.get("heartbeat_datastore_candidate_policy") # Only needed if no default value is there | ||||||||
and das_config.heartbeat_datastore_candidate_policy != self.params.get("heartbeat_datastore_candidate_policy") | ||||||||
or self.heartbeat_datastores_var # Only needed if no default value is there | ||||||||
and len([ds for ds in das_config.heartbeatDatastore if ds.name not in set(ds.name for ds in self.heartbeat_datastores)]) != 0 | ||||||||
or das_config.defaultVmSettings.restartPriority | ||||||||
!= self.params.get("ha_restart_priority") | ||||||||
or das_config.defaultVmSettings.isolationResponse | ||||||||
|
@@ -447,6 +482,12 @@ def configure_ha(self): | |||||||
cluster_config_spec.dasConfig.hostMonitoring = self.params.get('ha_host_monitoring') | ||||||||
cluster_config_spec.dasConfig.vmMonitoring = self.params.get('ha_vm_monitoring') | ||||||||
|
||||||||
if self.params.get("heartbeat_datastore_candidate_policy"): | ||||||||
cluster_config_spec.dasConfig.hBDatastoreCandidatePolicy = self.params.get("heartbeat_datastore_candidate_policy") | ||||||||
|
||||||||
if self.heartbeat_datastores_var: | ||||||||
cluster_config_spec.dasConfig.heartbeatDatastore = self.heartbeat_datastores | ||||||||
|
||||||||
if self.changed_advanced_settings: | ||||||||
cluster_config_spec.dasConfig.option = self.changed_advanced_settings | ||||||||
|
||||||||
|
@@ -482,6 +523,10 @@ def main(): | |||||||
default='none', | ||||||||
choices=['none', 'powerOff', 'shutdown']), | ||||||||
advanced_settings=dict(type='dict', default=dict(), required=False), | ||||||||
heartbeat_datastores=dict(type='list', elements='str', required=False), | ||||||||
heartbeat_datastore_candidate_policy=dict(type='str', | ||||||||
required=False, | ||||||||
choices=['allFeasibleDs', 'userSelectedDs', 'allFeasibleDsWithUserPreference']), | ||||||||
# HA VM Monitoring related parameters | ||||||||
ha_vm_monitoring=dict(type='str', | ||||||||
choices=['vmAndAppMonitoring', 'vmMonitoringOnly', 'vmMonitoringDisabled'], | ||||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.