[Linux-HA] How to ping only a subset of ping hosts and set different attribute name than "pingd"?
Andrew Beekhof
beekhof at gmail.com
Wed Sep 12 01:40:05 MDT 2007
On 8/31/07, Dominik Klein <dk at in-telegence.net> wrote:
> Andrew Beekhof schrieb:
> > On 8/30/07, Dominik Klein <dk at in-telegence.net> wrote:
> >> And again I have to reply to myself. Sorry.
> >>
> >> I can see both processes running and I can see both ping groups being
> >> pinged (using tcpdump). So it's not that the processes are not run, just
> >> that the attribute is not (cannot?) be set.
> >
> > the nodes will be pinged regardless of whether pingd runs or not -
> > pingd gets the information from heartbeat.
> >
> > there are two problems:
> > 1) both pingd processes are using the same name to connect to HA, so
> > only the first one is able to connect
> > (http://old.linux-foundation.org/developer_bugzilla/show_bug.cgi?id=1701)
>
> Thanks for that hint.
>
> Here's a workaround:
> I edited tools/pingd.c and changed crm_system_name to pingd17216,
> compiled it, copied it to /usr/lib/heartbeat/pingd17216, edited ha.cf to
> respawn pingd17216 with the corresponding ping_group and the original
> pingd with its own ping_group.
>
> After a first try I found out that some kind of authorization is needed
> for this new process.
> Log:
> Aug 31 08:49:24 XEN-01 heartbeat: [29083]: WARN: Client [pingd17216] pid
> 29120 failed authorization [no default client auth]
>
> I grepped my way around and found heartbeat/config.c and added
> , {"apiauth", "pingd17216 uid=root"}
> right after the same line with just "pingd"
>
> Recompile, Restart.
>
> Works fine so far.
I'm going to commit this patch:
diff -r d928677b3d70 tools/pingd.c
--- a/tools/pingd.c Tue Sep 11 17:03:27 2007 +0200
+++ b/tools/pingd.c Wed Sep 12 08:58:02 2007 +0200
@@ -235,7 +235,7 @@ main(int argc, char **argv)
};
#endif
pid_file = crm_strdup("/tmp/pingd.pid");
- crm_system_name = "pingd";
+ crm_system_name = basename(argv[0]);
G_main_add_SignalHandler(
G_PRIORITY_HIGH, SIGTERM, pingd_shutdown, NULL, NULL);
@@ -244,7 +244,7 @@ main(int argc, char **argv)
g_str_hash, g_str_equal,
g_hash_destroy_str, g_hash_destroy_str);
- crm_log_init(crm_system_name, LOG_INFO, TRUE, FALSE, argc, argv);
+ crm_log_init(basename(argv[0]), LOG_INFO, TRUE, FALSE, argc, argv);
while (1) {
that way, one just needs to copy/symlink pingd to have a new name and add:
apiauth {newname} uid=root
to ha.cf
More information about the Linux-HA
mailing list