-
Notifications
You must be signed in to change notification settings - Fork 94
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
base: master
Are you sure you want to change the base?
Dev: ui_resource: Give warning start/stop/restart if "is-managed" or "maintenance" get detected #859
Conversation
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 code is incomplete since the maintenance
mode has 3 different levels: cluster/node/resource.
e7bdd8b
to
90a3b6b
Compare
90a3b6b
to
459941e
Compare
6ae82bf
to
0f77bd9
Compare
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 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): |
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.
How about,
s/is_node_running_resource_in_maintenance/is_node_in_maintenance_for_the_running_resource/
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.
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) |
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 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)
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.
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
?
crmsh/ui_resource.py
Outdated
@@ -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)) |
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.
Confusing terminology here, since "unmanaged" does not match to the fact when the "maintenance" mode is 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.
@zzhou1 From the display of crm_mon
, both maintenance and is-manage=false situation, the resource status always show unmanaged
0f77bd9
to
ae0b247
Compare
ae0b247
to
058875f
Compare
It should better to give warning when start/stop/restart a RA while this RA is in
unmanaged
modeAdd checking items in
is_managed
:Example: