]> sourceware.org Git - lvm2.git/commitdiff
config: fix one-node dumpconfig, add dm_config_write_one_node
authorPeter Rajnoha <prajnoha@redhat.com>
Fri, 20 Jul 2012 13:53:04 +0000 (15:53 +0200)
committerPeter Rajnoha <prajnoha@redhat.com>
Fri, 20 Jul 2012 13:53:04 +0000 (15:53 +0200)
A regression introduced in 2.02.89 (11e520256b3005ed813ce83f8770aaab74edef3f)
caused the lvm dumpconfig <node> to print out
the node as well as its subsequent siblings.
The information about "only_one" mode got lost.

Before this patch (just an example node):
  # lvm dumpconfig global/use_lvmetad
  use_lvmetad=1
  thin_check_executable="/usr/sbin/thin_check"
  thin_check_options="-q"
  (...all nodes to the end of the section)

With this patch applied:
   # lvm dumpconfig global/use_lvmetad
   use_lvmetad=1

WHATS_NEW
WHATS_NEW_DM
lib/config/config.c
libdm/libdevmapper.h
libdm/libdm-config.c

index 4f23c398bb5598d68c45342591b2560dd4abd91e..aa26622acb2e73100a54b6d7b87b620d0187fc69 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.97 - 
 ===============================
+  Fix dumpconfig <node> to print only <node> without its siblings (2.02.89).
   Do not issue "Failed to handle a client connection" error if lvmetad killed.
   Support changing of discard and zeroing for thin pool.
   Report used discard for thin pool and volume.
index 416becab1ace048b61d249331db1e161575e1985..0bfd0167ccb705e0aeedab1874d0722f8a4b3c40 100644 (file)
@@ -1,5 +1,6 @@
 Version 1.02.76 - 
 ===============================
+  Add dm_config_write_one_node to libdevmapper.
   Add support for thin pool message release/reserve_metadata_snap.
   Add support for thin pool discard and external origin.
   Add configure --enable-udev-rule-exec-detection to detect exec path in rules.
index 67a8b042de6f827faf1ee634dad2e93f63c09d8a..60ae6c8b6444817ed01e4be95b2e7d504c6d51a3 100644 (file)
@@ -473,7 +473,7 @@ int config_write(struct dm_config_tree *cft, const char *file,
                }
        } else while (argc--) {
                if ((cn = dm_config_find_node(cft->root, *argv))) {
-                       if (!dm_config_write_node(cn, _putline_fn, fp)) {
+                       if (!dm_config_write_one_node(cn, _putline_fn, fp)) {
                                log_error("Failure while writing to %s", file);
                                r = 0;
                        }
index 549a6355cae90fc74674a777b117a191c1a41162..02bf421b4f125ecd1be9b58e2b3a8746d8b9450b 100644 (file)
@@ -1488,7 +1488,10 @@ struct dm_config_tree *dm_config_remove_cascaded_tree(struct dm_config_tree *cft
 void dm_config_destroy(struct dm_config_tree *cft);
 
 typedef int (*dm_putline_fn)(const char *line, void *baton);
+/* Write the node and any subsequent siblings it has. */
 int dm_config_write_node(const struct dm_config_node *cn, dm_putline_fn putline, void *baton);
+/* Write given node only without subsequent siblings. */
+int dm_config_write_one_node(const struct dm_config_node *cn, dm_putline_fn putline, void *baton);
 
 struct dm_config_node *dm_config_find_node(const struct dm_config_node *cn, const char *path);
 int dm_config_has_node(const struct dm_config_node *cn, const char *path);
index d9d3882f2a564ac7671ec5f711b0a23f59fd8f3b..845749797bfcf892373e41aa68dd46acaef20078 100644 (file)
@@ -331,14 +331,15 @@ static int _write_config(const struct dm_config_node *n, int only_one,
        return 1;
 }
 
-int dm_config_write_node(const struct dm_config_node *cn, dm_putline_fn putline, void *baton)
+static int _write_node(const struct dm_config_node *cn, int only_one,
+                      dm_putline_fn putline, void *baton)
 {
        struct output_line outline;
        if (!(outline.mem = dm_pool_create("config_line", 1024)))
                return_0;
        outline.putline = putline;
        outline.putline_baton = baton;
-       if (!_write_config(cn, 0, &outline, 0)) {
+       if (!_write_config(cn, only_one, &outline, 0)) {
                dm_pool_destroy(outline.mem);
                return_0;
        }
@@ -346,6 +347,16 @@ int dm_config_write_node(const struct dm_config_node *cn, dm_putline_fn putline,
        return 1;
 }
 
+int dm_config_write_one_node(const struct dm_config_node *cn, dm_putline_fn putline, void *baton)
+{
+       return _write_node(cn, 1, putline, baton);
+}
+
+int dm_config_write_node(const struct dm_config_node *cn, dm_putline_fn putline, void *baton)
+{
+       return _write_node(cn, 0, putline, baton);
+}
+
 
 /*
  * parser
This page took 0.052781 seconds and 5 git commands to generate.