Fix: controller: Replace node state atomically at DC join ack step
Currently, do_dc_join_ack() deletes part of the joining node's resource
history from the CIB and then updates the remaining portion. If we
query the CIB or we're interrupted in some way between the delete and
the update, then we get a bad view of the state, where pieces are
missing.
Here, we use a CIB transaction to ensure that the update happens
atomically as a replacement.
Of note: anything passed as user_data to a CIB client callback must be
freeable by the function passed to cib_client_register_callback_full()
as the free_func argument. That argument is of type
void (*free_func)(void *).
free_xml() can't be passed as the free_func() argument to a CIB client
callback. The behavior is undefined by the C standard, and GCC throws an
error. (void *) and (xmlNode *) are not compatible.
Casting might be safe in practice though:
Closes T186
Closes CLBZ#5306
Closes RHBZ#2000595
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>