HomeClusterLabs Projects

Med: daemons: Copy all attrs from parent to child in multi-update IPC.

Description

Med: daemons: Copy all attrs from parent to child in multi-update IPC.

A multi-update IPC message consists of a parent message with various
attributes set (see create_attrd_op and add_op_attr in
pcmk__attrd_api_update_list), and then several child messages with
operation-specific attributes (see populate_update_op).

For instance, a client could send the following multi-update IPC message
to an attrd server:

<create_attrd_op t="attrd" src="attrd_updater" task="update" acl_target="root"

               attr_user="root" attr_host="rhel8-cluster-1" attr_host_id="1"
               attr_version="5" confirm="false" attr_writer="2">
<op attr_name="AAA" attr_block="utilization" task="update" attr_value="123"
    attr_is_remote="0" attr_is_private="0"/>
<op attr_name="BBB" attr_block="utilization" task="update" attr_value="456"
    attr_is_remote="0" attr_is_private="0"/>

</create_attrd_op>

If the cluster supports multi-update IPC messages, the attrd server side
handles this by throwing away the parent wrapper and iterating over the
child messages just like it would for a single-update IPC message.

However, this means those attributes on the parent get lost. The most
significant problems this causes are:

(1) The attr_host attribute is missing, so the server will attempt to
set the attribute on all hosts regardless of what the client wanted.

(2) The attr_user and acl_target attributes get lost, so the server will
always use "(null)" for the ACL user.

The fix for this is to simply copy all missing attributes from the
parent to the children. We need to be sure to not copy attributes
already present on the child because we could stomp on the client's
attr_host request.

Basically, we turn this:

<op attr_name="AAA" attr_block="utilization" task="update" attr_value="123"
    attr_is_remote="0" attr_is_private="0"/>

Into this:

<op attr_name="AAA" attr_block="utilization" task="update"

attr_value="123" attr_is_remote="0" attr_is_private="0" t="attrd"
src="attrd_updater" acl_target="root" attr_user="root"
attr_host="rhel8-cluster-1" attr_host_id="1" attr_version="5"
confirm="false" attr_writer="2"/>

Details

Provenance
clumensAuthored on Nov 16 2022, 3:13 PM
Parents
rP00dc31042074: Merge pull request #2943 from kgaillot/join
Branches
Unknown
Tags
Unknown