master - lvmcache: Skip VG_GLOBAL cache lock state update.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=aeb4d3b740434e...
Commit: aeb4d3b740434ed04993e9e7ef74f6e3462efb50
Parent: 31f10a05544122693143da75bb4a4857cb890226
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Oct 7 00:30:28 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Oct 7 01:15:43 2014 +0100
lvmcache: Skip VG_GLOBAL cache lock state update.
Avoids message:
Metadata cache has no info for vgname: "#global"
---
lib/cache/lvmcache.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 44f586b..416907e 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -367,10 +367,10 @@ void lvmcache_lock_vgname(const char *vgname, int read_only __attribute__((unuse
if (!dm_hash_insert(_lock_hash, vgname, (void *) 1))
log_error("Cache locking failure for %s", vgname);
- _update_cache_lock_state(vgname, 1);
-
- if (strcmp(vgname, VG_GLOBAL))
+ if (strcmp(vgname, VG_GLOBAL)) {
+ _update_cache_lock_state(vgname, 1);
_vgs_locked++;
+ }
}
int lvmcache_vgname_is_locked(const char *vgname)
@@ -387,7 +387,8 @@ void lvmcache_unlock_vgname(const char *vgname)
log_error(INTERNAL_ERROR "Attempt to unlock unlocked VG %s.",
vgname);
- _update_cache_lock_state(vgname, 0);
+ if (strcmp(vgname, VG_GLOBAL))
+ _update_cache_lock_state(vgname, 0);
dm_hash_remove(_lock_hash, vgname);
9 years, 2 months
master - man: lvmcache mention automatic pool conversion
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=31f10a05544122...
Commit: 31f10a05544122693143da75bb4a4857cb890226
Parent: 97b16ec26f10f98b7febf661ba33bcd2882c7e6c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Oct 6 16:12:51 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Oct 6 16:22:54 2014 -0500
man: lvmcache mention automatic pool conversion
When converting an origin to a cache lv, lvm will automatically convert
the specified cache pool into a cache pool if it is not already a cache
pool.
---
man/lvmcache.7.in | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/man/lvmcache.7.in b/man/lvmcache.7.in
index 2603e1a..79ceb64 100644
--- a/man/lvmcache.7.in
+++ b/man/lvmcache.7.in
@@ -276,6 +276,7 @@ the same VG.
.br
.B lvconvert --type cache\-pool VG/CacheDataLV
+
.SS Create a new cache LV without an existing origin LV
\&
@@ -286,7 +287,7 @@ single step.
.B lvcreate \-\-type cache \-L LargeSize \-n CacheLV
.RS
-.B \-\-cachepool VG/CachePoolLV SlowPVs
+.B \-\-cachepool VG/CachePoolLV VG SlowPVs
.RE
@@ -301,6 +302,32 @@ LV, a cache metadata LV, and combines the two into a cache pool LV.
.B lvcreate \-\-type cache\-pool \-L CacheSize \-n CachePoolLV VG FastPVs
+.SS Convert existing LVs to cache types
+
+\&
+
+When an existing origin LV is converted to a cache LV, the specified cache
+pool may be a normal LV, rather than a cache pool LV. In this case, lvm
+will first convert the normal LV to a cache pool LV. A pool metadata LV
+may optionally be specified.
+
+.B lvcreate -n OriginLV -L LargeSize VG
+.br
+.B lvcreate -n CacheDataLV -L CacheSize VG
+.br
+.B lvconvert --type cache --cachepool VG/CataDataLV VG/OriginLV
+
+This is equivalent to:
+
+.B lvcreate -n OriginLV -L LargeSize VG
+.br
+.B lvcreate -n CacheDataLV -L CacheSize VG
+.br
+.B lvconvert --type cache-pool VG/CacheDataLV
+.br
+.B lvconvert --type cache --cachepool VG/CachePoolLV VG/OriginLV
+
+
.SH SEE ALSO
.BR lvm.conf (5),
.BR lvchange (8),
9 years, 2 months
master - toollib: Shuffle PV functions.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=97b16ec26f10f9...
Commit: 97b16ec26f10f98b7febf661ba33bcd2882c7e6c
Parent: b7c81769e72fe6ad4569c10de86090e75fe914ba
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Oct 6 22:02:00 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Oct 6 22:02:00 2014 +0100
toollib: Shuffle PV functions.
---
tools/toollib.c | 495 ++++++++++++++++++++++++++++---------------------------
1 files changed, 248 insertions(+), 247 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index 195f47a..4b0ba22 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -266,249 +266,6 @@ int process_each_segment_in_lv(struct cmd_context *cmd,
return ret_max;
}
-int process_each_pv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
- const struct dm_list *tagsl, void *handle,
- process_single_pv_fn_t process_single_pv)
-{
- int ret_max = ECMD_PROCESSED;
- int ret;
- struct pv_list *pvl;
-
- dm_list_iterate_items(pvl, &vg->pvs) {
- if (sigint_caught())
- return_ECMD_FAILED;
- if (tagsl && !dm_list_empty(tagsl) &&
- !str_list_match_list(tagsl, &pvl->pv->tags, NULL)) {
- continue;
- }
- if ((ret = process_single_pv(cmd, vg, pvl->pv, handle)) > ret_max)
- ret_max = ret;
- }
-
- return ret_max;
-}
-
-static int _process_all_devs(struct cmd_context *cmd, void *handle,
- process_single_pv_fn_t process_single_pv)
-{
- struct pv_list *pvl;
- struct dm_list *pvslist;
- struct physical_volume *pv;
- struct physical_volume pv_dummy;
- struct dev_iter *iter;
- struct device *dev;
-
- int ret_max = ECMD_PROCESSED;
- int ret;
-
- lvmcache_seed_infos_from_lvmetad(cmd);
- if (!(pvslist = get_pvs(cmd)))
- return_ECMD_FAILED;
-
- if (!(iter = dev_iter_create(cmd->filter, 1))) {
- log_error("dev_iter creation failed");
- return ECMD_FAILED;
- }
-
- while ((dev = dev_iter_get(iter)))
- {
- if (sigint_caught()) {
- ret_max = ECMD_FAILED;
- stack;
- break;
- }
-
- memset(&pv_dummy, 0, sizeof(pv_dummy));
- dm_list_init(&pv_dummy.tags);
- dm_list_init(&pv_dummy.segments);
- pv_dummy.dev = dev;
- pv = &pv_dummy;
-
- /* TODO use a device-indexed hash here */
- dm_list_iterate_items(pvl, pvslist)
- if (pvl->pv->dev == dev)
- pv = pvl->pv;
-
- ret = process_single_pv(cmd, NULL, pv, handle);
-
- if (ret > ret_max)
- ret_max = ret;
-
- free_pv_fid(pv);
- }
-
- dev_iter_destroy(iter);
- dm_list_iterate_items(pvl, pvslist)
- free_pv_fid(pvl->pv);
-
- return ret_max;
-}
-
-/*
- * If the lock_type is LCK_VG_READ (used only in reporting commands),
- * we lock VG_GLOBAL to enable use of metadata cache.
- * This can pause alongide pvscan or vgscan process for a while.
- */
-int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
- struct volume_group *vg, uint32_t flags,
- int scan_label_only, void *handle,
- process_single_pv_fn_t process_single_pv)
-{
- int opt = 0;
- int ret_max = ECMD_PROCESSED;
- int ret;
- int lock_global = !(flags & READ_WITHOUT_LOCK) && !(flags & READ_FOR_UPDATE) && !lvmetad_active();
-
- struct pv_list *pvl;
- struct physical_volume *pv;
- struct dm_list *pvslist = NULL, *vgnames;
- struct dm_list tagsl;
- struct dm_str_list *sll;
- char *at_sign, *tagname;
- struct device *dev;
-
- dm_list_init(&tagsl);
-
- if (lock_global && !lock_vol(cmd, VG_GLOBAL, LCK_VG_READ, NULL)) {
- log_error("Unable to obtain global lock.");
- return ECMD_FAILED;
- }
-
- if (argc) {
- log_verbose("Using physical volume(s) on command line");
- for (; opt < argc; opt++) {
- if (sigint_caught()) {
- ret_max = ECMD_FAILED;
- goto_out;
- }
- dm_unescape_colons_and_at_signs(argv[opt], NULL, &at_sign);
- if (at_sign && (at_sign == argv[opt])) {
- tagname = at_sign + 1;
-
- if (!validate_tag(tagname)) {
- log_error("Skipping invalid tag %s",
- tagname);
- if (ret_max < EINVALID_CMD_LINE)
- ret_max = EINVALID_CMD_LINE;
- continue;
- }
- if (!str_list_add(cmd->mem, &tagsl,
- dm_pool_strdup(cmd->mem,
- tagname))) {
- log_error("strlist allocation failed");
- goto bad;
- }
- continue;
- }
- if (vg) {
- if (!(pvl = find_pv_in_vg(vg, argv[opt]))) {
- log_error("Physical Volume \"%s\" not "
- "found in Volume Group "
- "\"%s\"", argv[opt],
- vg->name);
- ret_max = ECMD_FAILED;
- continue;
- }
- pv = pvl->pv;
- } else {
- if (!pvslist) {
- lvmcache_seed_infos_from_lvmetad(cmd);
- if (!(pvslist = get_pvs(cmd)))
- goto bad;
- }
-
- if (!(dev = dev_cache_get(argv[opt], cmd->filter))) {
- log_error("Failed to find device "
- "\"%s\"", argv[opt]);
- ret_max = ECMD_FAILED;
- continue;
- }
-
- pv = NULL;
- dm_list_iterate_items(pvl, pvslist)
- if (pvl->pv->dev == dev)
- pv = pvl->pv;
-
- if (!pv) {
- log_error("Failed to find physical volume "
- "\"%s\"", argv[opt]);
- ret_max = ECMD_FAILED;
- continue;
- }
- }
-
- ret = process_single_pv(cmd, vg, pv, handle);
-
- if (ret > ret_max)
- ret_max = ret;
- }
- if (!dm_list_empty(&tagsl) && (vgnames = get_vgnames(cmd, 1)) &&
- !dm_list_empty(vgnames)) {
- dm_list_iterate_items(sll, vgnames) {
- if (sigint_caught()) {
- ret_max = ECMD_FAILED;
- goto_out;
- }
- vg = vg_read(cmd, sll->str, NULL, flags);
- if (ignore_vg(vg, sll->str, 0, &ret_max)) {
- release_vg(vg);
- stack;
- continue;
- }
-
- ret = process_each_pv_in_vg(cmd, vg, &tagsl,
- handle,
- process_single_pv);
- if (ret > ret_max)
- ret_max = ret;
-
- unlock_and_release_vg(cmd, vg, sll->str);
- }
- }
- } else {
- if (vg) {
- log_verbose("Using all physical volume(s) in "
- "volume group");
- ret_max = process_each_pv_in_vg(cmd, vg, NULL, handle,
- process_single_pv);
- } else if (arg_count(cmd, all_ARG)) {
- ret_max = _process_all_devs(cmd, handle, process_single_pv);
- } else {
- log_verbose("Scanning for physical volume names");
-
- lvmcache_seed_infos_from_lvmetad(cmd);
- if (!(pvslist = get_pvs(cmd)))
- goto bad;
-
- dm_list_iterate_items(pvl, pvslist) {
- if (sigint_caught()) {
- ret_max = ECMD_FAILED;
- goto_out;
- }
- ret = process_single_pv(cmd, NULL, pvl->pv,
- handle);
- if (ret > ret_max)
- ret_max = ret;
-
- free_pv_fid(pvl->pv);
- }
- }
- }
-out:
- if (pvslist)
- dm_list_iterate_items(pvl, pvslist)
- free_pv_fid(pvl->pv);
-
- if (lock_global)
- unlock_vg(cmd, VG_GLOBAL);
- return ret_max;
-bad:
- if (lock_global)
- unlock_vg(cmd, VG_GLOBAL);
-
- return ECMD_FAILED;
-}
-
static const char *_extract_vgname(struct cmd_context *cmd, const char *lv_name,
const char **after)
{
@@ -540,6 +297,7 @@ static const char *_extract_vgname(struct cmd_context *cmd, const char *lv_name,
return vg_name;
}
+
/*
* Extract default volume group name from environment
*/
@@ -1999,7 +1757,7 @@ static int _process_lv_vgnameid_list(struct cmd_context *cmd, uint32_t flags,
process_single_lv_fn_t process_single_lv)
{
struct volume_group *vg;
- struct vgnameid_list *nl;
+ struct vgnameid_list *vgnl;
struct dm_str_list *sl;
struct dm_list *tags_arg;
struct dm_list lvnames;
@@ -2010,9 +1768,9 @@ static int _process_lv_vgnameid_list(struct cmd_context *cmd, uint32_t flags,
int ret_max = ECMD_PROCESSED;
int ret;
- dm_list_iterate_items(nl, vgnameids_to_process) {
- vg_name = nl->vg_name;
- vg_uuid = nl->vgid;
+ dm_list_iterate_items(vgnl, vgnameids_to_process) {
+ vg_name = vgnl->vg_name;
+ vg_uuid = vgnl->vgid;
ret = 0;
/*
@@ -2128,3 +1886,246 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv, uint32_t fla
return _process_lv_vgnameid_list(cmd, flags, &vgnameids_to_process, &arg_vgnames, &arg_lvnames,
&arg_tags, handle, process_single_lv);
}
+
+int process_each_pv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
+ const struct dm_list *tagsl, void *handle,
+ process_single_pv_fn_t process_single_pv)
+{
+ int ret_max = ECMD_PROCESSED;
+ int ret;
+ struct pv_list *pvl;
+
+ dm_list_iterate_items(pvl, &vg->pvs) {
+ if (sigint_caught())
+ return_ECMD_FAILED;
+ if (tagsl && !dm_list_empty(tagsl) &&
+ !str_list_match_list(tagsl, &pvl->pv->tags, NULL)) {
+ continue;
+ }
+ if ((ret = process_single_pv(cmd, vg, pvl->pv, handle)) > ret_max)
+ ret_max = ret;
+ }
+
+ return ret_max;
+}
+
+static int _process_all_devs(struct cmd_context *cmd, void *handle,
+ process_single_pv_fn_t process_single_pv)
+{
+ struct pv_list *pvl;
+ struct dm_list *pvslist;
+ struct physical_volume *pv;
+ struct physical_volume pv_dummy;
+ struct dev_iter *iter;
+ struct device *dev;
+
+ int ret_max = ECMD_PROCESSED;
+ int ret;
+
+ lvmcache_seed_infos_from_lvmetad(cmd);
+ if (!(pvslist = get_pvs(cmd)))
+ return_ECMD_FAILED;
+
+ if (!(iter = dev_iter_create(cmd->filter, 1))) {
+ log_error("dev_iter creation failed");
+ return ECMD_FAILED;
+ }
+
+ while ((dev = dev_iter_get(iter)))
+ {
+ if (sigint_caught()) {
+ ret_max = ECMD_FAILED;
+ stack;
+ break;
+ }
+
+ memset(&pv_dummy, 0, sizeof(pv_dummy));
+ dm_list_init(&pv_dummy.tags);
+ dm_list_init(&pv_dummy.segments);
+ pv_dummy.dev = dev;
+ pv = &pv_dummy;
+
+ /* TODO use a device-indexed hash here */
+ dm_list_iterate_items(pvl, pvslist)
+ if (pvl->pv->dev == dev)
+ pv = pvl->pv;
+
+ ret = process_single_pv(cmd, NULL, pv, handle);
+
+ if (ret > ret_max)
+ ret_max = ret;
+
+ free_pv_fid(pv);
+ }
+
+ dev_iter_destroy(iter);
+ dm_list_iterate_items(pvl, pvslist)
+ free_pv_fid(pvl->pv);
+
+ return ret_max;
+}
+
+/*
+ * If the lock_type is LCK_VG_READ (used only in reporting commands),
+ * we lock VG_GLOBAL to enable use of metadata cache.
+ * This can pause alongide pvscan or vgscan process for a while.
+ */
+int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
+ struct volume_group *vg, uint32_t flags,
+ int scan_label_only, void *handle,
+ process_single_pv_fn_t process_single_pv)
+{
+ int opt = 0;
+ int ret_max = ECMD_PROCESSED;
+ int ret;
+ int lock_global = !(flags & READ_WITHOUT_LOCK) && !(flags & READ_FOR_UPDATE) && !lvmetad_active();
+
+ struct pv_list *pvl;
+ struct physical_volume *pv;
+ struct dm_list *pvslist = NULL, *vgnames;
+ struct dm_list tagsl;
+ struct dm_str_list *sll;
+ char *at_sign, *tagname;
+ struct device *dev;
+
+ dm_list_init(&tagsl);
+
+ if (lock_global && !lock_vol(cmd, VG_GLOBAL, LCK_VG_READ, NULL)) {
+ log_error("Unable to obtain global lock.");
+ return ECMD_FAILED;
+ }
+
+ if (argc) {
+ log_verbose("Using physical volume(s) on command line");
+ for (; opt < argc; opt++) {
+ if (sigint_caught()) {
+ ret_max = ECMD_FAILED;
+ goto_out;
+ }
+ dm_unescape_colons_and_at_signs(argv[opt], NULL, &at_sign);
+ if (at_sign && (at_sign == argv[opt])) {
+ tagname = at_sign + 1;
+
+ if (!validate_tag(tagname)) {
+ log_error("Skipping invalid tag %s",
+ tagname);
+ if (ret_max < EINVALID_CMD_LINE)
+ ret_max = EINVALID_CMD_LINE;
+ continue;
+ }
+ if (!str_list_add(cmd->mem, &tagsl,
+ dm_pool_strdup(cmd->mem,
+ tagname))) {
+ log_error("strlist allocation failed");
+ goto bad;
+ }
+ continue;
+ }
+ if (vg) {
+ if (!(pvl = find_pv_in_vg(vg, argv[opt]))) {
+ log_error("Physical Volume \"%s\" not "
+ "found in Volume Group "
+ "\"%s\"", argv[opt],
+ vg->name);
+ ret_max = ECMD_FAILED;
+ continue;
+ }
+ pv = pvl->pv;
+ } else {
+ if (!pvslist) {
+ lvmcache_seed_infos_from_lvmetad(cmd);
+ if (!(pvslist = get_pvs(cmd)))
+ goto bad;
+ }
+
+ if (!(dev = dev_cache_get(argv[opt], cmd->filter))) {
+ log_error("Failed to find device "
+ "\"%s\"", argv[opt]);
+ ret_max = ECMD_FAILED;
+ continue;
+ }
+
+ pv = NULL;
+ dm_list_iterate_items(pvl, pvslist)
+ if (pvl->pv->dev == dev)
+ pv = pvl->pv;
+
+ if (!pv) {
+ log_error("Failed to find physical volume "
+ "\"%s\"", argv[opt]);
+ ret_max = ECMD_FAILED;
+ continue;
+ }
+ }
+
+ ret = process_single_pv(cmd, vg, pv, handle);
+
+ if (ret > ret_max)
+ ret_max = ret;
+ }
+ if (!dm_list_empty(&tagsl) && (vgnames = get_vgnames(cmd, 1)) &&
+ !dm_list_empty(vgnames)) {
+ dm_list_iterate_items(sll, vgnames) {
+ if (sigint_caught()) {
+ ret_max = ECMD_FAILED;
+ goto_out;
+ }
+ vg = vg_read(cmd, sll->str, NULL, flags);
+ if (ignore_vg(vg, sll->str, 0, &ret_max)) {
+ release_vg(vg);
+ stack;
+ continue;
+ }
+
+ ret = process_each_pv_in_vg(cmd, vg, &tagsl,
+ handle,
+ process_single_pv);
+ if (ret > ret_max)
+ ret_max = ret;
+
+ unlock_and_release_vg(cmd, vg, sll->str);
+ }
+ }
+ } else {
+ if (vg) {
+ log_verbose("Using all physical volume(s) in "
+ "volume group");
+ ret_max = process_each_pv_in_vg(cmd, vg, NULL, handle,
+ process_single_pv);
+ } else if (arg_count(cmd, all_ARG)) {
+ ret_max = _process_all_devs(cmd, handle, process_single_pv);
+ } else {
+ log_verbose("Scanning for physical volume names");
+
+ lvmcache_seed_infos_from_lvmetad(cmd);
+ if (!(pvslist = get_pvs(cmd)))
+ goto bad;
+
+ dm_list_iterate_items(pvl, pvslist) {
+ if (sigint_caught()) {
+ ret_max = ECMD_FAILED;
+ goto_out;
+ }
+ ret = process_single_pv(cmd, NULL, pvl->pv,
+ handle);
+ if (ret > ret_max)
+ ret_max = ret;
+
+ free_pv_fid(pvl->pv);
+ }
+ }
+ }
+out:
+ if (pvslist)
+ dm_list_iterate_items(pvl, pvslist)
+ free_pv_fid(pvl->pv);
+
+ if (lock_global)
+ unlock_vg(cmd, VG_GLOBAL);
+ return ret_max;
+bad:
+ if (lock_global)
+ unlock_vg(cmd, VG_GLOBAL);
+
+ return ECMD_FAILED;
+}
9 years, 2 months
master - man: lvmcache changes related to removal and splitting
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b7c81769e72fe6...
Commit: b7c81769e72fe6ad4569c10de86090e75fe914ba
Parent: 902192abdc3bc8cf17c89b14db4496476e7fa73c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Oct 6 14:04:09 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Oct 6 14:04:09 2014 -0500
man: lvmcache changes related to removal and splitting
---
man/lvmcache.7.in | 37 +++++++++++++++++++------------------
1 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/man/lvmcache.7.in b/man/lvmcache.7.in
index 6339b91..2603e1a 100644
--- a/man/lvmcache.7.in
+++ b/man/lvmcache.7.in
@@ -138,15 +138,30 @@ OriginLV is renamed OriginLV_corig and becomes hidden.
.SH Cache Removal
+.SS Split a cache pool LV off of a cache LV
+
+\&
+
+A cache pool LV can be disconnected from a cache LV, leaving an
+unused cache pool LV, and an uncached origin LV. This command
+writes back data from the cache pool to the origin LV when necessary.
+
+.B lvconvert --splitcache VG/CacheLV
+
.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.
+then removes the cache pool LV, leaving the uncached origin LV.
.B lvremove VG/CachePoolLV
+An alternative command that also disconnects the cache pool from the cache
+LV, and deletes the cache pool:
+
+.B lvconvert --uncache VG/CacheLV
+
.I Example
.nf
# lvs vg
@@ -161,29 +176,15 @@ then removes the cache pool LV, leaving the un-cached origin LV.
lvol0 vg -wi-a----- 100.00g
.fi
-.SS Removing an origin LV without removing its linked cache pool LV
+.SS Removing a cache LV: both origin LV and the cache pool LV
\&
-This removes the origin LV, leaving the cache pool LV which can be linked
-to another origin LV.
+Removing a cache LV removes both the origin LV and the linked cache pool
+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
-
.SH Cache Topics
9 years, 2 months
master - man: lvmthin show the lvcreate -n option for pools
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=902192abdc3bc8...
Commit: 902192abdc3bc8cf17c89b14db4496476e7fa73c
Parent: 1115a9ea51a3302ede188073f94a42f4b38867da
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Oct 6 13:29:18 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Oct 6 13:29:18 2014 -0500
man: lvmthin show the lvcreate -n option for pools
lvcreate of thin pools can now use '-n lv vg' like other lv types,
or it can name the new thin pool in the free arg as 'vg/lv', which
is not allowed with other lv types.
---
man/lvmthin.7.in | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/man/lvmthin.7.in b/man/lvmthin.7.in
index 8009a9e..84a3138 100644
--- a/man/lvmthin.7.in
+++ b/man/lvmthin.7.in
@@ -989,16 +989,12 @@ rather than using lvconvert on existing LVs.
This one command creates a thin data LV, a thin metadata LV,
and combines the two into a thin pool LV.
-.B lvcreate \-\-type thin\-pool \-L LargeSize VG/ThinPoolLV
-
-./" FIXME: make this work
-./" or using standard form of lvcreate:
-./" .B lvcreate \-\-type thin\-pool \-L LargeSize \-n ThinPoolLV VG
+.B lvcreate \-\-type thin\-pool \-L LargeSize \-n ThinPoolLV VG
.I Example
.br
.nf
-# lvcreate \-\-type thin\-pool \-L8M vg/pool0
+# lvcreate \-\-type thin\-pool \-L8M -n pool0 vg
# lvs vg/pool0
LV VG Attr LSize Pool Origin Data%
9 years, 2 months
master - toollib: Remove unused functions from header file.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1115a9ea51a330...
Commit: 1115a9ea51a3302ede188073f94a42f4b38867da
Parent: fa517221a19751b93a5b94f8b379919b9c1c0226
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Oct 6 15:22:01 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Oct 6 15:22:01 2014 +0100
toollib: Remove unused functions from header file.
---
tools/toollib.c | 52 ++++++++++++++++++++++++++--------------------------
tools/toollib.h | 9 ---------
2 files changed, 26 insertions(+), 35 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index ddd669a..195f47a 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -541,6 +541,29 @@ static const char *_extract_vgname(struct cmd_context *cmd, const char *lv_name,
return vg_name;
}
/*
+ * Extract default volume group name from environment
+ */
+static const char *_default_vgname(struct cmd_context *cmd)
+{
+ const char *vg_path;
+
+ /* Take default VG from environment? */
+ vg_path = getenv("LVM_VG_NAME");
+ if (!vg_path)
+ return 0;
+
+ vg_path = skip_dev_dir(cmd, vg_path, NULL);
+
+ if (strchr(vg_path, '/')) {
+ log_error("Environment Volume Group in LVM_VG_NAME invalid: "
+ "\"%s\"", vg_path);
+ return 0;
+ }
+
+ return dm_pool_strdup(cmd->mem, vg_path);
+}
+
+/*
* Determine volume group name from a logical volume name
*/
const char *extract_vgname(struct cmd_context *cmd, const char *lv_name)
@@ -555,7 +578,7 @@ const char *extract_vgname(struct cmd_context *cmd, const char *lv_name)
return vg_name;
}
- if (!(vg_name = default_vgname(cmd))) {
+ if (!(vg_name = _default_vgname(cmd))) {
if (lv_name)
log_error("Path required for Logical Volume \"%s\"",
lv_name);
@@ -566,29 +589,6 @@ const char *extract_vgname(struct cmd_context *cmd, const char *lv_name)
}
/*
- * Extract default volume group name from environment
- */
-char *default_vgname(struct cmd_context *cmd)
-{
- const char *vg_path;
-
- /* Take default VG from environment? */
- vg_path = getenv("LVM_VG_NAME");
- if (!vg_path)
- return 0;
-
- vg_path = skip_dev_dir(cmd, vg_path, NULL);
-
- if (strchr(vg_path, '/')) {
- log_error("Environment Volume Group in LVM_VG_NAME invalid: "
- "\"%s\"", vg_path);
- return 0;
- }
-
- return dm_pool_strdup(cmd->mem, vg_path);
-}
-
-/*
* Process physical extent range specifiers
*/
static int _add_pe_range(struct dm_pool *mem, const char *pvname,
@@ -1907,7 +1907,7 @@ static int _get_arg_lvnames(struct cmd_context *cmd,
const char *vgname;
const char *lv_name;
const char *tmp_lv_name;
- char *vgname_def;
+ const char *vgname_def;
unsigned dev_dir_found;
log_verbose("Using logical volume(s) on command line");
@@ -1956,7 +1956,7 @@ static int _get_arg_lvnames(struct cmd_context *cmd,
continue;
}
} else if (!dev_dir_found &&
- (vgname_def = default_vgname(cmd)))
+ (vgname_def = _default_vgname(cmd)))
vgname = vgname_def;
else
lv_name = NULL;
diff --git a/tools/toollib.h b/tools/toollib.h
index 1a14d60..ae4b21e 100644
--- a/tools/toollib.h
+++ b/tools/toollib.h
@@ -20,16 +20,8 @@
int become_daemon(struct cmd_context *cmd, int skip_lvm);
-int autobackup_set(void);
-int autobackup_init(const char *backup_dir, int keep_days, int keep_number,
- int autobackup);
-int autobackup(struct volume_group *vg);
-
int ignore_vg(struct volume_group *vg, const char *vg_name, int allow_inconsistent, int *ret);
-struct volume_group *recover_vg(struct cmd_context *cmd, const char *vgname,
- uint32_t lock_type);
-
typedef int (*process_single_vg_fn_t) (struct cmd_context * cmd,
const char *vg_name,
struct volume_group * vg,
@@ -91,7 +83,6 @@ int process_each_lv_in_vg(struct cmd_context *cmd,
void *handle,
process_single_lv_fn_t process_single_lv);
-char *default_vgname(struct cmd_context *cmd);
const char *extract_vgname(struct cmd_context *cmd, const char *lv_name);
const char *skip_dev_dir(struct cmd_context *cmd, const char *vg_name,
unsigned *dev_dir_found);
9 years, 2 months
master - tests: lvconvert cache usage of thin pool
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fa517221a19751...
Commit: fa517221a19751b93a5b94f8b379919b9c1c0226
Parent: 742d250cc52dcbd965310b1bf5357d4793254f4d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 6 15:30:19 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 6 15:31:44 2014 +0200
tests: lvconvert cache usage of thin pool
Checked stacking usage of thin pool data volume being cached.
---
test/shell/lvconvert-cache-thin.sh | 50 ++++++++++++++++++++++++++++++++++++
1 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvconvert-cache-thin.sh b/test/shell/lvconvert-cache-thin.sh
new file mode 100644
index 0000000..87256a4
--- /dev/null
+++ b/test/shell/lvconvert-cache-thin.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Exercise usage of stacked cache volume used in thin pool volumes
+
+. lib/inittest
+
+aux have_cache 1 3 0 || skip
+aux have_thin 1 0 0 || skip
+
+aux prepare_vg 5 80
+
+lvcreate -L10 -n cpool $vg
+lvcreate -L10 -n tpool $vg
+lvcreate -L10 -n $lv1 $vg
+
+lvconvert --yes --cache --cachepool cpool $vg/tpool
+
+# Currently the only allowed stacking is cache thin data volume
+lvconvert --yes --type thin-pool $vg/tpool
+
+lvcreate -V10 -T -n $lv2 $vg/tpool
+
+aux mkdev_md5sum $vg $lv2
+
+lvconvert --splitcache $vg/tpool
+
+check dev_md5sum $vg $lv2
+lvchange -an $vg
+lvchange -ay $vg
+check dev_md5sum $vg $lv2
+
+lvs -a $vg
+lvconvert --yes --cache --cachepool cpool $vg/tpool
+
+lvconvert --yes -T --thinpool $vg/tpool $vg/$lv1
+check lv_field $vg/tpool segtype "thin-pool"
+check lv_field $vg/$lv1 segtype "thin"
+lvconvert --uncache $vg/tpool
+lvs -a $vg
+
+vgremove -f $vg
9 years, 2 months
master - tests: lvconvert thin pool
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=742d250cc52dcb...
Commit: 742d250cc52dcbd965310b1bf5357d4793254f4d
Parent: c243cf6581904c2628294d342ba1380208985e49
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 6 11:56:09 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 6 15:31:44 2014 +0200
tests: lvconvert thin pool
More tests.
---
test/shell/lvconvert-thin.sh | 53 +++++++++++++++++++++++++++++++----------
1 files changed, 40 insertions(+), 13 deletions(-)
diff --git a/test/shell/lvconvert-thin.sh b/test/shell/lvconvert-thin.sh
index 4aee7d2..bd43d58 100644
--- a/test/shell/lvconvert-thin.sh
+++ b/test/shell/lvconvert-thin.sh
@@ -27,6 +27,7 @@ aux prepare_pvs 4 64
# build one large PV
vgcreate $vg1 $(head -n 3 DEVICES)
+
# 32bit linux kernels are fragille with device size >= 16T
# maybe uname -m [ x86_64 | i686 ]
TSIZE=64T
@@ -63,12 +64,25 @@ lvconvert --yes --thinpool $vg/$lv1 --poolmetadata $vg/$lv2
prepare_lvs
lvconvert --yes -c 64 --stripes 2 --thinpool $vg/$lv1 --readahead 48
-
lvremove -f $vg
-lvcreate -L1T -n $lv1 $vg
-lvconvert --yes -c 8M --type thin-pool $vg/$lv1
+
+# Swaping of metadata volume
+lvcreate -L1T -n $lv1 $vg
+lvcreate -L32 -n $lv2 $vg
+lvconvert --yes -c 8M --type thin-pool $vg/$lv1 |& tee err
+# Check tther is warning for large chunk size and zeroing enabled
+grep "Pool zeroing and large" err
+UUID=$(get lv_field $vg/$lv2 uuid)
+# Fail is pool is active
+# TODO maybe detect inactive pool and deactivate
+fail lvconvert --yes --thinpool $vg/$lv1 --poolmetadata $lv2
+lvchange -an $vg
+lvconvert --yes --thinpool $vg/$lv1 --poolmetadata $lv2
+check lv_field $vg/${lv1}_tmeta uuid "$UUID"
lvremove -f $vg
+
+
# test with bigger sizes
lvcreate -L1T -n $lv1 $vg
lvcreate -L8M -n $lv2 $vg
@@ -81,39 +95,52 @@ invalid lvconvert --stripes 2 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2
# too small metadata (<2M)
fail lvconvert --yes -c 64 --thinpool $vg/$lv1 --poolmetadata $vg/$lv3
# too small chunk size fails
-# 'fail' because profiles need to read VG
-fail lvconvert -c 4 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2
+invalid lvconvert -c 4 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2
# too big chunk size fails
-fail lvconvert -c 2G --thinpool $vg/$lv1 --poolmetadata $vg/$lv2
+invalid lvconvert -c 2G --thinpool $vg/$lv1 --poolmetadata $vg/$lv2
# negative chunk size fails
invalid lvconvert -c -256 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2
-# non power of 2 fails
-fail lvconvert -c 88 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2
+# non multiple of 64KiB fails
+invalid lvconvert -c 88 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2
# Warning about smaller then suggested
lvconvert --yes -c 256 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 |& tee err
grep "WARNING: Chunk size is smaller" err
-
lvremove -f $vg
+
+
lvcreate -L1T -n $lv1 $vg
lvcreate -L32G -n $lv2 $vg
# Warning about bigger then needed
lvconvert --yes --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 |& tee err
grep "WARNING: Maximum" err
-
lvremove -f $vg
+
if test "$TSIZE" = 64T; then
lvcreate -L24T -n $lv1 $vg
# Warning about bigger then needed (24T data and 16G -> 128K chunk)
lvconvert --yes -c 64 --thinpool $vg/$lv1 |& tee err
grep "WARNING: Chunk size is too small" err
+lvremove -f $vg
fi
#lvs -a -o+chunk_size,stripe_size,seg_pe_ranges
-# Convertions of pool to mirror or RAID is unsupported
-fail lvconvert --type mirror -m1 $vg/$lv1
-fail lvconvert --type raid1 -m1 $vg/$lv1
+####################################
+# Prohibites thin pool conversions #
+####################################
+lvcreate -L32 -n $lv1 $vg
+lvcreate -L16 -n $lv2 $vg
+lvconvert --yes --thinpool $vg/$lv1
+
+fail lvconvert --yes --type cache-pool $vg/$lv1
+fail lvconvert --yes --type mirror -m1 $vg/$lv1
+fail lvconvert --yes --type raid1 -m1 $vg/$lv1
+fail lvconvert --yes --type snapshot $vg/$lv1 $vg/$lv2
+fail lvconvert --yes --type snapshot $vg/$lv2 $vg/$lv1
+fail lvconvert --yes --type thin-pool $vg/$lv1
+
+lvremove -f $vg
vgremove -ff $vg
9 years, 2 months
master - tests: lvconvert cache
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c243cf6581904c...
Commit: c243cf6581904c2628294d342ba1380208985e49
Parent: 52821572d507a48b7bf9b9b79e2fd765ece9c423
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 6 11:49:49 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 6 15:31:44 2014 +0200
tests: lvconvert cache
Many new tests
---
test/shell/lvconvert-cache.sh | 125 ++++++++++++++++++++++++++++++-----------
1 files changed, 93 insertions(+), 32 deletions(-)
diff --git a/test/shell/lvconvert-cache.sh b/test/shell/lvconvert-cache.sh
index 5979912..c108008 100644
--- a/test/shell/lvconvert-cache.sh
+++ b/test/shell/lvconvert-cache.sh
@@ -9,39 +9,36 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Exercise conversion of cache and cache pool
+
. lib/inittest
aux have_cache 1 3 0 || skip
aux prepare_vg 5 80
+###########################
+# Check regular converion #
+###########################
# lvcreate origin, lvcreate cache-pool, and lvconvert to cache
-lvcreate -L 2 -n $lv1 $vg
+lvcreate -an -Zn -L 2 -n $lv1 $vg
lvcreate -L 8 -n $lv2 $vg
-lvcreate -L 8 -n $lv3 $vg
-
-# undefined cachepool
-invalid lvconvert --type cache --poolmetadata $vg/$lv2 $vg/$lv1
-
-# cannot mix with thins
-invalid lvconvert --type cache --poolmetadata $vg/$lv2 --thinpool $vg/$lv1
-invalid lvconvert --type cache --thin --poolmetadata $vg/$lv2 $vg/$lv1
+lvcreate -an -Zn -L 8 -n $lv3 $vg
+lvcreate -an -Zn -L 8 -n $lv4 $vg
+lvcreate -an -Zn -L 16 -n $lv5 $vg
-# undefined cached volume
-invalid lvconvert --type cache --cachepool $vg/$lv1
-invalid lvconvert --cache --cachepool $vg/$lv1
-
-# single vg
-invalid lvconvert --type cache --cachepool $vg/$lv1 --poolmetadata $vg1/$lv2 $vg/$lv3
-invalid lvconvert --type cache --cachepool $vg/$lv1 --poolmetadata $lv2 $vg1/$lv3
-invalid lvconvert --type cache --cachepool $vg1/$lv1 --poolmetadata $vg2/$lv2 $vg/$lv3
-
-invalid lvconvert --cachepool $vg1/$lv1 --poolmetadata $vg2/$lv2
-invalid lvconvert --type cache-pool --poolmetadata $vg2/$lv2 $vg1/$lv1
+lvconvert --yes --type cache-pool --cachepool $vg/$lv1
+check inactive $vg ${lv1}_cdata
+lvconvert --yes --type cache-pool --chunksize 256 $vg/$lv2
+check inactive $vg ${lv2}_cdata
+check lv_field $vg/$lv2 chunk_size "256.00k"
-fail lvconvert --yes --type cache-pool --chunksize 16M --poolmetadata $lv2 $vg/$lv1
+# Check swap of cache pool metadata
+lvconvert --yes --type cache-pool --poolmetadata $lv4 $vg/$lv3
+UUID=$(get lv_field $vg/$lv5 uuid)
+lvconvert --yes --cachepool $vg/$lv3 --poolmetadata $lv5
+check lv_field $vg/${lv3}_cmeta uuid "$UUID"
-lvconvert --yes --type cache-pool --cachepool $vg/$lv1
#fail lvconvert --cachepool $vg/$lv1 --poolmetadata $vg/$lv2
#lvconvert --yes --type cache-pool --poolmetadata $vg/$lv2 $vg/$lv1
@@ -51,7 +48,6 @@ lvremove -ff $vg
lvcreate -L 2 -n $lv1 $vg
lvcreate --type cache-pool -l 1 -n ${lv1}_cachepool $vg
-
lvconvert --cache --cachepool $vg/${lv1}_cachepool $vg/$lv1
dmsetup table ${vg}-$lv1 | grep cache # ensure it is loaded in kernel
@@ -60,39 +56,104 @@ dmsetup table ${vg}-$lv1 | grep cache # ensure it is loaded in kernel
fail lvconvert --type cache --cachepool $vg/${lv1}_cachepool $vg/$lv1
-lvremove -ff $vg
+
+# Test --splitcache leaves both cache origin and cache pool
+lvconvert --splitcache $vg/$lv1
+check lv_exists $vg $lv1 ${lv1}_cachepool
+lvremove -f $vg
+
# Bug 1095843
# lvcreate RAID1 origin, lvcreate cache-pool, and lvconvert to cache
lvcreate --type raid1 -m 1 -l 2 -n $lv1 $vg
lvcreate --type cache-pool -l 1 -n ${lv1}_cachepool $vg
-lvconvert --type cache --cachepool $vg/${lv1}_cachepool $vg/$lv1
-lvs -a $vg/${lv1}_corig_rimage_0 # ensure images are properly renamed
+lvconvert --cache --cachepool $vg/${lv1}_cachepool $vg/$lv1
+check lv_exists $vg/${lv1}_corig_rimage_0 # ensure images are properly renamed
dmsetup table ${vg}-$lv1 | grep cache # ensure it is loaded in kernel
lvremove -ff $vg
+
# lvcreate RAID1 origin, lvcreate RAID1 cache-pool, and lvconvert to cache
lvcreate --type raid1 -m 1 -l 2 -n $lv1 $vg
lvcreate --type raid1 -m 1 -l 2 -n ${lv1}_cachepool $vg
-lvconvert --type cache-pool --yes $vg/${lv1}_cachepool
#should lvs -a $vg/${lv1}_cdata_rimage_0 # ensure images are properly renamed
-lvconvert --type cache --cachepool $vg/${lv1}_cachepool $vg/$lv1
-lvs -a $vg/${lv1}_corig_rimage_0 # ensure images are properly renamed
+lvconvert --yes --type cache --cachepool $vg/${lv1}_cachepool $vg/$lv1
+check lv_exists $vg/${lv1}_corig_rimage_0 # ensure images are properly renamed
dmsetup table ${vg}-$lv1 | grep cache # ensure it is loaded in kernel
lvremove -ff $vg
+
lvcreate -n corigin -l 10 $vg
lvcreate -n pool -l 10 $vg
lvs -a -o +devices
-echo n | not lvconvert --type cache --cachepool $vg/pool $vg/corigin
-lvconvert -y --type cache --cachepool $vg/pool $vg/corigin
-
+fail lvconvert --type cache --cachepool $vg/pool $vg/corigin
+lvconvert --yes --cache --cachepool $vg/pool $vg/corigin
lvremove -ff $vg
+
# TODO: creating a cache on top of active RAID appears to be broken
lvcreate -n corigin -m 1 --type raid1 -l 10 $vg
lvcreate -n cpool --type cache $vg/corigin -l 10
lvchange --refresh $vg # fix up DM tables
lvconvert --splitmirrors 1 --name split $vg/corigin $dev1
+lvremove -f $vg
+
+#######################
+# Invalid conversions #
+#######################
+lvcreate -an -Zn -L 2 -n $lv1 $vg
+lvcreate -an -Zn -L 8 -n $lv2 $vg
+lvcreate -an -Zn -L 8 -n $lv3 $vg
+lvcreate -an -Zn -L 8 -n $lv4 $vg
+
+# Undefined cachepool
+invalid lvconvert --type cache --poolmetadata $vg/$lv2 $vg/$lv1
+
+# Cannot mix with thins
+invalid lvconvert --type cache --poolmetadata $vg/$lv2 --thinpool $vg/$lv1
+invalid lvconvert --type cache --thin --poolmetadata $vg/$lv2 $vg/$lv1
+
+# Undefined cached volume
+invalid lvconvert --type cache --cachepool $vg/$lv1
+invalid lvconvert --cache --cachepool $vg/$lv1
+
+# Single vg is required
+invalid lvconvert --type cache --cachepool $vg/$lv1 --poolmetadata $vg1/$lv2 $vg/$lv3
+invalid lvconvert --type cache --cachepool $vg/$lv1 --poolmetadata $lv2 $vg1/$lv3
+invalid lvconvert --type cache --cachepool $vg1/$lv1 --poolmetadata $vg2/$lv2 $vg/$lv3
+invalid lvconvert --type cache-pool --poolmetadata $vg2/$lv2 $vg1/$lv1
+
+invalid lvconvert --cachepool $vg1/$lv1 --poolmetadata $vg2/$lv2
+
+# Invalid syntax, vg is unknown
+invalid lvconvert --yes --cachepool $lv3 --poolmetadata $lv4
+
+# Invalid chunk size is <32KiB >1GiB
+invalid lvconvert --type cache-pool --chunksize 16 --poolmetadata $lv2 $vg/$lv1
+invalid lvconvert --type cache-pool --chunksize 2G --poolmetadata $lv2 $vg/$lv1
+
+# Invalid chunk size is bigger then data size, needs to open VG
+fail lvconvert --yes --type cache-pool --chunksize 16M --poolmetadata $lv2 $vg/$lv1
+
+lvremove -f $vg
+
+##########################
+# Prohibited conversions #
+##########################
+lvcreate --type cache-pool -L10 $vg/$lv1
+lvcreate --cache -L20 $vg/$lv1
+lvcreate -L10 -n $lv2 $vg
+
+fail lvconvert --yes --type cache $vg/$lv2 --cachepool $vg/$lv1
+fail lvconvert --yes --type cache $vg/$lv1 --cachepool $vg/$lv2
+fail lvconvert --yes --type cache-pool $vg/$lv1
+fail lvconvert --yes --type mirror -m1 $vg/$lv1
+fail lvconvert --yes --type raid1 -m1 $vg/$lv1
+fail lvconvert --yes --type snapshot $vg/$lv1 $vg/$lv2
+fail lvconvert --yes --type snapshot $vg/$lv2 $vg/$lv1
+fail lvconvert --yes -T --thinpool $vg/$lv2 $vg/$lv1
+
+lvremove -f $vg
+
vgremove -f $vg
9 years, 2 months
master - tests: lvcreate external origin
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=52821572d507a4...
Commit: 52821572d507a48b7bf9b9b79e2fd765ece9c423
Parent: de0e6029f18a78a816f3c183d42ab641001dbebe
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 6 11:52:40 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Oct 6 15:31:33 2014 +0200
tests: lvcreate external origin
Fix unsupportable case.
We cannot create thinpool and snapshot at the same time.
(-L could not have 2 meanings).
---
test/shell/lvcreate-thin-external.sh | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/test/shell/lvcreate-thin-external.sh b/test/shell/lvcreate-thin-external.sh
index 74e5521..65401fb 100644
--- a/test/shell/lvcreate-thin-external.sh
+++ b/test/shell/lvcreate-thin-external.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
@@ -60,8 +60,11 @@ lvcreate -s $vg/$lv2 --thinpool $vg/pool
# Fail with --thin and --snapshot
not lvcreate -s $vg/$lv5 --name $vg/$lv7 -T $vg/newpool
-# Fail to create already existing pool
-not lvcreate -s $vg/$lv2 -L10 --thinpool $vg/pool
+# Cannot specify size and thin pool.
+# TODO: maybe with --poolsize
+invalid lvcreate -s $vg/$lv2 -L10 --thinpool $vg/pool
+invalid lvcreate -s -K $vg/$lv2 --name $vg/$lv3 -L20 --chunksize 128 --thinpool $vg/newpool
+
not lvcreate -s $vg/$lv2 --chunksize 64 --thinpool $vg/pool
not lvcreate -s $vg/$lv2 --zero y --thinpool $vg/pool
not lvcreate -s $vg/$lv2 --poolmetadata $vg/$lv1 --thinpool $vg/pool
@@ -70,7 +73,7 @@ not lvcreate -s $vg/$lv2 --poolmetadata $vg/$lv1 --thinpool $vg/pool
not lvcreate -s $vg/$lv2 --thinpool $vg/newpool
# Create pool and snap
-lvcreate -s -K $vg/$lv2 --name $vg/$lv3 -L20 --chunksize 128 --thinpool $vg/newpool
+lvcreate -T --name $vg/$lv3 -V10 -L20 --chunksize 128 --thinpool $vg/newpool
lvcreate -s -K $vg/$lv3 --name $vg/$lv4
lvcreate -s -K $vg/$lv2 --name $vg/$lv5 --thinpool $vg/newpool
# Make normal thin snapshot
9 years, 2 months