mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Return error status if vgchange fails to activate some volume.
(on one node a storage connection failed): # vgchange -a y vg_bar ; echo $? Error locking on node bar-02: Refusing activation of partial LV lv1. Use --partial to override. 1 logical volume(s) in volume group "vg_bar" now active 0 So activation fails on one node, error is correctly printed but status code is wrong. This patch fixes the top level (vgchange) to return proper code (and print # of activated LVs). (lvchange returns error properly here.)
This commit is contained in:
parent
6b8304ab43
commit
155c608cd3
@ -1,5 +1,6 @@
|
||||
Version 2.02.56 -
|
||||
====================================
|
||||
Return error status if vgchange fails to activate some volume.
|
||||
Fix memory lock imbalance in locking code.
|
||||
Revert vg_read_internal change, clvmd cannot use vg_read now. (2.02.55)
|
||||
|
||||
|
@ -56,7 +56,7 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd,
|
||||
{
|
||||
struct lv_list *lvl;
|
||||
struct logical_volume *lv;
|
||||
int count = 0;
|
||||
int count = 0, expected_count = 0;
|
||||
|
||||
dm_list_iterate_items(lvl, &vg->lvs) {
|
||||
lv = lvl->lv;
|
||||
@ -78,6 +78,8 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd,
|
||||
((lv->status & PVMOVE) ))
|
||||
continue;
|
||||
|
||||
expected_count++;
|
||||
|
||||
if (activate == CHANGE_AN) {
|
||||
if (!deactivate_lv(cmd, lv))
|
||||
continue;
|
||||
@ -100,7 +102,12 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd,
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
if (expected_count)
|
||||
log_verbose("%s %d logical volumes in volume group %s",
|
||||
activate ? "Activated" : "Deactivated",
|
||||
count, vg->name);
|
||||
|
||||
return (expected_count != count) ? ECMD_FAILED : ECMD_PROCESSED;
|
||||
}
|
||||
|
||||
static int _vgchange_monitoring(struct cmd_context *cmd, struct volume_group *vg)
|
||||
@ -121,7 +128,7 @@ static int _vgchange_monitoring(struct cmd_context *cmd, struct volume_group *vg
|
||||
static int _vgchange_available(struct cmd_context *cmd, struct volume_group *vg)
|
||||
{
|
||||
int lv_open, active, monitored;
|
||||
int available;
|
||||
int available, ret;
|
||||
int activate = 1;
|
||||
|
||||
/*
|
||||
@ -158,17 +165,11 @@ static int _vgchange_available(struct cmd_context *cmd, struct volume_group *vg)
|
||||
}
|
||||
}
|
||||
|
||||
if (activate && _activate_lvs_in_vg(cmd, vg, available))
|
||||
log_verbose("Activated logical volumes in "
|
||||
"volume group \"%s\"", vg->name);
|
||||
|
||||
if (!activate && _activate_lvs_in_vg(cmd, vg, available))
|
||||
log_verbose("Deactivated logical volumes in "
|
||||
"volume group \"%s\"", vg->name);
|
||||
ret = _activate_lvs_in_vg(cmd, vg, available);
|
||||
|
||||
log_print("%d logical volume(s) in volume group \"%s\" now active",
|
||||
lvs_in_vg_activated(vg), vg->name);
|
||||
return ECMD_PROCESSED;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int _vgchange_alloc(struct cmd_context *cmd, struct volume_group *vg)
|
||||
|
Loading…
Reference in New Issue
Block a user