Merge pull request #2903 from ccin2p3/documentation/libvirt
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Tue, 9 Oct 2018 08:09:12 +0000 (10:09 +0200)
committerGitHub <noreply@github.com>
Tue, 9 Oct 2018 08:09:12 +0000 (10:09 +0200)
add some useful info to libvirt manpage

17 files changed:
Makefile.am
build.sh
configure.ac
contrib/docker/rootfs_prefix/rootfs_prefix.c
src/chrony.c
src/collectd.conf.in
src/collectd.conf.pod
src/daemon/plugin.h
src/daemon/utils_avltree.c
src/daemon/utils_avltree_test.c
src/exec.c
src/nfs.c
src/redis.c
src/sensors.c
src/utils_dpdk.c
src/utils_format_json.c
src/virt.c

index cb40148..48a7cb3 100644 (file)
@@ -2,11 +2,13 @@ ACLOCAL_AMFLAGS = -I m4
 AM_YFLAGS = -d
 
 if BUILD_WIN32
-pkgdatadir=$(datadir)
-pkglibdir=$(libdir)/plugins
-pkglocalstatedir=${localstatedir}
+cpkgdatadir=$(datadir)
+cpkglibdir=$(libdir)/plugins
+cpkglocalstatedir=${localstatedir}
 else
-pkglocalstatedir=${localstatedir}/lib/${PACKAGE_NAME}
+cpkgdatadir=$(pkgdatadir)
+cpkglibdir=$(pkglibdir)
+cpkglocalstatedir=${localstatedir}/lib/${PACKAGE_NAME}
 endif
 
 BUILT_SOURCES = \
@@ -165,7 +167,7 @@ TESTS = $(check_PROGRAMS)
 LOG_COMPILER = env VALGRIND="@VALGRIND@" $(abs_srcdir)/testwrapper.sh
 
 
-jardir = $(pkgdatadir)/java
+jardir = $(cpkgdatadir)/java
 
 pkglib_LTLIBRARIES =
 
@@ -184,9 +186,9 @@ AM_CPPFLAGS = \
        -DPREFIX='"${prefix}"' \
        -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' \
        -DLOCALSTATEDIR='"${localstatedir}"' \
-       -DPKGLOCALSTATEDIR='"${pkglocalstatedir}"' \
-       -DPLUGINDIR='"${pkglibdir}"' \
-       -DPKGDATADIR='"${pkgdatadir}"'
+       -DPKGLOCALSTATEDIR='"${cpkglocalstatedir}"' \
+       -DPLUGINDIR='"${cpkglibdir}"' \
+       -DPKGDATADIR='"${cpkgdatadir}"'
 if BUILD_WIN32
 AM_CPPFLAGS += -DNOGDI
 endif
@@ -2094,15 +2096,15 @@ install-exec-hook:
        else \
                $(INSTALL) -m 0640 $(builddir)/src/collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf; \
        fi; \
-       $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
-       $(INSTALL) -m 0644 $(srcdir)/src/types.db $(DESTDIR)$(pkgdatadir)/types.db;
+       $(mkinstalldirs) $(DESTDIR)$(cpkgdatadir)
+       $(INSTALL) -m 0644 $(srcdir)/src/types.db $(DESTDIR)$(cpkgdatadir)/types.db;
        $(INSTALL) -m 0644 $(srcdir)/src/postgresql_default.conf \
-               $(DESTDIR)$(pkgdatadir)/postgresql_default.conf;
+               $(DESTDIR)$(cpkgdatadir)/postgresql_default.conf;
 
 uninstall-hook:
-       rm -f $(DESTDIR)$(pkgdatadir)/types.db;
+       rm -f $(DESTDIR)$(cpkgdatadir)/types.db;
        rm -f $(DESTDIR)$(sysconfdir)/collectd.conf
-       rm -f $(DESTDIR)$(pkgdatadir)/postgresql_default.conf;
+       rm -f $(DESTDIR)$(cpkgdatadir)/postgresql_default.conf;
 
 all-local: @PERL_BINDINGS@
 
index a1a6769..c0ccce3 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -75,7 +75,7 @@ build_cygwin()
     : ${DATADIR:="${INSTALL_DIR}"}
 
     echo "Installing collectd to ${INSTALL_DIR}."
