[ClusterLabs] Preventing a resource from migrating to / starting on a node

Reid Wahl nwahl at redhat.com
Tue Nov 29 00:31:02 EST 2022


On Mon, Nov 28, 2022 at 8:21 PM Madison Kelly <mkelly at alteeve.com> wrote:
>
> This question builds on questions I was talking to kgaillot on IRC.
>
> I am try to prevent a resource from being allowed to migrate to or start on a given node. When I asked about this, Ken talked about node attributes, which I've been trying to implement.
>
> To try to figure this out / test this, I setup an attribute against a resource called 'srv01-sql' called 'drbd-fenced_srv01-psql' that sets a location constraint of -INFINITY. I had the resource running on 'mk-a01n01' and then set 'drbd-fenced_srv01-psql=1' to trigger the constraint against 'mk-a01n02'. I verified this was set, then tried migrating it, and it happily migrated.
>
> Clearly I am missing something. :)
>
> ====
> [root at mk-a01n01 ~]# crm_attribute --type nodes --node mk-a01n02 --name drbd-fenced_srv01-sql --query
> scope=nodes  name=drbd-fenced_srv01-sql value=1
>
> [root at mk-a01n01 ~]# pcs constraint location config
> Location Constraints:
>   Resource: srv01-sql
>     Enabled on:
>       Node: mk-a01n02 (score:100)
>       Node: mk-a01n01 (score:200)
>     Constraint: location-srv01-sql
>       Rule: score=-INFINITY
>         Expression: drbd-fenced_srv01-sql eq 0
>   Resource: srv02-web
>     Enabled on:
>       Node: mk-a01n02 (score:100)
>       Node: mk-a01n01 (score:200)
>
> [root at mk-a01n01 ~]# crm_attribute --type nodes --node mk-a01n02 --name drbd-fenced_srv01-sql --query
> scope=nodes  name=drbd-fenced_srv01-sql value=1
>
> [root at mk-a01n01 ~]# pcs resource status srv01-sql
>   * srv01-sql    (ocf::alteeve:server):     Started mk-a01n01
>
> [root at mk-a01n01 ~]# pcs constraint location srv01-sql prefers mk-a01n02=200 mk-a01n01=100
>
> [root at mk-a01n01 ~]# pcs resource status srv01-sql
>   * srv01-sql    (ocf::alteeve:server):     Migrating mk-a01n01
>
> [root at mk-a01n01 ~]# pcs resource status srv01-sql
>   * srv01-sql    (ocf::alteeve:server):     Started mk-a01n02
> ====
>
> I feel like this shouldn't be so complicated, so I am likely over-thinking this, or missing something obvious...
>
> --
> Madison Kelly
> Alteeve's Niche!
> Chief Technical Officer
> c: +1-647-471-0951
> https://alteeve.com/

The configured rule prevents srv01-sql from running on a node where
the drbd-fenced_srv01-sql attribute is set to 0. It looks like it's
set to 1.

Maybe I'm misunderstanding though -- if I am, can you help clarify and
send the CIB so that I can mess around with it?

>
> _______________________________________________
> Manage your subscription:
> https://lists.clusterlabs.org/mailman/listinfo/users
>
> ClusterLabs home: https://www.clusterlabs.org/



-- 
Regards,

Reid Wahl (He/Him)
Senior Software Engineer, Red Hat
RHEL High Availability - Pacemaker



More information about the Users mailing list