Skip to content

Commit 3111663

Browse files
arkamarvlvkobal
authored andcommitted
xenstat.plugin: check xenstat_vbd_error presence (netdata#7103)
The xenstat_vbd_error function is going to be part of the xen 4.13 release. The workaround here is to check if the function is already present in configuration phase and set vbd_m->error always to 0 if xenstat_vbd_error does not exist.
1 parent 509882e commit 3111663

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

collectors/xenstat.plugin/xenstat_plugin.c

+4
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,11 @@ static int vbd_metrics_collect(struct domain_metrics *d, xenstat_domain *domain)
333333
return 1;
334334
}
335335

336+
#ifdef HAVE_XENSTAT_VBD_ERROR
336337
vbd_m->error = xenstat_vbd_error(vbd);
338+
#else
339+
vbd_m->error = 0;
340+
#endif
337341
vbd_m->oo_reqs = xenstat_vbd_oo_reqs(vbd);
338342
vbd_m->rd_reqs = xenstat_vbd_rd_reqs(vbd);
339343
vbd_m->wr_reqs = xenstat_vbd_wr_reqs(vbd);

configure.ac

+16
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,22 @@ fi
748748
AC_MSG_RESULT([${enable_plugin_xenstat}])
749749
AM_CONDITIONAL([ENABLE_PLUGIN_XENSTAT], [test "${enable_plugin_xenstat}" = "yes"])
750750

751+
if test "${enable_plugin_xenstat}" == "yes"; then
752+
AC_MSG_CHECKING([for xenstat_vbd_error in -lxenstat])
753+
AC_TRY_LINK(
754+
[ #include <xenstat.h> ],
755+
[
756+
xenstat_vbd * vbd;
757+
int out = xenstat_vbd_error(vbd);
758+
],
759+
[
760+
have_xenstat_vbd_error=yes
761+
AC_DEFINE([HAVE_XENSTAT_VBD_ERROR], [1], [xenstat_vbd_error usability])
762+
],
763+
[ have_xenstat_vbd_error=no ]
764+
)
765+
AC_MSG_RESULT([${have_xenstat_vbd_error}])
766+
fi
751767

752768
# -----------------------------------------------------------------------------
753769
# perf.plugin

0 commit comments

Comments
 (0)