diff options
author | pjd <pjd@FreeBSD.org> | 2010-08-29 21:42:45 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2010-08-29 21:42:45 +0000 |
commit | 1d4a51dd2dff0160ffbc290b08ab4e9f38368294 (patch) | |
tree | 616552ec91255abe15391f6950c56ad051985011 /sbin/hastd/control.c | |
parent | 70a52f0307093bb9b0b23ae15d717c7481911ddf (diff) | |
download | FreeBSD-src-1d4a51dd2dff0160ffbc290b08ab4e9f38368294.zip FreeBSD-src-1d4a51dd2dff0160ffbc290b08ab4e9f38368294.tar.gz |
- Call hook on role change.
- Document new event.
MFC after: 2 weeks
Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
Diffstat (limited to 'sbin/hastd/control.c')
-rw-r--r-- | sbin/hastd/control.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sbin/hastd/control.c b/sbin/hastd/control.c index 5c48061..2f42826 100644 --- a/sbin/hastd/control.c +++ b/sbin/hastd/control.c @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include "hast.h" #include "hastd.h" #include "hast_proto.h" +#include "hooks.h" #include "nv.h" #include "pjdlog.h" #include "proto.h" @@ -54,6 +55,7 @@ static void control_set_role_common(struct hastd_config *cfg, struct nv *nvout, uint8_t role, struct hast_resource *res, const char *name, unsigned int no) { + int oldrole; /* Name is always needed. */ if (name != NULL) @@ -85,6 +87,7 @@ control_set_role_common(struct hastd_config *cfg, struct nv *nvout, pjdlog_info("Role changed to %s.", role2str(role)); /* Change role to the new one. */ + oldrole = res->hr_role; res->hr_role = role; pjdlog_prefix_set("[%s] (%s) ", res->hr_name, role2str(res->hr_role)); @@ -113,6 +116,8 @@ control_set_role_common(struct hastd_config *cfg, struct nv *nvout, if (role == HAST_ROLE_PRIMARY) hastd_primary(res); pjdlog_prefix_set("%s", ""); + hook_exec(res->hr_exec, "role", res->hr_name, role2str(oldrole), + role2str(res->hr_role), NULL); } void |