1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 18:55:19 +03:00

API change for args of process_each_lv_in_vg()

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.
This commit is contained in:
Zdenek Kabelac 2010-05-21 12:21:51 +00:00
parent 0e83352280
commit 04a6dd7731
4 changed files with 14 additions and 3 deletions

View File

@ -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

View 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;

View 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);

View 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 ---");