[ClusterLabs] Location not working

Miro Igov miro.igov at pharmya.com
Mon Apr 10 10:16:48 EDT 2023


Ken Galliot,

Not true. See this:

<rsc_order id="nginx_1_active_ord" kind="Mandatory" first="nginx_1" then="nginx_1_active">

And this:
     <primitive id="nginx_1_active" class="ocf" provider="pacemaker" type="attribute">

        <instance_attributes id="nginx_1_active-instance_attributes">

          <nvpair name="active_value" value="1" id="nginx_1_active-instance_attributes-active_value"/>

          <nvpair name="inactive_value" value="0" id="nginx_1_active-instance_attributes-inactive_value"/>

        </instance_attributes>

        <operations>

          <op name="monitor" interval="10s" timeout="20s" id="nginx_1_active-monitor-10s"/>

        </operations>

      </primitive>

According to the rsc_order when nginx_1 starts nginx_1_active also starts which sets it's active_value to 1.
The opposite operation nginx_1_active stops before nginx_1 so it's active_value changes to 0.

Then refer to my first post:

....
   * intranet-ip (ocf::heartbeat:IPaddr2):        Started intranet-test1
.....
.....
  * nginx_1     (systemd:nginx at intranet-test1):  Stopped

  * nginx_1_active      (ocf::pacemaker:attribute):      Stopped

So how is it possible nginx_1_active stopped and it's opa-nginx_1_active value 0 and intranet-ip running on a node with -INF score?


-----Original Message-----
From: Users <users-bounces at clusterlabs.org> On Behalf Of Ken Gaillot
Sent: 10 April 2023 16:40
To: Cluster Labs - All topics related to open-source clustering welcomed <users at clusterlabs.org>
Subject: Re: [ClusterLabs] Location not working

On Mon, 2023-04-10 at 16:33 +0300, Andrei Borzenkov wrote:
> On Mon, Apr 10, 2023 at 4:26 PM Ken Gaillot <kgaillot at redhat.com>
> wrote:
> > On Mon, 2023-04-10 at 14:18 +0300, Miro Igov wrote:
> > > Hello,
> > > I have a resource with location constraint set to:
> > > 
> > > location intranet-ip_on_any_nginx intranet-ip \
> > >         rule -inf: opa-nginx_1_active eq 0 \
> > >         rule -inf: opa-nginx_2_active eq 0
> > 
> > You haven't specified a score for the constraint, so it defaults to 
> > 0, meaning the resource is allowed on those nodes but has no 
> > preference for them.
> > 
> 
> But each rule has score -INFINITY?

Whoops, I skimmed too quickly, you're right.

The referenced node attributes (opa-nginx_1_active and opa-
nginx_1_active) aren't set anywhere, so the condition isn't met.

