mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-08-03 21:23:48 +00:00
add suppressing healthcheck pritf message
(Logical change 1.88) git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@318 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
parent
6b42f21c83
commit
ce9948db45
@ -67,19 +67,25 @@ void setSanameT (SaNameT *name, char *str) {
|
||||
memcpy (name->value, str, name->length);
|
||||
}
|
||||
|
||||
int healthcheck_count = 0;
|
||||
static int health_flag = -1;
|
||||
static unsigned int healthcheck_count = 0;
|
||||
static unsigned int healthcheck_no = 0;
|
||||
void HealthcheckCallback (SaInvocationT invocation,
|
||||
const SaNameT *compName,
|
||||
SaAmfHealthcheckT checkType)
|
||||
{
|
||||
SaErrorT res;
|
||||
|
||||
// if (healthcheck_count++ % 20 == 19) {
|
||||
printf ("20 HealthcheckCallback have occured for component: ");
|
||||
healthcheck_no ++;
|
||||
if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) {
|
||||
printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no);
|
||||
printSaNameT ((SaNameT *)compName);
|
||||
printf ("\n");
|
||||
// }
|
||||
saAmfResponse (invocation, SA_OK);
|
||||
|
||||
}
|
||||
res = saAmfResponse (invocation, SA_OK);
|
||||
if (res != SA_OK) {
|
||||
printf ("response res is %d\n", res);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadinessStateSetCallback (SaInvocationT invocation,
|
||||
@ -245,18 +251,42 @@ void sigintr_handler (int signum) {
|
||||
}
|
||||
|
||||
|
||||
int main (void) {
|
||||
int main (int argc, char **argv) {
|
||||
SaAmfHandleT handle;
|
||||
int result;
|
||||
int select_fd;
|
||||
fd_set read_fds;
|
||||
SaNameT compName;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
int c;
|
||||
|
||||
memset (&compName, 0, sizeof (SaNameT));
|
||||
signal (SIGINT, sigintr_handler);
|
||||
result = sched_setscheduler (0, SCHED_RR, &sched_param);
|
||||
if (result == -1) {
|
||||
printf ("couldn't set sched priority\n");
|
||||
}
|
||||
result = sched_setscheduler (0, SCHED_RR, &sched_param);
|
||||
if (result == -1) {
|
||||
printf ("couldn't set sched priority\n");
|
||||
}
|
||||
|
||||
for (;;){
|
||||
c = getopt(argc,argv,"h:n:");
|
||||
if (c==-1) {
|
||||
break;
|
||||
}
|
||||
switch (c) {
|
||||
case 0 :
|
||||
break;
|
||||
case 'h':
|
||||
health_flag = 0;
|
||||
sscanf (optarg,"%ud" ,&healthcheck_count);
|
||||
break;
|
||||
case 'n':
|
||||
setSanameT (&compName, optarg);
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
result = saAmfInitialize (&handle, &amfCallbacks, &version);
|
||||
if (result != SA_OK) {
|
||||
@ -267,8 +297,9 @@ printf ("couldn't set sched priority\n");
|
||||
FD_ZERO (&read_fds);
|
||||
saAmfSelectionObjectGet (&handle, &select_fd);
|
||||
FD_SET (select_fd, &read_fds);
|
||||
|
||||
setSanameT (&compName, "comp_a_in_su_x");
|
||||
if (compName.length <= 0) {
|
||||
setSanameT (&compName, "comp_a_in_su_x");
|
||||
}
|
||||
|
||||
result = saAmfComponentRegister (&handle, &compName, NULL);
|
||||
printf ("register result is %d (should be 1)\n", result);
|
||||
|
@ -67,20 +67,26 @@ void setSanameT (SaNameT *name, char *str) {
|
||||
memcpy (name->value, str, name->length);
|
||||
}
|
||||
|
||||
int healthcheck_count = 0;
|
||||
static int health_flag = -1;
|
||||
static unsigned int healthcheck_count = 0;
|
||||
static unsigned int healthcheck_no = 0;
|
||||
void HealthcheckCallback (SaInvocationT invocation,
|
||||
const SaNameT *compName,
|
||||
SaAmfHealthcheckT checkType)
|
||||
{
|
||||
SaErrorT res;
|
||||
|
||||
// if (healthcheck_count++ % 20 == 19) {
|
||||
printf ("20 HealthcheckCallback have occured for component: ");
|
||||
healthcheck_no++;
|
||||
|
||||
if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) {
|
||||
printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no);
|
||||
printSaNameT ((SaNameT *)compName);
|
||||
printf ("\n");
|
||||
// }
|
||||
saAmfResponse (invocation, SA_OK);
|
||||
printf ("Healthcheck Count is %d\n", healthcheck_count++);
|
||||
|
||||
}
|
||||
res = saAmfResponse (invocation, SA_OK);
|
||||
if (res != SA_OK) {
|
||||
printf ("response res is %d\n", res);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadinessStateSetCallback (SaInvocationT invocation,
|
||||
@ -240,18 +246,40 @@ void sigintr_handler (int signum) {
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
int main (void) {
|
||||
int main (int argc, char **argv) {
|
||||
SaAmfHandleT handle;
|
||||
int result;
|
||||
int select_fd;
|
||||
fd_set read_fds;
|
||||
SaNameT compName;
|
||||
int i;
|
||||
int c,i;
|
||||
SaAmfErrorDescriptorT errorDescriptor;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
|
||||
memset (&compName, 0, sizeof (SaNameT));
|
||||
signal (SIGINT, sigintr_handler);
|
||||
|
||||
for (;;) {
|
||||
c = getopt(argc,argv,"h:n:");
|
||||
if (c==-1) {
|
||||
break;
|
||||
}
|
||||
switch (c) {
|
||||
case 0 :
|
||||
break;
|
||||
case 'h':
|
||||
health_flag = 0;
|
||||
sscanf (optarg,"%ud" ,&healthcheck_count);
|
||||
break;
|
||||
case 'n':
|
||||
setSanameT (&compName, optarg);
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
result = saAmfInitialize (&handle, &amfCallbacks, &version);
|
||||
if (result != SA_OK) {
|
||||
printf ("initialize result is %d\n", result);
|
||||
@ -262,7 +290,9 @@ int main (void) {
|
||||
saAmfSelectionObjectGet (&handle, &select_fd);
|
||||
FD_SET (select_fd, &read_fds);
|
||||
|
||||
setSanameT (&compName, "comp_b_in_su_x");
|
||||
if (compName.length <= 0){
|
||||
setSanameT (&compName, "comp_b_in_su_x");
|
||||
}
|
||||
|
||||
result = saAmfComponentRegister (&handle, &compName, NULL);
|
||||
|
||||
|
@ -66,19 +66,26 @@ void setSanameT (SaNameT *name, char *str) {
|
||||
memcpy (name->value, str, name->length);
|
||||
}
|
||||
|
||||
int healthcheck_count = 0;
|
||||
static int health_flag = -1;
|
||||
static unsigned int healthcheck_count = 0;
|
||||
static unsigned int healthcheck_no = 0;
|
||||
void HealthcheckCallback (SaInvocationT invocation,
|
||||
const SaNameT *compName,
|
||||
SaAmfHealthcheckT checkType)
|
||||
{
|
||||
SaErrorT res;
|
||||
healthcheck_no ++;
|
||||
|
||||
// if (healthcheck_count++ % 20 == 19) {
|
||||
printf ("20 HealthcheckCallback have occured for component: ");
|
||||
if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) {
|
||||
printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no);
|
||||
printSaNameT ((SaNameT *)compName);
|
||||
printf ("\n");
|
||||
// }
|
||||
saAmfResponse (invocation, SA_OK);
|
||||
}
|
||||
|
||||
res = saAmfResponse (invocation, SA_OK);
|
||||
if (res != SA_OK) {
|
||||
printf ("response res is %d\n", res);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadinessStateSetCallback (SaInvocationT invocation,
|
||||
@ -240,14 +247,38 @@ void sigintr_handler (int signum) {
|
||||
}
|
||||
|
||||
|
||||
int main (void) {
|
||||
int main (int argc, char **argv) {
|
||||
SaAmfHandleT handle;
|
||||
int result;
|
||||
int select_fd;
|
||||
fd_set read_fds;
|
||||
SaNameT compName;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
int c;
|
||||
|
||||
signal (SIGINT, sigintr_handler);
|
||||
memset (&compName, 0, sizeof (SaNameT));
|
||||
for (;;) {
|
||||
c = getopt(argc,argv,"h:n:");
|
||||
if (c==-1) {
|
||||
break;
|
||||
}
|
||||
switch (c) {
|
||||
case 0 :
|
||||
break;
|
||||
case 'h':
|
||||
health_flag = 0;
|
||||
sscanf (optarg,"%ud" ,&healthcheck_count);
|
||||
break;
|
||||
case 'n':
|
||||
setSanameT (&compName, optarg);
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
result = saAmfInitialize (&handle, &amfCallbacks, &version);
|
||||
if (result != SA_OK) {
|
||||
printf ("initialize result is %d\n", result);
|
||||
@ -258,7 +289,9 @@ int main (void) {
|
||||
saAmfSelectionObjectGet (&handle, &select_fd);
|
||||
FD_SET (select_fd, &read_fds);
|
||||
|
||||
setSanameT (&compName, "comp_a_in_su_y");
|
||||
if (compName.length <= 0){
|
||||
setSanameT (&compName, "comp_b_in_su_x");
|
||||
}
|
||||
|
||||
result = saAmfComponentRegister (&handle, &compName, NULL);
|
||||
printf ("register result is %d (should be 1)\n", result);
|
||||
|
@ -66,19 +66,25 @@ void setSanameT (SaNameT *name, char *str) {
|
||||
memcpy (name->value, str, name->length);
|
||||
}
|
||||
|
||||
int healthcheck_count = 0;
|
||||
static int health_flag = -1;
|
||||
static unsigned int healthcheck_count = 0;
|
||||
static unsigned int healthcheck_no = 0;
|
||||
void HealthcheckCallback (SaInvocationT invocation,
|
||||
const SaNameT *compName,
|
||||
SaAmfHealthcheckT checkType)
|
||||
{
|
||||
SaErrorT res;
|
||||
|
||||
// if (healthcheck_count++ % 20 == 19) {
|
||||
printf ("20 HealthcheckCallback have occured for component: ");
|
||||
healthcheck_no ++;
|
||||
if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) {
|
||||
printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no);
|
||||
printSaNameT ((SaNameT *)compName);
|
||||
printf ("\n");
|
||||
// }
|
||||
saAmfResponse (invocation, SA_OK);
|
||||
|
||||
}
|
||||
res = saAmfResponse (invocation, SA_OK);
|
||||
if (res != SA_OK) {
|
||||
printf ("response res is %d\n", res);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadinessStateSetCallback (SaInvocationT invocation,
|
||||
@ -238,16 +244,39 @@ void sigintr_handler (int signum) {
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
int main (void) {
|
||||
int main (int argc, char **argv) {
|
||||
SaAmfHandleT handle;
|
||||
int result;
|
||||
int select_fd;
|
||||
fd_set read_fds;
|
||||
SaNameT compName;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
int c;
|
||||
|
||||
memset (&compName, 0, sizeof (SaNameT));
|
||||
signal (SIGINT, sigintr_handler);
|
||||
|
||||
for (;;) {
|
||||
c = getopt(argc,argv,"h:n:");
|
||||
if (c==-1) {
|
||||
break;
|
||||
}
|
||||
switch (c) {
|
||||
case 0 :
|
||||
break;
|
||||
case 'h':
|
||||
health_flag = 0;
|
||||
sscanf (optarg,"%ud" ,&healthcheck_count);
|
||||
break;
|
||||
case 'n':
|
||||
setSanameT (&compName, optarg);
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
result = saAmfInitialize (&handle, &amfCallbacks, &version);
|
||||
if (result != SA_OK) {
|
||||
printf ("initialize result is %d\n", result);
|
||||
@ -258,7 +287,9 @@ int main (void) {
|
||||
saAmfSelectionObjectGet (&handle, &select_fd);
|
||||
FD_SET (select_fd, &read_fds);
|
||||
|
||||
setSanameT (&compName, "comp_b_in_su_y");
|
||||
if (compName.length <= 0){
|
||||
setSanameT (&compName, "comp_b_in_su_x");
|
||||
}
|
||||
|
||||
result = saAmfComponentRegister (&handle, &compName, NULL);
|
||||
printf ("register result is %d (should be 1)\n", result);
|
||||
|
@ -66,19 +66,25 @@ void setSanameT (SaNameT *name, char *str) {
|
||||
memcpy (name->value, str, name->length);
|
||||
}
|
||||
|
||||
int healthcheck_count = 0;
|
||||
static int health_flag = -1;
|
||||
static unsigned int healthcheck_count = 0;
|
||||
static unsigned int healthcheck_no = 0;
|
||||
void HealthcheckCallback (SaInvocationT invocation,
|
||||
const SaNameT *compName,
|
||||
SaAmfHealthcheckT checkType)
|
||||
{
|
||||
SaErrorT res;
|
||||
|
||||
// if (healthcheck_count++ % 20 == 19) {
|
||||
printf ("20 HealthcheckCallback have occured for component: ");
|
||||
healthcheck_no ++;
|
||||
if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) {
|
||||
printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no);
|
||||
printSaNameT ((SaNameT *)compName);
|
||||
printf ("\n");
|
||||
// }
|
||||
saAmfResponse (invocation, SA_OK);
|
||||
|
||||
}
|
||||
res = saAmfResponse (invocation, SA_OK);
|
||||
if (res != SA_OK) {
|
||||
printf ("response res is %d\n", res);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadinessStateSetCallback (SaInvocationT invocation,
|
||||
@ -239,14 +245,39 @@ void sigintr_handler (int signum) {
|
||||
exit (0);
|
||||
}
|
||||
|
||||
int main (void) {
|
||||
int main (int argc, char **argv) {
|
||||
SaAmfHandleT handle;
|
||||
int result;
|
||||
int select_fd;
|
||||
fd_set read_fds;
|
||||
SaNameT compName;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
int c;
|
||||
|
||||
memset (&compName, 0, sizeof (SaNameT));
|
||||
signal (SIGINT, sigintr_handler);
|
||||
|
||||
for (;;) {
|
||||
c = getopt(argc,argv,"h:n:");
|
||||
if (c==-1) {
|
||||
break;
|
||||
}
|
||||
switch (c) {
|
||||
case 0 :
|
||||
break;
|
||||
case 'h':
|
||||
health_flag = 0;
|
||||
sscanf (optarg,"%ud" ,&healthcheck_count);
|
||||
break;
|
||||
case 'n':
|
||||
setSanameT (&compName, optarg);
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
result = saAmfInitialize (&handle, &amfCallbacks, &version);
|
||||
if (result != SA_OK) {
|
||||
printf ("initialize result is %d\n", result);
|
||||
@ -257,7 +288,9 @@ int main (void) {
|
||||
saAmfSelectionObjectGet (&handle, &select_fd);
|
||||
FD_SET (select_fd, &read_fds);
|
||||
|
||||
setSanameT (&compName, "comp_a_in_su_z");
|
||||
if (compName.length <= 0){
|
||||
setSanameT (&compName, "comp_b_in_su_x");
|
||||
}
|
||||
|
||||
result = saAmfComponentRegister (&handle, &compName, NULL);
|
||||
printf ("register result is %d (should be 1)\n", result);
|
||||
|
@ -66,21 +66,26 @@ void setSanameT (SaNameT *name, char *str) {
|
||||
memcpy (name->value, str, name->length);
|
||||
}
|
||||
|
||||
int healthcheck_count = 0;
|
||||
|
||||
static int health_flag = -1;
|
||||
static unsigned int healthcheck_count = 0;
|
||||
static unsigned int healthcheck_no = 0;
|
||||
void HealthcheckCallback (SaInvocationT invocation,
|
||||
const SaNameT *compName,
|
||||
SaAmfHealthcheckT checkType)
|
||||
{
|
||||
SaErrorT res;
|
||||
|
||||
// if (healthcheck_count++ % 20 == 19) {
|
||||
printf ("20 HealthcheckCallback have occured for component: ");
|
||||
healthcheck_no ++;
|
||||
if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) {
|
||||
printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no);
|
||||
printSaNameT ((SaNameT *)compName);
|
||||
printf ("\n");
|
||||
// }
|
||||
}
|
||||
res = saAmfResponse (invocation, SA_OK);
|
||||
printf ("response res is %d\n", res);
|
||||
|
||||
if (res != SA_OK) {
|
||||
printf ("response res is %d\n", res);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadinessStateSetCallback (SaInvocationT invocation,
|
||||
@ -240,26 +245,53 @@ void sigintr_handler (int signum) {
|
||||
exit (0);
|
||||
}
|
||||
|
||||
int main (void) {
|
||||
int main (int argc, char **argv) {
|
||||
SaAmfHandleT handle;
|
||||
int result;
|
||||
int select_fd;
|
||||
fd_set read_fds;
|
||||
SaNameT compName;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
int c;
|
||||
|
||||
memset (&compName, 0, sizeof (SaNameT));
|
||||
signal (SIGINT, sigintr_handler);
|
||||
|
||||
for (;;) {
|
||||
c = getopt(argc,argv,"h:n:");
|
||||
if (c==-1) {
|
||||
break;
|
||||
}
|
||||
switch (c) {
|
||||
case 0 :
|
||||
break;
|
||||
case 'h':
|
||||
health_flag = 0;
|
||||
sscanf (optarg,"%ud" ,&healthcheck_count);
|
||||
break;
|
||||
case 'n':
|
||||
setSanameT (&compName, optarg);
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
result = saAmfInitialize (&handle, &amfCallbacks, &version);
|
||||
if (result != SA_OK) {
|
||||
printf ("initialize result is %d\n", result);
|
||||
exit (1);
|
||||
}
|
||||
printf ("initialize result is %d\n", result);
|
||||
|
||||
FD_ZERO (&read_fds);
|
||||
saAmfSelectionObjectGet (&handle, &select_fd);
|
||||
FD_SET (select_fd, &read_fds);
|
||||
|
||||
setSanameT (&compName, "comp_b_in_su_z");
|
||||
if (compName.length <= 0){
|
||||
setSanameT (&compName, "comp_b_in_su_z");
|
||||
}
|
||||
|
||||
result = saAmfComponentRegister (&handle, &compName, NULL);
|
||||
printf ("register result is %d (should be 1)\n", result);
|
||||
|
Loading…
Reference in New Issue
Block a user