master - lvconvert: better testing order
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8c56c5fbacf6a4...
Commit: 8c56c5fbacf6a4e9a0130b6f1fdc5683d6f108ec
Parent: ab7bcc26f60edd529fc498a856f0dde2479919be
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 18 12:19:40 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jul 22 22:38:59 2014 +0200
lvconvert: better testing order
Avoid duplicate tests through implicit calls - check directly
result of string assignment.
---
tools/lvconvert.c | 49 ++++++++++++++++++++-----------------------------
1 files changed, 20 insertions(+), 29 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 206c041..61b1660 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -234,7 +234,7 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
int cachepool = 0;
int thinpool = 0;
- if (arg_count(cmd, cachepool_ARG)) {
+ if ((lp->pool_data_lv_name = arg_str_value(cmd, cachepool_ARG, NULL))) {
if (type_str[0] &&
strcmp(type_str, "cache") &&
strcmp(type_str, "cache-pool")) {
@@ -242,13 +242,11 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
" the cache or cache-pool segment type.");
return 0;
}
- lp->pool_data_lv_name = arg_str_value(cmd, cachepool_ARG, NULL);
cachepool = 1;
type_str = "cache-pool";
} else if (!strcmp(type_str, "cache-pool"))
cachepool = 1;
-
- if (arg_count(cmd, thinpool_ARG)) {
+ else if ((lp->pool_data_lv_name = arg_str_value(cmd, thinpool_ARG, NULL))) {
if (type_str[0] &&
strcmp(type_str, "thin") &&
strcmp(type_str, "thin-pool")) {
@@ -256,33 +254,18 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
" the thin or thin-pool segment type.");
return 0;
}
- lp->pool_data_lv_name = arg_str_value(cmd, thinpool_ARG, NULL);
thinpool = 1;
type_str = "thin-pool";
} else if (!strcmp(type_str, "thin-pool"))
thinpool = 1;
- if (thinpool) {
- lp->discards = (thin_discards_t) arg_uint_value(cmd, discards_ARG, THIN_DISCARDS_PASSDOWN);
- lp->origin_lv_name = arg_str_value(cmd, originname_ARG, NULL);
- } else {
- if (arg_from_list_is_set(cmd, "is valid only with thin pools",
- discards_ARG, originname_ARG, zero_ARG,
- -1))
- return_0;
- if (lp->thin) {
- log_error("--thin requires --thinpool.");
- return 0;
- }
- }
-
if (cachepool) {
if ((tmp_str = arg_str_value(cmd, cachemode_ARG, NULL)) &&
!get_cache_mode(tmp_str, &lp->feature_flags))
return_0;
} else {
if (arg_from_list_is_set(cmd, "is valid only with cache pools",
- cachemode_ARG, -1))
+ cachepool_ARG, cachemode_ARG, -1))
return_0;
if (lp->cache) {
log_error("--cache requires --cachepool.");
@@ -290,6 +273,20 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
}
}
+ if (thinpool) {
+ lp->discards = (thin_discards_t) arg_uint_value(cmd, discards_ARG, THIN_DISCARDS_PASSDOWN);
+ lp->origin_lv_name = arg_str_value(cmd, originname_ARG, NULL);
+ } else {
+ if (arg_from_list_is_set(cmd, "is valid only with thin pools",
+ discards_ARG, originname_ARG, thinpool_ARG,
+ zero_ARG, -1))
+ return_0;
+ if (lp->thin) {
+ log_error("--thin requires --thinpool.");
+ return 0;
+ }
+ }
+
if (thinpool || cachepool) {
if (arg_from_list_is_set(cmd, "is invalid with pools",
merge_ARG, mirrors_ARG, repair_ARG, snapshot_ARG,
@@ -308,7 +305,7 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
/* value is read in get_pool_params() */
}
- if (arg_count(cmd, poolmetadata_ARG)) {
+ if ((lp->pool_metadata_lv_name = arg_str_value(cmd, poolmetadata_ARG, NULL))) {
if (arg_count(cmd, stripesize_ARG) || arg_count(cmd, stripes_long_ARG)) {
log_error("Can't use --stripes and --stripesize with --poolmetadata.");
return 0;
@@ -318,11 +315,6 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
log_error("Can't use --readahead with --poolmetadata.");
return 0;
}
-
- if (!(lp->pool_metadata_lv_name = arg_str_value(cmd, poolmetadata_ARG, NULL))) {
- log_error("Missing --poolmetadata argument.");
- return 0;
- }
}
if (arg_count(cmd, chunksize_ARG) &&
@@ -331,14 +323,13 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
return 0;
}
- if (!arg_count(cmd, cachepool_ARG) &&
- !arg_count(cmd, thinpool_ARG)) {
+ if (!lp->pool_data_lv_name) {
if (!*pargc) {
log_error("Please specify the pool data LV.");
return 0;
}
lp->pool_data_lv_name = (*pargv)[0];
- (*pargv)++, (*pargc)--;
+ (*pargv)++, (*pargc)--;
}
if (!lp->thin && !lp->cache)
9 years, 8 months
master - tools: switch logic for new arg_ func
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ab7bcc26f60edd...
Commit: ab7bcc26f60edd529fc498a856f0dde2479919be
Parent: 864ff3cb181183ccfabc8a2e3c53ddcd1e36390f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 18 21:56:37 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jul 22 22:38:59 2014 +0200
tools: switch logic for new arg_ func
Revert logic and rename new arg_ functions to:
arg_from_list_is_set()
arg_outside_list_is_set()
When err_found is given, log_error message is automaticaly
printed.
---
tools/lvconvert.c | 58 ++++++++++++++++++++++++++--------------------------
tools/lvmcmdline.c | 28 ++++++++++++++----------
tools/tools.h | 4 +-
3 files changed, 47 insertions(+), 43 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 63a1d98..206c041 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -266,9 +266,9 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
lp->discards = (thin_discards_t) arg_uint_value(cmd, discards_ARG, THIN_DISCARDS_PASSDOWN);
lp->origin_lv_name = arg_str_value(cmd, originname_ARG, NULL);
} else {
- if (!arg_is_any_set(cmd, "is valid only with thin pools",
- discards_ARG, originname_ARG, zero_ARG,
- -1))
+ if (arg_from_list_is_set(cmd, "is valid only with thin pools",
+ discards_ARG, originname_ARG, zero_ARG,
+ -1))
return_0;
if (lp->thin) {
log_error("--thin requires --thinpool.");
@@ -281,8 +281,8 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
!get_cache_mode(tmp_str, &lp->feature_flags))
return_0;
} else {
- if (!arg_is_any_set(cmd, "is valid only with cache pools",
- cachemode_ARG, -1))
+ if (arg_from_list_is_set(cmd, "is valid only with cache pools",
+ cachemode_ARG, -1))
return_0;
if (lp->cache) {
log_error("--cache requires --cachepool.");
@@ -291,9 +291,9 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
}
if (thinpool || cachepool) {
- if (!arg_is_any_set(cmd, "is invalid with pools",
- merge_ARG, mirrors_ARG, repair_ARG, snapshot_ARG,
- splitmirrors_ARG, -1))
+ if (arg_from_list_is_set(cmd, "is invalid with pools",
+ merge_ARG, mirrors_ARG, repair_ARG, snapshot_ARG,
+ splitmirrors_ARG, -1))
return_0;
if (arg_count(cmd, poolmetadatasize_ARG)) {
@@ -349,9 +349,9 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
if (!(lp->segtype = get_segtype_from_string(cmd, type_str)))
return_0;
- } else if (!arg_is_any_set(cmd, "is valid only with pools",
- poolmetadatasize_ARG, poolmetadataspare_ARG,
- -1))
+ } else if (arg_from_list_is_set(cmd, "is valid only with pools",
+ poolmetadatasize_ARG, poolmetadataspare_ARG,
+ -1))
return_0;
return 1;
@@ -374,12 +374,12 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
return_0;
if (arg_count(cmd, repair_ARG) &&
- !arg_is_only_set(cmd, "cannot be used with --repair",
- repair_ARG,
- alloc_ARG, use_policies_ARG,
- stripes_long_ARG, stripesize_ARG,
- force_ARG, noudevsync_ARG, test_ARG,
- -1))
+ arg_outside_list_is_set(cmd, "cannot be used with --repair",
+ repair_ARG,
+ alloc_ARG, use_policies_ARG,
+ stripes_long_ARG, stripesize_ARG,
+ force_ARG, noudevsync_ARG, test_ARG,
+ -1))
return_0;
if (arg_is_set(cmd, mirrorlog_ARG) && arg_is_set(cmd, corelog_ARG)) {
@@ -388,10 +388,10 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
}
if (arg_is_set(cmd, splitsnapshot_ARG)) {
- if (!arg_is_only_set(cmd, "cannot be used with --splitsnapshot",
- splitsnapshot_ARG,
- force_ARG, noudevsync_ARG, test_ARG,
- -1))
+ if (arg_outside_list_is_set(cmd, "cannot be used with --splitsnapshot",
+ splitsnapshot_ARG,
+ force_ARG, noudevsync_ARG, test_ARG,
+ -1))
return_0;
lp->splitsnapshot = 1;
}
@@ -504,11 +504,11 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
/* There are six types of lvconvert. */
if (lp->merge) { /* Snapshot merge */
- if (!arg_is_only_set(cmd, "cannot be used with --merge",
- merge_ARG,
- background_ARG, interval_ARG,
- force_ARG, noudevsync_ARG, test_ARG,
- -1))
+ if (arg_outside_list_is_set(cmd, "cannot be used with --merge",
+ merge_ARG,
+ background_ARG, interval_ARG,
+ force_ARG, noudevsync_ARG, test_ARG,
+ -1))
return_0;
if (!(lp->segtype = get_segtype_from_string(cmd, "snapshot")))
@@ -2796,9 +2796,9 @@ static int _lvconvert_pool(struct cmd_context *cmd,
lp->pool_data_lv = pool_lv;
if (!metadata_lv) {
- if (!arg_is_any_set(cmd, "is invalid with existing pool",
- cachemode_ARG,chunksize_ARG, discards_ARG,
- zero_ARG, poolmetadatasize_ARG, -1))
+ if (arg_from_list_is_set(cmd, "is invalid with existing pool",
+ cachemode_ARG,chunksize_ARG, discards_ARG,
+ zero_ARG, poolmetadatasize_ARG, -1))
return_0;
return 1;
}
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 4654978..10dac8f 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -68,25 +68,26 @@ unsigned arg_is_set(const struct cmd_context *cmd, int a)
return arg_count(cmd, a) ? 1 : 0;
}
-int arg_is_any_set(const struct cmd_context *cmd, const char *err, ...)
+int arg_from_list_is_set(const struct cmd_context *cmd, const char *err_found, ...)
{
int arg;
va_list ap;
- va_start(ap, err);
+ va_start(ap, err_found);
while ((arg = va_arg(ap, int)) != -1 && !arg_count(cmd, arg))
/* empty */;
va_end(ap);
- if (arg != -1) {
- log_error("%s %s.", arg_long_option_name(arg), err);
+ if (arg == -1)
return 0;
- }
+
+ if (err_found)
+ log_error("%s %s.", arg_long_option_name(arg), err_found);
return 1;
}
-int arg_is_only_set(const struct cmd_context *cmd, const char *err, ...)
+int arg_outside_list_is_set(const struct cmd_context *cmd, const char *err_found, ...)
{
int i, arg;
va_list ap;
@@ -109,18 +110,21 @@ int arg_is_only_set(const struct cmd_context *cmd, const char *err, ...)
}
if (!arg_count(cmd, i))
continue; /* unset */
- va_start(ap, err);
+ va_start(ap, err_found);
while (((arg = va_arg(ap, int)) != -1) && (arg != i))
/* empty */;
va_end(ap);
- if (arg != i) {
- log_error("Option %s %s.", arg_long_option_name(i), err);
- return 0;
- }
+ if (arg == i)
+ continue; /* set and in list */
+
+ if (err_found)
+ log_error("Option %s %s.", arg_long_option_name(i), err_found);
+
+ return 1;
}
- return 1;
+ return 0;
}
unsigned grouped_arg_is_set(const struct arg_values *av, int a)
diff --git a/tools/tools.h b/tools/tools.h
index a92845a..beb1671 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -144,8 +144,8 @@ int major_minor_valid(const struct cmd_context * cmd, const struct format_type *
/* we use the enums to access the switches */
unsigned arg_count(const struct cmd_context *cmd, int a);
unsigned arg_is_set(const struct cmd_context *cmd, int a);
-int arg_is_any_set(const struct cmd_context *cmd, const char *err, ...);
-int arg_is_only_set(const struct cmd_context *cmd, const char *err, ...);
+int arg_from_list_is_set(const struct cmd_context *cmd, const char *err_found, ...);
+int arg_outside_list_is_set(const struct cmd_context *cmd, const char *err_found, ...);
const char *arg_long_option_name(int a);
const char *arg_value(struct cmd_context *cmd, int a);
const char *arg_str_value(struct cmd_context *cmd, int a, const char *def);
9 years, 8 months
master - man: rework lvmcache to match lvmthin
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=864ff3cb181183...
Commit: 864ff3cb181183ccfabc8a2e3c53ddcd1e36390f
Parent: 50961f43d03aec309dd06e121d03a6fd7b301850
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jul 22 15:10:35 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Jul 22 15:12:02 2014 -0500
man: rework lvmcache to match lvmthin
Reorganize and rewrite parts to match lvmthin(7).
---
man/lvmcache.7.in | 251 ++++++++++++++++++++++++++++++++--------------------
1 files changed, 154 insertions(+), 97 deletions(-)
diff --git a/man/lvmcache.7.in b/man/lvmcache.7.in
index 4b21a8a..cc92673 100644
--- a/man/lvmcache.7.in
+++ b/man/lvmcache.7.in
@@ -4,7 +4,7 @@ lvmcache \(em LVM caching
.SH DESCRIPTION
-The \fIcache\fP logical volume type uses a small and fast LV to improve
+The \fBcache\fP logical volume type uses a small and fast LV to improve
the performance of a large and slow LV. It does this by storing the
frequently used blocks on the faster LV.
LVM refers to the small fast LV as a \fBcache pool LV\fP. The large
@@ -27,59 +27,60 @@ cache pool LV CachePoolLV CacheDataLV + CacheMetaLV
cache LV CacheLV OriginLV + CachePoolLV
.fi
-.SH Cache Steps
-The steps to create a logical volume of \fIcache\fP type are as follows:
-.TP
-0.
-Create an LV or identify an existing LV to be the origin LV.
-.TP
-1.
-Create the cache data LV. The size of this LV is the size of the cache
-and will be reported as the size of the cache pool LV.
-.TP
-2.
-Create the cache metadata LV.
-The size of this LV should be 1000 times smaller than the cache data LV
-with a minimum size of 8MiB.
-.TP
-3.
-Create the cache pool LV by combining the cache data LV (from step 1)
-and cache metadata LV (from step 2). When performing this step,
-behavioral characteristics of the cache pool LV can be set.
-The name of the cache pool LV takes the name of the cache data LV and
-the cache data LV and cache metadata LV are renamed
-to CachePoolLV_cdata and CachePoolLV_cmeta.
-.TP
-4.
-Create a cache LV by linking the cache pool LV to the origin LV.
-The user accessible cache LV takes the name of the origin LV,
-while the origin LV becomes a hidden LV with the name
-OriginLV_corig. Users can perform this step while the origin LV
-is in use.
+.SH Cache Usage
-.P
-The steps above represent the best way to create a cache LV.
-They provide the most options and have the ability to create the
-most robust logical volumes. The examples below illustrate how these
-steps might be used in practice.
+The primary method for using a cache type logical volume:
-.SH Cache Commands
-0. create OriginLV
-.br
-.B lvcreate \-L LargeSize \-n OriginLV VG SlowPVs
+.SS 0. create OriginLV
-1. create CacheDataLV
+Create an LV or identify an existing LV to be the origin LV.
+
+.B lvcreate \-n OriginLV \-L LargeSize VG SlowPVs
+
+.I Example
.br
-.B lvcreate \-L CacheSize \-n CacheDataLV VG FastPVs
+# lvcreate \-n lvol0 \-L 100G vg
+
-2. create CacheMetaLV
+.SS 1. create CacheDataLV
+
+Create the cache data LV. This LV will hold data blocks from the
+OriginLV. The size of this LV is the size of the cache and will be
+reported as the size of the cache pool LV.
+
+.B lvcreate \-n CacheDataLV \-L CacheSize VG FastPVs
+
+.I Example
.br
-.B lvcreate \-L MetaSize \-n CacheMetaLV VG FastPVs
+# lvcreate \-n cache0 \-L 10G vg /dev/fast
+
-3. create CachePoolLV
+.SS 2. create CacheMetaLV
+
+Create the cache metadata LV. This LV will hold cache pool metadata. The
+size of this LV should be 1000 times smaller than the cache data LV, with
+a minimum size of 8MiB.
+
+.B lvcreate \-n CacheMetaLV \-L MetaSize VG FastPVs
+
+.I Example
.br
-.B lvconvert \-\-cachepool VG/CacheDataLV \-\-poolmetadata VG/CacheMetaLV
+# lvcreate \-n cache0meta \-L 12M vg /dev/fast
+
+.nf
+# lvs -a vg
+ LV VG Attr LSize Pool Origin
+ cache0 vg -wi-a----- 10.00g
+ cache0meta vg -wi-a----- 12.00m
+ lvol0 vg -wi-a----- 100.00g
+.fi
+
+
+.SS 3. create CachePoolLV
+
+Combine the data and metadata LVs into a cache pool LV.
+The behavior of the cache pool LV can be set in this step.
.br
CachePoolLV takes the name of CacheDataLV.
.br
@@ -87,44 +88,108 @@ CacheDataLV is renamed CachePoolLV_cdata and becomes hidden.
.br
CacheMetaLV is renamed CachePoolLV_cmeta and becomes hidden.
-4. create CacheLV
+.B lvconvert \-\-cachepool VG/CacheDataLV \-\-poolmetadata VG/CacheMetaLV
+
+.I Example
.br
-.B lvconvert \-\-type cache \-\-cachepool VG/CachePoolLV VG/OriginLV
+# lvconvert \-\-cachepool vg/cache0 \-\-poolmetadata vg/cache0meta
+
+.nf
+# lvs -a vg
+ LV VG Attr LSize Pool Origin
+ cache0 vg Cwi---C--- 10.00g
+ [cache0_cdata] vg Cwi------- 10.00g
+ [cache0_cmeta] vg ewi------- 12.00m
+ lvol0 vg -wi-a----- 100.00g
+.fi
+
+
+.SS 4. create CacheLV
+
+Create a cache LV by linking the cache pool LV to the origin LV.
+The user accessible cache LV takes the name of the origin LV,
+while the origin LV becomes a hidden LV with the name
+OriginLV_corig. This can be done while the origin LV is in use.
.br
CacheLV takes the name of OriginLV.
.br
OriginLV is renamed OriginLV_corig and becomes hidden.
+.B lvconvert \-\-type cache \-\-cachepool VG/CachePoolLV VG/OriginLV
-.SH Cache Examples
+.I Example
+.br
+# lvconvert \-\-type cache \-\-cachepool vg/cache0 vg/lvol0
+
+.nf
+# lvs -a vg
+ LV VG Attr LSize Pool Origin
+ cache0 vg Cwi---C--- 10.00g
+ [cache0_cdata] vg Cwi-ao---- 10.00g
+ [cache0_cmeta] vg ewi-ao---- 12.00m
+ lvol0 vg Cwi-a-C--- 100.00g cache0 [lvol0_corig]
+ [lvol0_corig] vg -wi-ao---- 100.00g
+.fi
+
+
+.SH Cache Removal
-.SS Example 1
-Create a simple cache LV.
+.SS Removing a cache pool LV without removing its linked origin LV
+\&
+
+This writes back data from the cache pool to the origin LV when necessary,
+then removes the cache pool LV, leaving the un-cached origin LV.
+
+.B lvremove VG/CachePoolLV
+
+.I Example
.nf
-0. Create the origin LV
-# lvcreate \-L 10G \-n lvx vg /dev/slow_dev
+# lvs vg
+ LV VG Attr LSize Pool Origin
+ cache0 vg Cwi---C--- 10.00g
+ lvol0 vg Cwi-a-C--- 100.00g cache0 [lvol0_corig]
-1. Create a cache data LV
-# lvcreate \-L 1G \-n lvx_cache vg /dev/fast_dev
+# lvremove vg/cache0
-2. Create a cache metadata LV (~1/1000th size of CacheDataLV or 8MiB)
-# lvcreate \-L 8M \-n lvx_cache_meta vg /dev/fast_dev
+# lvs vg
+ LV VG Attr LSize Pool Origin
+ lvol0 vg -wi-a----- 100.00g
+.fi
-3. Create a cache pool LV, combining cache data LV and cache metadata LV
-# lvconvert \-\-cachepool vg/lvx_cache \-\-poolmetadata vg/lvx_cache_meta
+.SS Removing an origin LV without removing its linked cache pool LV
-4. Create a cached LV by combining the cache pool LV and origin LV
-# lvconvert \-\-type cache \-\-cachepool vg/lvx_cache vg/lvx
+\&
+
+This removes the origin LV, leaving the cache pool LV which can be linked
+to another origin LV.
+
+.B lvremove VG/CacheLV
+
+.I Example
+.nf
+# lvs vg
+ LV VG Attr LSize Pool Origin
+ cache0 vg Cwi---C--- 10.00g
+ lvol0 vg Cwi-a-C--- 100.00g cache0 [lvol0_corig]
+
+# lvremove vg/lvol0
+
+# lvs vg
+ LV VG Attr LSize Pool Origin
+ cache0 vg Cwi---C--- 10.00g
.fi
-.SS Example 2
-Create a cache LV with a fault tolerant cache pool LV.
-Users who are concerned about the possibility of failures in their fast devices
-that could lead to data loss might consider making their cache pool sub-LVs
-redundant. Example 2 illustrates how to do that. Note that only steps
-1 & 2 change.
+.SH Cache Topics
+
+.SS Tolerate device failures in a cache pool LV
+
+\&
+
+Users who are concerned about the possibility of failures in their fast
+devices that could lead to data loss might consider making their cache
+pool sub-LVs redundant.
.nf
0. Create an origin LV we wish to cache
@@ -145,16 +210,16 @@ redundant. Example 2 illustrates how to do that. Note that only steps
# lvconvert \-\-type cache \-\-cachepool vg/lvx_cache vg/lvx
.fi
-.SS Example 3
-Create a simple cache LV with \fIwritethough\fP caching.
+.SS Writethough caching
-Some users wish to ensure that any data written will be stored both in the
-cache pool LV and on the origin LV. The loss of a device associated with
-the cache pool LV in this case would not mean the loss of any data. When
-combining the cache data LV and the cache metadata LV to form the cache pool
-LV, properties of the cache can be specified - in this case,
-\fIwritethrough\fP vs. \fIwriteback\fP. Note that only step 3 is affected
-in this case.
+\&
+
+Writethrough caching ensures that any data written will be stored both in
+the cache pool LV and on the origin LV. The loss of a device associated
+with the cache pool LV in this case would not mean the loss of any data.
+When combining the cache data LV and the cache metadata LV to form the
+cache pool LV, properties of the cache can be specified - in this case,
+\fIwritethrough\fP vs. \fIwriteback\fP.
.nf
0. Create an origin LV we wish to cache (yours may already exist)
@@ -174,35 +239,27 @@ in this case.
# lvconvert \-\-type cache \-\-cachepool vg/lvx_cache vg/lvx
.fi
-.SH Cache Removal
-
-.SS Removing a cache pool LV without removing an associated origin LV
+.SS Spare metadata LV
-This writes back data from the cache pool to the origin LV, then removes
-the cache pool LV, leaving the un-cached origin LV. (If the origin LV
-will also be removed, the data flushing can be avoided; see "Removing
-both" below.)
+\&
-.B lvremove VG/CachePoolLV
+See
+.BR lvmthin (7)
+for a description of the "pool metadata spare" LV.
+The same concept is used for cache pools.
-.SS Removing both an origin LV and its associated cache pool LV
+.SS Automatic pool metadata LV
-This removes the cache LV, which includes removing both the origin LV and
-its associated cache pool LV. Data blocks from the cache pool are not
-written back to the origin LV.
+\&
-.B lvremove VG/CacheLV
+A cache data LV can be converted to cache pool LV without specifying a
+cache pool metadata LV. LVM will automatically create a metadata LV from
+the same VG.
-./" .SS Separating a cache pool LV from an origin LV
-./" This writes back data from the cache pool to the origin LV, then removes
-./" the association between the cache pool LV and the origin LV.
-./" .br
-./" Not yet implemented.
+.B lvcreate -n CacheDataLV -L CacheSize VG
+.br
+.B lvconvert --cachepool VG/CacheDataLV
-./" .SS Removing an origin LV without removing an associated cache pool LV
-./" Separate the cache pool LV from the origin LV, then remove the origin LV.
-./" .br
-./" Not yet implemented.
.SH SEE ALSO
.BR lvm.conf (5),
9 years, 8 months
master - report: Remove lv_target_type field.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=50961f43d03aec...
Commit: 50961f43d03aec309dd06e121d03a6fd7b301850
Parent: 99e3c1301294fdd1cd8be25adb303e24e1260c76
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Jul 22 20:57:57 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Jul 22 20:57:57 2014 +0100
report: Remove lv_target_type field.
This field is too complicated to be useful on its own and either needs
redefining or splitting up into multiple fields.
---
lib/report/columns.h | 2 +-
lib/report/properties.c | 5 ++---
lib/report/report.c | 2 ++
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/report/columns.h b/lib/report/columns.h
index af39008..0d95806 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -49,7 +49,7 @@ FIELD(LVS, lv, BIN, "AllocLock", lvid, 10, lvallocationlocked, lv_allocation_loc
FIELD(LVS, lv, BIN, "FixMin", lvid, 10, lvfixedminor, lv_fixed_minor, "Set if LV has fixed minor number assigned.", 0)
FIELD(LVS, lv, BIN, "MergeFailed", lvid, 15, lvmergefailed, lv_merge_failed, "Set if snapshot merge failed.", 0)
FIELD(LVS, lv, BIN, "SnapInvalid", lvid, 15, lvsnapshotinvalid, lv_snapshot_invalid, "Set if snapshot LV is invalid.", 0)
-FIELD(LVS, lv, STR, "TargetType", lvid, 10, lvtargettype, lv_target_type, "Kernel target type the LV is related to.", 0)
+//FIELD(LVS, lv, STR, "TargetType", lvid, 10, lvtargettype, lv_target_type, "Kernel target type the LV is related to.", 0)
FIELD(LVS, lv, STR, "Health", lvid, 15, lvhealthstatus, lv_health_status, "LV health status.", 0)
FIELD(LVS, lv, BIN, "SkipAct", lvid, 15, lvskipactivation, lv_skip_activation, "Set if LV is skipped on activation.", 0)
FIELD(LVS, lv, STR, "Active", lvid, 6, lvactive, lv_active, "Active state of the LV.", 0)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index b4e183f..72d689d 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -216,11 +216,10 @@ GET_PV_NUM_PROPERTY_FN(pv_ba_size, SECTOR_SIZE * pv->ba_size)
#define _lv_inactive_table_get prop_not_implemented_get
#define _lv_device_open_set prop_not_implemented_set
#define _lv_device_open_get prop_not_implemented_get
-#define _lv_target_type_set prop_not_implemented_set
-#define _lv_target_type_get prop_not_implemented_get
+//#define _lv_target_type_set prop_not_implemented_set
+//#define _lv_target_type_get prop_not_implemented_get
#define _lv_health_status_set prop_not_implemented_set
#define _lv_health_status_get prop_not_implemented_get
-#define _lv_target_type_get prop_not_implemented_get
#define _lv_skip_activation_set prop_not_implemented_set
#define _lv_skip_activation_get prop_not_implemented_get
diff --git a/lib/report/report.c b/lib/report/report.c
index 91dfac0..cea2c3c 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1603,6 +1603,7 @@ static int _lvdeviceopen_disp(struct dm_report *rh, struct dm_pool *mem,
return _binary_undef_disp(rh, mem, field, private);
}
+/* FIXME Replace with something that provides a complete unique description for every combination.
static int _lvtargettype_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
@@ -1629,6 +1630,7 @@ static int _lvtargettype_disp(struct dm_report *rh, struct dm_pool *mem,
return _string_disp(rh, mem, field, &target_type, private);
}
+*/
static int _thinzero_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
9 years, 8 months
master - raid: Moved degraded activation code to raid_manip.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=99e3c1301294fd...
Commit: 99e3c1301294fdd1cd8be25adb303e24e1260c76
Parent: fe5b282a4a51bcc2780da9ef7ab298d97c45f3db
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Jul 22 20:50:29 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Jul 22 20:50:29 2014 +0100
raid: Moved degraded activation code to raid_manip.
Adjust some messages & fn names.
---
lib/activate/activate.c | 119 ++-----------------------------------
lib/metadata/metadata-exported.h | 1 +
lib/metadata/raid_manip.c | 105 +++++++++++++++++++++++++++++++++
tools/lvmcmdline.c | 7 +-
4 files changed, 117 insertions(+), 115 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index deb09e2..ebeaa79 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2203,112 +2203,6 @@ out:
return r;
}
-/* FIXME Move this non-activation code elsewhere */
-static int _lv_raid_is_redundant(struct logical_volume *lv)
-{
- struct lv_segment *raid_seg = first_seg(lv);
- uint32_t copies;
- uint32_t i, s, rebuilds_per_group = 0;
- uint32_t failed_components = 0;
-
- if (!(lv->status & PARTIAL_LV)) {
- /*
- * Redundant, but this function shouldn't
- * be called in this case.
- */
- log_error(INTERNAL_ERROR "%s is not a partial LV", lv->name);
- return 1;
- }
-
- if (!lv_is_raid(lv))
- return 0; /* Not RAID, not redundant */
-
- if (!strcmp(raid_seg->segtype->name, "raid10")) {
- /* FIXME: We only support 2-way mirrors in RAID10 currently */
- copies = 2;
- for (i = 0; i < raid_seg->area_count * copies; i++) {
- s = i % raid_seg->area_count;
- if (!(i % copies))
- rebuilds_per_group = 0;
- if ((seg_lv(raid_seg, s)->status & PARTIAL_LV) ||
- (seg_metalv(raid_seg, s)->status & PARTIAL_LV) ||
- lv_is_virtual(seg_lv(raid_seg, s)) ||
- lv_is_virtual(seg_metalv(raid_seg, s)))
- rebuilds_per_group++;
- if (rebuilds_per_group >= copies) {
- log_debug("An entire mirror group "
- "has failed in %s", lv->name);
- return 0; /* Not redundant */
- }
- }
- return 1; /* Redundant */
- }
-
- for (s = 0; s < raid_seg->area_count; s++) {
- if ((seg_lv(raid_seg, s)->status & PARTIAL_LV) ||
- (seg_metalv(raid_seg, s)->status & PARTIAL_LV) ||
- lv_is_virtual(seg_lv(raid_seg, s)) ||
- lv_is_virtual(seg_metalv(raid_seg, s)))
- failed_components++;
- }
- if (failed_components == raid_seg->area_count) {
- log_debug("All components in %s have failed", lv->name);
- return 0;
- } else if (raid_seg->segtype->parity_devs &&
- (failed_components > raid_seg->segtype->parity_devs)) {
- log_debug("More than %u components from (%s) %s/%s have failed",
- raid_seg->segtype->parity_devs,
- raid_seg->segtype->ops->name(raid_seg),
- lv->vg->name, lv->name);
- return 0;
- }
-
- return 1;
-}
-
-static int _lv_is_not_degraded_capable(struct logical_volume *lv, void *data)
-{
- int *not_capable = (int *)data;
- uint32_t s;
- struct lv_segment *seg;
-
- if (!(lv->status & PARTIAL_LV))
- return 1;
-
- if (lv_is_raid(lv))
- return _lv_raid_is_redundant(lv);
-
- /* Ignore RAID sub-LVs. */
- if (lv_is_raid_type(lv))
- return 1;
-
- dm_list_iterate_items(seg, &lv->segments)
- for (s = 0; s < seg->area_count; s++)
- if (seg_type(seg, s) != AREA_LV) {
- log_debug("%s is not capable of degraded mode",
- lv->name);
- *not_capable = 1;
- }
-
- return 1;
-}
-
-static int lv_is_degraded_capable(struct logical_volume *lv)
-{
- int not_capable = 0;
-
- if (!(lv->status & PARTIAL_LV))
- return 1;
-
- if (!_lv_is_not_degraded_capable(lv, ¬_capable) || not_capable)
- return 0;
-
- if (!for_each_sub_lv(lv, _lv_is_not_degraded_capable, ¬_capable))
- log_error(INTERNAL_ERROR "for_each_sub_lv failure.");
-
- return !not_capable;
-}
-
static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
struct lv_activate_opts *laopts, int filter,
struct logical_volume *lv)
@@ -2330,19 +2224,20 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
goto out;
}
- if ((!lv->vg->cmd->partial_activation) && (lv->status & PARTIAL_LV)) {
- if (!lv_is_degraded_capable(lv)) {
+ if ((!lv->vg->cmd->partial_activation) && (lv->status & PARTIAL_LV) && lv_is_raid_type(lv)) {
+ if (!partial_raid_lv_supports_degraded_activation(lv)) {
log_error("Refusing activation of partial LV %s. "
"Use '--activationmode partial' to override.",
- lv->name);
+ display_lvname(lv));
goto out;
- } else if (!lv->vg->cmd->degraded_activation) {
+ }
+
+ if (!lv->vg->cmd->degraded_activation) {
log_error("Refusing activation of partial LV %s. "
"Try '--activationmode degraded'.",
- lv->name);
+ display_lvname(lv));
goto out;
}
- log_print_unless_silent("Attempting activation of partial RAID LV, %s.", lv->name);
}
if (lv_has_unknown_segments(lv)) {
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 2b06718..9d7a653 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1038,6 +1038,7 @@ int lv_raid_reshape(struct logical_volume *lv,
int lv_raid_replace(struct logical_volume *lv, struct dm_list *remove_pvs,
struct dm_list *allocate_pvs);
int lv_raid_remove_missing(struct logical_volume *lv);
+int partial_raid_lv_supports_degraded_activation(struct logical_volume *lv);
/* -- metadata/raid_manip.c */
/* ++ metadata/cache_manip.c */
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 6fead9a..ab30af9 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -1938,3 +1938,108 @@ int lv_raid_remove_missing(struct logical_volume *lv)
return 1;
}
+
+/* Return 1 if a partial raid LV can be activated redundantly */
+static int _partial_raid_lv_is_redundant(struct logical_volume *lv)
+{
+ struct lv_segment *raid_seg = first_seg(lv);
+ uint32_t copies;
+ uint32_t i, s, rebuilds_per_group = 0;
+ uint32_t failed_components = 0;
+
+ if (!strcmp(raid_seg->segtype->name, "raid10")) {
+ /* FIXME: We only support 2-way mirrors in RAID10 currently */
+ copies = 2;
+ for (i = 0; i < raid_seg->area_count * copies; i++) {
+ s = i % raid_seg->area_count;
+
+ if (!(i % copies))
+ rebuilds_per_group = 0;
+
+ if ((seg_lv(raid_seg, s)->status & PARTIAL_LV) ||
+ (seg_metalv(raid_seg, s)->status & PARTIAL_LV) ||
+ lv_is_virtual(seg_lv(raid_seg, s)) ||
+ lv_is_virtual(seg_metalv(raid_seg, s)))
+ rebuilds_per_group++;
+
+ if (rebuilds_per_group >= copies) {
+ log_verbose("An entire mirror group has failed in %s",
+ display_lvname(lv));
+ return 0; /* Insufficient redundancy to activate */
+ }
+ }
+
+ return 1; /* Redundant */
+ }
+
+ for (s = 0; s < raid_seg->area_count; s++) {
+ if ((seg_lv(raid_seg, s)->status & PARTIAL_LV) ||
+ (seg_metalv(raid_seg, s)->status & PARTIAL_LV) ||
+ lv_is_virtual(seg_lv(raid_seg, s)) ||
+ lv_is_virtual(seg_metalv(raid_seg, s)))
+ failed_components++;
+ }
+
+ if (failed_components == raid_seg->area_count) {
+ log_verbose("All components of raid LV %s have failed",
+ display_lvname(lv));
+ return 0; /* Insufficient redundancy to activate */
+ } else if (raid_seg->segtype->parity_devs &&
+ (failed_components > raid_seg->segtype->parity_devs)) {
+ log_verbose("More than %u components from %s %s have failed",
+ raid_seg->segtype->parity_devs,
+ raid_seg->segtype->ops->name(raid_seg),
+ display_lvname(lv));
+ return 0; /* Insufficient redundancy to activate */
+ }
+
+ return 1;
+}
+
+/* Sets *data to 1 if the LV cannot be activated without data loss */
+static int _lv_may_be_activated_in_degraded_mode(struct logical_volume *lv, void *data)
+{
+ int *not_capable = (int *)data;
+ uint32_t s;
+ struct lv_segment *seg;
+
+ if (*not_capable)
+ return 1; /* No further checks needed */
+
+ if (!(lv->status & PARTIAL_LV))
+ return 1;
+
+ if (lv_is_raid(lv)) {
+ *not_capable = !_partial_raid_lv_is_redundant(lv);
+ return 1;
+ }
+
+ /* Ignore RAID sub-LVs. */
+ if (lv_is_raid_type(lv))
+ return 1;
+
+ dm_list_iterate_items(seg, &lv->segments)
+ for (s = 0; s < seg->area_count; s++)
+ if (seg_type(seg, s) != AREA_LV) {
+ log_verbose("%s contains a segment incapable of degraded activation",
+ display_lvname(lv));
+ *not_capable = 1;
+ }
+
+ return 1;
+}
+
+int partial_raid_lv_supports_degraded_activation(struct logical_volume *lv)
+{
+ int not_capable = 0;
+
+ if (!_lv_may_be_activated_in_degraded_mode(lv, ¬_capable) || not_capable)
+ return 0;
+
+ if (!for_each_sub_lv(lv, _lv_may_be_activated_in_degraded_mode, ¬_capable)) {
+ log_error(INTERNAL_ERROR "for_each_sub_lv failure.");
+ return 0;
+ }
+
+ return !not_capable;
+}
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index a9769f2..4654978 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -980,10 +980,9 @@ static int _get_settings(struct cmd_context *cmd)
if (!strcmp(activation_mode, "partial")) {
cmd->partial_activation = 1;
log_warn("PARTIAL MODE. Incomplete logical volumes will be processed.");
- } else if (!strcmp(activation_mode, "degraded")) {
+ } else if (!strcmp(activation_mode, "degraded"))
cmd->degraded_activation = 1;
- log_verbose("DEGRADED MODE. Incomplete RAID LVs will be processed.");
- } else if (strcmp(activation_mode, "complete")) {
+ else if (strcmp(activation_mode, "complete")) {
log_error("Invalid activation mode given.");
return EINVALID_CMD_LINE;
}
@@ -1339,6 +1338,8 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
if ((ret = _get_settings(cmd)))
goto_out;
_apply_settings(cmd);
+ if (cmd->degraded_activation)
+ log_verbose("DEGRADED MODE. Incomplete RAID LVs will be processed.");
if (!get_activation_monitoring_mode(cmd, &monitoring))
goto_out;
9 years, 8 months
master - man: lvmcache updates
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fe5b282a4a51bc...
Commit: fe5b282a4a51bcc2780da9ef7ab298d97c45f3db
Parent: 1fe487043dadf189b08b9862f45d21438f197cf2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Jul 21 15:41:42 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Jul 21 15:41:42 2014 -0500
man: lvmcache updates
- use the lvconvert --cachepool syntax to match the lvmthin style
- rewrite removal information
- very minor formatting adjustments
---
man/lvmcache.7.in | 101 +++++++++++++++++++++++++++++++---------------------
1 files changed, 60 insertions(+), 41 deletions(-)
diff --git a/man/lvmcache.7.in b/man/lvmcache.7.in
index 87fb9f4..4b21a8a 100644
--- a/man/lvmcache.7.in
+++ b/man/lvmcache.7.in
@@ -18,7 +18,7 @@ on the origin LV or on the cache data LV). Users should be familiar with
these LVs if they wish to create the best and most robust cached
logical volumes.
-.SS Cache Terms
+.SH Cache Terms
.nf
origin LV OriginLV large slow LV
cache data LV CacheDataLV small fast LV for cache pool data
@@ -27,7 +27,7 @@ cache pool LV CachePoolLV CacheDataLV + CacheMetaLV
cache LV CacheLV OriginLV + CachePoolLV
.fi
-.SS Cache Steps
+.SH Cache Steps
The steps to create a logical volume of \fIcache\fP type are as follows:
.TP
0.
@@ -63,34 +63,43 @@ They provide the most options and have the ability to create the
most robust logical volumes. The examples below illustrate how these
steps might be used in practice.
-.SS Cache Commands
-.nf
+.SH Cache Commands
+
0. create OriginLV
-lvcreate \-L LargeSize \-n OriginLV VG SlowPVs
+.br
+.B lvcreate \-L LargeSize \-n OriginLV VG SlowPVs
1. create CacheDataLV
-lvcreate \-L CacheSize \-n CacheDataLV VG FastPVs
+.br
+.B lvcreate \-L CacheSize \-n CacheDataLV VG FastPVs
2. create CacheMetaLV
-lvcreate \-L MetaSize \-n CacheMetaLV VG FastPVs
+.br
+.B lvcreate \-L MetaSize \-n CacheMetaLV VG FastPVs
3. create CachePoolLV
-lvconvert \-\-type cache-pool \-\-poolmetadata VG/CacheMetaLV VG/CacheDataLV
+.br
+.B lvconvert \-\-cachepool VG/CacheDataLV \-\-poolmetadata VG/CacheMetaLV
+.br
CachePoolLV takes the name of CacheDataLV.
+.br
CacheDataLV is renamed CachePoolLV_cdata and becomes hidden.
+.br
CacheMetaLV is renamed CachePoolLV_cmeta and becomes hidden.
4. create CacheLV
-lvconvert \-\-type cache \-\-cachepool VG/CachePoolLV VG/OriginLV
+.br
+.B lvconvert \-\-type cache \-\-cachepool VG/CachePoolLV VG/OriginLV
+.br
CacheLV takes the name of OriginLV.
+.br
OriginLV is renamed OriginLV_corig and becomes hidden.
-.fi
-.SS Cache Examples
-.B Example 1:
-Creating a simple cache LV.
-.br
+.SH Cache Examples
+
+.SS Example 1
+Create a simple cache LV.
.nf
0. Create the origin LV
@@ -103,15 +112,14 @@ Creating a simple cache LV.
# lvcreate \-L 8M \-n lvx_cache_meta vg /dev/fast_dev
3. Create a cache pool LV, combining cache data LV and cache metadata LV
-# lvconvert \-\-type cache-pool \-\-poolmetadata vg/lvx_cache_meta \\
- vg/lvx_cache
+# lvconvert \-\-cachepool vg/lvx_cache \-\-poolmetadata vg/lvx_cache_meta
4. Create a cached LV by combining the cache pool LV and origin LV
# lvconvert \-\-type cache \-\-cachepool vg/lvx_cache vg/lvx
.fi
-.B Example 2:
-Creating a cache LV with a fault tolerant cache pool LV.
+.SS Example 2
+Create a cache LV with a fault tolerant cache pool LV.
Users who are concerned about the possibility of failures in their fast devices
that could lead to data loss might consider making their cache pool sub-LVs
@@ -131,15 +139,14 @@ redundant. Example 2 illustrates how to do that. Note that only steps
/dev/fast1 /dev/fast2
3. Create a cache pool LV combining cache data LV and cache metadata LV
-# lvconvert \-\-type cache-pool \-\-poolmetadata vg/lvx_cache_meta \\
- vg/lvx_cache
+# lvconvert \-\-cachepool vg/lvx_cache \-\-poolmetadata vg/lvx_cache_meta
4. Create a cached LV by combining the cache pool LV and origin LV
# lvconvert \-\-type cache \-\-cachepool vg/lvx_cache vg/lvx
.fi
-.B Example 3:
-Creating a simple cache LV with \fIwritethough\fP caching.
+.SS Example 3
+Create a simple cache LV with \fIwritethough\fP caching.
Some users wish to ensure that any data written will be stored both in the
cache pool LV and on the origin LV. The loss of a device associated with
@@ -160,30 +167,42 @@ in this case.
# lvcreate \-L 8M \-n lvx_cache_meta vg /dev/fast
3. Create a cache pool LV specifying cache mode "writethrough"
-# lvconvert \-\-type cache-pool \-\-poolmetadata vg/lvx_cache_meta \\
- \-\-cachemode writethrough vg/lvx_cache
+# lvconvert \-\-cachepool vg/lvx_cache \-\-poolmetadata vg/lvx_cache_meta \\
+ \-\-cachemode writethrough
4. Create a cache LV by combining the cache pool LV and origin LV
# lvconvert \-\-type cache \-\-cachepool vg/lvx_cache vg/lvx
.fi
-.SS Removing Cache Logical Volumes
-If you wish to remove all logical volumes associated with a cache
-LV, you must remove both top-level, user-visible devices.
-The cache metadata LV and cache data LV cannot be removed
-directly. If only the cache pool LV is specfied for removal, any cached
-blocks not yet on the origin LV will be flush, the cache pool LV will be
-removed, and the now un-cached origin LV will remain. If the user
-specifies a cache LV for removal, then the origin LV is
-removed and only the cache pool LV will remain. The cache pool LV can then
-be used to create another cache LV with a different origin LV if desired.
-
-When users intend to remove all logical volumes associated with a
-cache LV, it is generally better to start with the origin LV and then
-remove the cache pool LV. If the operations are performed in the
-reverse order, the user will have to wait for the contents of the
-cache pool LV to be flushed before the origin LV is removed. This
-could take some time.
+.SH Cache Removal
+
+.SS Removing a cache pool LV without removing an associated origin LV
+
+This writes back data from the cache pool to the origin LV, then removes
+the cache pool LV, leaving the un-cached origin LV. (If the origin LV
+will also be removed, the data flushing can be avoided; see "Removing
+both" below.)
+
+.B lvremove VG/CachePoolLV
+
+.SS Removing both an origin LV and its associated cache pool LV
+
+This removes the cache LV, which includes removing both the origin LV and
+its associated cache pool LV. Data blocks from the cache pool are not
+written back to the origin LV.
+
+.B lvremove VG/CacheLV
+
+./" .SS Separating a cache pool LV from an origin LV
+./" This writes back data from the cache pool to the origin LV, then removes
+./" the association between the cache pool LV and the origin LV.
+./" .br
+./" Not yet implemented.
+
+./" .SS Removing an origin LV without removing an associated cache pool LV
+./" Separate the cache pool LV from the origin LV, then remove the origin LV.
+./" .br
+./" Not yet implemented.
.SH SEE ALSO
.BR lvm.conf (5),
9 years, 8 months
master - man: use macros for indenting in lvmthin
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1fe487043dadf1...
Commit: 1fe487043dadf189b08b9862f45d21438f197cf2
Parent: 3366baf07675a259eeb7828fb6e605108a5a4290
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Jul 21 10:28:20 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Jul 21 10:28:20 2014 -0500
man: use macros for indenting in lvmthin
---
man/lvmthin.7.in | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/man/lvmthin.7.in b/man/lvmthin.7.in
index d534b42..6652f7e 100644
--- a/man/lvmthin.7.in
+++ b/man/lvmthin.7.in
@@ -818,7 +818,9 @@ Command to set the discard mode when creating a thin pool LV:
.br
.B lvconvert \-\-discards {ignore|nopassdown|passdown}
.br
-.B " " \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV
+.RS
+.B \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV
+.RE
Command to change the discard mode of an existing thin pool LV:
.br
@@ -933,7 +935,9 @@ name of ExampleLV.
.B lvconvert \-\-type thin \-\-thinpool VG/ThinPoolLV
.br
-.B " " \-\-originname NewExternalOriginLV \-\-thin VG/ExampleLV
+.RS
+.B \-\-originname NewExternalOriginLV \-\-thin VG/ExampleLV
+.RE
.I Example
.br
9 years, 8 months
master - metadata: Reinstate system info in metadata.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3366baf07675a2...
Commit: 3366baf07675a259eeb7828fb6e605108a5a4290
Parent: 513fd029a635470522e1c8a9cdddb70eec39474a
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Jul 21 15:54:20 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Jul 21 15:54:20 2014 +0100
metadata: Reinstate system info in metadata.
Revert part of cac0722cacaac06ac1211194f1d6c21572a32998
This was deliberate and aids the investigation of problems.
---
lib/format_text/export.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/lib/format_text/export.c b/lib/format_text/export.c
index aa0d905..bea97de 100644
--- a/lib/format_text/export.c
+++ b/lib/format_text/export.c
@@ -329,7 +329,6 @@ static int _print_header(struct formatter *f,
{
char *buf;
time_t t;
- char com[PATH_MAX];
t = time(NULL);
@@ -345,10 +344,9 @@ static int _print_header(struct formatter *f,
}
outf(f, "description = \"%s\"", dm_escape_double_quotes(buf, desc));
outnl(f);
- (void) dm_snprintf(com, sizeof(com), "# %s %s %s %s %s",
- _utsname.sysname, _utsname.nodename, _utsname.release,
- _utsname.version, _utsname.machine);
- outfc(f, com, "creation_host = \"%s\"", _utsname.nodename);
+ outf(f, "creation_host = \"%s\"\t# %s %s %s %s %s", _utsname.nodename,
+ _utsname.sysname, _utsname.nodename, _utsname.release,
+ _utsname.version, _utsname.machine);
outf(f, "creation_time = %lu\t# %s", t, ctime(&t));
return 1;
9 years, 8 months
master - config: Adjust description of activation_mode.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=513fd029a63547...
Commit: 513fd029a635470522e1c8a9cdddb70eec39474a
Parent: 8c231a5f4d8e3e309dd018c92644580d06b11dd1
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Jul 21 15:50:47 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Jul 21 15:50:47 2014 +0100
config: Adjust description of activation_mode.
---
WHATS_NEW | 3 ++-
conf/example.conf.in | 32 +++++++++++++++-----------------
lib/activate/activate.c | 1 +
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 956b07b..c800dd0 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -10,7 +10,8 @@ Version 2.02.108 -
Prompt for confirmation before change LV into a snapshot exception store.
Return proper error codes for some failing lvconvert funtions.
Add initial code to use cache tools (cache_check|dump|repair|restore).
- Add "degraded" activation mode and make it the default.
+ Support lvdisplay --maps for raid.
+ Add --activationmode degraded to activate degraded raid volumes by default.
Add separate lv_active_{locally,remotely,exclusively} LV reporting fields.
Recognize "auto"/"unmanaged" values in selection for appropriate fields only.
Add report/binary_values_as_numeric lvm.conf option for binary values as 0/1.
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 2930054..21c553a 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -1042,26 +1042,24 @@ activation {
# operation is complete.
polling_interval = 15
- # 'activation_mode' determines how logical volumes are activated if
- # devices are missing. Possible settings are:
- #
- # "complete" - Only allow activation of an LV if all of the PVs
- # that it uses are available (i.e. the volume group
- # is complete). There may be a failed PV in the
- # volume group; but if a particular LV is not on that
- # PV, it is still allowed to activate in this mode.
- #
- # "degraded" - Like "complete", except that RAID logical volumes of
- # segment type "raid{1,4,5,6,10}" are activated if
- # they have sufficient redundancy to present the entire
- # addressable range of the logical volume.
- #
- # "partial" - Allow activation for any logical volume - even if
- # a missing or failed PV would cause a portion of the
- # logical volume to be inaccessible. (E.g. a stripe
- # volume that has lost one of its members would be
- # unable to access a portion of the logical volume.)
- # This setting is not recommended for normal use.
+ # 'activation_mode' determines how Logical Volumes are activated if
+ # any devices are missing. Possible settings are:
+ #
+ # "complete" - Only allow activation of an LV if all of the Physical
+ # Volumes it uses are present. Other PVs in the Volume
+ # Group may be missing.
+ #
+ # "degraded" - Like "complete", but additionally RAID Logical Volumes of
+ # segment type raid1, raid4, raid5, radid6 and raid10 will
+ # be activated if there is no data loss, i.e. they have
+ # sufficient redundancy to present the entire addressable
+ # range of the Logical Volume.
+ #
+ # "partial" - Allows the activation of any Logical Volume even if
+ # a missing or failed PV could cause data loss with a
+ # portion of the Logical Volume inaccessible.
+ # This setting should not normally be used, but may
+ # sometimes assist with data recovery.
#
# This setting was introduced in LVM version 2.02.108. It corresponds
# with the '--activationmode' option for lvchange and vgchange.
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 70777fd..deb09e2 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2203,6 +2203,7 @@ out:
return r;
}
+/* FIXME Move this non-activation code elsewhere */
static int _lv_raid_is_redundant(struct logical_volume *lv)
{
struct lv_segment *raid_seg = first_seg(lv);
9 years, 8 months
master - raid: Correct degraded warning message level
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8c231a5f4d8e3e...
Commit: 8c231a5f4d8e3e309dd018c92644580d06b11dd1
Parent: 27574d0e410c9b78a1bdc14dc6fd3c9ed2b6ca9f
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Jul 21 15:40:59 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Jul 21 15:40:59 2014 +0100
raid: Correct degraded warning message level
---
tools/lvmcmdline.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index ccef904..a9769f2 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -982,7 +982,7 @@ static int _get_settings(struct cmd_context *cmd)
log_warn("PARTIAL MODE. Incomplete logical volumes will be processed.");
} else if (!strcmp(activation_mode, "degraded")) {
cmd->degraded_activation = 1;
- log_debug("DEGRADED MODE. Incomplete RAID LVs will be processed.");
+ log_verbose("DEGRADED MODE. Incomplete RAID LVs will be processed.");
} else if (strcmp(activation_mode, "complete")) {
log_error("Invalid activation mode given.");
return EINVALID_CMD_LINE;
9 years, 8 months