master - activation: add _add_layer_target_to_dtree
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0631d233d84cc4...
Commit: 0631d233d84cc451380155b8062bd37c6f22c2f7
Parent: 520cc9a7f86282a230d8e6eef0edcac9dd94a8cd
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 21 10:24:28 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Feb 23 10:29:08 2013 +0100
activation: add _add_layer_target_to_dtree
Add function for creation of simple linear mapping over layer device.
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 0f4228b..68baaf1 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Add _add_layer_target_to_dtree() for adding linear layer into dtree.
Extend _cached_info() to accept layer string.
Allow identical table reload for RAID to restore transiently failed PVs.
vgimport '--force' now allows users to import VGs with missing PVs.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index c0cee4c..5f0457b 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1831,6 +1831,25 @@ int add_areas_line(struct dev_manager *dm, struct lv_segment *seg,
return 1;
}
+static int _add_layer_target_to_dtree(struct dev_manager *dm,
+ struct dm_tree_node *dnode,
+ struct logical_volume *lv)
+{
+ const char *layer_dlid;
+
+ if (!(layer_dlid = build_dm_uuid(dm->mem, lv->lvid.s, lv_layer(lv))))
+ return_0;
+
+ /* Add linear mapping over layered LV */
+ if (!add_linear_area_to_dtree(dnode, lv->size, lv->vg->extent_size,
+ lv->vg->cmd->use_linear_target,
+ lv->vg->name, lv->name) ||
+ !dm_tree_node_add_target_area(dnode, NULL, layer_dlid, 0))
+ return_0;
+
+ return 1;
+}
+
static int _add_origin_target_to_dtree(struct dev_manager *dm,
struct dm_tree_node *dnode,
struct logical_volume *lv)
11 years, 2 months
master - thin: replace _thin_layer with lv_layer()
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=520cc9a7f86282...
Commit: 520cc9a7f86282a230d8e6eef0edcac9dd94a8cd
Parent: 78b23f35950f9d5dd502495325aa019b793c8052
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Feb 18 09:53:05 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Feb 23 10:28:04 2013 +0100
thin: replace _thin_layer with lv_layer()
Use consitently lv_layer function internally for thin pool layer name.
---
lib/activate/dev_manager.c | 20 ++++++++++----------
lib/thin/thin.c | 2 +-
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index deaab9f..c0cee4c 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -59,8 +59,6 @@ struct lv_layer {
const char *old_name;
};
-static const char _thin_layer[] = "tpool";
-
int read_only_lv(struct logical_volume *lv, struct lv_activate_opts *laopts)
{
return (laopts->read_only || !(lv->vg->status & LVM_WRITE) || !(lv->status & LVM_WRITE));
@@ -1137,7 +1135,7 @@ int dev_manager_thin_pool_status(struct dev_manager *dm,
int r = 0;
/* Build dlid for the thin pool layer */
- if (!(dlid = build_dm_uuid(dm->mem, lv->lvid.s, _thin_layer)))
+ if (!(dlid = build_dm_uuid(dm->mem, lv->lvid.s, lv_layer(lv))))
return_0;
log_debug_activation("Getting thin pool device status for %s.", lv->name);
@@ -1178,10 +1176,10 @@ int dev_manager_thin_pool_percent(struct dev_manager *dm,
/* Build a name for the top layer */
if (!(name = dm_build_dm_name(dm->mem, lv->vg->name, lv->name,
- _thin_layer)))
+ lv_layer(lv))))
return_0;
- if (!(dlid = build_dm_uuid(dm->mem, lv->lvid.s, _thin_layer)))
+ if (!(dlid = build_dm_uuid(dm->mem, lv->lvid.s, lv_layer(lv))))
return_0;
log_debug_activation("Getting device status percentage for %s", name);
@@ -1618,10 +1616,10 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
/* FIXME code from _create_partial_dtree() should be moved here */
if (!_add_lv_to_dtree(dm, dtree, seg_lv(seg, 0), 0))
return_0;
- if (!_add_dev_to_dtree(dm, dtree, lv, _thin_layer))
+ if (!_add_dev_to_dtree(dm, dtree, lv, lv_layer(lv)))
return_0;
/* If the partial tree is used for deactivation, setup callback */
- if (!(uuid = build_dm_uuid(dm->mem, lv->lvid.s, _thin_layer)))
+ if (!(uuid = build_dm_uuid(dm->mem, lv->lvid.s, lv_layer(lv))))
return_0;
if ((thin_node = dm_tree_find_node_by_uuid(dtree, uuid)) &&
!_thin_pool_register_callback(dm, thin_node, lv))
@@ -2046,11 +2044,13 @@ static int _add_segment_to_dtree(struct dev_manager *dm,
} else if (lv_is_cow(seg->lv) && !layer) {
if (!_add_new_lv_to_dtree(dm, dtree, seg->lv, laopts, "cow"))
return_0;
- } else if ((layer != _thin_layer) && seg_is_thin(seg)) {
+ } else if ((layer != lv_layer(seg->lv)) && seg_is_thin(seg)) {
lva = *laopts;
lva.real_pool = 1;
if (!_add_new_lv_to_dtree(dm, dtree, seg_is_thin_pool(seg) ?
- seg->lv : seg->pool_lv, &lva, _thin_layer))
+ seg->lv : seg->pool_lv, &lva,
+ seg_is_thin_pool(seg) ?
+ lv_layer(seg->lv) : lv_layer(seg->pool_lv)))
return_0;
} else {
if (seg_is_thin_pool(seg) &&
@@ -2405,7 +2405,7 @@ static int _tree_action(struct dev_manager *dm, struct logical_volume *lv,
/* Restore fs cookie */
dm_tree_set_cookie(root, fs_get_cookie());
- if (!(dlid = build_dm_uuid(dm->mem, lv->lvid.s, (lv_is_origin(lv) && laopts->origin_only) ? "real" : NULL)))
+ if (!(dlid = build_dm_uuid(dm->mem, lv->lvid.s, laopts->origin_only ? lv_layer(lv) : NULL)))
goto_out;
/* Only process nodes with uuid of "LVM-" plus VG id. */
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index 8c0ec82..06ab67b 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -496,7 +496,7 @@ static int _thin_add_target_line(struct dev_manager *dm,
char *pool_dlid;
uint32_t device_id = seg->device_id;
- if (!(pool_dlid = build_dm_uuid(mem, seg->pool_lv->lvid.s, "tpool"))) {
+ if (!(pool_dlid = build_dm_uuid(mem, seg->pool_lv->lvid.s, lv_layer(seg->pool_lv)))) {
log_error("Failed to build uuid for pool LV %s.",
seg->pool_lv->name);
return 0;
11 years, 2 months
master - activation: extend _cached_info
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=78b23f35950f9d...
Commit: 78b23f35950f9d5dd502495325aa019b793c8052
Parent: 6a995bac43f8ddcdbb5075053943aa8189df3170
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Feb 18 00:08:38 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Feb 23 10:28:01 2013 +0100
activation: extend _cached_info
Add layer string to support check of layered devices.
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 14 ++++++++------
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2f8fbd4..0f4228b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Extend _cached_info() to accept layer string.
Allow identical table reload for RAID to restore transiently failed PVs.
vgimport '--force' now allows users to import VGs with missing PVs.
Fix PV alignment to incorporate alignment offset if the PV has zero MDAs.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index e8f449c..deaab9f 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -481,14 +481,15 @@ int dev_manager_info(struct dm_pool *mem, const struct logical_volume *lv,
}
static const struct dm_info *_cached_info(struct dm_pool *mem,
+ struct dm_tree *dtree,
const struct logical_volume *lv,
- struct dm_tree *dtree)
+ const char *layer)
{
const char *dlid;
struct dm_tree_node *dnode;
const struct dm_info *dinfo;
- if (!(dlid = build_dm_uuid(mem, lv->lvid.s, NULL))) {
+ if (!(dlid = build_dm_uuid(mem, lv->lvid.s, layer))) {
log_error("dlid build failed for %s", lv->name);
return NULL;
}
@@ -2169,10 +2170,11 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
* - open_count is always retrieved (as of dm-ioctl 4.7.0)
* so just use the tree's existing nodes' info
*/
- if (((dinfo = _cached_info(dm->mem, lv,
- dtree)) && dinfo->open_count) ||
- ((dinfo = _cached_info(dm->mem, find_merging_cow(lv)->cow,
- dtree)) && dinfo->open_count)) {
+ if (((dinfo = _cached_info(dm->mem, dtree, lv, NULL)) &&
+ dinfo->open_count) ||
+ ((dinfo = _cached_info(dm->mem, dtree,
+ find_merging_cow(lv)->cow, NULL)) &&
+ dinfo->open_count)) {
/* FIXME Is there anything simpler to check for instead? */
if (!lv_has_target_type(dm->mem, lv, NULL, "snapshot-merge"))
laopts->no_merging = 1;
11 years, 2 months
master - configure: Respect pkg-config --cflags for udev.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6a995bac43f8dd...
Commit: 6a995bac43f8ddcdbb5075053943aa8189df3170
Parent: ae6fae9b26b61bcd9cc031ec021224cb4ac28cba
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon Feb 18 16:18:41 2013 +0100
Committer: Petr Rockai <me(a)mornfall.net>
CommitterDate: Fri Feb 22 14:49:31 2013 +0100
configure: Respect pkg-config --cflags for udev.
---
make.tmpl.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/make.tmpl.in b/make.tmpl.in
index 8b56f01..b33ddb3 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -34,7 +34,7 @@ LIBS = @LIBS@
# Extra libraries always linked with static binaries
STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS)
DEFS += @DEFS@
-CFLAGS += @CFLAGS@
+CFLAGS += @CFLAGS@ @UDEV_CFLAGS@
CLDFLAGS += @CLDFLAGS@
ELDFLAGS += @ELDFLAGS@
LDDEPS += @LDDEPS@
11 years, 2 months
master - conf: add missing '=' for raid10_segtype_default
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ae6fae9b26b61b...
Commit: ae6fae9b26b61bcd9cc031ec021224cb4ac28cba
Parent: bbc6378b73246d7ef00c16274fea38118531ae95
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Feb 22 12:36:03 2013 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Feb 22 12:36:03 2013 +0100
conf: add missing '=' for raid10_segtype_default
---
doc/example.conf.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/doc/example.conf.in b/doc/example.conf.in
index e6494e5..ab83c0c 100644
--- a/doc/example.conf.in
+++ b/doc/example.conf.in
@@ -513,7 +513,7 @@ global {
# this setting is not advised.
# Specify the '--type <raid10|mirror>' option to override this default
# setting.
- raid10_segtype_default "mirror"
+ raid10_segtype_default = "mirror"
# The default format for displaying LV names in lvdisplay was changed
# in version 2.02.89 to show the LV name and path separately.
11 years, 2 months
master - RAID: Make 'lvchange --refresh' restore transiently failed RAID PVs
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bbc6378b73246d...
Commit: bbc6378b73246d7ef00c16274fea38118531ae95
Parent: 3ab46449f4dbcc45fe878149838a8439f5ac8b34
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Thu Feb 21 11:31:36 2013 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Thu Feb 21 11:31:36 2013 -0600
RAID: Make 'lvchange --refresh' restore transiently failed RAID PVs
A new function (dm_tree_node_force_identical_table_reload) was added to
avoid the suppression of identical table reloads. This allows RAID LVs
to reload the on-disk superblock information that contains which devices
have failed and the bitmaps. If the failed device has returned, this has
the effect of restoring the device and initiating recovery. Without this
patch, the user had to completely deactivate their RAID LV and re-activate
it in order to restore the failed device. Now they simply need to
suspend and resume (which is done by 'lvchange --refresh').
The identical table suppression is only avoided if the LV is not PARTAIL
(i.e. all of it's devices can be seen and read by LVM) and the kernel
status of the array contains failed devices. In other words, the function
will only be called in the case where we may have success in restoring
a failed device in the array.
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 613ec3d..2f8fbd4 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Allow identical table reload for RAID to restore transiently failed PVs.
vgimport '--force' now allows users to import VGs with missing PVs.
Fix PV alignment to incorporate alignment offset if the PV has zero MDAs.
Allow remove/replace of RAID sub-LVs that are composed of error targets.
11 years, 2 months
master - vgimport: Allow '--force' to import VGs with missing PVs.
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3ab46449f4dbcc...
Commit: 3ab46449f4dbcc45fe878149838a8439f5ac8b34
Parent: 303e86adc8dbbab2fe78412f1b90021e5bdb5bc3
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Feb 20 16:28:26 2013 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Feb 20 16:37:41 2013 -0600
vgimport: Allow '--force' to import VGs with missing PVs.
When there are missing PVs in a volume group, most operations that alter
the LVM metadata are disallowed. It turns out that 'vgimport' is one of
those disallowed operations. This is bad because it creates a circular
dependency. 'vgimport' will complain that the VG is inconsistent and that
'vgreduce --removemissing' must be run. However, 'vgreduce' cannot be run
because it has not been imported. Therefore, 'vgimport' must be one of
the operations allowed to change the metadata when PVs are missing. The
'--force' option is the way to make 'vgimport' happen in spite of the
missing PVs.
---
WHATS_NEW | 1 +
man/vgimport.8.in | 5 +++++
tools/vgimport.c | 17 +++++++++++++++++
3 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 82cbfc9..613ec3d 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ vgimport '--force' now allows users to import VGs with missing PVs.
Fix PV alignment to incorporate alignment offset if the PV has zero MDAs.
Allow remove/replace of RAID sub-LVs that are composed of error targets.
Make 'vgreduce --removemissing' able to handle RAID LVs with missing PVs.
diff --git a/man/vgimport.8.in b/man/vgimport.8.in
index dd781de..9496d40 100644
--- a/man/vgimport.8.in
+++ b/man/vgimport.8.in
@@ -20,6 +20,11 @@ See \fBlvm\fP(8) for common options.
.TP
.BR \-a ", " \-\-all
Import all exported Volume Groups.
+.TP
+.BR \-\-force
+Import exported Volume Groups even if there are missing Physical Volumes.
+This option should only be used if the missing devices are known to have
+failed and they cannot be restored.
.SH SEE ALSO
.BR lvm (8),
.BR pvscan (8),
diff --git a/tools/vgimport.c b/tools/vgimport.c
index 5badcb5..20cae6c 100644
--- a/tools/vgimport.c
+++ b/tools/vgimport.c
@@ -68,6 +68,23 @@ int vgimport(struct cmd_context *cmd, int argc, char **argv)
return ECMD_FAILED;
}
+ if (arg_count(cmd, force_ARG)) {
+ /*
+ * The volume group cannot be repaired unless it is first
+ * imported. If we don't allow the user a way to import the
+ * VG while it is 'partial', then we will have created a
+ * circular dependency.
+ *
+ * The reason we don't just simply set 'handles_missing_pvs'
+ * by default is that we want to guard against the case
+ * where the user simply forgot to move one or more disks in
+ * the VG before running 'vgimport'.
+ */
+ log_print("'--force' supplied. Volume groups with missing PVs"
+ " will be imported.");
+ cmd->handles_missing_pvs = 1;
+ }
+
return process_each_vg(cmd, argc, argv,
READ_FOR_UPDATE | READ_ALLOW_EXPORTED,
NULL,
11 years, 2 months
master - pvcreate: fix alignment to incorporate alignment offset if PV has 0 MDAs
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=303e86adc8dbba...
Commit: 303e86adc8dbbab2fe78412f1b90021e5bdb5bc3
Parent: 70f57996b3b9ba126a9cbf69afed79a7d66c793c
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Feb 21 14:47:49 2013 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Feb 21 14:51:19 2013 +0100
pvcreate: fix alignment to incorporate alignment offset if PV has 0 MDAs
If zero metadata copies are used, there's no further recalculation of
PV alignment that happens when adding metadata areas to the PV and
which actually calculates the alignment correctly as a matter of fact.
So fix this for "PV without MDA" case as well.
Before this patch:
[1] raw/~ # pvcreate --dataalignment 8m --dataalignmentoffset 4m
--metadatacopies 1 /dev/sda
Physical volume "/dev/sda" successfully created
[1] raw/~ # pvs -o pv_name,pe_start
PV 1st PE
/dev/sda 12.00m
[1] raw/~ # pvcreate --dataalignment 8m --dataalignmentoffset 4m
--metadatacopies 0 /dev/sda
Physical volume "/dev/sda" successfully created
[1] raw/~ # pvs -o pv_name,pe_start
PV 1st PE
/dev/sda 8.00m
After this patch:
[1] raw/~ # pvcreate --dataalignment 8m --dataalignmentoffset 4m
--metadatacopies 1 /dev/sda
Physical volume "/dev/sda" successfully created
[1] raw/~ # pvs -o pv_name,pe_start
PV 1st PE
/dev/sda 12.00m
[1] raw/~ # pvcreate --dataalignment 8m --dataalignmentoffset 4m
--metadatacopies 0 /dev/sda
Physical volume "/dev/sda" successfully created
[1] raw/~ # pvs -o pv_name,pe_start
PV 1st PE
/dev/sda 12.00m
Also, remove a superfluous condition "pv->pe_start < pv->pe_align" in:
if (pe_start == PV_PE_START_CALC && pv->pe_start < pv->pe_align)
pv->pe_start = pv->pe_align ...
This part of the condition is not reachable as with the PV_PE_START_CALC,
we always have pv->pe_start set to 0 from the PV struct initialisation
(...the pv->pe_start value is just being calculated).
---
WHATS_NEW | 1 +
lib/format_text/format-text.c | 10 ++++++++--
lib/metadata/metadata.c | 2 +-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 33993e4..82cbfc9 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix PV alignment to incorporate alignment offset if the PV has zero MDAs.
Allow remove/replace of RAID sub-LVs that are composed of error targets.
Make 'vgreduce --removemissing' able to handle RAID LVs with missing PVs.
Rename lvm.conf setting 'mirror_region_size' to 'raid_region_size'.
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 24fd318..cf15313 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -1508,8 +1508,14 @@ static int _text_pv_initialise(const struct format_type *fmt,
return 0;
}
- if (pe_start == PV_PE_START_CALC && pv->pe_start < pv->pe_align)
- pv->pe_start = pv->pe_align;
+ if (pv->size < pv->pe_align + pv->pe_align_offset) {
+ log_error("%s: Data alignment must not exceed device size.",
+ pv_dev_name(pv));
+ return 0;
+ }
+
+ if (pe_start == PV_PE_START_CALC)
+ pv->pe_start = pv->pe_align + pv->pe_align_offset;
if (extent_size)
pv->pe_size = extent_size;
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 0b774ac..d03b49c 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1650,7 +1650,7 @@ struct physical_volume *pv_create(const struct cmd_context *cmd,
goto bad;
}
- if (pv->size < data_alignment) {
+ if (pv->size < data_alignment + data_alignment_offset) {
log_error("%s: Data alignment must not exceed device size.",
pv_dev_name(pv));
goto bad;
11 years, 2 months
master - RAID: Add new 'raid10_segtype_default' setting in lvm.conf
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=70f57996b3b9ba...
Commit: 70f57996b3b9ba126a9cbf69afed79a7d66c793c
Parent: dc2ce71313cef15efa2ba0addfb0f4115af80ca6
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Feb 20 15:10:04 2013 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Feb 20 15:10:04 2013 -0600
RAID: Add new 'raid10_segtype_default' setting in lvm.conf
If '--mirrors/-m' and '--stripes/-i' are used together when creating
a logical volume, mirrors-over-stripes is currently chosen. The user
can override this by using the '--type raid10' option on creation.
However, we want a place where we can set the default behavior to
'raid10' explicitly - similar to the "mirror" and "raid1" tunable,
mirror_segtype_default.
A follow-on patch should use this new setting to change the default
from "mirror" to "raid10", as this is the preferred segment type.
---
doc/example.conf.in | 17 +++++++++++++++++
lib/config/defaults.h | 1 +
tools/lvcreate.c | 11 ++++++-----
3 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/doc/example.conf.in b/doc/example.conf.in
index a1ba5f8..e6494e5 100644
--- a/doc/example.conf.in
+++ b/doc/example.conf.in
@@ -498,6 +498,23 @@ global {
# setting.
mirror_segtype_default = "mirror"
+ # 'raid10_segtype_default' determines the segment types used by default
+ # when the '--stripes/-i' and '--mirrors/-m' arguments are both specified
+ # during the creation of a logical volume.
+ # Possible settings include:
+ #
+ # "raid10" - This implementation leverages MD's RAID10 personality through
+ # device-mapper.
+ #
+ # "mirror" - LVM will layer the 'mirror' and 'stripe' segment types. It
+ # will do this by creating a mirror on top of striped sub-LVs;
+ # effectively creating a RAID 0+1 array. This is suboptimal
+ # in terms of providing redunancy and performance. Changing to
+ # this setting is not advised.
+ # Specify the '--type <raid10|mirror>' option to override this default
+ # setting.
+ raid10_segtype_default "mirror"
+
# The default format for displaying LV names in lvdisplay was changed
# in version 2.02.89 to show the LV name and path separately.
# Previously this was always shown as /dev/vgname/lvname even when that
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 0a98254..d39995e 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -56,6 +56,7 @@
#define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"
#define DEFAULT_MIRROR_IMAGE_FAULT_POLICY "remove"
#define DEFAULT_MIRROR_MAX_IMAGES 8 /* limited by kernel DM_KCOPYD_MAX_REGIONS */
+#define DEFAULT_RAID10_SEGTYPE "mirror"
#define DEFAULT_RAID_FAULT_POLICY "warn"
#define DEFAULT_DMEVENTD_RAID_LIB "libdevmapper-event-lvm2raid.so"
#define DEFAULT_DMEVENTD_MIRROR_LIB "libdevmapper-event-lvm2mirror.so"
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 8919ba4..a2626c0 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -673,11 +673,12 @@ static int _lvcreate_params(struct lvcreate_params *lp,
/* Set default segtype */
if (arg_count(cmd, mirrors_ARG))
- /*
- * FIXME: Add default setting for when -i and -m arguments
- * are both given. We should default to "raid10".
- */
- segtype_str = find_config_tree_str(cmd, "global/mirror_segtype_default", DEFAULT_MIRROR_SEGTYPE);
+ if (arg_uint_value(cmd, arg_count(cmd, stripes_long_ARG) ?
+ stripes_long_ARG : stripes_ARG, 1) > 1) {
+ segtype_str = find_config_tree_str(cmd, "global/raid10_segtype_default", DEFAULT_RAID10_SEGTYPE);
+ } else {
+ segtype_str = find_config_tree_str(cmd, "global/mirror_segtype_default", DEFAULT_MIRROR_SEGTYPE);
+ }
else if (arg_count(cmd, thin_ARG) || arg_count(cmd, thinpool_ARG))
segtype_str = "thin";
else
11 years, 2 months
master - clean-up: Remove a FIXME question that has been settled
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dc2ce71313cef1...
Commit: dc2ce71313cef15efa2ba0addfb0f4115af80ca6
Parent: bd0ee420b597d38e37cfe738951cb1242f527638
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Feb 20 15:03:58 2013 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Feb 20 15:03:58 2013 -0600
clean-up: Remove a FIXME question that has been settled
It is ok for us to use the shorthand 'lv_is_virtual' to detect error
targets in a RAID LV when searching for candidates for device replacement.
---
lib/metadata/raid_manip.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index f716664..b1ada5c 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -1675,7 +1675,6 @@ int lv_raid_replace(struct logical_volume *lv,
return 0;
}
- // FIXME: safe to use 'virtual' as a substitute for 'error'?
if (lv_is_virtual(seg_lv(raid_seg, s)) ||
lv_is_virtual(seg_metalv(raid_seg, s)) ||
_lv_is_on_pvs(seg_lv(raid_seg, s), remove_pvs) ||
11 years, 2 months