| 421 | } |
| 422 | |
| 423 | static void shutdown_do(int force) |
| 424 | { |
| 425 | cs_error_t result; |
| 426 | corosync_cfg_handle_t handle; |
| 427 | corosync_cfg_callbacks_t callbacks; |
| 428 | int flag; |
| 429 | |
| 430 | callbacks.corosync_cfg_shutdown_callback = NULL; |
| 431 | if (force) { |
| 432 | flag = COROSYNC_CFG_SHUTDOWN_FLAG_REGARDLESS; |
| 433 | } else { |
| 434 | flag = COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST; |
| 435 | } |
| 436 | |
| 437 | result = corosync_cfg_initialize (&handle, &callbacks); |
| 438 | if (result != CS_OK) { |
| 439 | fprintf (stderr, "Could not initialize corosync configuration API error %d\n", result); |
| 440 | exit (EXIT_FAILURE); |
| 441 | } |
| 442 | |
| 443 | printf ("Shutting down corosync\n"); |
| 444 | cs_repeat(result, 30, corosync_cfg_try_shutdown (handle, flag)); |
| 445 | if (result != CS_OK) { |
| 446 | fprintf (stderr, "Could not shutdown (error = %d)\n", result); |
| 447 | } |
| 448 | |
| 449 | (void)corosync_cfg_finalize (handle); |
| 450 | } |
| 451 | |
| 452 | static int showaddrs_do(unsigned int nodeid) |
| 453 | { |
no test coverage detected