Introduce helper functions for container-attribute-target
In this change we introduce the ocf_attribute_target() function that helps
RAs decide where to store per-node attributes. The rationale is that
when an OCF resource runs in a bundle (e.g. rabbitmq-bundle-0) the
NODENAME will point to the bundle name and not to the physical node
running the bundle. Since a bundle can run on any cluster node, this
is not ideal in the situations in which an RA wants to remember on which
*host* a bundle was running (this is typically the case when there is no
shared storage)
The way this new ocf_attribute_target() function works is the following:
A) When the meta-attr 'container-attribute-target' == 'host' and the
function is called without arguments it will return the physical hostname the resource is running on.
B) When the meta-attr 'container-attribute-target' != 'host' and the
function is called without arguments it will return the NODENAME (default)
C) When the meta-attr 'container-attribute-target' == 'host' and the
function is called with an argument it will return the physical hostname on which the corresponding argument is running on.
D) When the meta-attr 'container-attribute-target' != 'host' and the
function is called with an argument it will return the NODENAME (default)
The basic idea is that if resources need to store per-host attributes
you will set the meta attribute 'container-attribute-target' equal to
host (the no-shared storage case). If resources need to store attributes
on a per-bundle basis (because they access data from shared-storage)
then no change is needed on meta attributes (this is the default
behaviour).
Signed-off-by: Andrew Beekhof <abeekhof@redhat.com>
Tested-by: Michele Baldessari <michele@acksyn.org>
Tested-by: Damien Ciabrini <dciabrin@redhat.com>