master - uuid: revert uuids for mirrors and raids
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=70551eec5921e3...
Commit: 70551eec5921e3b8bce7318880e54836f467b5fa
Parent: 13fb02ff1fe5ebc47f315774eac8a31e1b150550
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 30 14:04:25 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jun 30 14:58:30 2014 +0200
uuid: revert uuids for mirrors and raids
Using suffixes for mirrors and raids will need more work,
before this could be enabled.
Meanwhile revert to previous behavior.
Keep suffixes for thins and caches.
---
lib/misc/lvm-string.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/lib/misc/lvm-string.c b/lib/misc/lvm-string.c
index 79357f2..5858638 100644
--- a/lib/misc/lvm-string.c
+++ b/lib/misc/lvm-string.c
@@ -182,15 +182,16 @@ char *build_dm_uuid(struct dm_pool *mem, const struct logical_volume *lv,
/*
* Mark internal LVs with layer suffix
* so tools like blkid may immeditelly see it's
- * an internal LV they should not scan
- * Should also make internal detection simpler
+ * an internal LV they should not scan.
+ * Should also make internal detection simpler.
*/
layer = lv_is_cache_pool_data(lv) ? "cdata" :
lv_is_cache_pool_metadata(lv) ? "cmeta" :
- lv_is_mirror_image(lv) ? "mimage" :
- lv_is_mirror_log(lv) ? "mlog" :
- lv_is_raid_image(lv) ? "rimage" :
- lv_is_raid_metadata(lv) ? "rmeta" :
+ // FIXME: dm-tree needs fixes for mirrors/raids
+ //lv_is_mirror_image(lv) ? "mimage" :
+ //lv_is_mirror_log(lv) ? "mlog" :
+ //lv_is_raid_image(lv) ? "rimage" :
+ //lv_is_raid_metadata(lv) ? "rmeta" :
lv_is_thin_pool(lv) ? "pool" :
lv_is_thin_pool_data(lv) ? "tdata" :
lv_is_thin_pool_metadata(lv) ? "tmeta" :
9 years, 5 months
master - cleanup: ignore vg_name in /lib
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=13fb02ff1fe5eb...
Commit: 13fb02ff1fe5ebc47f315774eac8a31e1b150550
Parent: 667f93b7d95d23a45cc5040043c9117de83f7336
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 30 12:02:05 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jun 30 12:21:36 2014 +0200
cleanup: ignore vg_name in /lib
Since vg_name inside /lib function has already been ignored mostly
except for a few debug prints - make it and official internal API
feature.
vg_name is used only in /tools while the VG is not yet openned,
and when lvresize/lvcreate /lib function is called with VG pointer
already being used, then vg_name becomes irrelevant (it's not been
validated anyway).
So any internal user of lvcreate_params and lvresize_params does not
need to set vg_name pointer and may leave it NULL.
---
lib/metadata/lv_manip.c | 10 +++++-----
lib/metadata/metadata-exported.h | 4 ++--
lib/metadata/thin_manip.c | 2 --
liblvm/lvm_lv.c | 24 ++++++++++--------------
tools/lvconvert.c | 1 -
5 files changed, 17 insertions(+), 24 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 9581942..d35a244 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -3658,8 +3658,8 @@ static int _fsadm_cmd(struct cmd_context *cmd,
if (status)
*status = -1;
- if (dm_snprintf(lv_path, PATH_MAX, "%s%s/%s", cmd->dev_dir, lp->vg_name,
- lp->lv_name) < 0) {
+ if (dm_snprintf(lv_path, sizeof(lv_path), "%s%s/%s", cmd->dev_dir,
+ vg->name, lp->lv_name) < 0) {
log_error("Couldn't create LV path for %s", lp->lv_name);
return 0;
}
@@ -3667,7 +3667,7 @@ static int _fsadm_cmd(struct cmd_context *cmd,
argv[i++] = lv_path;
if (fcmd == FSADM_CMD_RESIZE) {
- if (dm_snprintf(size_buf, SIZE_BUF, "%" PRIu64 "K",
+ if (dm_snprintf(size_buf, sizeof(size_buf), "%" PRIu64 "K",
(uint64_t) lp->extents * (vg->extent_size / 2)) < 0) {
log_error("Couldn't generate new LV size string");
return 0;
@@ -3713,7 +3713,7 @@ static int _adjust_policy_params(struct cmd_context *cmd,
(percent > policy_threshold)) {
if (!thin_pool_feature_supported(lv, THIN_FEATURE_METADATA_RESIZE)) {
log_error_once("Online metadata resize for %s/%s is not supported.",
- lp->vg_name, lp->lv_name);
+ lv->vg->name, lv->name);
return 0;
}
lp->poolmetadatasize = (first_seg(lv)->metadata_lv->size *
@@ -6015,7 +6015,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
if (new_lv_name && find_lv_in_vg(vg, new_lv_name)) {
log_error("Logical volume \"%s\" already exists in "
- "volume group \"%s\"", new_lv_name, lp->vg_name);
+ "volume group \"%s\"", new_lv_name, vg->name);
return NULL;
}
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index eece882..85ea944 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -473,7 +473,7 @@ struct pvcreate_params {
};
struct lvresize_params {
- const char *vg_name;
+ const char *vg_name; /* only-used when VG is not yet opened (in /tools) */
const char *lv_name;
uint32_t stripes;
@@ -782,7 +782,7 @@ struct lvcreate_params {
const char *origin; /* snap */
const char *pool; /* thin */
- const char *vg_name; /* all */
+ const char *vg_name; /* only-used when VG is not yet opened (in /tools) */
const char *lv_name; /* all */
/* Keep args given by the user on command line */
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 1000680..b2ebaa1 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -559,7 +559,6 @@ struct logical_volume *alloc_pool_metadata(struct logical_volume *pool_lv,
.read_ahead = read_ahead,
.stripe_size = stripe_size,
.stripes = stripes,
- .vg_name = pool_lv->vg->name,
.zero = 1,
};
@@ -600,7 +599,6 @@ static struct logical_volume *_alloc_pool_metadata_spare(struct volume_group *vg
.pvh = pvh ? : &vg->pvs,
.read_ahead = DM_READ_AHEAD_AUTO,
.stripes = 1,
- .vg_name = vg->name,
.zero = 1,
.temporary = 1,
};
diff --git a/liblvm/lvm_lv.c b/liblvm/lvm_lv.c
index d89e8ae..89d0e92 100644
--- a/liblvm/lvm_lv.c
+++ b/liblvm/lvm_lv.c
@@ -194,7 +194,6 @@ static void _lv_set_default_params(struct lvcreate_params *lp,
lp->major = -1;
lp->minor = -1;
lp->activate = CHANGE_AY;
- lp->vg_name = vg->name;
lp->lv_name = lvname; /* FIXME: check this for safety */
lp->pvh = &vg->pvs;
@@ -458,19 +457,16 @@ int lvm_lv_rename(lv_t lv, const char *new_name)
int lvm_lv_resize(const lv_t lv, uint64_t new_size)
{
int rc = 0;
- struct lvresize_params lp = { 0 };
- struct saved_env e = { 0 };
-
- lp.vg_name = lv->vg->name;
- lp.lv_name = lv->name;
- lp.sign = SIGN_NONE;
- lp.percent = PERCENT_NONE;
- lp.resize = LV_ANY;
- lp.size = new_size >> SECTOR_SHIFT;
- lp.ac_force = 1; /* Assume the user has a good backup? */
- lp.sizeargs = 1;
-
- e = store_user_env(lv->vg->cmd);
+ struct lvresize_params lp = {
+ .lv_name = lv->name,
+ .sign = SIGN_NONE,
+ .percent = PERCENT_NONE,
+ .resize = LV_ANY,
+ .size = new_size >> SECTOR_SHIFT,
+ .ac_force = 1, /* Assume the user has a good backup? */
+ .sizeargs = 1,
+ };
+ struct saved_env e = store_user_env(lv->vg->cmd);
if (!lv_resize_prepare(lv->vg->cmd, lv, &lp, &lv->vg->pvs) ||
!lv_resize(lv->vg->cmd, lv, &lp, &lv->vg->pvs)) {
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 9f2d114..d0555b3 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2522,7 +2522,6 @@ static int _lvconvert_thinpool_external(struct cmd_context *cmd,
.pvh = &vg->pvs,
.read_ahead = DM_READ_AHEAD_AUTO,
.stripes = 1,
- .vg_name = vg->name,
.voriginextents = external_lv->le_count,
.voriginsize = external_lv->size,
};
9 years, 5 months
master - uuid: add more private uuid sufixes
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=667f93b7d95d23...
Commit: 667f93b7d95d23a45cc5040043c9117de83f7336
Parent: 2ada6852162c2dc2ee0f92220c29fe5f0959f510
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 27 00:03:31 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jun 30 12:17:07 2014 +0200
uuid: add more private uuid sufixes
Use suffixes for easier detection of private volumes.
This commit makes older volume UUIDs incompatible and
it most probably needs machine reboot after upgrade.
---
WHATS_NEW | 1 +
lib/misc/lvm-string.c | 20 ++++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 838eb41..4fa881c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.108 -
=================================
+ Enhance private volumes UUIDs with suffixed for easier detection.
Do not use reserved _[tc]meta volumes for temporary LVs.
Leave backup pool metadata with _meta%d suffix instead of reserved _tmeta%d.
Allow RAID repair to reuse PVs from same image that suffered a failure.
diff --git a/lib/misc/lvm-string.c b/lib/misc/lvm-string.c
index be6298b..79357f2 100644
--- a/lib/misc/lvm-string.c
+++ b/lib/misc/lvm-string.c
@@ -178,8 +178,24 @@ char *build_dm_uuid(struct dm_pool *mem, const struct logical_volume *lv,
{
const char *lvid = lv->lvid.s;
- if (!layer && lv_is_thin_pool(lv))
- layer = "pool";
+ if (!layer) {
+ /*
+ * Mark internal LVs with layer suffix
+ * so tools like blkid may immeditelly see it's
+ * an internal LV they should not scan
+ * Should also make internal detection simpler
+ */
+ layer = lv_is_cache_pool_data(lv) ? "cdata" :
+ lv_is_cache_pool_metadata(lv) ? "cmeta" :
+ lv_is_mirror_image(lv) ? "mimage" :
+ lv_is_mirror_log(lv) ? "mlog" :
+ lv_is_raid_image(lv) ? "rimage" :
+ lv_is_raid_metadata(lv) ? "rmeta" :
+ lv_is_thin_pool(lv) ? "pool" :
+ lv_is_thin_pool_data(lv) ? "tdata" :
+ lv_is_thin_pool_metadata(lv) ? "tmeta" :
+ NULL;
+ }
return dm_build_dm_uuid(mem, UUID_PREFIX, lvid, layer);
}
9 years, 5 months
master - cleanup: more lv_is_ functions
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2ada6852162c2d...
Commit: 2ada6852162c2dc2ee0f92220c29fe5f0959f510
Parent: 6da14a82c665dd8be0039548a54a87f182508cd9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 27 00:02:58 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jun 30 12:16:08 2014 +0200
cleanup: more lv_is_ functions
---
lib/metadata/metadata-exported.h | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index a7d30b3..eece882 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -163,17 +163,21 @@
#define vg_is_archived(vg) (((vg)->status & ARCHIVED_VG) ? 1 : 0)
#define lv_is_external_origin(lv) (((lv)->external_count > 0) ? 1 : 0)
-#define lv_is_thin_volume(lv) ((lv)->status & THIN_VOLUME ? 1 : 0)
-#define lv_is_thin_pool(lv) ((lv)->status & THIN_POOL ? 1 : 0)
+#define lv_is_thin_volume(lv) (((lv)->status & (THIN_VOLUME)) ? 1 : 0)
+#define lv_is_thin_pool(lv) (((lv)->status & (THIN_POOL)) ? 1 : 0)
#define lv_is_used_thin_pool(lv) (lv_is_thin_pool(lv) && !dm_list_empty(&(lv)->segs_using_this_lv))
-#define lv_is_thin_pool_data(lv) ((lv)->status & THIN_POOL_DATA ? 1 : 0)
-#define lv_is_thin_pool_metadata(lv) ((lv)->status & THIN_POOL_METADATA ? 1 : 0)
-#define lv_is_mirrored(lv) ((lv)->status & MIRRORED ? 1 : 0)
-#define lv_is_rlog(lv) ((lv)->status & REPLICATOR_LOG ? 1 : 0)
-
-#define lv_is_thin_type(lv) ((lv)->status & (THIN_POOL | THIN_VOLUME | THIN_POOL_DATA | THIN_POOL_METADATA) ? 1 : 0)
-#define lv_is_mirror_type(lv) ((lv)->status & (MIRROR_LOG | MIRROR_IMAGE | MIRRORED | PVMOVE) ? 1 : 0)
+#define lv_is_thin_pool_data(lv) (((lv)->status & (THIN_POOL_DATA)) ? 1 : 0)
+#define lv_is_thin_pool_metadata(lv) (((lv)->status & (THIN_POOL_METADATA)) ? 1 : 0)
+#define lv_is_mirrored(lv) (((lv)->status & (MIRRORED)) ? 1 : 0)
+#define lv_is_rlog(lv) (((lv)->status & (REPLICATOR_LOG)) ? 1 : 0)
+
+#define lv_is_thin_type(lv) (((lv)->status & (THIN_POOL | THIN_VOLUME | THIN_POOL_DATA | THIN_POOL_METADATA)) ? 1 : 0)
+#define lv_is_mirror_type(lv) (((lv)->status & (MIRROR_LOG | MIRROR_IMAGE | MIRRORED | PVMOVE)) ? 1 : 0)
+#define lv_is_mirror_image(lv) (((lv)->status & (MIRROR_IMAGE)) ? 1 : 0)
+#define lv_is_mirror_log(lv) (((lv)->status & (MIRROR_LOG)) ? 1 : 0)
#define lv_is_raid(lv) (((lv)->status & (RAID)) ? 1 : 0)
+#define lv_is_raid_image(lv) (((lv)->status & (RAID_IMAGE)) ? 1 : 0)
+#define lv_is_raid_metadata(lv) (((lv)->status & (RAID_META)) ? 1 : 0)
#define lv_is_raid_type(lv) (((lv)->status & (RAID | RAID_IMAGE | RAID_META)) ? 1 : 0)
#define lv_is_cache(lv) (((lv)->status & (CACHE)) ? 1 : 0)
@@ -182,8 +186,8 @@
#define lv_is_cache_pool_metadata(lv) (((lv)->status & (CACHE_POOL_METADATA)) ? 1 : 0)
#define lv_is_cache_type(lv) (((lv)->status & (CACHE | CACHE_POOL | CACHE_POOL_DATA | CACHE_POOL_METADATA)) ? 1 : 0)
-#define lv_is_virtual(lv) (((lv)->status & VIRTUAL) ? 1 : 0)
-#define lv_is_pool_metadata_spare(lv) (((lv)->status & POOL_METADATA_SPARE) ? 1 : 0)
+#define lv_is_virtual(lv) (((lv)->status & (VIRTUAL)) ? 1 : 0)
+#define lv_is_pool_metadata_spare(lv) (((lv)->status & (POOL_METADATA_SPARE)) ? 1 : 0)
/* Ordered list - see lv_manip.c */
typedef enum {
9 years, 5 months
master - thin: do not create reserved LVs
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6da14a82c665dd...
Commit: 6da14a82c665dd8be0039548a54a87f182508cd9
Parent: eadcea2dae8c56e96b694cb388999865d2678e22
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 30 11:33:23 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jun 30 12:16:05 2014 +0200
thin: do not create reserved LVs
When creating pool's metadata - create initial LV for clearing with some
generic name and after the volume is create & cleared - rename it to
reserved name '_tmeta/_cmeta'.
We should not expose 'reserved' names for public LVs.
---
WHATS_NEW | 1 +
lib/metadata/thin_manip.c | 4 +++-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b8b2951..838eb41 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.108 -
=================================
+ Do not use reserved _[tc]meta volumes for temporary LVs.
Leave backup pool metadata with _meta%d suffix instead of reserved _tmeta%d.
Allow RAID repair to reuse PVs from same image that suffered a failure.
New RAID images now avoid allocation on any PVs in the same parent RAID LV.
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 8520440..1000680 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -552,7 +552,6 @@ struct logical_volume *alloc_pool_metadata(struct logical_volume *pool_lv,
struct lvcreate_params lvc = {
.activate = CHANGE_ALY,
.alloc = alloc,
- .lv_name = name,
.major = -1,
.minor = -1,
.permission = LVM_READ | LVM_WRITE,
@@ -578,6 +577,9 @@ struct logical_volume *alloc_pool_metadata(struct logical_volume *pool_lv,
if (!(metadata_lv = lv_create_single(pool_lv->vg, &lvc)))
return_0;
+ if (!lv_rename_update(pool_lv->vg->cmd, metadata_lv, name, 0))
+ return_0;
+
return metadata_lv;
}
9 years, 5 months
master - thin: repaired LV uses _meta%d
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=eadcea2dae8c56...
Commit: eadcea2dae8c56e96b694cb388999865d2678e22
Parent: b6fe906956cb7bdaa9b3ef43c14f8e6155483d7e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 30 11:01:04 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jun 30 12:15:13 2014 +0200
thin: repaired LV uses _meta%d
Don't leave 'regular' LV with reserved suffix for a user.
After succefull repair use 'normal' (non-reserved) LV name
for backup of original metadata.
---
WHATS_NEW | 1 +
man/lvconvert.8.in | 2 +-
tools/lvconvert.c | 8 ++++----
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 396dd07..b8b2951 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.108 -
=================================
+ Leave backup pool metadata with _meta%d suffix instead of reserved _tmeta%d.
Allow RAID repair to reuse PVs from same image that suffered a failure.
New RAID images now avoid allocation on any PVs in the same parent RAID LV.
Always reevaluate filters just before creating PV.
diff --git a/man/lvconvert.8.in b/man/lvconvert.8.in
index 76003b4..f96cee2 100644
--- a/man/lvconvert.8.in
+++ b/man/lvconvert.8.in
@@ -380,7 +380,7 @@ Only inactive thin pool volumes can be repaired.
There is no validation of metadata between kernel and lvm2.
This requires further manual work.
After successfull repair the old unmodified metadata are still
-available in \fB<pool>_tmeta<n>\fP LV.
+available in \fB<pool>_meta<n>\fP LV.
.TP
.B \-\-replace \fIPhysicalVolume
Remove the specified device (\fIPhysicalVolume\fP) and replace it with one
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index a2e02d4..9f2d114 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2468,8 +2468,8 @@ deactivate_pmslv:
if (!handle_pool_metadata_spare(pool_lv->vg, 0, NULL, 1))
stack;
- if (dm_snprintf(meta_path, sizeof(meta_path), "%s%%d", mlv->name) < 0) {
- log_error("Can't prepare new name for %s.", mlv->name);
+ if (dm_snprintf(meta_path, sizeof(meta_path), "%s_meta%%d", pool_lv->name) < 0) {
+ log_error("Can't prepare new metadata name for %s.", pool_lv->name);
return 0;
}
@@ -2488,7 +2488,7 @@ deactivate_pmslv:
if (!attach_pool_metadata_lv(first_seg(pool_lv), pmslv))
return_0;
- /* Used _tmeta will become visible _tmeta%d */
+ /* Used _tmeta will become visible _meta%d */
if (!lv_rename_update(cmd, mlv, pms_path, 0))
return_0;
@@ -2499,7 +2499,7 @@ deactivate_pmslv:
mlv->vg->name, mlv->name);
log_warn("WARNING: Use pvmove command to move \"%s/%s\" on the best fitting PV.",
- mlv->vg->name, first_seg(pool_lv)->metadata_lv->name);
+ pool_lv->vg->name, first_seg(pool_lv)->metadata_lv->name);
return 1;
}
9 years, 5 months
master - activation: fix typo in 'activation skip' message
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b6fe906956cb7b...
Commit: b6fe906956cb7bdaa9b3ef43c14f8e6155483d7e
Parent: 100342605ce4a304b397665682d2ec555af5aa27
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Jun 30 11:02:45 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jun 30 11:02:45 2014 +0200
activation: fix typo in 'activation skip' message
---
lib/metadata/lv_manip.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 05293f1..9581942 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5887,7 +5887,7 @@ int lv_activation_skip(struct logical_volume *lv, activation_change_t activate,
override_lv_skip_flag)
return 0;
- log_verbose("ACTIVATON_SKIP flag set for LV %s/%s, skipping activation.",
+ log_verbose("ACTIVATION_SKIP flag set for LV %s/%s, skipping activation.",
lv->vg->name, lv->name);
return 1;
}
9 years, 5 months
master - libdm: fix double const for "value" in dm_report_reserved_value structure
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=100342605ce4a3...
Commit: 100342605ce4a304b397665682d2ec555af5aa27
Parent: b41aa985d7f93ba9e2db6fab032e0cf3d7180cf8
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Jun 30 09:44:23 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jun 30 09:44:23 2014 +0200
libdm: fix double const for "value" in dm_report_reserved_value structure
C++ may have
---
libdm/libdevmapper.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 90e0b51..ad504da 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1660,7 +1660,7 @@ struct dm_report_field_type {
struct dm_report_reserved_value {
const unsigned type; /* DM_REPORT_FIELD_TYPE_* */
- const void const *value; /* reserved value:
+ const void *value; /* reserved value:
uint64_t for DM_REPORT_FIELD_TYPE_NUMBER
uint64_t for DM_REPORT_FIELD_TYPE_SIZE (number of 512-byte sectors)
uint64_t for DM_REPORT_FIELD_TYPE_PERCENT
9 years, 5 months
master - man: do not mention '(i)nherited' for alloc policy in vg_attr field
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b41aa985d7f93b...
Commit: b41aa985d7f93ba9e2db6fab032e0cf3d7180cf8
Parent: ed3c2537b82be4e326a53c7e3e6d5eccdd833800
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 26 15:14:54 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jun 26 15:15:10 2014 +0200
man: do not mention '(i)nherited' for alloc policy in vg_attr field
VG has nothing to inherit from...
---
man/vgs.8.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/man/vgs.8.in b/man/vgs.8.in
index 2d4946f..de0ef9b 100644
--- a/man/vgs.8.in
+++ b/man/vgs.8.in
@@ -85,7 +85,7 @@ E(x)ported
(p)artial: one or more physical volumes belonging to the volume group
are missing from the system
.IP 5 3
-Allocation policy: (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere, (i)nherited
+Allocation policy: (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere
.IP 6 3
(c)lustered
.RE
9 years, 5 months
master - raid: Allow repair to reuse PVs from same image that suffered a PV failure
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ed3c2537b82be4...
Commit: ed3c2537b82be4e326a53c7e3e6d5eccdd833800
Parent: 7028fd31a0f2d2234ffdd1b94ea6ae6128ca9362
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Jun 25 22:26:06 2014 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Jun 25 22:26:06 2014 -0500
raid: Allow repair to reuse PVs from same image that suffered a PV failure
When repairing RAID LVs that have multiple PVs per image, allow
replacement images to be reallocated from the PVs that have not
failed in the image if there is sufficient space.
This allows for scenarios where a 2-way RAID1 is spread across 4 PVs,
where each image lives on two PVs but doesn't use the entire space
on any of them. If one PV fails and there is sufficient space on the
remaining PV in the image, the image can be reallocated on just the
remaining PV.
---
WHATS_NEW | 1 +
lib/metadata/raid_manip.c | 127 ++++++++++++++++++++++++++++---
test/shell/lvconvert-raid-allocation.sh | 20 ++++-
3 files changed, 133 insertions(+), 15 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 05b3c7c..396dd07 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.108 -
=================================
+ Allow RAID repair to reuse PVs from same image that suffered a failure.
New RAID images now avoid allocation on any PVs in the same parent RAID LV.
Always reevaluate filters just before creating PV.
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 0303654..6fead9a 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -1501,6 +1501,85 @@ int lv_raid_reshape(struct logical_volume *lv,
return 0;
}
+
+static int _remove_partial_multi_segment_image(struct logical_volume *lv,
+ struct dm_list *remove_pvs)
+{
+ uint32_t s, extents_needed;
+ struct lv_segment *rm_seg, *raid_seg = first_seg(lv);
+ struct logical_volume *rm_image = NULL;
+ struct physical_volume *pv;
+
+ if (!(lv->status & PARTIAL_LV))
+ return_0;
+
+ for (s = 0; s < raid_seg->area_count; s++) {
+ extents_needed = 0;
+ if ((seg_lv(raid_seg, s)->status & PARTIAL_LV) &&
+ lv_is_on_pvs(seg_lv(raid_seg, s), remove_pvs) &&
+ (dm_list_size(&(seg_lv(raid_seg, s)->segments)) > 1)) {
+ rm_image = seg_lv(raid_seg, s);
+
+ /* First, how many damaged extents are there */
+ if (seg_metalv(raid_seg, s)->status & PARTIAL_LV)
+ extents_needed += seg_metalv(raid_seg, s)->le_count;
+ dm_list_iterate_items(rm_seg, &rm_image->segments) {
+ /*
+ * segment areas are for stripe, mirror, raid,
+ * etc. We only need to check the first area
+ * if we are dealing with RAID image LVs.
+ */
+ if (seg_type(rm_seg, 0) != AREA_PV)
+ continue;
+ pv = seg_pv(rm_seg, 0);
+ if (pv->status & MISSING_PV)
+ extents_needed += rm_seg->len;
+ }
+ log_debug("%u extents needed to repair %s",
+ extents_needed, rm_image->name);
+
+ /* Second, do the other PVs have the space */
+ dm_list_iterate_items(rm_seg, &rm_image->segments) {
+ if (seg_type(rm_seg, 0) != AREA_PV)
+ continue;
+ pv = seg_pv(rm_seg, 0);
+ if (pv->status & MISSING_PV)
+ continue;
+
+ if ((pv->pe_count - pv->pe_alloc_count) >
+ extents_needed) {
+ log_debug("%s has enough space for %s",
+ pv_dev_name(pv),
+ rm_image->name);
+ goto has_enough_space;
+ }
+ log_debug("Not enough space on %s for %s",
+ pv_dev_name(pv), rm_image->name);
+ }
+ }
+ }
+
+ /*
+ * This is likely to be the normal case - single
+ * segment images.
+ */
+ return_0;
+
+has_enough_space:
+ /*
+ * Now we have a multi-segment, partial image that has enough
+ * space on just one of its PVs for the entire image to be
+ * replaced. So, we replace the image's space with an error
+ * target so that the allocator can find that space (along with
+ * the remaining free space) in order to allocate the image
+ * anew.
+ */
+ if (!replace_lv_with_error_segment(rm_image))
+ return_0;
+
+ return 1;
+}
+
/*
* lv_raid_replace
* @lv
@@ -1513,6 +1592,7 @@ int lv_raid_replace(struct logical_volume *lv,
struct dm_list *remove_pvs,
struct dm_list *allocate_pvs)
{
+ int partial_segment_removed = 0;
uint32_t s, sd, match_count = 0;
struct dm_list old_lvs;
struct dm_list new_meta_lvs, new_data_lvs;
@@ -1605,25 +1685,40 @@ int lv_raid_replace(struct logical_volume *lv,
try_again:
if (!_alloc_image_components(lv, allocate_pvs, match_count,
&new_meta_lvs, &new_data_lvs)) {
- log_error("Failed to allocate replacement images for %s/%s",
- lv->vg->name, lv->name);
-
- /*
- * If this is a repair, then try to
- * do better than all-or-nothing
- */
- if (match_count > 1) {
- log_error("Attempting replacement of %u devices"
- " instead of %u", match_count - 1, match_count);
- match_count--;
+ if (!(lv->status & PARTIAL_LV))
+ return 0;
+ /* This is a repair, so try to do better than all-or-nothing */
+ match_count--;
+ if (match_count > 0) {
+ log_error("Failed to replace %u devices."
+ " Attempting to replace %u instead.",
+ match_count, match_count+1);
/*
* Since we are replacing some but not all of the bad
* devices, we must set partial_activation
*/
lv->vg->cmd->partial_activation = 1;
goto try_again;
+ } else if (!match_count && !partial_segment_removed) {
+ /*
+ * We are down to the last straw. We can only hope
+ * that a failed PV is just one of several PVs in
+ * the image; and if we extract the image, there may
+ * be enough room on the image's other PVs for a
+ * reallocation of the image.
+ */
+ if (!_remove_partial_multi_segment_image(lv, remove_pvs))
+ return_0;
+
+ match_count = 1;
+ partial_segment_removed = 1;
+ lv->vg->cmd->partial_activation = 1;
+ goto try_again;
}
+ log_error("Failed to allocate replacement images for %s/%s",
+ lv->vg->name, lv->name);
+
return 0;
}
@@ -1632,9 +1727,17 @@ try_again:
* - If we did this before the allocate, we wouldn't have to rename
* the allocated images, but it'd be much harder to avoid the right
* PVs during allocation.
+ *
+ * - If this is a repair and we were forced to call
+ * _remove_partial_multi_segment_image, then the remove_pvs list
+ * is no longer relevant - _raid_extract_images is forced to replace
+ * the image with the error target. Thus, the full set of PVs is
+ * supplied - knowing that only the image with the error target
+ * will be affected.
*/
if (!_raid_extract_images(lv, raid_seg->area_count - match_count,
- remove_pvs, 0,
+ partial_segment_removed ?
+ &lv->vg->pvs : remove_pvs, 0,
&old_lvs, &old_lvs)) {
log_error("Failed to remove the specified images from %s/%s",
lv->vg->name, lv->name);
diff --git a/test/shell/lvconvert-raid-allocation.sh b/test/shell/lvconvert-raid-allocation.sh
index 804317b..aef786c 100644
--- a/test/shell/lvconvert-raid-allocation.sh
+++ b/test/shell/lvconvert-raid-allocation.sh
@@ -27,7 +27,8 @@ lvconvert -m 0 $vg/$lv1
# lvconvert --type raid1 -m 1 --alloc anywhere $vg/$lv1 "$dev1" "$dev2"
lvremove -ff $vg
-# Setup 2-way RAID1 LV to spread across 4 devices.
+
+# Setup 2-way RAID1 LV, spread across 4 devices.
# For each image:
# - metadata LV + 1 image extent (2 total extents) on one PV
# - 2 image extents on the other PV
@@ -43,10 +44,8 @@ aux wait_for_sync $vg $lv1
# Should not be enough non-overlapping space.
not lvconvert -m +1 $vg/$lv1 \
"$dev5:0-1" "$dev1" "$dev2" "$dev3" "$dev4"
-
lvconvert -m +1 $vg/$lv1 "$dev5"
lvconvert -m 0 $vg/$lv1
-
# Should work due to '--alloc anywhere'
# RAID conversion not honoring allocation policy!
#lvconvert -m +1 --alloc anywhere $vg/$lv1 \
@@ -54,4 +53,19 @@ lvconvert -m 0 $vg/$lv1
lvremove -ff $vg
+# Setup 2-way RAID1 LV, spread across 4 devices
+# - metadata LV + 1 image extent (2 total extents) on one PV
+# - 2 image extents on the other PV
+# Kill one PV. There should be enough space on the remaining
+# PV for that image to reallocate the entire image there and
+# still maintain redundancy.
+lvcreate --type raid1 -m 1 -l 3 -n $lv1 $vg \
+ "$dev1:0-1" "$dev2:0-1" "$dev3:0-1" "$dev4:0-1"
+aux wait_for_sync $vg $lv1
+aux disable_dev "$dev1"
+lvconvert --repair -y $vg/$lv1 "$dev1" "$dev2" "$dev3" "$dev4"
+#FIXME: ensure non-overlapping images (they should not share PVs)
+aux enable_dev "$dev1"
+lvremove -ff $vg
+
vgremove -ff $vg
9 years, 5 months