1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Reinstate support for format1 snapshots, but issue deprecated warning.

I anticipate removing support for snapshots with lvm1-formatted metadata in a
future release.
This commit is contained in:
Alasdair Kergon 2011-12-20 00:02:18 +00:00
parent 90b7423846
commit 66e5b7f53c
3 changed files with 31 additions and 0 deletions

View File

@ -1,5 +1,7 @@
Version 2.02.89 -
==================================
Issue deprecation warning when removing last lvm1-format snapshot.
Reinstate support for snapshot removal with lvm1 format. (2.02.86)
Add policy based automated repair of RAID logical volumes
Don't allow two images to be split and tracked from a RAID LV at one time
Don't allow size change of RAID LV that is tracking changes for a split image

View File

@ -3138,6 +3138,8 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
{
struct volume_group *vg;
struct lvinfo info;
struct logical_volume *format1_origin = NULL;
int format1_reload_required = 0;
vg = lv->vg;
@ -3195,6 +3197,10 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
return 0;
if (lv_is_cow(lv)) {
/* Old format1 code */
if (!(lv->vg->fid->fmt->features & FMT_MDAS))
format1_origin = origin_from_cow(lv);
log_verbose("Removing snapshot %s", lv->name);
/* vg_remove_snapshot() will preload origin/former snapshots */
if (!vg_remove_snapshot(lv))
@ -3214,12 +3220,31 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
return 0;
}
/*
* Old format1 code: If no snapshots left reload without -real.
*/
if (format1_origin && !lv_is_origin(format1_origin)) {
log_warn("WARNING: Support for snapshots with old LVM1-style metadata is deprecated.");
log_warn("WARNING: Please use lvconvert to update to lvm2 metadata at your convenience.");
format1_reload_required = 1;
}
/* store it on disks */
if (!vg_write(vg))
return_0;
/* format1 */
if (format1_reload_required && !suspend_lv(cmd, format1_origin))
log_error("Failed to refresh %s without snapshot.", format1_origin->name);
if (!vg_commit(vg))
return_0;
/* format1 */
if (format1_reload_required && !resume_lv(cmd, format1_origin)) {
log_error("Failed to resume %s.", format1_origin->name);
return 0;
}
backup(vg);

View File

@ -208,6 +208,10 @@ int vg_remove_snapshot(struct logical_volume *cow)
cow->snapshot = NULL;
lv_set_visible(cow);
/* format1 must do the change in one step, with the commit last. */
if (!(origin->vg->fid->fmt->features & FMT_MDAS))
return 1;
if (!vg_write(origin->vg))
return_0;
if (!suspend_lv(origin->vg->cmd, origin)) {