Skip to content

Conversation

@liangxin1300
Copy link
Collaborator

@liangxin1300 liangxin1300 commented Apr 17, 2025

When cluster is already started, the return value of crm cluster start is 1, which was expected as 0

# crm cluster start
INFO: The cluster stack already started on node1
# echo $?
1

This regression was introduced from #1692

logger.error('%s', msg)
logger.info("Please try 'crm cluster start' on each node")
return False
return
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is NoSSHEror also changed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It also changed to return False in #1692, which was different on do_stop side

Or, this time we define NoSSHError's return code as False, on both start and stop sides?
@zzhou1 What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

It makes sense to me to stay as "1"


adm@tw-1:~> sudo crm cluster start --all; echo $?
INFO: The cluster stack already started on tw-1
ERROR: cluster.start: Failed to run command systemctl is-active 'pacemaker.service' on adm@tw-2: adm@tw-2: Permission denied (publickey,password,keyboard-interactive). Environment variable SSH_AUTH_SOCK does not exist. Please check whether ssh-agent is available and consider using "sudo --preserve-env=SSH_AUTH_SOCK".
1

adm@tw-1:~> sudo crm cluster stop --all; echo $?
ERROR: cluster.stop: Failed to run command systemctl is-active 'corosync.service' on adm@tw-2: adm@tw-2: Permission denied (publickey,password,keyboard-interactive). Environment variable SSH_AUTH_SOCK does not exist. Please check whether ssh-agent is available and consider using "sudo --preserve-env=SSH_AUTH_SOCK".
1

Copy link
Contributor

Choose a reason for hiding this comment

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

And, all the following should return "0"

adm@tw-1:~> sudo crm cluster stop; echo $?
INFO: The cluster stack stopped on tw-1
0
adm@tw-1:~> sudo crm cluster start; echo $?
INFO: Starting pacemaker.service on tw-1
INFO: The cluster stack started on tw-1
0
adm@tw-1:~> sudo crm cluster start; echo $?
INFO: The cluster stack already started on tw-1
0       # <-- only fix here

@liangxin1300 liangxin1300 force-pushed the 20250417_restart_return_value branch 2 times, most recently from 709bee9 to 6c67963 Compare April 18, 2025 09:18
@liangxin1300 liangxin1300 force-pushed the 20250417_restart_return_value branch from 6c67963 to 4c358ca Compare April 22, 2025 12:52
…Error

To keep consistency with the return value of `crm cluster start` when
raise NoSSHError
@liangxin1300 liangxin1300 force-pushed the 20250417_restart_return_value branch from 4c358ca to f76f6b7 Compare April 22, 2025 13:27
@liangxin1300 liangxin1300 merged commit db2a29e into ClusterLabs:master Apr 23, 2025
32 checks passed
liangxin1300 added a commit that referenced this pull request Apr 23, 2025
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.

3 participants