mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
xxchange -ae to activation exclusively
This commit is contained in:
parent
29e94d9531
commit
36cfd88743
@ -1,5 +1,6 @@
|
|||||||
Version 2.00.16 -
|
Version 2.00.16 -
|
||||||
=============================
|
=============================
|
||||||
|
xxchange -ae for exclusive activation.
|
||||||
Don't return non-zero status if there aren't any volume groups.
|
Don't return non-zero status if there aren't any volume groups.
|
||||||
Add --alloc argument to tools.
|
Add --alloc argument to tools.
|
||||||
Rename allocation policies to contiguous, normal, anywhere, inherit.
|
Rename allocation policies to contiguous, normal, anywhere, inherit.
|
||||||
|
@ -51,7 +51,7 @@ arg(allocation_ARG, '\0', "allocation", yes_no_arg)
|
|||||||
/*
|
/*
|
||||||
* ... and now the short args.
|
* ... and now the short args.
|
||||||
*/
|
*/
|
||||||
arg(available_ARG, 'a', "available", yes_no_arg)
|
arg(available_ARG, 'a', "available", yes_no_excl_arg)
|
||||||
arg(all_ARG, 'a', "all", NULL)
|
arg(all_ARG, 'a', "all", NULL)
|
||||||
arg(autobackup_ARG, 'A', "autobackup", yes_no_arg)
|
arg(autobackup_ARG, 'A', "autobackup", yes_no_arg)
|
||||||
arg(activevolumegroups_ARG, 'A', "activevolumegroups", NULL)
|
arg(activevolumegroups_ARG, 'A', "activevolumegroups", NULL)
|
||||||
|
@ -75,15 +75,14 @@ static int lvchange_permission(struct cmd_context *cmd,
|
|||||||
static int lvchange_availability(struct cmd_context *cmd,
|
static int lvchange_availability(struct cmd_context *cmd,
|
||||||
struct logical_volume *lv)
|
struct logical_volume *lv)
|
||||||
{
|
{
|
||||||
int activate = 0;
|
int activate;
|
||||||
const char *pvname;
|
const char *pvname;
|
||||||
|
|
||||||
if (strcmp(arg_str_value(cmd, available_ARG, "n"), "n"))
|
activate = arg_uint_value(cmd, available_ARG, 0);
|
||||||
activate = 1;
|
|
||||||
|
|
||||||
if (activate) {
|
if (activate) {
|
||||||
log_verbose("Activating logical volume \"%s\"", lv->name);
|
log_verbose("Activating logical volume \"%s\"", lv->name);
|
||||||
if (lv_is_origin(lv)) {
|
if (lv_is_origin(lv) || (activate == 2)) {
|
||||||
if (!activate_lv_excl(cmd, lv->lvid.s)) {
|
if (!activate_lv_excl(cmd, lv->lvid.s)) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -85,6 +85,31 @@ int yes_no_arg(struct cmd_context *cmd, struct arg *a)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int yes_no_excl_arg(struct cmd_context *cmd, struct arg *a)
|
||||||
|
{
|
||||||
|
a->sign = SIGN_NONE;
|
||||||
|
|
||||||
|
if (!strcmp(a->value, "e")) {
|
||||||
|
a->i_value = 2;
|
||||||
|
a->ui_value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (!strcmp(a->value, "y")) {
|
||||||
|
a->i_value = 1;
|
||||||
|
a->ui_value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (!strcmp(a->value, "n")) {
|
||||||
|
a->i_value = 0;
|
||||||
|
a->ui_value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int metadatatype_arg(struct cmd_context *cmd, struct arg *a)
|
int metadatatype_arg(struct cmd_context *cmd, struct arg *a)
|
||||||
{
|
{
|
||||||
struct format_type *fmt;
|
struct format_type *fmt;
|
||||||
|
@ -109,6 +109,7 @@ void usage(const char *name);
|
|||||||
|
|
||||||
/* the argument verify/normalise functions */
|
/* the argument verify/normalise functions */
|
||||||
int yes_no_arg(struct cmd_context *cmd, struct arg *a);
|
int yes_no_arg(struct cmd_context *cmd, struct arg *a);
|
||||||
|
int yes_no_excl_arg(struct cmd_context *cmd, struct arg *a);
|
||||||
int size_kb_arg(struct cmd_context *cmd, struct arg *a);
|
int size_kb_arg(struct cmd_context *cmd, struct arg *a);
|
||||||
int size_mb_arg(struct cmd_context *cmd, struct arg *a);
|
int size_mb_arg(struct cmd_context *cmd, struct arg *a);
|
||||||
int int_arg(struct cmd_context *cmd, struct arg *a);
|
int int_arg(struct cmd_context *cmd, struct arg *a);
|
||||||
|
@ -37,7 +37,7 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd,
|
|||||||
if (!activate) {
|
if (!activate) {
|
||||||
if (!deactivate_lv(cmd, lv->lvid.s))
|
if (!deactivate_lv(cmd, lv->lvid.s))
|
||||||
continue;
|
continue;
|
||||||
} else if (lv_is_origin(lv)) {
|
} else if (lv_is_origin(lv) || (activate == 2)) {
|
||||||
if (!activate_lv_excl(cmd, lv->lvid.s))
|
if (!activate_lv_excl(cmd, lv->lvid.s))
|
||||||
continue;
|
continue;
|
||||||
} else if (!activate_lv(cmd, lv->lvid.s))
|
} else if (!activate_lv(cmd, lv->lvid.s))
|
||||||
@ -60,7 +60,9 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd,
|
|||||||
static int _vgchange_available(struct cmd_context *cmd, struct volume_group *vg)
|
static int _vgchange_available(struct cmd_context *cmd, struct volume_group *vg)
|
||||||
{
|
{
|
||||||
int lv_open, active;
|
int lv_open, active;
|
||||||
int available = !strcmp(arg_str_value(cmd, available_ARG, "n"), "y");
|
int available;
|
||||||
|
|
||||||
|
available = arg_uint_value(cmd, available_ARG, 0);
|
||||||
|
|
||||||
/* FIXME: Force argument to deactivate them? */
|
/* FIXME: Force argument to deactivate them? */
|
||||||
if (!available && (lv_open = lvs_in_vg_opened(vg))) {
|
if (!available && (lv_open = lvs_in_vg_opened(vg))) {
|
||||||
@ -73,7 +75,7 @@ static int _vgchange_available(struct cmd_context *cmd, struct volume_group *vg)
|
|||||||
log_verbose("%d logical volume(s) in volume group \"%s\" "
|
log_verbose("%d logical volume(s) in volume group \"%s\" "
|
||||||
"already active", active, vg->name);
|
"already active", active, vg->name);
|
||||||
|
|
||||||
if (available && _activate_lvs_in_vg(cmd, vg, 1))
|
if (available && _activate_lvs_in_vg(cmd, vg, available))
|
||||||
log_verbose("Activated logical volumes in "
|
log_verbose("Activated logical volumes in "
|
||||||
"volume group \"%s\"", vg->name);
|
"volume group \"%s\"", vg->name);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user