Commit Graph

3821 Commits

Author SHA1 Message Date
Jan Friesse
228007a746 qdevice tlv: Remove default/return code redundancy
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:40 +02:00
Jan Friesse
500b8978c0 qdevice-net: Free send buffer on error (leak)
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:40 +02:00
Jan Friesse
d89c57ee89 qnetd: Return lock file fd
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:40 +02:00
Jan Friesse
3ff96e8d56 qdevice-net: Ensure to free non blocking client
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:40 +02:00
Jan Friesse
131cfbe4ae Refactor qdevice-net
- corosync-device-net as binary is gone. Replacement is
  corosync-qdevice
- corosync-qdevice has support for multiple models (only net is
  currently implemented)
- Completelly redesign qdevice-net main loop.
  - Connect is non blocking
  - Cmap and Votequorum events are handled even before connect to
    qnetd. Algorithm gets send_node_list and vote set so it's not needed
    to check connection status and also vote_timer is running and voting
    until something changes (configuration or votequorum node list)
  - If connect fails, algorithm_disconnected with new reason
    CANT_CONNECT_TO_THE_SERVER is called
- Logging for qdevice is based on libqb logging functions. Also
  logging configuration from corosync.conf is now used and dynamic
  changes of configuration are handled.
- Added qdevice_net_algorithm_config_node_list_changed
- Changed qdevice_net_algorithm_votequorum_node_list_notify in respect
  of adding  send_node_list so it's similar to other functions.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:40 +02:00
Christine Caulfield
e41b256c67 votequorum: Allow wait_for_all with qdevice
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:39 +02:00
Christine Caulfield
c4090cba6a qnetd: Use ring_id, not client->last_ring_id in algorithms
ring_id should only be copied into the client structure after the
algorithm has run (so the last one is also available), so fix the
algorithms to use the passed-in ring_id where available.

Also tidy some debug logging in algo-lms

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:39 +02:00
Christine Caulfield
09b904e7ae qnetd-algo: Fix list traversal corruption when freeing partitions.
TAILQ_* doesn't have a safe iterator for use when freeing entries, so the
only safe way of doing it (without assuming implementation) is to
restart the iterator after freeing the structure.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:39 +02:00
Jan Friesse
6c1add2925 Improve qdevice
- Add support for cmap node list configuration change
- Add client side algorithms
- Check if currently received ring id in membership message
  equals to last sent ring id
- Send config node list only if config node list really changes and not
  after every reload
- Add tlv_ring_id_eq (replacing qnetd_algo_rings_eq) so it's usable in
  client
- Move debug logs from algo-test into qnetd-log-debug.c and call them in
  proper places (= logs are now algorithm independent)
- Fix memory leak in msg

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:39 +02:00
Christine Caulfield
2f5ff28c4d qnetd-algo: Refactor common routines
Move several commonly used routines into their own
qnetd-algo-utils.[ch] files and change over to using
the ring_id held in the client structure rather than
managint it ourself.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:39 +02:00
Christine Caulfield
27887779cf qnetd: Add ring_id to client structure
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:39 +02:00
Christine Caulfield
5b097c818e algo-lms: some tidying
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:39 +02:00
Jan Friesse
2960122481 qnetd: Make proper support for ipv4/6
- Add option for forcing ip version 4 or 6
- Choose new default port. It's now 5403. Exactly one less than used by
  corosync.
- Fix compiler warning

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:39 +02:00
Jan Friesse
1561dce437 qnetd: Add init script
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:39 +02:00
Jan Friesse
ba1b4e91b4 qnetd: Refactor
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:39 +02:00
Jan Friesse
f7ca447799 qnetd: Really daemonize
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:39 +02:00
Christine Caulfield
2ff2d136b1 qdevice: qnetd_algo_lms: Fix nominated tie_breaker node
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:39 +02:00
Christine Caulfield
5e457d9e0a qnetd: lms: Add support for other tie_breaker options.
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:39 +02:00
Christine Caulfield
b842be0f5f qnetd: Add tie_breaker options to 2nodelms
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:39 +02:00
Jan Friesse
ee1e257b8d qdevice: Add tie_breaker option
Tie-breaker can be used in algorithm to decide if algorithm should
prefer highest, lowest or some concrete node id.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:39 +02:00
Jan Friesse
8c0a45de41 qnet: Add TLV_VOTE_NO_CHANGE
State used for informative only callbacks (quorum node list) and
possibly informative only callbacks (configuration node list). Client
doesn't change cast vote timer state.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:39 +02:00
Jan Friesse
afa22646f9 qnet: Migrate to new votequorum API
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:39 +02:00
Christine Caulfield
9e2fb2492b qdevice: 2nodelms: don't split-brain when the primary node comes back.
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:39 +02:00
Christine Caulfield
98548e1880 qnetd: lms: Fix search for node/ring_id check
We were looking for us in other node lists, rather than
others in our nodelist.

Also, remove debug print in votequorum.c

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:39 +02:00
Christine Caulfield
3a5d51fca7 votequorum: Fix up quorum/nodelist callbacks
This patch tidies the two state change callbacks and explains them
in the man page:

