summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 12f6497)
raw | patch | inline | side by side (parent: 12f6497)
author | Mytnyk, VolodymyrX <volodymyrx.mytnyk@intel.com> | |
Tue, 27 Sep 2016 13:36:26 +0000 (14:36 +0100) | ||
committer | Mytnyk, VolodymyrX <volodymyrx.mytnyk@intel.com> | |
Mon, 26 Dec 2016 13:26:05 +0000 (13:26 +0000) |
- Fix Ubuntu compilation warnings.
Change-Id: I7bb72ec0ca732b00c4169e0174d64407d99a2751
Signed-off-by: Mytnyk, VolodymyrX <volodymyrx.mytnyk@intel.com>
Change-Id: I7bb72ec0ca732b00c4169e0174d64407d99a2751
Signed-off-by: Mytnyk, VolodymyrX <volodymyrx.mytnyk@intel.com>
src/collectd.conf.in | patch | blob | history | |
src/ovs_events.c | patch | blob | history | |
src/utils_ovs.c | patch | blob | history |
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index 7396286c8aed99762cd69bb758994fa940886529..ae4f6022fd3b9a7a1633eea6791c1fdbb66b7666 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
#@BUILD_PLUGIN_OPENLDAP_TRUE@LoadPlugin openldap
#@BUILD_PLUGIN_OPENVPN_TRUE@LoadPlugin openvpn
#@BUILD_PLUGIN_ORACLE_TRUE@LoadPlugin oracle
-#@BUILD_PLUGIN_OVS_LINK_TRUE@LoadPlugin ovs_events
+#@BUILD_PLUGIN_OVS_EVENTS_TRUE@LoadPlugin ovs_events
#@BUILD_PLUGIN_PERL_TRUE@LoadPlugin perl
#@BUILD_PLUGIN_PINBA_TRUE@LoadPlugin pinba
#@BUILD_PLUGIN_PING_TRUE@LoadPlugin ping
diff --git a/src/ovs_events.c b/src/ovs_events.c
index f971d1112ce418b53315ac17dc393659f57db69a..2eedf99dc5321e23d565487ae1e8a6b618f5df1f 100644 (file)
--- a/src/ovs_events.c
+++ b/src/ovs_events.c
n.severity = NOTIF_WARNING;
break;
default:
- ERROR(OVS_EVENTS_PLUGIN, ": unknown interface link status");
+ ERROR(OVS_EVENTS_PLUGIN ": unknown interface link status");
return;
}
/* add interface metadata to the notification */
if (plugin_notification_meta_add_string(&n, "uuid", ifinfo->uuid) < 0) {
- ERROR(OVS_EVENTS_PLUGIN, ": add interface uuid meta data failed");
+ ERROR(OVS_EVENTS_PLUGIN ": add interface uuid meta data failed");
return;
}
if (strlen(ifinfo->ext_vm_uuid) > 0)
if (plugin_notification_meta_add_string
(&n, "vm-uuid", ifinfo->ext_vm_uuid) < 0) {
- ERROR(OVS_EVENTS_PLUGIN, ": add interface vm-uuid meta data failed");
+ ERROR(OVS_EVENTS_PLUGIN ": add interface vm-uuid meta data failed");
return;
}
if (strlen(ifinfo->ext_iface_id) > 0)
if (plugin_notification_meta_add_string
(&n, "iface-id", ifinfo->ext_iface_id) < 0) {
- ERROR(OVS_EVENTS_PLUGIN, ": add interface iface-id meta data failed");
+ ERROR(OVS_EVENTS_PLUGIN ": add interface iface-id meta data failed");
return;
}
/* add interface metadata to the submit value */
if ((meta = meta_data_create()) != NULL) {
if (meta_data_add_string(meta, "uuid", ifinfo->uuid) < 0)
- ERROR(OVS_EVENTS_PLUGIN, ": add interface uuid meta data failed");
+ ERROR(OVS_EVENTS_PLUGIN ": add interface uuid meta data failed");
if (strlen(ifinfo->ext_vm_uuid) > 0)
if (meta_data_add_string(meta, "vm-uuid", ifinfo->ext_vm_uuid) < 0)
- ERROR(OVS_EVENTS_PLUGIN, ": add interface vm-uuid meta data failed");
+ ERROR(OVS_EVENTS_PLUGIN ": add interface vm-uuid meta data failed");
if (strlen(ifinfo->ext_iface_id) > 0)
if (meta_data_add_string(meta, "iface-id", ifinfo->ext_iface_id) < 0)
- ERROR(OVS_EVENTS_PLUGIN, ": add interface iface-id meta data failed");
+ ERROR(OVS_EVENTS_PLUGIN ": add interface iface-id meta data failed");
vl.meta = meta;
} else
ERROR(OVS_EVENTS_PLUGIN ": create metadata failed");
{
notification_t n = {NOTIF_FAILURE, cdtime(), "", "", OVS_EVENTS_PLUGIN,
"", "", "", NULL};
- ssnprintf(n.message, sizeof(n.message), msg);
+ sstrncpy(n.message, msg, sizeof(n.message));
sstrncpy(n.host, hostname_g, sizeof(n.host));
plugin_dispatch_notification(&n);
}
yajl_val jexternal_ids = NULL;
yajl_val jvalue = NULL;
yajl_val juuid = NULL;
+ const char *state = NULL;
/* check YAJL type */
if (!YAJL_IS_OBJECT(jobject))
- return NULL;
+ return (-1);
/* try to find external_ids, name and link_state fields */
jexternal_ids = ovs_utils_get_value_by_key(jobject, "external_ids");
/* get OVS DB interface link status */
jvalue = ovs_utils_get_value_by_key(jobject, "link_state");
- if (jvalue != NULL && YAJL_IS_STRING(jvalue)) {
+ if (jvalue != NULL && ((state = YAJL_GET_STRING(jvalue)) != NULL)) {
/* convert OVS table link state to link status */
- if (strcmp(YAJL_GET_STRING(jvalue), "up") == 0)
+ if (strcmp(state, "up") == 0)
ifinfo->link_status = UP;
- else if (strcmp(YAJL_GET_STRING(jvalue), "down") == 0)
+ else if (strcmp(state, "down") == 0)
ifinfo->link_status = DOWN;
}
return (0);
diff --git a/src/utils_ovs.c b/src/utils_ovs.c
index 983f249a025a87da52f3597833d83f0c176a6adb..636a38d2c517117268f51b116b193e458d7c6b42 100644 (file)
--- a/src/utils_ovs.c
+++ b/src/utils_ovs.c
return (0);
failure:
- OVS_ERROR("%s() : invalid OVS DB URL provided");
+ OVS_ERROR("invalid OVS DB URL provided [url=%s]", surl);
sfree(in_str);
return (-1);
}
return (-1);
sstrncpy(sjson, data, len + 1);
- OVS_DEBUG("[len=%d] %s", len, sjson);
+ OVS_DEBUG("[len=%zu] %s", len, sjson);
/* parse json data */
jnode = yajl_tree_parse(sjson, yajl_errbuf, sizeof(yajl_errbuf));
size_t array_len = 0;
yajl_val *map_values = NULL;
yajl_val *array_values = NULL;
+ const char *str_val = NULL;
/* check YAJL array */
if (!YAJL_IS_ARRAY(jval) || (key == NULL))
return NULL;
/* check first element of the array */
- if (strcmp("map", YAJL_GET_STRING(array_values[0])) != 0)
+ str_val = YAJL_GET_STRING(array_values[0]);
+ if (strcmp("map", str_val) != 0)
return NULL;
/* try to find map value by map key */
break;
/* return map value if given key equals map key */
- if (strcmp(key, YAJL_GET_STRING(array_values[0])) == 0)
+ str_val = YAJL_GET_STRING(array_values[0]);
+ if (strcmp(key, str_val) == 0)
return array_values[1];
}
return NULL;