Skip to content

Commit

Permalink
Merge pull request ClusterLabs#23 from linux-ha-japan/update-2.3
Browse files Browse the repository at this point in the history
Update 2.3
  • Loading branch information
Kazunori INOUE committed Jun 15, 2017
2 parents df88c4b + ed9dc34 commit 79797f2
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 3 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT(pm_extras, 2.2)
AC_INIT(pm_extras, 2.3)
dnl Older distros may need: AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)
AM_INIT_AUTOMAKE
AC_PROG_CC
Expand Down
4 changes: 2 additions & 2 deletions resources/VIPcheck
Expand Up @@ -68,8 +68,8 @@ wait times
<actions>
<action name="start" timeout="60s" />
<action name="stop" timeout="60s" />
<action name="monitor" timeout="60s" interval="10s" depth="0" start-delay="0s" />
<action name="stop" timeout="20s" />
<action name="monitor" timeout="20s" interval="10s" depth="0" />
<action name="validate-all" timeout="30s" />
<action name="meta-data" timeout="5s" />
</actions>
Expand Down
64 changes: 64 additions & 0 deletions tools/ifcheckd.c
Expand Up @@ -78,6 +78,11 @@
*/
#define DEFAULT_INTERVAL 1

/**
*
*
*/
#define PACEMAKERD_SEARCH_KEY "runtime.connections.pacemakerd"
/**
* trace faulty key
*/
Expand Down Expand Up @@ -303,6 +308,48 @@ crm_lock_pidfile(const char *filename)
return crm_pidfile_inuse(filename, mypid);
}

/**
* "runtime.connections.pacemakerd" key search function.
* If a key exists, Pacemaker has been started.
* @return key exists is TRUE, otherwise FALSE
*/
static gboolean
_is_alive_pacemakerd()
{
cmap_handle_t handle;
cs_error_t rc;
cmap_iter_handle_t iter_handle;
char key_name[CMAP_KEYNAME_MAXLEN + 1];
size_t value_len;
cmap_value_types_t type;
gboolean connected = FALSE;

rc = cmap_initialize(&handle);
if (rc != CS_OK) {
crm_debug("Failed to initialize the cmap API. Error %d", rc);
return FALSE;
}

rc = cmap_iter_init(handle, PACEMAKERD_SEARCH_KEY, &iter_handle);
if (rc != CS_OK) {
crm_debug("Failed to iter_init the cmap API. Error %d", rc);
goto out_free;
}

rc = cmap_iter_next(handle, iter_handle, key_name, &value_len, &type);
if (rc == CS_OK) {
connected = TRUE;
}
crm_debug("The key(%s) to cmap is %s", PACEMAKERD_SEARCH_KEY, rc == CS_OK ? "found" : "not found" );

(void) cmap_iter_finalize(handle, iter_handle);

out_free :
(void) cmap_finalize(handle);

return connected;
}

/**
* SIGNAL handler function.
* @param nsig the number of SIGNAL. except as called by signal trap,
Expand Down Expand Up @@ -457,6 +504,12 @@ _attr_iface_finalize(void)
gboolean rc = FALSE;

crm_debug("Start to finalize attribute information.");

if (_is_alive_pacemakerd() == FALSE) {
crm_debug("Cannot confirm start of pacemakerd.");
return FALSE;
}

result = corosync_cfg_initialize(&handle, NULL);
if (result != CS_OK) {
crm_debug("Could not initialize corosync configuration API error %d",
Expand Down Expand Up @@ -514,6 +567,12 @@ _attr_iface_init(void)
gboolean rc = FALSE;

crm_debug("Start to initialize attribute information.");

if (_is_alive_pacemakerd() == FALSE) {
crm_debug("Cannot confirm start of pacemakerd.");
return FALSE;
}

result = corosync_cfg_initialize(&handle, NULL);
if (result != CS_OK) {
crm_debug("Could not initialize corosync configuration API error %d",
Expand Down Expand Up @@ -778,6 +837,11 @@ _cs_cmap_rrp_faulty_key_changed(cmap_handle_t cmap_handle_c,
uint8_t faulty;
cs_error_t err;

if (_is_alive_pacemakerd() == FALSE) {
crm_debug("Cannot confirm start of pacemakerd.");
return;
}

result = sscanf(key_name, FAULTY_KEY_SCAN_FORMAT, &iface_no,
tmp_key);
if (result != 2) {
Expand Down

0 comments on commit 79797f2

Please sign in to comment.