The difference between votequorum_nodelist_notification_t and
votequorum_quorum_notification_t is subtle but important.
The 'nodelist' callback is sent at the start of a cluster state
transition and contains the new ring_id and only the list of
nodes that are included in the sync state - ie only active nodes. No
quorum information is included this callback because it is not
available at that time.

The 'quorum' callback is sent after the cluster state transition has
completed and does contain quorum information.
In addition, the nodelist contains a list of all nodes known to
votequorum (whether up or down) and their state as well
as information about the quorum device attached (if any). quorum
callbacks will not be sent for qdevice up and down
events unless they affect quorum.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:39 +02:00
Jan Friesse
21911d3906 qnetd: Some small improvements
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:39 +02:00
Jan Friesse
bdce67516f qnetd: Improve logging
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:38 +02:00
Christine Caulfield
cf0028c86e votequorum: split callbacks into nodelist and quorum
This split is needed for qdevice, so that it gets the ring_id and
nodelist as part of the sync process and not afterwards - when quorum
has been calculated.

As this is and unsupported API I'm not too worried about breaking
existing code - all the clients I know of are using the quorum API
anyway as they should be.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:38 +02:00
Jan Friesse
92bc46a79f qdevice-net: Copy correct ring id in votequorum cb
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:38 +02:00
Christine Caulfield
cd3a96f26a qnetd: Add LMS algorithm
Only lightly tested so far

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:38 +02:00
Jan Friesse
02eafebdf5 Improve qdevice-net
- Add cast vote timer (qdevice-net now really votes)
- In sync phase it's impossible retreive cmap config version so it's no
  longer sent in membership node list
- Refactor qdevice-net

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:38 +02:00
Christine Caulfield
434aa4fc64 votequorum: make corosync_quorumtool show full ring_id
Add the ring leader node_id to corosync_quorumtool. This is
only shown when votequorum is active

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:38 +02:00
Christine Caulfield
a4fe280cbb qnetd: move 2nodelms algo files to the right directory
No, I don't know how that happened.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:38 +02:00
Christine Caulfield
379a3a9b89 qdevice-net: add a 2node Last Man Standing algorithm
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:38 +02:00
Jan Friesse
a0d3d4eb05 qdevice-net: Implement missing messages handlers
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:38 +02:00
Jan Friesse
4cf9a1462c qnetd-certutil: Fix master node variable
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:38 +02:00
Jan Friesse
a9488b8c73 corosync-qnetd-certutil: Delete tabs
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:38 +02:00
Jan Friesse
d92b98aafd corosync-qnetd-certutil: Delete dev comment
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:38 +02:00
Christine Caulfield
3999cd1444 qnetd: Move algorithms_register into qnetd-algorithms.c
and fix qnetd_algorithm_vote_info_reply_received

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:38 +02:00
Jan Friesse
81c1649191 corosync-qnetd-certutl: Improvements
- Location of certificates is now correctly set depending on operation
  (qnetd/node)
- Added quick start mode

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:38 +02:00
Christine Caulfield
b1504098f4 qnetd: Make it easier to add algorithms
Put the algorithms into an array of structure pointers
(a bit like corosync services) so we can easily add more
without having huge switch statements.

I haven't added any code to the client end that parses the
name into the enum. Yet.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:38 +02:00
Christine Caulfield
118e56ec7c Don't attempt to free a string we haven't been given.
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:38 +02:00
Jan Friesse
b15497739e qnetd: Improvements
- Move adding client to cluster to init phase instead of preinit
- Implement missing ask for vote and vote info messages
- Fix cluster name memory leak
- Refactor unexpected message handler to one generic function
- Move qnetd_client_send_err to new file
- Add qnetd_client_send_vote_info

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:38 +02:00
Jan Friesse
1365455250 qnetd: Add skel of ffsplit algo and cluster list
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:38 +02:00
Jan Friesse
d1d72dbc11 Qnetd improvements
- Complete config and membership node list callbacks
- Add client disconnect callback
- Always send msg_seq_num in node list
- Store config and last membership node list

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:38 +02:00
Jan Friesse
97ba4a077a Qnet improvements
- Support for membership node list
- Initial support for "pluggable" algorithms

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:38 +02:00
Jan Friesse
e221441b6c Qdevices-net improvements
- Implement node list
- Implement send buffer list
- Add nodelist message type
- Add ring_id, config_version, data_center_id, node_state, node_info,
  node_list_type and vote msg options

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2016-06-28 13:58:38 +02:00
Christine Caulfield
fc9817fec4 votequorum: Make display of qdevice more intuitive.
corosync-quorumtool displays the votes of the qdevice whether
or not it is active. This is confusing because if it is not active
then the display looks like there is a vote being contributed to
quorum when there is not.

This patch displays 0 for qdevice votes if the device is present
(but inactive) and adds the votes after the name. If the device is
contributing votes then they are displayed as normal.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-06-28 13:58:38 +02:00
Jan Friesse
3a5cb94906 Improve qnet 2016-06-28 13:58:38 +02:00
Jan Friesse
908de5e36a Initial commit of qdevice net 2016-06-28 13:58:37 +02:00