mirror of
git://sourceware.org/git/lvm2.git
synced 2025-10-14 15:33:15 +03:00
Compare commits
1 Commits
v2_03_24
...
dev-dct-lv
Author | SHA1 | Date | |
---|---|---|---|
|
18d49412d1 |
@@ -61,6 +61,7 @@ struct logical_volume {
|
|||||||
|
|
||||||
uint64_t timestamp;
|
uint64_t timestamp;
|
||||||
unsigned new_lock_args:1;
|
unsigned new_lock_args:1;
|
||||||
|
unsigned process_specific:1; /* lv is identified specifically for processing */
|
||||||
const char *hostname;
|
const char *hostname;
|
||||||
const char *lock_args;
|
const char *lock_args;
|
||||||
};
|
};
|
||||||
|
@@ -658,7 +658,7 @@ xx(lvreduce,
|
|||||||
|
|
||||||
xx(lvremove,
|
xx(lvremove,
|
||||||
"Remove logical volume(s) from the system",
|
"Remove logical volume(s) from the system",
|
||||||
ALL_VGS_IS_DEFAULT, /* all VGs only with --select */
|
ALL_VGS_IS_DEFAULT | CONFIRM_UNLESS_SPECIFIC, /* all VGs only with --select */
|
||||||
"lvremove\n"
|
"lvremove\n"
|
||||||
"\t[-A|--autobackup y|n]\n"
|
"\t[-A|--autobackup y|n]\n"
|
||||||
"\t[--commandprofile ProfileName]\n"
|
"\t[--commandprofile ProfileName]\n"
|
||||||
|
@@ -2352,6 +2352,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
|
|||||||
struct lv_list *final_lvl;
|
struct lv_list *final_lvl;
|
||||||
struct glv_list *glvl, *tglvl;
|
struct glv_list *glvl, *tglvl;
|
||||||
int do_report_ret_code = 1;
|
int do_report_ret_code = 1;
|
||||||
|
int lv_is_specific = 0;
|
||||||
|
|
||||||
log_set_report_object_type(LOG_REPORT_OBJECT_TYPE_LV);
|
log_set_report_object_type(LOG_REPORT_OBJECT_TYPE_LV);
|
||||||
|
|
||||||
@@ -2435,9 +2436,8 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
|
|||||||
if (arg_is_set(cmd, all_ARG) ||
|
if (arg_is_set(cmd, all_ARG) ||
|
||||||
(lvargs_supplied && str_list_match_item(arg_lvnames, lvl->lv->name))) {
|
(lvargs_supplied && str_list_match_item(arg_lvnames, lvl->lv->name))) {
|
||||||
log_very_verbose("Processing lockd_sanlock_lv %s/%s.", vg->name, lvl->lv->name);
|
log_very_verbose("Processing lockd_sanlock_lv %s/%s.", vg->name, lvl->lv->name);
|
||||||
} else {
|
} else
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2449,15 +2449,19 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
process_lv = process_all;
|
process_lv = process_all;
|
||||||
|
lv_is_specific = 0;
|
||||||
|
|
||||||
if (lvargs_supplied && str_list_match_item(arg_lvnames, lvl->lv->name)) {
|
if (lvargs_supplied && str_list_match_item(arg_lvnames, lvl->lv->name)) {
|
||||||
/* Remove LV from list of unprocessed LV names */
|
/* Remove LV from list of unprocessed LV names */
|
||||||
str_list_del(arg_lvnames, lvl->lv->name);
|
str_list_del(arg_lvnames, lvl->lv->name);
|
||||||
process_lv = 1;
|
process_lv = 1;
|
||||||
|
lv_is_specific = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!process_lv && tags_supplied && str_list_match_list(tags_in, &lvl->lv->tags, NULL))
|
if (!process_lv && tags_supplied && str_list_match_list(tags_in, &lvl->lv->tags, NULL)) {
|
||||||
process_lv = 1;
|
process_lv = 1;
|
||||||
|
lv_is_specific = 1;
|
||||||
|
}
|
||||||
|
|
||||||
process_lv = process_lv && select_match_lv(cmd, handle, vg, lvl->lv) && _select_matches(handle);
|
process_lv = process_lv && select_match_lv(cmd, handle, vg, lvl->lv) && _select_matches(handle);
|
||||||
|
|
||||||
@@ -2477,6 +2481,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
|
|||||||
goto_out;
|
goto_out;
|
||||||
}
|
}
|
||||||
final_lvl->lv = lvl->lv;
|
final_lvl->lv = lvl->lv;
|
||||||
|
final_lvl->lv->process_specific = lv_is_specific;
|
||||||
dm_list_add(&final_lvs, &final_lvl->list);
|
dm_list_add(&final_lvs, &final_lvl->list);
|
||||||
}
|
}
|
||||||
log_set_report_object_name_and_id(NULL, NULL);
|
log_set_report_object_name_and_id(NULL, NULL);
|
||||||
@@ -3829,6 +3834,14 @@ int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
force_t force = (force_t) arg_count(cmd, force_ARG)
|
force_t force = (force_t) arg_count(cmd, force_ARG)
|
||||||
? : (arg_is_set(cmd, yes_ARG) ? DONT_PROMPT : PROMPT);
|
? : (arg_is_set(cmd, yes_ARG) ? DONT_PROMPT : PROMPT);
|
||||||
|
|
||||||
|
if ((force == PROMPT) &&
|
||||||
|
!lv->process_specific &&
|
||||||
|
(cmd->command->flags & CONFIRM_UNLESS_SPECIFIC)) {
|
||||||
|
if (yes_no_prompt("Remove LV %s that was not named directly? [y/n]: ",
|
||||||
|
display_lvname(lv)) == 'n')
|
||||||
|
return ECMD_PROCESSED;
|
||||||
|
}
|
||||||
|
|
||||||
if (!lv_remove_with_dependencies(cmd, lv, force, 0))
|
if (!lv_remove_with_dependencies(cmd, lv, force, 0))
|
||||||
return_ECMD_FAILED;
|
return_ECMD_FAILED;
|
||||||
|
|
||||||
|
@@ -118,6 +118,7 @@ struct arg_value_group_list {
|
|||||||
#define ENABLE_DUPLICATE_DEVS 0x00000400
|
#define ENABLE_DUPLICATE_DEVS 0x00000400
|
||||||
/* Command does not accept tags as args. */
|
/* Command does not accept tags as args. */
|
||||||
#define DISALLOW_TAG_ARGS 0x00000800
|
#define DISALLOW_TAG_ARGS 0x00000800
|
||||||
|
#define CONFIRM_UNLESS_SPECIFIC 0x00001000
|
||||||
|
|
||||||
/* a register of the lvm commands */
|
/* a register of the lvm commands */
|
||||||
struct command {
|
struct command {
|
||||||
|
Reference in New Issue
Block a user