Commit Graph

66 Commits

Author SHA1 Message Date
Christine Caulfield
ce03c68394 Report crypto errors back to cfg reload
Because crypto changing happens in the 'commit' phase
of the reload and we can't get sure that knet will
allow the new parameters, the result gets ignored.
This can happen in FIPS mode if a non-FIPS cipher
is requested.

This patch reports the errors back in a cmap key
so that the command-line can spot those errors
and report them back to the user.

It also restores the internal values for crypto
so that subsequent attempts to change things have
predictable results. Otherwise further attempts can
do nothing but not report any errors back.

I've also added some error reporting back for the
knet ping counters using this mechanism.

The alternative to all of this would be to check for FIPS
in totemconfig.c and then exclude certain options, but this
would be duplicating code that could easily get out of sync.

This system could also be a useful mechanism for reporting
back other 'impossible' errors.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2024-02-05 15:20:08 +01:00
Jan Friesse
49999d0692 cfgtool: Use CS_PRI_NODE_ID for formatting nodeid
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2021-08-02 15:13:45 +02:00
Jan Friesse
2856a6d85e cfgtool: Fix brief mode display of localhost
Show 'n' also for first localhost link, so all localhost links
are marked consistently with non-brief display.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2021-08-02 15:13:38 +02:00
Jan Friesse
d2d159a8ac cfgtool: Set nodeid indexes after sort
Needed for having correct index of localhost

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2021-08-02 15:13:31 +02:00
Jan Friesse
3928c22fd7 cfgtool: Check existence of at least one of nodeid
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2021-08-02 15:13:13 +02:00
Christine Caulfield
1d217b9a34 knet: Fix node status display
Currently if there is a gap in the links (eg link0 is missing)
corosync-cfgtool -s will still display the links as 0,1,2,3...
even if they are 1,2,5,6...

Also display the KNET transport type with the link in
corosync-cfgtool -s & -n

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2021-07-29 14:38:53 +02:00
Christine Caulfield
461cf49467 cfg: Reinstate cfg tracking
CFG tracking was removed in 815375411e,
probably as a mistake, as part of the tidy up of cfg and the removal of
dynamic loading. This means that shutdown tracking (using
cfg_try_shutdown()) stopped working.

This patch restores the trackstart & trackstop API calls (renamed to be
more consistent with the exiting libraries) so that shutdown tracking
can be used again.

Change cfg.shutdown_timeout to be in milliseconds rather than seconds
nd use libqb macros for conversion.

Add --force option to corosync-cfgtool -H

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2021-01-14 16:09:46 +01:00
Jan Friesse
d76fc6ab85 cfg: Improve nodestatusget versioning
Patch tries to make nodestatusget really extendable. Following changes
are implemented:
- corosync_cfg_node_status_version_t is added with (for now) single
  value CFG_NODE_STATUS_V1
