xenstat.plugin: check xenstat_vbd_error presence (#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.
Petr Vaněk committed
Oct 22, 2019 at 16:29 UTC
31116639d6a9f9fd731502150207371b892dc4e6
2 files changed
+20
collectors/xenstat.plugin/xenstat_plugin.c
+4
@@ -333,7 +333,11 @@ static int vbd_metrics_collect(struct domain_metrics *d, xenstat_domain *domain)
333
return 1;
334
}
335
336
+#ifdef HAVE_XENSTAT_VBD_ERROR
337
vbd_m->error = xenstat_vbd_error(vbd);
338
+#else
339
+ vbd_m->error = 0;
340
+#endif
341
vbd_m->oo_reqs = xenstat_vbd_oo_reqs(vbd);
342
vbd_m->rd_reqs = xenstat_vbd_rd_reqs(vbd);
343
vbd_m->wr_reqs = xenstat_vbd_wr_reqs(vbd);
configure.ac
+16
@@ -748,6 +748,22 @@ fi
748
AC_MSG_RESULT([${enable_plugin_xenstat}])
749
AM_CONDITIONAL([ENABLE_PLUGIN_XENSTAT], [test "${enable_plugin_xenstat}" = "yes"])
750
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
767
768
# -----------------------------------------------------------------------------
769
# perf.plugin