> 
>       <rsc_location id="intranet-ip_on_any_nginx" rsc="intranet-ip">
>         <rule score="-INFINITY" id="intranet-ip_on_any_nginx-rule">
>           <expression operation="eq" attribute="opa-nginx_1_active"
> value="0" id="intranet-ip_on_any_nginx-rule-expression"/>
>         </rule>
>         <rule score="-INFINITY" id="intranet-ip_on_any_nginx-rule-0">
>           <expression operation="eq" attribute="opa-nginx_2_active"
> value="0" id="intranet-ip_on_any_nginx-rule-0-expression"/>
>         </rule>
>       </rsc_location>
> 
> This exactly matches the example in documentation where score is moved 
> from rsc_location to rule.
> 
> > > In syslog I see the attribute transition:
> > > Apr 10 12:11:02 intranet-test2 pacemaker-attrd[1511]:  notice:
> > > Setting opa-nginx_1_active[intranet-test1]: 1 -> 0
> > > 
> > > Current cluster status is :
> > > 
> > > Node List:
> > >   * Online: [ intranet-test1 intranet-test2 nas-sync-test1 nas-
> > > sync-
> > > test2 ]
> > > 
> > > * stonith-sbd (stonith:external/sbd):  Started intranet-test2
> > >   * admin-ip    (ocf::heartbeat:IPaddr2):        Started nas-
> > > sync-
> > > test2
> > >   * cron_symlink        (ocf::heartbeat:symlink):        Started
> > > intranet-test1
> > >   * intranet-ip (ocf::heartbeat:IPaddr2):        Started
> > > intranet-
> > > test1
> > >   * mysql_1     (systemd:mariadb at intranet-test1):        Started
> > > intranet-test1
> > >   * mysql_2     (systemd:mariadb at intranet-test2):        Started
> > > intranet-test2
> > >   * nginx_1     (systemd:nginx at intranet-test1):  Stopped
> > >   * nginx_1_active      (ocf::pacemaker:attribute):      Stopped
> > >   * nginx_2     (systemd:nginx at intranet-test2):  Started
> > > intranet-
> > > test2
> > >   * nginx_2_active      (ocf::pacemaker:attribute):      Started
> > > intranet-test2
> > >   * php_1       (systemd:php5.6-fpm at intranet-test1):     Started
> > > intranet-test1
> > >   * php_2       (systemd:php5.6-fpm at intranet-test2):     Started
> > > intranet-test2
> > >   * data_1      (ocf::heartbeat:Filesystem):     Stopped
> > >   * data_2      (ocf::heartbeat:Filesystem):     Started
> > > intranet-
> > > test2
> > >   * nfs_export_1        (ocf::heartbeat:exportfs):       Stopped
> > >   * nfs_export_2        (ocf::heartbeat:exportfs):       Started
> > > nas-
> > > sync-test2
> > >   * nfs_server_1        (systemd:nfs-server at nas-sync-test1):
> > > Stopped
> > >   * nfs_server_2        (systemd:nfs-server at nas-sync-test2):
> > > Started nas-sync-test2
> > > 
> > > Failed Resource Actions:
> > >   * nfs_server_1_start_0 on nas-sync-test1 'error' (1): call=95, 
> > > status='complete', exitreason='', last-rc-change='2023-04-10
> > > 12:35:12
> > > +02:00', queued=0ms, exec=209ms
> > > 
> > > 
> > > Why intranet-ip is located on intranet-test1 while nginx_1_active 
> > > is
> > > 0 ?
> > > 
> > > # crm res constraint intranet-ip
> > > 
> > > cron_symlink
> > >         (score=INFINITY, id=c_cron_symlink_on_intranet-ip)
> > > * intranet-ip
> > >   : Node nas-sync-
> > > test2
> > > (score=-INFINITY, id=intranet-ip_loc-rule)
> > >   : Node nas-sync-
> > > test1
> > > (score=-INFINITY, id=intranet-ip_loc-rule)
> > > 
> > > Why no constraint entry for intranet-ip_on_any_nginx location ?
> > > 
> > > 
> > >  This message has been sent as a part of discussion between 
> > > PHARMYA and the addressee whose name is specified above. Should 
> > > you receive this message by mistake, we would be most grateful if 
> > > you informed us that the message has been sent to you. In this 
> > > case, we also ask that you delete this message from your mailbox, 
> > > and do not forward it or any part of it to anyone else.
> > > Thank you for your cooperation and understanding.
> > > 
> > > _______________________________________________
> > > Manage your subscription:
> > > https://lists.clusterlabs.org/mailman/listinfo/users
> > > 
> > > ClusterLabs home: https://www.clusterlabs.org/
> > --
> > Ken Gaillot <kgaillot at redhat.com>
> > 
> > _______________________________________________
> > Manage your subscription:
> > https://lists.clusterlabs.org/mailman/listinfo/users
> > 
> > ClusterLabs home: https://www.clusterlabs.org/
> _______________________________________________
> Manage your subscription:
> https://lists.clusterlabs.org/mailman/listinfo/users
> 
> ClusterLabs home: https://www.clusterlabs.org/
--
Ken Gaillot <kgaillot at redhat.com>

_______________________________________________
Manage your subscription:
https://lists.clusterlabs.org/mailman/listinfo/users

ClusterLabs home: https://www.clusterlabs.org/

-- 
This message has been sent as a part of discussion between PHARMYA and the
addressee whose name is specified above. Should you receive this message by
mistake, we would be most grateful if you informed us that the message has
been sent to you. In this case, we also ask that you delete this message
from your mailbox, and do not forward it or any part of it to anyone else.
Thank you for your cooperation and understanding.


More information about the Users mailing list