- corosync_knet_node_status renamed to corosync_cfg_node_status_v1 (it
  isn't really knet because it works as well for udp(u()
- struct res_lib_cfg_nodestatusget_version is added which holds only ipc
  result header and version on same position as for
  corosync_cfg_node_status_v1
- corosync_cfg_node_status_get requires version and pointer to one of
  corosync_cfg_node_status_v structures
- request is handled in case switches to make adding new version easier

Also fix following bugs:
- totempg_nodestatus_get error was retyped to cs_error_t without any
  meaning.
- header.error was not checked at all in the library

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2020-11-26 16:16:49 +01:00
Christine Caulfield
9e7f62d27d cfg: New API to get extended node/link infomation
Current we horribly over-use totempg_ifaces_get() to
retrieve information about knet interfaces. This is an attempt to
improve on that.

All transports are supported (so not only Knet but also UDP(U)).

This patch builds best against the "onwire-upgrade" branch of knet
as that's what sparked my interest in getting more information out.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2020-11-26 16:15:50 +01:00
liangxin1300
ad2f1c6272 cfg: enhance message_handler_req_lib_cfg_killnode
While execute corosync-cfgtool -k <nodeid> to kill node:
* Check whether nodeid exists
* Check whether the node was joined

Signed-off-by: liangxin1300 <XLiang@suse.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2020-09-17 15:26:10 +02:00
liangxin1300
c02a69a988 cfgtool: Return error when -i doesn't match
Give error message and EXIT_FAILURE return code when -i
option doesn't match.

Signed-off-by: liangxin1300 <XLiang@suse.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2020-08-18 18:15:48 +02:00
liangxin1300
fb5e0fae92 tools: use util_strtonum for options checking
Function atoi is not safe since miss validation;
Function strtol is better but need to consider empty string and overflows
Function util_strtonum is a safer wrapper of strtoll

Use util_strtonum to check nodeid option and strict checking condition.

Signed-off-by: liangxin1300 <XLiang@suse.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2020-08-12 16:56:34 +02:00
liangxin1300
e741f6a612 cfgtool: enhancement -a option
* Add return code
  * Give error message when nodeid not exist

Signed-off-by: liangxin1300 <XLiang@suse.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2020-08-11 09:45:10 +02:00
liangxin1300
06d530dbf5 cfgtool: output error messages to stderr
... and standardize the return code

Signed-off-by: liangxin1300 <XLiang@suse.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2020-08-07 11:39:52 +02:00
Hideo Yamauchi
0d0febbc94 cfgtool: Fix error code as described in MP
If all links are connected 0 is returned to the shell, otherwise it's
error code 1.

Signed-off-by: Hideo Yamauchi <renayama19661014@ybb.ne.jp>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2020-03-30 18:05:56 +02:00
Jan Friesse
15c25a286d cfgtool: Simplify output a bit for link status
Display words connected/disconnected instead of 1/0 and show enabled
status only when link is not enabled (shouldn't happen).

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2020-03-04 15:19:13 +01:00
Jan Friesse
720a892751 cfgtool: Improve link status display
Totemknet is enhanced to use 'n' character for localhost and not adding
status, because it is safe to expect that localhost link is always
connectd. corosync-cfgtool is enhanced to properly decode 'n', '?' and
'd' characters and display its meaning for extended status. Special
characters are also documented in man page.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2020-02-12 13:08:25 +01:00
Jan Friesse
21e1c71169 cfgtool: Remove unused callbacks
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2019-11-28 09:44:45 +01:00
Jan Friesse
d7f5478b32 cfgtool: Remove unused code
corosync_cfg_ring_status_get returns string status, which is always OK
for UDP(U) and detailed status for Knet transport. Previously also
FAULTY status was returned for UDP(U) and cfgtool used to return error
code back to shell when one of the interfaces was faulty.

Because FAULTY is now not returned, it's not needed to have code for
handling it.

Also man page was misleading, so it is fixed too.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2019-07-08 13:00:58 +02:00
Jan Friesse
5731af2782 logging: Add CS_PRI_NODE_ID and CS_PRI_RING_ID
Previously node id was logged ether as a %d (most often), %u, %x or
PRI.32 and ring id ether as %lld, %llx with various separators (., :, /)
between rep nodeid and seq. This seems to cause confusion.

This patch adds macros CS_PRI_NODE_ID, CS_PRI_RING_ID and
CS_PRI_RING_ID_SEQ (CS prefix = corosync, PRI modeled in spirit of
inttypes.h PRIx32) and makes code use them.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2019-07-03 10:53:52 +02:00
Fabian Grünbichler
ef2569d323 cfgtool: Fix link status display
instead of the nodeid, this displayed arbitrary values (usually '1')
from other cmap keys under nodelist.node.XX.

sscanf returns the number of conversions even on mismatch, e.g. it also
returns 1 for

nodelist.node.2.quorum_votes
nodelist.node.2.ring0_addr
nodelist.node.2.name
...

instead of just

nodelist.node.2.nodeid

which leads to the value of (at least) quorum_votes being stored in
nodeid_list in addition to the actual nodeid.

storing the returned int in a cs_error_t enum also potentially masks
errors, so just compare the result with the expectation directly.

Fixes: c0d14485c3

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2019-05-30 15:23:37 +02:00
Jan Friesse
4f9e46e7a8 corosync-cfgtool: Fix -i matching
Previously it was required to use link id together with IP address (ex.
"0 127.0.0.1") as a -i parameter.

This was reported as not very user friendly. Solution is to split
returned interface name and try match link id and ip address
separately.

Also fix typo in description of parameter -s.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2019-02-14 13:46:57 +01:00
Christine Caulfield
c0d14485c3 cfgtool: Improve link status display
Now show the nodeids properly, rather than node indexes which were
annoying and unhelpful.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2019-02-04 08:06:01 +01:00
Jan Friesse
82f35f1720 log: Implement support for reopening log files
Feature depends on existence of libqb function qb_log_file_reopen.

New function call is added into CFG service API. This function is
used by corosync-cfgtool which now accepts -L parameter.

Finally, logrotate "postrotate" script is calling
corosync-cfgtool -L to notify corosync, instead of using
copytruncate option.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2018-10-16 14:46:52 +02:00
Christine Caulfield
d2876abed3 cfgtool: Don't assume link ID is a single char
For the moment link-ids are a single digit, but that could change and
the tools shouldn't be quite so fragile. So parse the interface_name
properly by looking for the space between the linkID and the IP.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2018-03-01 16:09:46 +01:00
Christine Caulfield
2c20590d16 knet: Always use link0 for loopback
Even if it's not used for anything else.

Also, make cfgtool show the correct link ID when links are not
contiguous

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2018-03-01 14:23:20 +01:00
Christine Caulfield
fc8580bdbf totem: Use nodeid ONLY in srp_addr
This shrinks the srp_addr (and consequently every packet sent by
corosync) so that instead of containing loads of IP addresses to
identify a node, it just sends the nodeid.

This then allows us to make ring0 optional and replaceable when running
knet.

It also means that we need some other way of identifying the local
node in corosync.conf, so the nodelist.node.name entry is now mandatory
and is mapped to the local host using the same algorithm as used in
cman.

This code needs LOTS of testing as it touches a huge amount of totemsrp
and totemconfig.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2018-03-01 14:18:51 +01:00
Bin Liu
6dee045326 corosync-cfgtool: refactor cli parameters handling
use the idea from corosync-cmapctl to set ACTION and params in the first
swtich, and add another swtich to call function based on ACTION and the
params.

Signed-off-by: Bin Liu <bliu@suse.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-12-01 17:29:42 +01:00
Christine Caulfield
1ca72a1154 totemsrp: Revert totemsrp_get_ifaces() changes
In my enthusiasm for removing code while integrating knet I
also deleted the correct code for returning IP address for a node,
so that only the IP addres of the local node was ever returned.

This commit restores the the previous code.

Also, because we always return INTERFACE_MAX interfaces now (they don't
have to be contiguous) set ss_family to zero if that interface is not
in use so that downstream apps know and don't display a lot of 0.0.0.0

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-11-30 16:59:05 +01:00
Bin Liu
146adcc230 fix output format for corosync-cfgtool with knet (#283)
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2017-11-27 08:35:40 +00:00
Bin Liu
0b5ab1e1cd make the output of "corosync-cfgtool -s" more readable (#269) 2017-11-03 09:50:29 +00:00
Bin Liu
250750b829 cfg: nodeid should be unsigned int
nodeid in struct req_lib_cfg_get_node_addrs is "unsigned int",
so the function corosync_cfg_get_node_addrs should have its param
"nodeid" to be unsigned int.

Signed-off-by: Bin Liu <bliu@suse.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-11-01 17:34:04 +01:00
Christine Caulfield
294a629fb5 config: Allow dynamic link configuration
Now we are using knet, it's possible to dynamically add, remove and
reconfigure links on the fly.

Also print 'n' for non-existant knet links. This will show up
only on loopback links >0. But it looks better than 'status ='

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-09-21 17:16:21 +02:00
Christine Caulfield
9da89f32c2 CFG: Remove ring-reenable code
RRP doesn't exist any more so all the ring re-enable code is redundant.

I've removed it from the library and all the code that does anything,
but I've left the hole in the IPC just in case old libraries are
hanging around.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2017-08-03 14:32:02 +02:00
Takeshi MIZUTA
034553c080 man: Modify man-page according to command usage
Signed-off-by: Takeshi MIZUTA <miz.take4@gmail.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2016-12-01 16:32:42 +01:00
Jan Friesse
1925074909 Fix few bugs found by coverity
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:43 +02:00
Richard B Winters
6218e2fc9e Fix spelling error in binary corosync-cfgtool
- Changed reenable to re-enable in tools/corosync-cfgtool.c

Change-Id: I0457bf3040a454a44f0d8343dd2cd8bf8fad16e0
Signed-off-by: Richard B Winters <rik@mmogp.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2016-01-27 18:29:25 +01:00
Hideo Yamauchi
8039cfe041 cfgtool: Display nodeid as unsigned int
Signed-off-by: Hideo Yamauchi <renayama19661014@ybb.ne.jp>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2015-11-13 15:50:11 +01:00
Jan Friesse
7014f10123 cfgtool: return error on reload failure
If reload fails, return code is set to value >0 to indicate error.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2013-11-26 15:39:34 +01:00
Christine Caulfield
82fbffc34b Reload: Add reload code to cfg
Add the code to do the actual corosync.conf reload to cfg, along with
a corosync-cfgtool -R command to trigger it

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2013-09-12 16:09:41 +01:00
Jan Friesse
2224169215 cfgtool: Retry shutdown on CS_ERR_TRY_AGAIN
It may be nice to deliver macro cs_repeat as default in some include
file.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2013-03-21 14:16:47 +01:00
Jan Friesse
28b2d176fc corosync-cfgtool: Remove set of cryptography
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-03-13 12:23:02 +01:00
Steven Dake
e476a63ef8 Update copyright dates in tools directory
Signed-off-by: Steven Dake <sdake@redhat.com>
Reviewed-by: Fabio Di Nitto <fdinitto@redhat.com>
2012-02-13 17:05:04 -07:00
Steven Dake
815375411e Remove unused or unimplemented CFG apis
Remove:
cfg_statetrack
cfg_statetrackstop
cfg_administrativestateste
cfg_administrativestateget
cfg_serviceload
cfg_serviceunload

Rev SO to 5.0.0

Signed-off-by: Steven Dake <sdake@redhat.com>
Reviewed-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-13 17:04:49 -07:00
Steven Dake
ba480ce908 Return an exit code of 1 if an interface is faulty in corosync-cfgtool
Signed-off-by: Oren Nechustan <theoren28@hotmail.com>
Signed-off-by: Steven Dake <sdake@redhat.com>
Reviewed-by: Fabio Di Nitto <fdinitto@redhat.com>
2012-01-30 06:30:41 -07:00
Jan Friesse
b4bef1cbf5 cfgtool: print list of IP with space between items
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
2011-03-24 17:42:09 +01:00
Christine Caulfield
94e4234c99 Fix corosync-cfgtool -a so that it actaully produces some output!
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2227 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-06-10 07:33:19 +00:00
Jim Meyering
1f40a10983 don't include <signal.h> when it's not used
* exec/coroparse.c: Likewise.
* exec/quorum.c: Likewise.
* exec/sync.c: Likewise.
* exec/totemmrp.c: Likewise.
* exec/totemnet.c: Likewise.
* exec/totemrrp.c: Likewise.
* exec/totemsrp.c: Likewise.
* exec/vsf_quorum.c: Likewise.
* exec/vsf_ykd.c: Likewise.
* lcr/uic.c: Likewise.
* lcr/uis.c: Likewise.
* lib/cfg.c: Likewise.
* services/cfg.c: Likewise.
* services/cpg.c: Likewise.
* services/evs.c: Likewise.
* services/pload.c: Likewise.
* services/testquorum.c: Likewise.
* services/votequorum.c: Likewise.
* test/testconfdb.c: Likewise.
* test/testcpg.c: Likewise.
* test/testcpgzc.c: Likewise.
* test/testzcgc.c: Likewise.
* tools/corosync-cfgtool.c: Likewise.
* tools/corosync-objctl.c: Likewise.
* tools/corosync-pload.c: Likewise.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2193 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-05-18 16:41:46 +00:00
Christine Caulfield
e9660ee62f Add libnss security support to corosync.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2145 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-25 14:05:27 +00:00
Jim Meyering
f5edd27d1d corosync-cfgtool.c: handle strdup failure gracefully
* tools/corosync-cfgtool.c (xstrdup): New function.
(main): Use it in place of strdup.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2100 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-20 18:26:22 +00:00