master - WHATS_NEW: historical LVs
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=418b7c6be8e553...
Commit: 418b7c6be8e553c04eeeb8a96d6b3d4b1da1bb9a
Parent: e447ab87e904799dac89f70d32733d4368563d91
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Mar 4 12:08:02 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Mar 4 12:08:02 2016 +0100
WHATS_NEW: historical LVs
---
WHATS_NEW | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f623226..cbdd14f 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,18 @@
Version 2.02.145 -
=====================================
+ Make it possible to use lvremove and lvrename on historical LVs.
+ For historical LVs, report 'none' for lv_layout and 'history' for lv_role.
+ Add full_{ancestors,descendants} fields to report LV ancestry with history.
+ Report (h)istorical state within 5th bit (State) of the lv_attr field.
+ Add lv_historical reporting field to report if LV is historical or not.
+ Add lv_time_removed reporting field to display removal time for hist. LVs.
+ Report lv_name, lv_uuid, vg_name, lv_time for historical LVs.
+ Add --nohistory switch to lvremove to disable history recording on demand.
+ Add -H|--history switch to lvs and lvdisplay to include historical LVs.
+ Create historical LVs out of removed thin snapshot LVs and record in history.
+ Add metadata/lvs_history_retention_time for automatic removal of hist. LVs.
+ Add metadata/record_lvs_history config for switching LV history recording.
+ Add support and infrastructure for tracking historical LVs.
Improve lvconvert man page.
Add kernel_cache_policy lvs field.
Display [unknown] instead of 'unknown device' in pvs output.
7 years, 3 months
master - man: lvrename: also mention possibility to rename historical logical volumes
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e447ab87e90479...
Commit: e447ab87e904799dac89f70d32733d4368563d91
Parent: fa06c2263b24561c25c04aefd93204f7cfc39543
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Mar 4 11:51:57 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Mar 4 11:51:57 2016 +0100
man: lvrename: also mention possibility to rename historical logical volumes
---
man/lvrename.8.in | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/man/lvrename.8.in b/man/lvrename.8.in
index bba46ae..fdacac7 100644
--- a/man/lvrename.8.in
+++ b/man/lvrename.8.in
@@ -19,7 +19,8 @@ lvrename \(em rename a logical volume
|
.I VolumeGroupName OldLogicalVolumeName NewLogicalVolumeName\fR}
.SH DESCRIPTION
-lvrename renames an existing logical volume from
+lvrename renames an existing logical volume or an existing
+historical logical volume from
.IR OldLogicalVolume { Name | Path }
to
.IR NewLogicalVolume { Name | Path }.
7 years, 3 months
master - cleanup: comment in the code for renaming historical LVs
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fa06c2263b2456...
Commit: fa06c2263b24561c25c04aefd93204f7cfc39543
Parent: 27245d97e57bb42b83aa240979aa6febf9096264
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Mar 4 11:46:29 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Mar 4 11:46:29 2016 +0100
cleanup: comment in the code for renaming historical LVs
---
lib/metadata/lv_manip.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 9b51b6d..91a010c 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4225,7 +4225,10 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
return_0;
if (old_lv_is_historical) {
- /* historical LVs don't have sub LVs */
+ /*
+ * Historical LVs have neither sub LVs nor any
+ * devices to reload, so just update metadata.
+ */
lv->this_glv->historical->name = lv->name = new_name;
if (update_mda &&
(!vg_write(vg) || !vg_commit(vg)))
7 years, 3 months
master - lvrename: support renaming historical logical volumes
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=27245d97e57bb4...
Commit: 27245d97e57bb42b83aa240979aa6febf9096264
Parent: b114b4d723129998b1578410b0b054bebfef1817
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Mar 4 11:36:24 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Mar 4 11:36:24 2016 +0100
lvrename: support renaming historical logical volumes
---
lib/metadata/lv_manip.c | 37 ++++++++++++-------
tools/lvrename.c | 92 ++++++++++++++++++++++++++++++++++++----------
2 files changed, 95 insertions(+), 34 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 136d232..9b51b6d 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4196,6 +4196,7 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
{
struct volume_group *vg = lv->vg;
struct lv_names lv_names = { .old = lv->name };
+ int old_lv_is_historical = lv_is_historical(lv);
int historical;
/*
@@ -4210,7 +4211,7 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
if (lv_name_is_used_in_vg(vg, new_name, &historical)) {
log_error("%sLogical Volume \"%s\" already exists in "
- "volume group \"%s\"", historical ? "historical " : "",
+ "volume group \"%s\"", historical ? "Historical " : "",
new_name, vg->name);
return 0;
}
@@ -4223,23 +4224,31 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
if (update_mda && !archive(vg))
return_0;
- if (!(lv_names.new = dm_pool_strdup(cmd->mem, new_name))) {
- log_error("Failed to allocate space for new name.");
- return 0;
- }
+ if (old_lv_is_historical) {
+ /* historical LVs don't have sub LVs */
+ lv->this_glv->historical->name = lv->name = new_name;
+ if (update_mda &&
+ (!vg_write(vg) || !vg_commit(vg)))
+ return_0;
+ } else {
+ if (!(lv_names.new = dm_pool_strdup(cmd->mem, new_name))) {
+ log_error("Failed to allocate space for new name.");
+ return 0;
+ }
- /* rename sub LVs */
- if (!for_each_sub_lv_except_pools(lv, _rename_cb, (void *) &lv_names))
- return_0;
+ /* rename sub LVs */
+ if (!for_each_sub_lv_except_pools(lv, _rename_cb, (void *) &lv_names))
+ return_0;
- /* rename main LV */
- lv->name = lv_names.new;
+ /* rename main LV */
+ lv->name = lv_names.new;
- if (lv_is_cow(lv))
- lv = origin_from_cow(lv);
+ if (lv_is_cow(lv))
+ lv = origin_from_cow(lv);
- if (update_mda && !lv_update_and_reload((struct logical_volume *)lv_lock_holder(lv)))
- return_0;
+ if (update_mda && !lv_update_and_reload((struct logical_volume *)lv_lock_holder(lv)))
+ return_0;
+ }
return 1;
}
diff --git a/tools/lvrename.c b/tools/lvrename.c
index e37d8aa..56c19fd 100644
--- a/tools/lvrename.c
+++ b/tools/lvrename.c
@@ -16,34 +16,64 @@
#include "tools.h"
struct lvrename_params {
+ int historical;
const char *lv_name_old;
const char *lv_name_new;
};
+/*
+ * Dummy LV to represent historical LV.
+ */
+static struct logical_volume _historical_lv = {
+ .name = "",
+ .major = -1,
+ .minor = -1,
+ .snapshot_segs = DM_LIST_HEAD_INIT(_historical_lv.snapshot_segs),
+ .segments = DM_LIST_HEAD_INIT(_historical_lv.segments),
+ .tags = DM_LIST_HEAD_INIT(_historical_lv.tags),
+ .segs_using_this_lv = DM_LIST_HEAD_INIT(_historical_lv.segs_using_this_lv),
+ .indirect_glvs = DM_LIST_HEAD_INIT(_historical_lv.indirect_glvs),
+ .hostname = "",
+};
+
static int _lvrename_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg, struct processing_handle *handle)
{
struct lvrename_params *lp = (struct lvrename_params *) handle->custom_handle;
- struct lv_list *lvl;
+ struct generic_logical_volume *glv;
+ struct logical_volume *lv;
int ret = ECMD_FAILED;
- if (!(lvl = find_lv_in_vg(vg, lp->lv_name_old))) {
- log_error("Existing logical volume \"%s\" not found in "
- "volume group \"%s\"", lp->lv_name_old, vg_name);
- goto bad;
- }
+ if (!lp->historical) {
+ if (!(lv = find_lv(vg, lp->lv_name_old))) {
+ log_error("Existing logical volume \"%s\" not found in "
+ "volume group \"%s\"", lp->lv_name_old, vg_name);
+ goto bad;
+ }
- if (lv_is_raid_image(lvl->lv) || lv_is_raid_metadata(lvl->lv)) {
- log_error("Cannot rename a RAID %s directly",
- lv_is_raid_image(lvl->lv) ? "image" :
- "metadata area");
- goto bad;
- }
+ if (lv_is_raid_image(lv) || lv_is_raid_metadata(lv)) {
+ log_error("Cannot rename a RAID %s directly",
+ lv_is_raid_image(lv) ? "image" :
+ "metadata area");
+ goto bad;
+ }
+
+ if (lv_is_raid_with_tracking(lv)) {
+ log_error("Cannot rename %s while it is tracking a split image",
+ lv->name);
+ goto bad;
+ }
+ } else {
+ if (!(glv = find_historical_glv(vg, lp->lv_name_old, 0, NULL))) {
+ log_error("Existing historical logical volume \"%s\" not found in "
+ "volume group \"%s\"", lp->lv_name_old, vg_name);
+ goto bad;
+ }
- if (lv_is_raid_with_tracking(lvl->lv)) {
- log_error("Cannot rename %s while it is tracking a split image",
- lvl->lv->name);
- goto bad;
+ _historical_lv.vg = vg;
+ _historical_lv.name = lp->lv_name_old;
+ _historical_lv.this_glv = glv;
+ lv = &_historical_lv;
}
/*
@@ -55,14 +85,16 @@ static int _lvrename_single(struct cmd_context *cmd, const char *vg_name,
* lock request acquires the LV lock (or fails). The transient lock
* is automatically released when the command exits.
*/
- if (!lockd_lv(cmd, lvl->lv, "ex", 0))
+ if (!lockd_lv(cmd, lv, "ex", 0))
goto_bad;
- if (!lv_rename(cmd, lvl->lv, lp->lv_name_new))
+ if (!lv_rename(cmd, lv, lp->lv_name_new))
goto_bad;
- log_print_unless_silent("Renamed \"%s\" to \"%s\" in volume group \"%s\"",
- lp->lv_name_old, lp->lv_name_new, vg_name);
+ log_print_unless_silent("Renamed \"%s%s\" to \"%s%s\" in volume group \"%s\"",
+ lp->historical ? HISTORICAL_LV_PREFIX : "", lp->lv_name_old,
+ lp->historical ? HISTORICAL_LV_PREFIX : "", lp->lv_name_new,
+ vg_name);
ret = ECMD_PROCESSED;
bad:
@@ -80,9 +112,12 @@ int lvrename(struct cmd_context *cmd, int argc, char **argv)
size_t maxlen;
char *lv_name_old, *lv_name_new;
const char *vg_name, *vg_name_new, *vg_name_old;
+ int historical = 0;
char *st;
int ret;
+ cmd->include_historical_lvs = 1;
+
if (argc == 3) {
vg_name = skip_dev_dir(cmd, argv[0], NULL);
lv_name_old = argv[1];
@@ -123,6 +158,21 @@ int lvrename(struct cmd_context *cmd, int argc, char **argv)
if ((st = strrchr(lv_name_new, '/')))
lv_name_new = st + 1;
+ if (!strncmp(lv_name_old, HISTORICAL_LV_PREFIX, strlen(HISTORICAL_LV_PREFIX))) {
+ lv_name_old = lv_name_old + strlen(HISTORICAL_LV_PREFIX);
+ historical = 1;
+ }
+
+ if (!strncmp(lv_name_new, HISTORICAL_LV_PREFIX, strlen(HISTORICAL_LV_PREFIX))) {
+ if (historical)
+ lv_name_new = lv_name_old + strlen(HISTORICAL_LV_PREFIX);
+ else {
+ log_error("Old name references live LV while "
+ "new name is for historical LV.");
+ return EINVALID_CMD_LINE;
+ }
+ }
+
/* Check sanity of new name */
maxlen = NAME_LEN - strlen(vg_name) - 3;
if (strlen(lv_name_new) > maxlen) {
@@ -152,6 +202,8 @@ int lvrename(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
+ lp.historical = historical;
+
if (!(lp.lv_name_old = dm_pool_strdup(cmd->mem, lv_name_old)))
return ECMD_FAILED;
7 years, 3 months
master - commands: lvdisplay: recognize -H|--history switch
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b114b4d7231299...
Commit: b114b4d723129998b1578410b0b054bebfef1817
Parent: ad9cbe271458741f87dca834c16078f181612d76
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Mar 4 10:27:45 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Mar 4 10:27:45 2016 +0100
commands: lvdisplay: recognize -H|--history switch
---
lib/display/display.c | 31 +++++++++++++++++++++++++++++++
tools/commands.h | 10 ++++++----
2 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/lib/display/display.c b/lib/display/display.c
index 2b7ea52..a6387c6 100644
--- a/lib/display/display.c
+++ b/lib/display/display.c
@@ -332,6 +332,34 @@ void lvdisplay_colons(const struct logical_volume *lv)
inkernel ? info.major : -1, inkernel ? info.minor : -1);
}
+static int _lvdisplay_historical_full(struct cmd_context *cmd,
+ const struct logical_volume *lv)
+{
+ char uuid[64] __attribute__((aligned(8)));
+ int lvm1compat = find_config_tree_bool(cmd, global_lvdisplay_shows_full_device_path_CFG, NULL);
+ struct historical_logical_volume *hlv = lv->this_glv->historical;
+
+ if (!id_write_format(&hlv->lvid.id[1], uuid, sizeof(uuid)))
+ return_0;
+
+ log_print("--- Historical Logical volume ---");
+
+ if (lvm1compat)
+ /* /dev/vgname/lvname doen't actually exist for historical devices */
+ log_print("LV Name %s%s/%s",
+ hlv->vg->cmd->dev_dir, hlv->vg->name, hlv->name);
+ else
+ log_print("LV Name %s%s", HISTORICAL_LV_PREFIX, hlv->name);
+
+ log_print("VG Name %s", hlv->vg->name);
+ log_print("LV UUID %s", uuid);
+ log_print("LV Creation time %s", lv_creation_time_dup(cmd->mem, lv, 1));
+ log_print("LV Removal time %s", lv_removal_time_dup(cmd->mem, lv, 1));
+
+ log_print(" ");
+ return 1;
+}
+
int lvdisplay_full(struct cmd_context *cmd,
const struct logical_volume *lv,
void *handle __attribute__((unused)))
@@ -349,6 +377,9 @@ int lvdisplay_full(struct cmd_context *cmd,
int thin_active = 0;
dm_percent_t thin_percent;
+ if (lv_is_historical(lv))
+ return _lvdisplay_historical_full(cmd, lv);
+
if (!id_write_format(&lv->lvid.id[1], uuid, sizeof(uuid)))
return_0;
diff --git a/tools/commands.h b/tools/commands.h
index bc5eb92..b3627dd 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -409,6 +409,7 @@ xx(lvdisplay,
"\t[-d|--debug]\n"
"\t[--foreign]\n"
"\t[-h|--help]\n"
+ "\t[-H|--history]\n"
"\t[--ignorelockingfailure]\n"
"\t[--ignoreskippedcluster]\n"
"\t[-m|--maps]\n"
@@ -429,6 +430,7 @@ xx(lvdisplay,
"\t[-d|--debug]\n"
"\t[--foreign]\n"
"\t[-h|--help]\n"
+ "\t[-H|--history]\n"
"\t[--ignorelockingfailure]\n"
"\t[--ignoreskippedcluster]\n"
"\t[--noheadings]\n"
@@ -447,10 +449,10 @@ xx(lvdisplay,
"\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n",
aligned_ARG, all_ARG, binary_ARG, colon_ARG, columns_ARG, foreign_ARG,
- ignorelockingfailure_ARG, ignoreskippedcluster_ARG, maps_ARG,
- noheadings_ARG, nosuffix_ARG, options_ARG, sort_ARG, partial_ARG,
- readonly_ARG, segments_ARG, select_ARG, separator_ARG, shared_ARG,
- unbuffered_ARG, units_ARG)
+ history_ARG, ignorelockingfailure_ARG, ignoreskippedcluster_ARG,
+ maps_ARG, noheadings_ARG, nosuffix_ARG, options_ARG, sort_ARG,
+ partial_ARG, readonly_ARG, segments_ARG, select_ARG, separator_ARG,
+ shared_ARG, unbuffered_ARG, units_ARG)
xx(lvextend,
"Add space to a logical volume",
7 years, 3 months
master - tests: direct control of lvm1 usage in tests
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ad9cbe27145874...
Commit: ad9cbe271458741f87dca834c16078f181612d76
Parent: 5764c484ea1eeef1c2726347ba2f93bb21fa4121
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Mar 2 16:49:32 2016 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Mar 3 14:43:19 2016 -0600
tests: direct control of lvm1 usage in tests
Using lvm1 metadata with lvmetad is not generally allowed,
but nothing has prevented creating new lvm1 metadata with
lvmetad (missing error checking in pvcreate/vgcreate.)
Various tests are using lvm1 with lvmetad and happen to
work because of the missing error checks.
This commit fixes the tests so they won't fail when the
lvm1/lvmetad error checking is fixed. A new variable
LVM_TEST_LVM1 is defined and is used in the scripts to
decide if lvm1 metadata should be tested. LVM_TEST_LVM1
is not defined when lvmetad is being tested, and the
combination of LVM_TEST_LVM1 and LVM_TEST_LVMETAD can
be used to verify the desired lvmetad+lvm1 behavior.
---
test/lib/flavour-ndev-cluster.sh | 1 +
test/lib/flavour-ndev-vanilla.sh | 1 +
test/lib/flavour-udev-cluster.sh | 1 +
test/lib/flavour-udev-vanilla.sh | 1 +
test/shell/format-lvm1.sh | 35 +++++++++++++++++++++++++++++++++++
test/shell/metadata.sh | 11 +++++++----
test/shell/pvchange-usage.sh | 3 +++
test/shell/pvcreate-operation.sh | 8 +++++++-
test/shell/pvcreate-usage.sh | 16 +++++-----------
test/shell/vgcfgbackup-usage.sh | 3 +++
test/shell/vgcreate-usage.sh | 8 +++++++-
test/shell/vgextend-usage.sh | 8 +++++++-
test/shell/vgreduce-usage.sh | 8 +++++++-
test/shell/vgsplit-usage.sh | 10 +++++++++-
14 files changed, 94 insertions(+), 20 deletions(-)
diff --git a/test/lib/flavour-ndev-cluster.sh b/test/lib/flavour-ndev-cluster.sh
index 3629069..3082b11 100644
--- a/test/lib/flavour-ndev-cluster.sh
+++ b/test/lib/flavour-ndev-cluster.sh
@@ -1 +1,2 @@
export LVM_TEST_LOCKING=3
+export LVM_TEST_LVM1=1
diff --git a/test/lib/flavour-ndev-vanilla.sh b/test/lib/flavour-ndev-vanilla.sh
index 1899c94..c106e61 100644
--- a/test/lib/flavour-ndev-vanilla.sh
+++ b/test/lib/flavour-ndev-vanilla.sh
@@ -1 +1,2 @@
export LVM_TEST_LOCKING=1
+export LVM_TEST_LVM1=1
diff --git a/test/lib/flavour-udev-cluster.sh b/test/lib/flavour-udev-cluster.sh
index a9025a6..1cab558 100644
--- a/test/lib/flavour-udev-cluster.sh
+++ b/test/lib/flavour-udev-cluster.sh
@@ -1,2 +1,3 @@
export LVM_TEST_LOCKING=3
export LVM_TEST_DEVDIR=/dev
+export LVM_TEST_LVM1=1
diff --git a/test/lib/flavour-udev-vanilla.sh b/test/lib/flavour-udev-vanilla.sh
index ca778a6..6fbdafe 100644
--- a/test/lib/flavour-udev-vanilla.sh
+++ b/test/lib/flavour-udev-vanilla.sh
@@ -1,2 +1,3 @@
export LVM_TEST_LOCKING=1
export LVM_TEST_DEVDIR=/dev
+export LVM_TEST_LVM1=1
diff --git a/test/shell/format-lvm1.sh b/test/shell/format-lvm1.sh
new file mode 100644
index 0000000..2b6e1a2
--- /dev/null
+++ b/test/shell/format-lvm1.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+# Copyright (C) 2008 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+test_description='Test lvm1 format'
+
+. lib/inittest
+
+aux prepare_devs 1
+
+if test -n "$LVM_TEST_LVM1" ; then
+pvcreate -M1 "$dev1"
+vgcreate -M1 $vg "$dev1"
+check vg_field $vg fmt "lvm1"
+fi
+
+# TODO: if we decide to make using lvm1 with lvmetad an error,
+# then if lvmetad is being used, then verify:
+# not pvcreate -M1 "$dev1"
+# not vgcreate -M1 $vg "$dev1"
+#
+# TODO: if we decide to allow using lvm1 with lvmetad, but disable lvmetad
+# when it happens, then verify:
+# pvcreate -M1 "$dev1" | tee err
+# grep "disabled" err
+# vgcreate -M1 $vg "$dev1" | tee err
+# grep "disabled" err
+
diff --git a/test/shell/metadata.sh b/test/shell/metadata.sh
index 9f4aa1f..273e2d1 100644
--- a/test/shell/metadata.sh
+++ b/test/shell/metadata.sh
@@ -46,7 +46,9 @@ for mdacp in 1 0; do
done
not grep "Cached VG .* incorrect PV list" out0
-# some M1 metadata tests
+# begin M1 metadata tests
+if test -n "$LVM_TEST_LVM1" ; then
+
pvcreate -M1 "$dev1" "$dev2" "$dev3"
pv3_uuid=$(get pv_field "$dev3" pv_uuid)
vgcreate -M1 $vg "$dev1" "$dev2" "$dev3"
@@ -60,9 +62,6 @@ check pv_field "$dev3" pe_start $pv_align
pvs --units k -o name,pe_start,vg_mda_size,vg_name $(cat DEVICES)
-# vgconvert -M does not work with lvmetad
-test -e LOCAL_LVMETAD && exit 0
-
# upgrade from v1 to v2 metadata
vgconvert -M2 $vg
@@ -80,3 +79,7 @@ vgcfgrestore -f $TESTDIR/bak-$vg $vg
# verify pe_start of $dev3
check pv_field "$dev3" pe_start $pv_align
+
+fi
+# end M1 metadata tests
+
diff --git a/test/shell/pvchange-usage.sh b/test/shell/pvchange-usage.sh
index df7893e..0a0a9c1 100644
--- a/test/shell/pvchange-usage.sh
+++ b/test/shell/pvchange-usage.sh
@@ -113,7 +113,10 @@ vgremove -f $vg1
fail pvchange "$dev1" --addtag test
fail pvchange "$dev1" --deltag test
+if test -n "$LVM_TEST_LVM1" ; then
# cannot add PV tag to lvm1 format
pvcreate -M1 "$dev1"
vgcreate -M1 $vg1 "$dev1"
fail pvchange "$dev1" --addtag test
+fi
+
diff --git a/test/shell/pvcreate-operation.sh b/test/shell/pvcreate-operation.sh
index e2895ad..e8c05c4 100644
--- a/test/shell/pvcreate-operation.sh
+++ b/test/shell/pvcreate-operation.sh
@@ -17,7 +17,13 @@ aux lvmconf 'devices/md_component_detection = 1'
aux prepare_devs 4
-for mdatype in 1 2
+if test -n "$LVM_TEST_LVM1" ; then
+mdatypes='1 2'
+else
+mdatypes='2'
+fi
+
+for mdatype in $mdatypes
do
# pvcreate (lvm$mdatype) refuses to overwrite an mounted filesystem (bz168330)
test ! -d mnt && mkdir mnt
diff --git a/test/shell/pvcreate-usage.sh b/test/shell/pvcreate-usage.sh
index ef59639..0a913d4 100644
--- a/test/shell/pvcreate-usage.sh
+++ b/test/shell/pvcreate-usage.sh
@@ -93,8 +93,10 @@ not pvcreate --labelsector 1000000000000 "$dev1"
#COMM 'pvcreate basic dataalignment sanity checks'
not pvcreate --dataalignment -1 "$dev1"
-not pvcreate -M 1 --dataalignment 1 "$dev1"
not pvcreate --dataalignment 1e "$dev1"
+if test -n "$LVM_TEST_LVM1" ; then
+not pvcreate -M1 --dataalignment 1 "$dev1"
+fi
#COMM 'pvcreate always rounded up to page size for start of device'
#pvcreate --metadatacopies 0 --dataalignment 1 "$dev1"
@@ -142,7 +144,7 @@ check pv_field "$dev1" pv_mda_count 2
#COMM 'pv with LVM1 compatible data alignment can be convereted'
#compatible == LVM1_PE_ALIGN == 64k
-if test ! -e LOCAL_LVMETAD; then
+if test -n "$LVM_TEST_LVM1" ; then
pvcreate --dataalignment 256k "$dev1"
vgcreate -s 1m $vg "$dev1"
vgconvert -M1 $vg
@@ -152,21 +154,13 @@ vgremove $vg
fi
#COMM 'pv with LVM1 incompatible data alignment cannot be convereted'
-if test ! -e LOCAL_LVMETAD; then
+if test -n "$LVM_TEST_LVM1" ; then
pvcreate --dataalignment 10k "$dev1"
vgcreate -s 1m $vg "$dev1"
not vgconvert -M1 $vg
vgremove $vg
fi
-#COMM 'vgconvert -M is disallowed with lvmetad'
-if test -e LOCAL_LVMETAD; then
-pvcreate "$dev1"
-vgcreate $vg "$dev1"
-not vgconvert -M1 $vg
-vgremove $vg
-fi
-
#COMM 'vgcfgrestore allows pe_start=0'
#basically it produces nonsense, but it tests vgcfgrestore,
#not that final cfg is usable...
diff --git a/test/shell/vgcfgbackup-usage.sh b/test/shell/vgcfgbackup-usage.sh
index e763178..31b0a6f 100644
--- a/test/shell/vgcfgbackup-usage.sh
+++ b/test/shell/vgcfgbackup-usage.sh
@@ -78,6 +78,7 @@ vgremove -f $vg
# vgcfgbackup correctly stores metadata LVM1 with missing PVs
# FIXME: clvmd seems to have problem with metadata format change here
# fix it and remove this vgscan
+if test -n "$LVM_TEST_LVM1" ; then
vgscan
pvcreate -M1 $(cat DEVICES)
vgcreate -M1 -c n $vg $(cat DEVICES)
@@ -85,3 +86,5 @@ lvcreate -l1 -n $lv1 $vg "$dev1"
pvremove -ff -y "$dev2"
not lvcreate -l1 -n $lv1 $vg "$dev3"
vgcfgbackup -f "backup.$$" $vg
+fi
+
diff --git a/test/shell/vgcreate-usage.sh b/test/shell/vgcreate-usage.sh
index 5648675..4161268 100644
--- a/test/shell/vgcreate-usage.sh
+++ b/test/shell/vgcreate-usage.sh
@@ -142,8 +142,14 @@ check pv_field "$dev1" pe_start ${pv_align}B --units b
vgremove -f $vg
pvremove -f "$dev1"
+if test -n "$LVM_TEST_LVM1" ; then
+mdatypes='1 2'
+else
+mdatypes='2'
+fi
+
# metadatatype
-for i in 1 2
+for i in $mdatypes
do
vgcreate -M $i $vg "$dev1"
check vg_field $vg vg_fmt lvm$i
diff --git a/test/shell/vgextend-usage.sh b/test/shell/vgextend-usage.sh
index 18a7dce..a470f71 100644
--- a/test/shell/vgextend-usage.sh
+++ b/test/shell/vgextend-usage.sh
@@ -20,7 +20,13 @@ SKIP_WITH_LVMPOLLD=1
aux prepare_devs 5
-for mdatype in 1 2
+if test -n "$LVM_TEST_LVM1" ; then
+mdatypes='1 2'
+else
+mdatypes='2'
+fi
+
+for mdatype in $mdatypes
do
# Explicit pvcreate
diff --git a/test/shell/vgreduce-usage.sh b/test/shell/vgreduce-usage.sh
index 7feed2d..37a27a0 100644
--- a/test/shell/vgreduce-usage.sh
+++ b/test/shell/vgreduce-usage.sh
@@ -16,7 +16,13 @@ SKIP_WITH_LVMPOLLD=1
aux prepare_devs 4
-for mdatype in 1 2
+if test -n "$LVM_TEST_LVM1" ; then
+mdatypes='1 2'
+else
+mdatypes='2'
+fi
+
+for mdatype in $mdatypes
do
# setup PVs
pvcreate -M$mdatype "$dev1" "$dev2"
diff --git a/test/shell/vgsplit-usage.sh b/test/shell/vgsplit-usage.sh
index 743a969..4f5c6d4 100644
--- a/test/shell/vgsplit-usage.sh
+++ b/test/shell/vgsplit-usage.sh
@@ -18,7 +18,13 @@ SKIP_WITH_LVMPOLLD=1
aux prepare_devs 5
-for mdatype in 1 2
+if test -n "$LVM_TEST_LVM1" ; then
+mdatypes='1 2'
+else
+mdatypes='2'
+fi
+
+for mdatype in $mdatypes
do
pvcreate -M$mdatype $(cat DEVICES)
@@ -162,6 +168,7 @@ check pvlv_counts $vg1 2 1 0
vgremove -f $vg1
# vgsplit rejects split because metadata types differ
+if test -n "$LVM_TEST_LVM1" ; then
pvcreate -ff -M1 "$dev3" "$dev4"
pvcreate -ff "$dev1" "$dev2"
vgcreate -M1 $vg1 "$dev3" "$dev4"
@@ -169,3 +176,4 @@ vgcreate $vg2 "$dev1" "$dev2"
not vgsplit $vg1 $vg2 "$dev3" 2>err;
grep "Metadata types differ" err
vgremove -f $vg1 $vg2
+fi
7 years, 3 months
master - man: Add some information about historical LVs.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5764c484ea1eee...
Commit: 5764c484ea1eeef1c2726347ba2f93bb21fa4121
Parent: 9a78c258ba8da349059138618858856f66cb7fed
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Mar 3 17:09:25 2016 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Mar 3 17:09:25 2016 +0000
man: Add some information about historical LVs.
---
man/lvm.8.in | 17 ++++++++++++++++-
man/lvremove.8.in | 18 ++++++++++++++++++
man/lvs.8.in | 16 +++++++++++-----
3 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/man/lvm.8.in b/man/lvm.8.in
index fe30b75..fd25001 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -482,7 +482,18 @@ The valid characters for VG and LV names are:
.BR 0 - 9
.BR "+ _ . -"
.P
-VG and LV names cannot begin with a hyphen.
+VG names cannot begin with a hyphen.
+The name of a new LV also cannot begin with a hyphen. However, if the
+configuration setting \fBmetadata/record_lvs_history\fP is enabled then an LV
+name with a hyphen as a prefix indicates that, although the LV was
+removed, it is still being tracked because it forms part of the history of at
+least one LV that is still present. This helps to record the ancestry of
+thin snapshots even after some links in the chain have been removed.
+A reference to the historical LV 'lvol1' in VG 'vg00' would be 'vg00/-lvol1'
+or just '-lvol1' if the VG is already set. (The latter form must be preceded
+by '--' to terminate command line option processing before reaching this
+argument.)
+.P
There are also various reserved names that are used internally by lvm that can
not be used as LV or VG names. A VG cannot be called anything that exists in
\fI/dev/\fP at the time of creation, nor can it be called '.' or '..'.
@@ -501,6 +512,7 @@ Other software and scripts should use the
amendment when the software is updated. Should you need to process the node
names in /dev/mapper, you may use \fBdmsetup splitname\fP to separate out the
original VG, LV and internal layer names.
+.P
.
.SH UNIQUE NAMES
.
@@ -522,6 +534,9 @@ An exception is if all but one of the VGs with the shared name is foreign
.BR lvmsystemid (7).)
In this case, the one VG that is not foreign is assumed to be the intended
VG and is processed.
+.P
+LV names are unique within a VG. The name of an historical LV cannot be
+reused until the historical LV has itself been removed or renamed.
.
.SH ALLOCATION
diff --git a/man/lvremove.8.in b/man/lvremove.8.in
index 8cf1bf3..433c277 100644
--- a/man/lvremove.8.in
+++ b/man/lvremove.8.in
@@ -9,6 +9,7 @@ lvremove \(em remove a logical volume
.IR ProfileName ]
.RB [ \-d | \-\-debug ]
.RB [ \-h | \-\-help ]
+.RB [ \-\-nohistory ]
.RB [ \-S | \-\-select
.IR Selection ]
.RB [ \-t | \-\-test ]
@@ -27,6 +28,18 @@ Removing an origin logical volume will also remove all dependent snapshots.
If the logical volume is clustered then it must be deactivated on all
nodes in the cluster before it can be removed. A single lvchange command
issued from one node can do this.
+.sp
+If the configuration setting \fBmetadata/record_lvs_history\fP is enabled
+and the logical volume being removed forms part of the history of at least
+one logical volume that is still present then a simplified representation of
+the logical volume will be retained. This includes the time of removal
+(\fBlv_time_removed\fP reporting field), creation time (\fBlv_time\fP), name
+(\fBlv_name\fP), LV uuid (\fBlv_uuid\fP) and VG name (\fBvg_name\fP) and
+allows you to see the ancestry chain of thin snapshot volumes even after
+some intermediate logical volumes have been removed.
+The names of such historical logical volumes acquire a hyphen as a prefix
+(e.g. '-lvol1') and cannot be reactivated. Use lvremove a second time,
+with the hyphen, to remove the record of the former logical volume completely.
.SH OPTIONS
See \fBlvm\fP(8) for common options.
.TP
@@ -35,6 +48,11 @@ Remove active logical volumes without confirmation.
Tool will try to deactivate \fIunused\fP volume.
To proceed with damaged pools use \-ff
.TP
+.B \-\-nohistory
+Disable the recording of history of logical volumes which are being removed.
+(This has no effect unless the configuration setting
+\fBmetadata/record_lvs_history\fP is enabled.)
+.TP
.B \-\-noudevsync
Disable udev synchronisation. The
process will not wait for notification from udev.
diff --git a/man/lvs.8.in b/man/lvs.8.in
index df61497..d4bc7f2 100644
--- a/man/lvs.8.in
+++ b/man/lvs.8.in
@@ -10,6 +10,7 @@ lvs \(em report information about logical volumes
.IR ProfileName ]
.RB [ \-d | \-\-debug ]
.RB [ \-h | \-? | \-\-help ]
+.RB [ \-H | \-\-history ]
.RB [ \-\-ignorelockingfailure ]
.RB [ \-\-ignoreskippedcluster ]
.RB [ \-\-nameprefixes ]
@@ -60,6 +61,11 @@ in the output. For example, after creating a mirror using
, this option will reveal three internal Logical
Volumes, with suffixes mimage_0, mimage_1, and mlog.
.TP
+.B \-H ", " \-\-history
+Include historical logical volumes in the output.
+(This has no effect unless logical volumes were removed while the configuration
+setting \fBmetadata/record_lvs_history\fP was enabled.)
+.TP
.B \-\-nameprefixes
Add an "LVM2_" prefix plus the field name to the output. Useful
with \fB\-\-noheadings\fP to produce a list of field=value pairs that can
@@ -166,11 +172,11 @@ changes, for example during
.IP 4 3
fixed (m)inor
.IP 5 3
-State: (a)ctive, (s)uspended, (I)nvalid snapshot, invalid (S)uspended snapshot,
-snapshot (m)erge failed, suspended snapshot (M)erge failed,
-mapped (d)evice present without tables, mapped device present with (i)nactive table,
-thin-pool (c)heck needed, suspended thin-pool (C)heck needed,
-(X) unknown
+State: (a)ctive, (h)istorical, (s)uspended, (I)nvalid snapshot,
+invalid (S)uspended snapshot, snapshot (m)erge failed,
+suspended snapshot (M)erge failed, mapped (d)evice present without tables,
+mapped device present with (i)nactive table, thin-pool (c)heck needed,
+suspended thin-pool (C)heck needed, (X) unknown
.IP 6 3
device (o)pen, (X) unknown
.IP 7 3
7 years, 3 months
master - tests: add lv-ancestry.sh test
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9a78c258ba8da3...
Commit: 9a78c258ba8da349059138618858856f66cb7fed
Parent: 45c82260db1c25f3885ea0e2185d7c3e7c33ed26
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 1 15:32:32 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 13:50:59 2016 +0100
tests: add lv-ancestry.sh test
---
test/shell/lv-ancestry.sh | 226 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 226 insertions(+), 0 deletions(-)
diff --git a/test/shell/lv-ancestry.sh b/test/shell/lv-ancestry.sh
new file mode 100644
index 0000000..febaf40
--- /dev/null
+++ b/test/shell/lv-ancestry.sh
@@ -0,0 +1,226 @@
+#!/bin/sh
+
+# Copyright (C) 2016 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+. lib/inittest
+
+aux have_thin 1 0 0 || skip
+aux prepare_pvs 1 16
+
+aux lvmconf "metadata/record_lvs_history=1"
+
+vgcreate $vg -s 64K $(cat DEVICES)
+
+lvcreate -l100%FREE -T ${vg}/pool
+
+# Thin snap chain with 2 branches starting at lv3.
+#
+# lv1 --> lv2 --> lv3 --> lv4 --> lv5
+# \
+# --> lv6 --> lv7
+
+lvcreate -V1 -T ${vg}/pool -n lv1
+lvcreate -s ${vg}/lv1 -n lv2
+lvcreate -s ${vg}/lv2 -n lv3
+lvcreate -s ${vg}/lv3 -n lv4
+lvcreate -s ${vg}/lv4 -n lv5
+lvcreate -s ${vg}/lv3 -n lv6
+lvcreate -s ${vg}/lv6 -n lv7
+
+check lvh_field ${vg}/lv1 full_ancestors ""
+check lvh_field ${vg}/lv1 full_descendants "lv2,lv3,lv4,lv5,lv6,lv7"
+
+check lvh_field ${vg}/lv2 full_ancestors "lv1"
+check lvh_field ${vg}/lv2 full_descendants "lv3,lv4,lv5,lv6,lv7"
+
+check lvh_field ${vg}/lv3 full_ancestors "lv2,lv1"
+check lvh_field ${vg}/lv3 full_descendants "lv4,lv5,lv6,lv7"
+
+check lvh_field ${vg}/lv4 full_ancestors "lv3,lv2,lv1"
+check lvh_field ${vg}/lv4 full_descendants "lv5"
+
+check lvh_field ${vg}/lv5 full_ancestors "lv4,lv3,lv2,lv1"
+check lvh_field ${vg}/lv5 full_descendants ""
+
+check lvh_field ${vg}/lv6 full_ancestors "lv3,lv2,lv1"
+check lvh_field ${vg}/lv6 full_descendants "lv7"
+
+check lvh_field ${vg}/lv7 full_ancestors "lv6,lv3,lv2,lv1"
+check lvh_field ${vg}/lv7 full_descendants ""
+
+
+# lv1 --> lv2 --> lv3 --> -lv4 --> lv5
+# \
+# --> lv6 --> lv7
+lvremove -ff ${vg}/lv4
+
+check lvh_field ${vg}/lv1 full_ancestors ""
+check lvh_field ${vg}/lv1 full_descendants "lv2,lv3,lv6,lv7,-lv4,lv5"
+
+check lvh_field ${vg}/lv2 full_ancestors "lv1"
+check lvh_field ${vg}/lv2 full_descendants "lv3,lv6,lv7,-lv4,lv5"
+
+check lvh_field ${vg}/lv3 full_ancestors "lv2,lv1"
+check lvh_field ${vg}/lv3 full_descendants "lv6,lv7,-lv4,lv5"
+
+check lvh_field ${vg}/-lv4 full_ancestors "lv3,lv2,lv1"
+check lvh_field ${vg}/-lv4 full_descendants "lv5"
+
+check lvh_field ${vg}/lv5 full_ancestors "-lv4,lv3,lv2,lv1"
+check lvh_field ${vg}/lv5 full_descendants ""
+
+check lvh_field ${vg}/lv6 full_ancestors "lv3,lv2,lv1"
+check lvh_field ${vg}/lv6 full_descendants "lv7"
+
+check lvh_field ${vg}/lv7 full_ancestors "lv6,lv3,lv2,lv1"
+check lvh_field ${vg}/lv7 full_descendants ""
+
+
+# lv1 --> lv2 --> -lv3 --> -lv4 --> lv5
+# \
+# --> lv6 --> lv7
+lvremove -ff ${vg}/lv3
+
+check lvh_field ${vg}/lv1 full_ancestors ""
+check lvh_field ${vg}/lv1 full_descendants "lv2,-lv3,-lv4,lv5,lv6,lv7"
+
+check lvh_field ${vg}/lv2 full_ancestors "lv1"
+check lvh_field ${vg}/lv2 full_descendants "-lv3,-lv4,lv5,lv6,lv7"
+
+check lvh_field ${vg}/-lv3 full_ancestors "lv2,lv1"
+check lvh_field ${vg}/-lv3 full_descendants "-lv4,lv5,lv6,lv7"
+
+check lvh_field ${vg}/-lv4 full_ancestors "-lv3,lv2,lv1"
+check lvh_field ${vg}/-lv4 full_descendants "lv5"
+
+check lvh_field ${vg}/lv5 full_ancestors "-lv4,-lv3,lv2,lv1"
+check lvh_field ${vg}/lv5 full_descendants ""
+
+check lvh_field ${vg}/lv6 full_ancestors "-lv3,lv2,lv1"
+check lvh_field ${vg}/lv6 full_descendants "lv7"
+
+check lvh_field ${vg}/lv7 full_ancestors "lv6,-lv3,lv2,lv1"
+check lvh_field ${vg}/lv7 full_descendants ""
+
+# lv1 --> -lv2 --> -lv3 --> -lv4 --> lv5
+# \
+# --> lv6 --> lv7
+lvremove -ff $vg/lv2
+
+check lvh_field ${vg}/lv1 full_ancestors ""
+check lvh_field ${vg}/lv1 full_descendants "-lv2,-lv3,-lv4,lv5,lv6,lv7"
+
+check lvh_field ${vg}/-lv2 full_ancestors "lv1"
+check lvh_field ${vg}/-lv2 full_descendants "-lv3,-lv4,lv5,lv6,lv7"
+
+check lvh_field ${vg}/-lv3 full_ancestors "-lv2,lv1"
+check lvh_field ${vg}/-lv3 full_descendants "-lv4,lv5,lv6,lv7"
+
+check lvh_field ${vg}/-lv4 full_ancestors "-lv3,-lv2,lv1"
+check lvh_field ${vg}/-lv4 full_descendants "lv5"
+
+check lvh_field ${vg}/lv5 full_ancestors "-lv4,-lv3,-lv2,lv1"
+check lvh_field ${vg}/lv5 full_descendants ""
+
+check lvh_field ${vg}/lv6 full_ancestors "-lv3,-lv2,lv1"
+check lvh_field ${vg}/lv6 full_descendants "lv7"
+
+check lvh_field ${vg}/lv7 full_ancestors "lv6,-lv3,-lv2,lv1"
+check lvh_field ${vg}/lv7 full_descendants ""
+
+# lv1 --> -lv2 --> -lv3 --> -lv4 --> lv5
+# \
+# --> -lv6 --> lv7
+lvremove -ff ${vg}/lv6
+
+check lvh_field ${vg}/lv1 full_ancestors ""
+check lvh_field ${vg}/lv1 full_descendants "-lv2,-lv3,-lv4,lv5,-lv6,lv7"
+
+check lvh_field ${vg}/-lv2 full_ancestors "lv1"
+check lvh_field ${vg}/-lv2 full_descendants "-lv3,-lv4,lv5,-lv6,lv7"
+
+check lvh_field ${vg}/-lv3 full_ancestors "-lv2,lv1"
+check lvh_field ${vg}/-lv3 full_descendants "-lv4,lv5,-lv6,lv7"
+
+check lvh_field ${vg}/-lv4 full_ancestors "-lv3,-lv2,lv1"
+check lvh_field ${vg}/-lv4 full_descendants "lv5"
+
+check lvh_field ${vg}/lv5 full_ancestors "-lv4,-lv3,-lv2,lv1"
+check lvh_field ${vg}/lv5 full_descendants ""
+
+check lvh_field ${vg}/-lv6 full_ancestors "-lv3,-lv2,lv1"
+check lvh_field ${vg}/-lv6 full_descendants "lv7"
+
+check lvh_field ${vg}/lv7 full_ancestors "-lv6,-lv3,-lv2,lv1"
+check lvh_field ${vg}/lv7 full_descendants ""
+
+# lv1 --> -lv2 -----------> -lv4 --> lv5
+# \
+# --> -lv6 --> lv7
+lvremove -ff ${vg}/-lv3
+
+check lvh_field ${vg}/lv1 full_ancestors ""
+check lvh_field ${vg}/lv1 full_descendants "-lv2,-lv4,lv5,-lv6,lv7"
+
+check lvh_field ${vg}/-lv2 full_ancestors "lv1"
+check lvh_field ${vg}/-lv2 full_descendants "-lv4,lv5,-lv6,lv7"
+
+check lvh_field ${vg}/-lv4 full_ancestors "-lv2,lv1"
+check lvh_field ${vg}/-lv4 full_descendants "lv5"
+
+check lvh_field ${vg}/lv5 full_ancestors "-lv4,-lv2,lv1"
+check lvh_field ${vg}/lv5 full_descendants ""
+
+check lvh_field ${vg}/-lv6 full_ancestors "-lv2,lv1"
+check lvh_field ${vg}/-lv6 full_descendants "lv7"
+
+check lvh_field ${vg}/lv7 full_ancestors "-lv6,-lv2,lv1"
+check lvh_field ${vg}/lv7 full_descendants ""
+
+# -lv2 -----------> -lv4 --> lv5
+# \
+# --> -lv6 --> lv7
+
+lvremove --nohistory -ff ${vg}/lv1
+
+check lvh_field ${vg}/-lv2 full_ancestors ""
+check lvh_field ${vg}/-lv2 full_descendants "-lv4,lv5,-lv6,lv7"
+
+check lvh_field ${vg}/-lv4 full_ancestors "-lv2"
+check lvh_field ${vg}/-lv4 full_descendants "lv5"
+
+check lvh_field ${vg}/lv5 full_ancestors "-lv4,-lv2"
+check lvh_field ${vg}/lv5 full_descendants ""
+
+check lvh_field ${vg}/-lv6 full_ancestors "-lv2"
+check lvh_field ${vg}/-lv6 full_descendants "lv7"
+
+check lvh_field ${vg}/lv7 full_ancestors "-lv6,-lv2"
+check lvh_field ${vg}/lv7 full_descendants ""
+
+# -lv2 -----------> -lv4 --> lv5
+#
+# lv7
+lvremove --nohistory -ff ${vg}/-lv6
+
+check lvh_field ${vg}/-lv2 full_ancestors ""
+check lvh_field ${vg}/-lv2 full_descendants "-lv4,lv5"
+
+check lvh_field ${vg}/-lv4 full_ancestors "-lv2"
+check lvh_field ${vg}/-lv4 full_descendants "lv5"
+
+check lvh_field ${vg}/lv5 full_ancestors "-lv4,-lv2"
+check lvh_field ${vg}/lv5 full_descendants ""
+
+check lvh_field ${vg}/lv7 full_ancestors ""
+check lvh_field ${vg}/lv7 full_descendants ""
+
+vgremove -ff $vg
7 years, 3 months
master - tests: add "get lvh_field" for "lvs -H"
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=45c82260db1c25...
Commit: 45c82260db1c25f3885ea0e2185d7c3e7c33ed26
Parent: b39473a537249b60e36f69e28155bfc6829763ab
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 1 15:32:20 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 13:50:59 2016 +0100
tests: add "get lvh_field" for "lvs -H"
---
test/lib/check.sh | 6 ++++++
test/lib/get.sh | 5 +++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/test/lib/check.sh b/test/lib/check.sh
index 4ede0be..e729ab2 100644
--- a/test/lib/check.sh
+++ b/test/lib/check.sh
@@ -310,6 +310,12 @@ lv_field() {
die "lv_field: lv=$1, field=\"$2\", actual=\"$actual\", expected=\"$3\""
}
+lvh_field() {
+ local actual=$(get lvh_field "$1" "$2" "${@:4}")
+ test "$actual" = "$3" || \
+ die "lvh_field: lv=$1, field=\"$2\", actual=\"$actual\", expected=\"$3\""
+}
+
lva_field() {
local actual=$(get lva_field "$1" "$2" "${@:4}")
test "$actual" = "$3" || \
diff --git a/test/lib/get.sh b/test/lib/get.sh
index 0d22eb4..74ee7e8 100644
--- a/test/lib/get.sh
+++ b/test/lib/get.sh
@@ -42,6 +42,11 @@ lv_field() {
trim_ "$r"
}
+lvh_field() {
+ local r=$(lvs -H --config 'log{prefix=""}' --noheadings -o "$2" "${@:3}" "$1")
+ trim_ "$r"
+}
+
lva_field() {
local r=$(lvs -a --config 'log{prefix=""}' --noheadings -o "$2" "${@:3}" "$1")
trim_ "$r"
7 years, 3 months
master - lvmdump: also list historical LVs in lvmdump
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b39473a537249b...
Commit: b39473a537249b60e36f69e28155bfc6829763ab
Parent: 8a601454e178c72b39be66365eaa153d69d4ed40
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Mar 3 10:36:58 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 13:50:59 2016 +0100
lvmdump: also list historical LVs in lvmdump
---
scripts/lvmdump.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/lvmdump.sh b/scripts/lvmdump.sh
index bf72d65..1e91a9d 100755
--- a/scripts/lvmdump.sh
+++ b/scripts/lvmdump.sh
@@ -137,7 +137,7 @@ if (( $advanced )); then
log "\"$LVM\" pvscan -v >> \"$dir/pvscan\" 2>> \"$log\""
myecho " lvs..."
- log "\"$LVM\" lvs -a -o +devices >> \"$dir/lvs\" 2>> \"$log\""
+ log "\"$LVM\" lvs -a -H -o +devices >> \"$dir/lvs\" 2>> \"$log\""
myecho " pvs..."
log "\"$LVM\" pvs -a -v >> \"$dir/pvs\" 2>> \"$log\""
7 years, 3 months