-    TOP_SRCDIR=$(pwd)
+    TOP_SRCDIR="$(pwd)"
     MINGW_ROOT="$(x86_64-w64-mingw32-gcc -print-sysroot)/mingw"
     export GNULIB_DIR="${TOP_SRCDIR}/gnulib/build/gllib"
 
index 7bf3718..95caeff 100644 (file)
@@ -5920,25 +5920,41 @@ AC_SUBST([BUILD_WITH_LIBVARNISH_CFLAGS])
 AC_SUBST([BUILD_WITH_LIBVARNISH_LIBS])
 # }}}
 
-# pkg-config --exists 'libxml-2.0' {{{
-$PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null
-if test $? -eq 0; then
-  with_libxml2="yes"
-else
-  with_libxml2="no (pkg-config doesn't know libxml-2.0)"
-fi
-
-if test "x$with_libxml2" = "xyes"; then
-  with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`"
-  if test $? -ne 0; then
-    with_libxml2="no"
-  fi
-
-  with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`"
-  if test $? -ne 0; then
-    with_libxml2="no"
-  fi
-fi
+# --with-libxml2 {{{
+AC_ARG_WITH(libxml2,
+  [AS_HELP_STRING([--with-libxml2@<:@=PREFIX@:>@], [Path to libxml2.])],
+  [
+    if test "x$withval" = "xno"; then
+      with_libxml2="no"
+    else if test "x$withval" = "xyes"; then
+      $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null
+      if test $? -eq 0; then
+        with_libxml2="yes"
+        with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`"
+        with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`"
+      else
+        with_libxml2="no (pkg-config doesn't know libxml-2.0)"
+      fi
+    else
+      with_libxml2="yes"
+      with_libxml2_cflags="-I$withval/include"
+      with_libxml2_ldflags="-L$withval/lib"
+    fi; fi
+  ],
+  dnl  if no argument --with-libxml2 was passed, find the library locations
+  dnl  with pkg-config just like above, when --with-libxml2=yes.
+  [
+    with_libxml2="yes"
+    $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null
+    if test $? -eq 0; then
+      with_libxml2="yes"
+      with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`"
+      with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`"
+    else
+      with_libxml2="no (pkg-config doesn't know libxml-2.0)"
+    fi
+  ]
+)
 
 if test "x$with_libxml2" = "xyes"; then
   SAVE_CPPFLAGS="$CPPFLAGS"
index 2b83151..fdacf74 100644 (file)
@@ -1,3 +1,33 @@
+/**
+ * collectd - contrib/docker/rootfs_prefix/rootfs_prefix.c
+ * Copyright (C) 2016-2018  Marc Fournier
+ * Copyright (C) 2016-2018  Ruben Kerkhof
+ *
+ * MIT License:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *   Marc Fournier <marc.fournier at camptocamp.com>
+ *   Ruben Kerkhof <ruben at rubenkerkhof.com>
+ **/
+
 #define _GNU_SOURCE
 
 #include <dirent.h>
index 6fb369a..913aab9 100644 (file)
 #include <arpa/inet.h> /* ntohs/ntohl */
 #endif
 
+/* AIX doesn't have MSG_DONTWAIT */
+#ifndef MSG_DONTWAIT
+#define MSG_DONTWAIT MSG_NONBLOCK
+#endif
+
 #define CONFIG_KEY_HOST "Host"
 #define CONFIG_KEY_PORT "Port"
 #define CONFIG_KEY_TIMEOUT "Timeout"
@@ -440,6 +445,15 @@ static int chrony_recv_response(tChrony_Response *p_resp,
   }
 }
 
