Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
SUSE:SLE-12-SP2:Update
pacemaker
pacemaker-stonith-check-missing-params-new-devi...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pacemaker-stonith-check-missing-params-new-device-and-dup.patch of Package pacemaker
commit 969bbfd06476a71f66882964e5ea92b0bebbcc5b Author: Nate Clark <nate@neworld.us> Date: Thu Dec 1 11:00:38 2016 -0500 stonith: Check for missing params in new device and dup device_has_duplicate would return a dup if all params in device where in dup with the same value but if dup had a param that device did not the dup would still be considered a duplicate. This updates the duplicate check to make sure that all keys and values overlap in both device and dup params. diff --git a/fencing/commands.c b/fencing/commands.c index a4699ee79..d21e5a85a 100644 --- a/fencing/commands.c +++ b/fencing/commands.c @@ -988,27 +988,15 @@ dynamic_list_search_cb(GPid pid, int rc, const char *output, gpointer user_data) /*! * \internal - * \brief Checks to see if an identical device already exists in the device_list + * \brief Returns true if any key in first is not is second or second has a different value for key */ -static stonith_device_t * -device_has_duplicate(stonith_device_t * device) -{ +static int +device_params_diff(GHashTable *first, GHashTable *second) { char *key = NULL; char *value = NULL; GHashTableIter gIter; - stonith_device_t *dup = g_hash_table_lookup(device_list, device->id); - if (!dup) { - crm_trace("No match for %s", device->id); - return NULL; - - } else if (safe_str_neq(dup->agent, device->agent)) { - crm_trace("Different agent: %s != %s", dup->agent, device->agent); - return NULL; - } - - /* Use calculate_operation_digest() here? */ - g_hash_table_iter_init(&gIter, device->params); + g_hash_table_iter_init(&gIter, first); while (g_hash_table_iter_next(&gIter, (void **)&key, (void **)&value)) { if(strstr(key, "CRM_meta") == key) { @@ -1016,15 +1004,42 @@ device_has_duplicate(stonith_device_t * device) } else if(strcmp(key, "crm_feature_set") == 0) { continue; } else { - char *other_value = g_hash_table_lookup(dup->params, key); + char *other_value = g_hash_table_lookup(second, key); if (!other_value || safe_str_neq(other_value, value)) { crm_trace("Different value for %s: %s != %s", key, other_value, value); - return NULL; + return 1; } } } + return 0; +} + +/*! + * \internal + * \brief Checks to see if an identical device already exists in the device_list + */ +static stonith_device_t * +device_has_duplicate(stonith_device_t * device) +{ + stonith_device_t *dup = g_hash_table_lookup(device_list, device->id); + + if (!dup) { + crm_trace("No match for %s", device->id); + return NULL; + + } else if (safe_str_neq(dup->agent, device->agent)) { + crm_trace("Different agent: %s != %s", dup->agent, device->agent); + return NULL; + } + + /* Use calculate_operation_digest() here? */ + if (device_params_diff(device->params, dup->params) || + device_params_diff(dup->params, device->params)) { + return NULL; + } + crm_trace("Match"); return dup; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor