-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add director notfiy method and use it for admin health changes #4186
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,16 +139,8 @@ VBE_Connect_Error(struct VSC_vbe *vsc, int err) | |
|
||
/*--------------------------------------------------------------------*/ | ||
|
||
int | ||
VBE_is_ah_auto(const struct backend *bp) | ||
{ | ||
|
||
CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC); | ||
return (bp->director->vdir->admin_health == VDI_AH_AUTO); | ||
} | ||
|
||
void | ||
VBE_connwait_signal_all(const struct backend *bp) | ||
static void | ||
vbe_connwait_signal_all(const struct backend *bp) | ||
{ | ||
struct connwait *cw; | ||
|
||
|
@@ -661,6 +653,21 @@ vbe_healthy(VRT_CTX, VCL_BACKEND d, VCL_TIME *t) | |
return (!bp->sick); | ||
} | ||
|
||
static VCL_VOID v_matchproto_(vdi_notify_f) | ||
vbe_notify(VCL_BACKEND d) | ||
{ | ||
const struct vdi_ahealth *ah; | ||
struct backend *bp; | ||
|
||
CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); | ||
CAST_OBJ_NOTNULL(bp, d->priv, BACKEND_MAGIC); | ||
CHECK_OBJ_NOTNULL(d->vdir, VCLDIR_MAGIC); | ||
ah = d->vdir->admin_health; | ||
|
||
// sick == 0 for _noprobe | ||
if (ah == VDI_AH_SICK || (ah == VDI_AH_AUTO && bp->sick)) | ||
vbe_connwait_signal_all(bp); | ||
} | ||
|
||
/*-------------------------------------------------------------------- | ||
*/ | ||
|
@@ -676,7 +683,8 @@ static const struct vdi_methods vbe_methods[1] = {{ | |
.destroy = vbe_destroy, | ||
.panic = vbe_panic, | ||
.list = vbe_list, | ||
.healthy = vbe_healthy | ||
.healthy = vbe_healthy, | ||
.notify = vbe_notify | ||
Comment on lines
683
to
+687
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was bothered by the notify method because this is a breaking change as we established earlier and I wasn't satisfied with such a resolution on the 7.6 branch where we'd rather not break VRT if we can help it. It then occurred to me that in spirit the new notify method is very close to the event method and I was wondering whether we'd agree to the creation of a new going-sick event even though that was not the original scope of the event enum. I don't personally see a strong reason against widening the scope beyond the existing set of events. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that yes, no or something else, @dridi ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, phk also brought up using the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was suggesting adding a new enum entry for the event callback, one that would be dedicated to backend/directors, instead of adding a new notify callback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FTR: I did consider using the . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! |
||
}}; | ||
|
||
static const struct vdi_methods vbe_methods_noprobe[1] = {{ | ||
|
@@ -689,7 +697,8 @@ static const struct vdi_methods vbe_methods_noprobe[1] = {{ | |
.event = vbe_dir_event, | ||
.destroy = vbe_destroy, | ||
.panic = vbe_panic, | ||
.list = vbe_list | ||
.list = vbe_list, | ||
.notify = vbe_notify | ||
}}; | ||
|
||
/*-------------------------------------------------------------------- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
vbe_connwait_broadcast()