src/utils_latency.[ch]: Remove latency_counter_get_start_time().
[collectd.git] / src / lvm.c
index cbf244b..5e130d8 100644 (file)
--- a/src/lvm.c
+++ b/src/lvm.c
  *
  * Authors:
  *   Chad Malfait <malfaitc at yahoo.com>
- *   Benjamin Gilbert <bgilbert at cs.cmu.edu>
+ *   Benjamin Gilbert <bgilbert at backtick.net>
  **/
 
 #include <lvm2app.h>
 
 #include "collectd.h"
+
 #include "common.h"
 #include "plugin.h"
 
@@ -54,15 +55,11 @@ static char const *get_lv_property_string(lv_t lv, char const *property)
 static void lvm_submit (char const *plugin_instance, char const *type_instance,
         uint64_t ivalue)
 {
-    value_t v;
     value_list_t vl = VALUE_LIST_INIT;
 
-    v.gauge = (gauge_t) ivalue;
-
-    vl.values = &v;
+    vl.values = &(value_t) { .gauge = (gauge_t) ivalue };
     vl.values_len = 1;
 
-    sstrncpy(vl.host, hostname_g, sizeof (vl.host));
     sstrncpy(vl.plugin, "lvm", sizeof (vl.plugin));
     sstrncpy(vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
     sstrncpy(vl.type, "df_complex", sizeof (vl.type));
@@ -119,11 +116,14 @@ static void vg_read(vg_t vg, char const *vg_name)
     lvm_submit (vg_name, "free", lvm_vg_get_free_size(vg));
 
     lvs = lvm_vg_list_lvs(vg);
-    if (lvs == NULL)
+    if (!lvs) {
+        /* no VGs are defined, which is not an error per se */
         return;
+    }
+
     dm_list_iterate_items(lvl, lvs) {
         name = lvm_lv_get_name(lvl->lv);
-        attrs = lvm_lv_get_attr(lvl->lv);
+        attrs = get_lv_property_string(lvl->lv, "lv_attr");
         size = lvm_lv_get_size(lvl->lv);
         if (name == NULL || attrs == NULL || size == NO_VALUE)
             continue;