+static void chrony_flush_recv_queue(void) {
+  char buf[1];
+
+  if (g_chrony_is_connected) {
+    while (recv(g_chrony_socket, buf, sizeof(buf), MSG_DONTWAIT) > 0)
+      ;
+  }
+}
+
 static int chrony_query(const int p_command, tChrony_Request *p_req,
                         tChrony_Response *p_resp, size_t *p_resp_size) {
   /* Check connection. We simply perform one try as collectd already handles
@@ -964,6 +978,9 @@ static int chrony_read(void) {
     g_chrony_seq_is_initialized = 1;
   }
 
+  /* Ignore late responses that may have been received */
+  chrony_flush_recv_queue();
+
   /* Get daemon stats */
   rc = chrony_request_daemon_stats();
   if (rc != CHRONY_RC_OK)
index fb1471f..af65214 100644 (file)
 #   <Node example>
 #      Host "redis.example.com"
 #      Port "6379"
+#      #Socket "/var/run/redis/redis.sock"
 #      Timeout 2000
 #      <Query "LLEN myqueue">
 #        #Database 0
index 5590c5b..b1f8eb4 100644 (file)
@@ -7359,6 +7359,7 @@ parameters and set of user-defined queries for this node.
     <Node "example">
         Host "localhost"
         Port "6379"
+        #Socket "/var/run/redis/redis.sock"
         Timeout 2000
         ReportCommandStats false
         ReportCpuUsage true
@@ -7392,6 +7393,11 @@ The B<Port> option is the TCP port on which the Redis instance accepts
 connections. Either a service name of a port number may be given. Please note
 that numerical port numbers must be given as a string, too.
 
+=item B<Socket> I<Path>
+
+Connect to Redis using the UNIX domain socket at I<Path>. If this
+setting is given, the B<Hostname> and B<Port> settings are ignored.
+
 =item B<Password> I<Password>
 
 Use I<Password> to authenticate when connecting to I<Redis>.
index 2d903cb..616889a 100644 (file)
@@ -245,7 +245,7 @@ int plugin_shutdown_all(void);
  *
  * DESCRIPTION
  *  Calls the write function of the given plugin with the provided data set and
- *  value list. It differs from `plugin_dispatch_value' in that it does not
+ *  value list. It differs from `plugin_dispatch_values' in that it does not
  *  update the cache, does not do threshold checking, call the chain subsystem
  *  and so on. It looks up the requested plugin and invokes the function, end
  *  of story.
index 87568fb..568d68c 100644 (file)
@@ -621,7 +621,7 @@ int c_avl_iterator_prev(c_avl_iterator_t *iter, void **key, void **value) {
     return -1;
 
   if (iter->node == NULL) {
-    for (n = iter->tree->root; n != NULL; n = n->left)
+    for (n = iter->tree->root; n != NULL; n = n->right)
       if (n->right == NULL)
         break;
     iter->node = n;
index 3171246..4be4941 100644 (file)
@@ -45,11 +45,17 @@ static int compare_callback(void const *v0, void const *v1) {
   return strcmp(v0, v1);
 }
 
+struct kv_t {
+  char *key;
+  char *value;
+};
+
+static int kv_compare(const void *a_ptr, const void *b_ptr) {
+  return strcmp(((struct kv_t *)a_ptr)->key, ((struct kv_t *)b_ptr)->key);
+}
+
 DEF_TEST(success) {
-  struct {
-    char *key;
-    char *value;
-  } cases[] = {
+  struct kv_t cases[] = {
       {"Eeph7chu", "vai1reiV"}, {"igh3Paiz", "teegh1Ee"},
       {"caip6Uu8", "ooteQu8n"}, {"Aech6vah", "AijeeT0l"},
       {"Xah0et2L", "gah8Taep"}, {"BocaeB8n", "oGaig8io"},
@@ -62,6 +68,11 @@ DEF_TEST(success) {
       {"ieN5engi", "Aevou1ah"}, {"ooTe4OhP", "aingai5Y"},
   };
 
+  struct kv_t sorted_cases[STATIC_ARRAY_SIZE(cases)];
+  memcpy(sorted_cases, cases, sizeof(cases));
+  qsort(sorted_cases, STATIC_ARRAY_SIZE(cases), sizeof(struct kv_t),
+        kv_compare);
+
   c_avl_tree_t *t;
 
   RESET_COUNTS();
@@ -91,6 +102,37 @@ DEF_TEST(success) {
     EXPECT_EQ_STR(cases[i].value, value_ret);
   }
 
+  /* iterate forward */
+  {
+    c_avl_iterator_t *iter = c_avl_get_iterator(t);
+    char *key;
+    char *value;
+    size_t i = 0;
+    while (c_avl_iterator_next(iter, (void **)&key, (void **)&value) == 0) {
+      EXPECT_EQ_STR(sorted_cases[i].key, key);
+      EXPECT_EQ_STR(sorted_cases[i].value, value);
+      i++;
+    }
+    c_avl_iterator_destroy(iter);
+    EXPECT_EQ_INT(i, STATIC_ARRAY_SIZE(cases));
+  }
+
+  /* iterate backward */
+  {
+    c_avl_iterator_t *iter = c_avl_get_iterator(t);
+    char *key;
+    char *value;
+    size_t i = 0;
+    while (c_avl_iterator_prev(iter, (void **)&key, (void **)&value) == 0) {
+      EXPECT_EQ_STR(sorted_cases[STATIC_ARRAY_SIZE(cases) - 1 - i].key, key);
+      EXPECT_EQ_STR(sorted_cases[STATIC_ARRAY_SIZE(cases) - 1 - i].value,
+                    value);
+      i++;
+    }
+    c_avl_iterator_destroy(iter);
+    EXPECT_EQ_INT(i, STATIC_ARRAY_SIZE(cases));
+  }
+
   /* remove half */
   for (size_t i = 0; i < STATIC_ARRAY_SIZE(cases) / 2; i++) {
     char *key = NULL;
index b145e81..77b1375 100644 (file)
@@ -78,6 +78,11 @@ typedef struct program_list_and_notification_s {
 } program_list_and_notification_t;
 
 /*
+ * constants
+ */
+const long int MAX_GRBUF_SIZE = 65536;
+
+/*
  * Private variables
  */
 static program_list_t *pl_head;
@@ -340,6 +345,65 @@ static void close_pipe(int fd_pipe[2]) /* {{{ */
 } /* }}} void close_pipe */
 
 /*
+ * Get effective group ID from group name.
+ * Input arguments:
+ *       pl  :program list struct with group name
+ *       gid :group id to fallback in case egid cannot be determined.
+ * Returns:
+ *       egid effective group id if successfull,
+ *            -1 if group is not defined/not found.
+ *            -2 for any buffer allocation error.
+ */
+static int getegr_id(program_list_t *pl, int gid) /* {{{ */
+{
+  if (pl->group == NULL) {
+    return -1;
+  }
+  if (strcmp(pl->group, "") == 0) {
+    return gid;
+  }
+  struct group *gr_ptr = NULL;
+  struct group gr;
+
+  long int grbuf_size = sysconf(_SC_GETGR_R_SIZE_MAX);
+  if (grbuf_size <= 0)
+    grbuf_size = sysconf(_SC_PAGESIZE);
+  if (grbuf_size <= 0)
+    grbuf_size = 4096;
+
+  char *temp = NULL;
+  char *grbuf = NULL;
+
+  do {
+    temp = realloc(grbuf, grbuf_size);
+    if (temp == NULL) {
+      ERROR("exec plugin: getegr_id for %s: realloc buffer[%ld] failed ",
+            pl->group, grbuf_size);
+      sfree(grbuf);
+      return -2;
+    }
+    grbuf = temp;
+    if (getgrnam_r(pl->group, &gr, grbuf, grbuf_size, &gr_ptr) == 0) {
+      sfree(grbuf);
+      if (gr_ptr == NULL) {
+        ERROR("exec plugin: No such group: `%s'", pl->group);
+        return -1;
+      }
+      return gr.gr_gid;
+    } else if (errno == ERANGE) {
+      grbuf_size += grbuf_size; // increment buffer size and try again
+    } else {
+      ERROR("exec plugin: getegr_id failed %s", STRERRNO);
+      sfree(grbuf);
+      return -2;
+    }
+  } while (grbuf_size <= MAX_GRBUF_SIZE);
+  ERROR("exec plugin: getegr_id Max grbuf size reached  for %s", pl->group);
+  sfree(grbuf);
+  return -2;
+}
+
+/*
  * Creates three pipes (one for reading, one for writing and one for errors),
  * forks a child, sets up the pipes so that fd_in is connected to STDIN of
  * the child and fd_out is connected to STDOUT and fd_err is connected to STDERR
@@ -397,36 +461,10 @@ static int fork_child(program_list_t *pl, int *fd_in, int *fd_out,
 
   /* The group configured in the configfile is set as effective group, because
    * this way the forked process can (re-)gain the user's primary group. */
-  egid = -1;
-  if (pl->group != NULL) {
-    if (*pl->group != '\0') {
-      struct group *gr_ptr = NULL;
-      struct group gr;
-
-      long int grbuf_size = sysconf(_SC_GETGR_R_SIZE_MAX);
-      if (grbuf_size <= 0)
-        grbuf_size = sysconf(_SC_PAGESIZE);
-      if (grbuf_size <= 0)
-        grbuf_size = 4096;
-      char grbuf[grbuf_size];
-
-      status = getgrnam_r(pl->group, &gr, grbuf, sizeof(grbuf), &gr_ptr);
-      if (status != 0) {
-        ERROR("exec plugin: Failed to get group information "
-              "for group ``%s'': %s",
-              pl->group, STRERROR(status));
-        goto failed;
-      }
-      if (gr_ptr == NULL) {
-        ERROR("exec plugin: No such group: `%s'", pl->group);
-        goto failed;
-      }
-
-      egid = gr.gr_gid;
-    } else {
-      egid = gid;
-    }
-  } /* if (pl->group == NULL) */
+  egid = getegr_id(pl, gid);
+  if (egid == -2) {
+    goto failed;
+  }
 
   pid = fork();
   if (pid < 0) {
index e1987f1..481aa79 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
@@ -519,7 +519,8 @@ static int nfs_submit_nfs4_client(const char *instance, char **fields,
 static void nfs_read_linux(FILE *fh, const char *inst) {
   char buffer[1024];
 
-  char *fields[64];
+  // The stats line is prefixed with type and number of fields, thus plus 2
+  char *fields[MAX(NFS4_SERVER_MAX_PROC, NFS4_CLIENT_MAX_PROC) + 2];
   int fields_num = 0;
 
   if (fh == NULL)
index 41442b6..e24abd5 100644 (file)
@@ -70,6 +70,7 @@ typedef struct redis_node_s redis_node_t;
 struct redis_node_s {
   char *name;
   char *host;
+  char *socket;
   char *passwd;
   int port;
   struct timeval timeout;
@@ -97,9 +98,11 @@ static void redis_node_free(void *arg) {
     rq = next;
   }
 
-  redisFree(rn->redisContext);
+  if (rn->redisContext)
+    redisFree(rn->redisContext);
   sfree(rn->name);
   sfree(rn->host);
+  sfree(rn->socket);
   sfree(rn->passwd);
   sfree(rn);
 } /* void redis_node_free */
@@ -212,6 +215,8 @@ static int redis_config_node(oconfig_item_t *ci) /* {{{ */
         rn->port = status;
         status = 0;
       }
+    } else if (strcasecmp("Socket", option->key) == 0) {
+      status = cf_util_get_string(option, &rn->socket);
     } else if (strcasecmp("Query", option->key) == 0) {
       redis_query_t *rq = redis_config_query(option);
       if (rq == NULL) {
@@ -590,15 +595,23 @@ static void redis_check_connection(redis_node_t *rn) {
   if (rn->redisContext)
     return;
 
-  redisContext *rh = redisConnectWithTimeout(rn->host, rn->port, rn->timeout);
+  redisContext *rh;
+  if (rn->socket != NULL)
+    rh = redisConnectUnixWithTimeout(rn->socket, rn->timeout);
+  else
+    rh = redisConnectWithTimeout(rn->host, rn->port, rn->timeout);
 
   if (rh == NULL) {
     ERROR("redis plugin: can't allocate redis context");
     return;
   }
   if (rh->err) {
-    ERROR("redis plugin: unable to connect to node `%s' (%s:%d): %s.", rn->name,
-          rn->host, rn->port, rh->errstr);
+    if (rn->socket)
+      ERROR("redis plugin: unable to connect to node `%s' (%s): %s.", rn->name,
+            rn->socket, rh->errstr);
+    else
+      ERROR("redis plugin: unable to connect to node `%s' (%s:%d): %s.",
+            rn->name, rn->host, rn->port, rh->errstr);
     redisFree(rh);
     return;
   }
@@ -759,8 +772,14 @@ static int redis_read(user_data_t *user_data) /* {{{ */
 {
   redis_node_t *rn = user_data->data;
 
-  DEBUG("redis plugin: querying info from node `%s' (%s:%d).", rn->name,
-        rn->host, rn->port);
+#if COLLECT_DEBUG
+  if (rn->socket)
+    DEBUG("redis plugin: querying info from node `%s' (%s).", rn->name,
+          rn->socket);
+  else
+    DEBUG("redis plugin: querying info from node `%s' (%s:%d).", rn->name,
+          rn->host, rn->port);
+#endif
 
   redis_check_connection(rn);
 
index 41cccf1..6106df3 100644 (file)
@@ -368,6 +368,9 @@ static int sensors_load_conf(void) {
 #if SENSORS_API_VERSION >= 0x402
           (feature->type != SENSORS_FEATURE_CURR) &&
 #endif
+#if SENSORS_API_VERSION >= 0x431
+          (feature->type != SENSORS_FEATURE_HUMIDITY) &&
+#endif
           (feature->type != SENSORS_FEATURE_POWER)) {
         DEBUG("sensors plugin: sensors_load_conf: "
               "Ignoring feature `%s', "
@@ -387,6 +390,9 @@ static int sensors_load_conf(void) {
 #if SENSORS_API_VERSION >= 0x402
             (subfeature->type != SENSORS_SUBFEATURE_CURR_INPUT) &&
 #endif
+#if SENSORS_API_VERSION >= 0x431
+            (subfeature->type != SENSORS_SUBFEATURE_HUMIDITY_INPUT) &&
+#endif
             (subfeature->type != SENSORS_SUBFEATURE_POWER_INPUT))
           continue;
 
@@ -521,6 +527,10 @@ static int sensors_read(void) {
     else if (fl->feature->type == SENSORS_FEATURE_CURR)
       type = "current";
 #endif
+#if SENSORS_API_VERSION >= 0x431
+    else if (fl->feature->type == SENSORS_FEATURE_HUMIDITY)
+      type = "humidity";
+#endif
     else
       continue;
 
index aee9791..3591eae 100644 (file)
 #include "common.h"
 #include "utils_dpdk.h"
 
+#if RTE_VERSION <= RTE_VERSION_NUM(18, 5, 0, 0)
 #define DPDK_DEFAULT_RTE_CONFIG "/var/run/.rte_config"
+#else
+#define DPDK_DEFAULT_RTE_CONFIG "/var/run/dpdk/rte/config"
+#endif
 #define DPDK_EAL_ARGC 10
 // Complete trace should fit into 1024 chars. Trace contain some headers
 // and text together with traced data from pipe. This is the reason why
@@ -184,8 +188,13 @@ int dpdk_helper_eal_config_parse(dpdk_helper_ctx_t *phc, oconfig_item_t *ci) {
 
       status = cf_util_get_string_buffer(child, prefix, sizeof(prefix));
       if (status == 0) {
+#if RTE_VERSION <= RTE_VERSION_NUM(18, 5, 0, 0)
         snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN,
                  "/var/run/.%s_config", prefix);
+#else
+        snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN,
+                 "/var/run/dpdk/%s/config", prefix);
+#endif
         DEBUG("dpdk_common: EAL:File prefix %s", phc->eal_config.file_prefix);
       }
     } else if (strcasecmp("LogLevel", child->key) == 0) {
index eae0b18..49aa229 100644 (file)
@@ -145,7 +145,6 @@ static int values_to_json(char *buffer, size_t buffer_size, /* {{{ */
 
 #undef BUFFER_ADD
 
-  DEBUG("format_json: values_to_json: buffer = %s;", buffer);
   sfree(rates);
   return 0;
 } /* }}} int values_to_json */
@@ -179,8 +178,6 @@ static int dstypes_to_json(char *buffer, size_t buffer_size, /* {{{ */
 
 #undef BUFFER_ADD
 
-  DEBUG("format_json: dstypes_to_json: buffer = %s;", buffer);
-
   return 0;
 } /* }}} int dstypes_to_json */
 
@@ -213,8 +210,6 @@ static int dsnames_to_json(char *buffer, size_t buffer_size, /* {{{ */
 
 #undef BUFFER_ADD
 
-  DEBUG("format_json: dsnames_to_json: buffer = %s;", buffer);
-
   return 0;
 } /* }}} int dsnames_to_json */
 
@@ -378,8 +373,6 @@ static int value_list_to_json(char *buffer, size_t buffer_size, /* {{{ */
 #undef BUFFER_ADD_KEYVAL
 #undef BUFFER_ADD
 
-  DEBUG("format_json: value_list_to_json: buffer = %s;", buffer);
-
   return 0;
 } /* }}} int value_list_to_json */
 
index 87ab8fd..c52a8a7 100644 (file)
@@ -2101,7 +2101,7 @@ static int lv_read(user_data_t *ud) {
       ERROR(PLUGIN_NAME
             " failed to get stats for block device (%s) in domain %s",
             state->block_devices[i].path,
-            virDomainGetName(state->domains[i].ptr));
+            virDomainGetName(state->block_devices[i].dom));
   }
 
   /* Get interface stats for each domain. */