]> sourceware.org Git - lvm2.git/commitdiff
API change for args of process_each_lv_in_vg()
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 21 May 2010 12:21:51 +0000 (12:21 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Fri, 21 May 2010 12:21:51 +0000 (12:21 +0000)
Patch adds failed_lvnames to the list of parameters for process_each_lv_in_vg().
If the list is not NULL it will be filled with LV names of failing LVs
during function execution.

Application could later reiterate only on failed LVs.

WHATS_NEW
tools/toollib.c
tools/toollib.h
tools/vgdisplay.c

index 303fa5f60b7adf21749ede9b0e9e54f5bc2899f6..a6b2f77335853b992acbc885daa60748e42e8a26 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.67 -
 ===============================
+  Extend process_each_lv_in_vg() with support for list of failed lvnames.
   Return ECMD_FAILED for break in process_each_lv() and process_each_segment_in_lv().
 
 Version 2.02.66 - 20th May 2010
index 5f5cbb33f5747c43ed124115bbff49925b9caa49..665d1633b73a930a9a12698fe7d102ef7e7afc2c 100644 (file)
@@ -86,6 +86,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd,
                          struct volume_group *vg,
                          const struct dm_list *arg_lvnames,
                          const struct dm_list *tags,
+                         struct dm_list *failed_lvnames,
                          void *handle,
                          process_single_lv_fn_t process_single_lv)
 {
@@ -96,7 +97,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd,
        unsigned tags_supplied = 0;
        unsigned lvargs_supplied = 0;
        unsigned lvargs_matched = 0;
-
+       char *lv_name;
        struct lv_list *lvl;
 
        if (!vg_check_status(vg, EXPORTED_VG))
@@ -155,6 +156,14 @@ int process_each_lv_in_vg(struct cmd_context *cmd,
                        continue;
 
                ret = process_single_lv(cmd, lvl->lv, handle);
+               if (ret != ECMD_PROCESSED && failed_lvnames) {
+                       lv_name = dm_pool_strdup(cmd->mem, lvl->lv->name);
+                       if (!lv_name ||
+                           !str_list_add(cmd->mem, failed_lvnames, lv_name)) {
+                               log_error("Allocation failed for str_list.");
+                               return ECMD_FAILED;
+                       }
+               }
                if (ret > ret_max)
                        ret_max = ret;
                if (sigint_caught())
@@ -325,7 +334,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
                }
 
                ret = process_each_lv_in_vg(cmd, vg, &lvnames, tags_arg,
-                                           handle, process_single_lv);
+                                           NULL, handle, process_single_lv);
                unlock_and_release_vg(cmd, vg, vgname);
                if (ret > ret_max)
                        ret_max = ret;
index 23ccd8681c848d455851cc5378c6ca4e484d5174..daab95a39452a5e07a03ec112b323fc994ba1dea 100644 (file)
@@ -78,6 +78,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd,
                          struct volume_group *vg,
                          const struct dm_list *arg_lvnames,
                          const struct dm_list *tags,
+                         struct dm_list *failed_lvnames,
                          void *handle,
                          process_single_lv_fn_t process_single_lv);
 
index 29bc7f1611e0febf5dd27be831cbf3b82b11550a..954e456b9e67488be63faf82addb737c181be7ed 100644 (file)
@@ -37,7 +37,7 @@ static int vgdisplay_single(struct cmd_context *cmd, const char *vg_name,
        if (arg_count(cmd, verbose_ARG)) {
                vgdisplay_extents(vg);
 
-               process_each_lv_in_vg(cmd, vg, NULL, NULL, NULL,
+               process_each_lv_in_vg(cmd, vg, NULL, NULL, NULL, NULL,
                                      (process_single_lv_fn_t)lvdisplay_full);
 
                log_print("--- Physical volumes ---");
This page took 0.052071 seconds and 5 git commands to generate.