1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

Thin creation without activation

All thins are created with the next activation and VG is updated
without messages. Only some basic commands works.
(i.e. lvcreate -an  -V10 -T mvg/pool)
There can be some combination to confuse this system.

This functionality for snapshots is going to be interesting.
This commit is contained in:
Zdenek Kabelac 2011-10-30 22:07:38 +00:00
parent bbcd37e4b8
commit 7654abc26f
3 changed files with 17 additions and 3 deletions

View File

@ -4194,8 +4194,12 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
init_dmeventd_monitor(lp->activation_monitoring);
if (seg_is_thin_pool(lp) || seg_is_thin(lp)) {
if (!activate_lv_excl(cmd, lv)) {
if (seg_is_thin(lp)) {
if ((lp->activate == CHANGE_AY) ||
(lp->activate == CHANGE_ALY))
lp->activate = CHANGE_AE;
if ((lp->activate == CHANGE_AE) &&
!activate_lv_excl(cmd, lv)) {
log_error("Aborting. Failed to activate thin %s.",
lv->name);
goto deactivate_and_revert_new_lv;
@ -4222,7 +4226,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
lp->snapshot ? "snapshot exception store" :
"start of new LV");
goto deactivate_and_revert_new_lv;
} else if (seg_is_thin_volume(lp)) {
} else if (seg_is_thin_volume(lp) && (lp->activate == CHANGE_AE)) {
/* FIXME: for now we may drop any queued thin messages
* since we are sure everything was activated already */
if (!detach_pool_messages(first_seg(lv)->pool_lv)) {

View File

@ -142,6 +142,10 @@ static int lvchange_availability(struct cmd_context *cmd,
"exclusively", lv->name);
if (!activate_lv_excl(cmd, lv))
return_0;
/* Drop any left thin messages after activation */
if (lv_is_thin_volume(lv) &&
!detach_pool_messages(first_seg(lv)->pool_lv))
return_0;
} else if (activate == CHANGE_ALY) {
log_verbose("Activating logical volume \"%s\" locally",
lv->name);

View File

@ -157,6 +157,12 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd,
stack;
continue;
}
/* Drop any left thin messages after activation */
if (lv_is_thin_volume(lv) &&
!detach_pool_messages(first_seg(lv)->pool_lv)) {
stack;
continue;
}
} else if (activate == CHANGE_ALY) {
if (!activate_lv_local(cmd, lv)) {
stack;