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

Dev: ui_resource: Give warning start/stop/restart if "is-managed" or "maintenance" get detected #859

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

liangxin1300
Copy link
Collaborator

@liangxin1300 liangxin1300 commented Aug 6, 2021

It should better to give warning when start/stop/restart a RA while this RA is in unmanaged mode

Add checking items in is_managed :

  • check if all nodes are in maintenance
  • check if node running this resource is in maintenance
  • check the rsc maintenance meta attribute

Example:

# crm resource start d 
WARNING: resource.start: Resource d is unmanaged (cluster property maintenance-mode is true)
# crm resource stop d
WARNING: resource.stop: Resource d is unmanaged (node which running "d" is in maintenance)
# crm node standby 15sp2-1
WARNING: node.standby: Node "15sp2-1" is in maintenance

Copy link
Contributor

@zzhou1 zzhou1 left a comment

Choose a reason for hiding this comment

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

The code is incomplete since the maintenance mode has 3 different levels: cluster/node/resource.

@liangxin1300 liangxin1300 changed the title Dev: ui_resource: Add warning if detect maintenance-mode is true while start/stop/add RA Dev: ui_resource: Add warning if detect maintenance-mode is true while start/stop/restart RA Aug 6, 2021
@liangxin1300 liangxin1300 changed the title Dev: ui_resource: Add warning if detect maintenance-mode is true while start/stop/restart RA Dev: ui_resource: Add warning if detect resource is unmanaged while start/stop/restart RA Aug 6, 2021
@liangxin1300 liangxin1300 force-pushed the 20210806_maintenance_warning branch 5 times, most recently from 6ae82bf to 0f77bd9 Compare August 10, 2021 00:05
@liangxin1300 liangxin1300 changed the title Dev: ui_resource: Add warning if detect resource is unmanaged while start/stop/restart RA Dev: ui_resource: Reject and give error if detect resource is unmanaged while start/stop/restart RA Aug 10, 2021
Copy link
Contributor

@zzhou1 zzhou1 left a comment

Choose a reason for hiding this comment

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

please tweak the title, something like,

Dev: ui_resource: reject start/stop/restart if "is-managed" or "maintenance" get detected

crmsh/xmlutil.py Outdated
"""
return all([self.is_node_in_maintenance(node) for node in self.list_nodes()])

def is_node_running_resource_in_maintenance(self, rsc_id):
Copy link
Contributor

Choose a reason for hiding this comment

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

How about,
s/is_node_running_resource_in_maintenance/is_node_in_maintenance_for_the_running_resource/

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed

# then check the rsc maintenance meta attribute
attr = get_attr_value(rsc_meta_node, "maintenance")
if attr and is_xs_boolean_true(attr):
return False, "resource \"{}\" is in maintenance".format(ident)
Copy link
Contributor

Choose a reason for hiding this comment

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

The above "maintenance" checks are not the scope of is_managed(). Since, "maintenance" and "is-managed" are two different terminologies and not fit into the current function name itself all together. I'm thinking their function names something like,

is_managed(rsc)
is_maintenance(rsc)
is_managed_or_maintenance(rsc)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

From display of crm_mon, pacemaker show both situations as unmanaged for the resource
How about change the function name as is_managed_or_maintenance?

@@ -293,6 +293,9 @@ def _commit_meta_attrs(self, context, resources, name, value):

rc = True
for rsc in resources:
rc, reason = xmlutil.RscState().is_managed(rsc)
if not rc:
context.error("Resource {} is unmanaged ({})".format(rsc, reason))
Copy link
Contributor

Choose a reason for hiding this comment

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

Confusing terminology here, since "unmanaged" does not match to the fact when the "maintenance" mode is true.

Copy link
Collaborator Author

@liangxin1300 liangxin1300 Aug 11, 2021

Choose a reason for hiding this comment

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

@zzhou1 From the display of crm_mon, both maintenance and is-manage=false situation, the resource status always show unmanaged

@liangxin1300 liangxin1300 changed the title Dev: ui_resource: Reject and give error if detect resource is unmanaged while start/stop/restart RA Dev: ui_resource: Give warning start/stop/restart if "is-managed" or "maintenance" get detected Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants