master - metadata: automatically remove invalid (dangling) historical LVs
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8a601454e178c7...
Commit: 8a601454e178c72b39be66365eaa153d69d4ed40
Parent: 1297b0c8bef38a9269186ca26d6827560ce0fddf
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Mar 2 12:19:07 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 13:50:59 2016 +0100
metadata: automatically remove invalid (dangling) historical LVs
Historical LV is valid as long as there is at least one live LV among
its ancestors. If we find any invalid (dangling) historical LVs, remove
them automatically.
---
lib/metadata/lv.h | 2 ++
lib/metadata/metadata.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 48 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h
index f9f5b4e..da81419 100644
--- a/lib/metadata/lv.h
+++ b/lib/metadata/lv.h
@@ -94,6 +94,8 @@ struct historical_logical_volume {
uint64_t timestamp_removed;
struct generic_logical_volume *indirect_origin;
struct dm_list indirect_glvs; /* list of struct generic_logical_volume */
+ int checked:1; /* set if this historical LV has been checked for validity */
+ int valid:1; /* historical LV is valid if there's at least one live LV among ancestors */
};
struct generic_logical_volume {
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 4951d71..9700e73 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3319,15 +3319,45 @@ static int _check_old_pv_ext_for_vg(struct volume_group *vg)
return 1;
}
-static int _handle_historical_lvs(struct volume_group *vg)
+static int _check_historical_lv_is_valid(struct historical_logical_volume *hlv)
{
struct glv_list *glvl;
+
+ if (hlv->checked)
+ return hlv->valid;
+
+ /*
+ * Historical LV is valid if there is
+ * at least one live LV among ancestors.
+ */
+ hlv->valid = 0;
+ dm_list_iterate_items(glvl, &hlv->indirect_glvs) {
+ if (!glvl->glv->is_historical ||
+ _check_historical_lv_is_valid(glvl->glv->historical)) {
+ hlv->valid = 1;
+ break;
+ }
+ }
+
+ hlv->checked = 1;
+ return hlv->valid;
+}
+
+static int _handle_historical_lvs(struct volume_group *vg)
+{
+ struct glv_list *glvl, *tglvl;
time_t current_timestamp = 0;
struct historical_logical_volume *hlv;
+ int valid = 1;
+
+ dm_list_iterate_items(glvl, &vg->historical_lvs)
+ glvl->glv->historical->checked = 0;
dm_list_iterate_items(glvl, &vg->historical_lvs) {
hlv = glvl->glv->historical;
+ valid &= _check_historical_lv_is_valid(hlv);
+
if (!hlv->timestamp_removed) {
if (!current_timestamp)
current_timestamp = time(NULL);
@@ -3335,6 +3365,21 @@ static int _handle_historical_lvs(struct volume_group *vg)
}
}
+ if (valid)
+ return 1;
+
+ dm_list_iterate_items_safe(glvl, tglvl, &vg->historical_lvs) {
+ hlv = glvl->glv->historical;
+ if (hlv->checked && hlv->valid)
+ continue;
+
+ log_print_unless_silent("Automatically removing historical "
+ "logical volume %s/%s%s.",
+ vg->name, HISTORICAL_LV_PREFIX, hlv->name);
+ if (!historical_glv_remove(glvl->glv))
+ return_0;
+ }
+
return 1;
}
7 years, 3 months
master - metadata: also validate historical LVs in VG in vg_validate and check_lv_segments
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1297b0c8bef38a...
Commit: 1297b0c8bef38a9269186ca26d6827560ce0fddf
Parent: fc628e92ba1b403988a0b058d0d3283d23bab5bf
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 1 15:32:01 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 13:50:59 2016 +0100
metadata: also validate historical LVs in VG in vg_validate and check_lv_segments
---
lib/metadata/merge.c | 20 +++++++++++
lib/metadata/metadata.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 108 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c
index a36cafd..17227c1 100644
--- a/lib/metadata/merge.c
+++ b/lib/metadata/merge.c
@@ -80,6 +80,7 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
unsigned seg_count = 0, seg_found;
uint32_t area_multiplier, s;
struct seg_list *sl;
+ struct glv_list *glvl;
int error_count = 0;
struct replicator_site *rsite;
struct replicator_device *rdev;
@@ -495,6 +496,25 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
}
}
+ dm_list_iterate_items(glvl, &lv->indirect_glvs) {
+ if (glvl->glv->is_historical) {
+ if (glvl->glv->historical->indirect_origin != lv->this_glv) {
+ log_error("LV %s is indirectly used by historical LV %s"
+ "but that historical LV does not point back to LV %s",
+ lv->name, glvl->glv->historical->name, lv->name);
+ inc_error_count;
+ }
+ } else {
+ if (!(seg = first_seg(glvl->glv->live)) ||
+ seg->indirect_origin != lv->this_glv) {
+ log_error("LV %s is indirectly used by LV %s"
+ "but that LV does not point back to LV %s",
+ lv->name, glvl->glv->live->name, lv->name);
+ inc_error_count;
+ }
+ }
+ }
+
if (le != lv->le_count) {
log_error("LV %s: inconsistent LE count %u != %u",
lv->name, le, lv->le_count);
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 5ab6f8e..4951d71 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -2613,7 +2613,9 @@ void lv_calculate_readahead(const struct logical_volume *lv, uint32_t *read_ahea
struct validate_hash {
struct dm_hash_table *lvname;
+ struct dm_hash_table *historical_lvname;
struct dm_hash_table *lvid;
+ struct dm_hash_table *historical_lvid;
struct dm_hash_table *pvid;
struct dm_hash_table *lv_lock_args;
};
@@ -2733,6 +2735,8 @@ int vg_validate(struct volume_group *vg)
{
struct pv_list *pvl;
struct lv_list *lvl;
+ struct glv_list *glvl;
+ struct historical_logical_volume *hlv;
struct lv_segment *seg;
struct dm_str_list *sl;
char uuid[64] __attribute__((aligned(8)));
@@ -3166,11 +3170,95 @@ int vg_validate(struct volume_group *vg)
}
}
+ if (!(vhash.historical_lvname = dm_hash_create(dm_list_size(&vg->historical_lvs)))) {
+ log_error("Failed to allocate historical LV name hash");
+ r = 0;
+ goto out;
+ }
+
+ if (!(vhash.historical_lvid = dm_hash_create(dm_list_size(&vg->historical_lvs)))) {
+ log_error("Failed to allocate historical LV uuid hash");
+ r = 0;
+ goto out;
+ }
+
+ dm_list_iterate_items(glvl, &vg->historical_lvs) {
+ if (!glvl->glv->is_historical) {
+ log_error(INTERNAL_ERROR "LV %s/%s appearing in VG's historical list is not a historical LV",
+ vg->name, glvl->glv->live->name);
+ r = 0;
+ continue;
+ }
+
+ hlv = glvl->glv->historical;
+
+ if (hlv->vg != vg) {
+ log_error(INTERNAL_ERROR "Historical LV %s points to different VG %s while it is listed in VG %s",
+ hlv->name, hlv->vg->name, vg->name);
+ r = 0;
+ continue;
+ }
+
+ if (!id_equal(&hlv->lvid.id[0], &hlv->vg->id)) {
+ if (!id_write_format(&hlv->lvid.id[0], uuid, sizeof(uuid)))
+ stack;
+ if (!id_write_format(&hlv->vg->id, uuid2, sizeof(uuid2)))
+ stack;
+ log_error(INTERNAL_ERROR "Historical LV %s has VG UUID %s but its VG %s has UUID %s",
+ hlv->name, uuid, hlv->vg->name, uuid2);
+ r = 0;
+ continue;
+ }
+
+ if (dm_hash_lookup_binary(vhash.historical_lvid, &hlv->lvid.id[1], sizeof(hlv->lvid.id[1]))) {
+ if (!id_write_format(&hlv->lvid.id[1], uuid,sizeof(uuid)))
+ stack;
+ log_error(INTERNAL_ERROR "Duplicate historical LV id %s detected for %s in %s",
+ uuid, hlv->name, vg->name);
+ r = 0;
+ }
+
+ if (dm_hash_lookup(vhash.historical_lvname, hlv->name)) {
+ log_error(INTERNAL_ERROR "Duplicate historical LV name %s detected in %s", hlv->name, vg->name);
+ r = 0;
+ continue;
+ }
+
+ if (!dm_hash_insert(vhash.historical_lvname, hlv->name, hlv)) {
+ log_error("Failed to hash historical LV name");
+ r = 0;
+ break;
+ }
+
+ if (!dm_hash_insert_binary(vhash.historical_lvid, &hlv->lvid.id[1], sizeof(hlv->lvid.id[1]), hlv)) {
+ log_error("Failed to hash historical LV id");
+ r = 0;
+ break;
+ }
+
+ if (dm_hash_lookup(vhash.lvname, hlv->name)) {
+ log_error(INTERNAL_ERROR "Name %s appears as live and historical LV at the same time in VG %s",
+ hlv->name, vg->name);
+ r = 0;
+ continue;
+ }
+
+ if (!hlv->indirect_origin && !dm_list_size(&hlv->indirect_glvs)) {
+ log_error(INTERNAL_ERROR "Historical LV %s is not part of any LV chain in VG %s", hlv->name, vg->name);
+ r = 0;
+ continue;
+ }
+ }
+
out:
if (vhash.lvid)
dm_hash_destroy(vhash.lvid);
if (vhash.lvname)
dm_hash_destroy(vhash.lvname);
+ if (vhash.historical_lvid)
+ dm_hash_destroy(vhash.historical_lvid);
+ if (vhash.historical_lvname)
+ dm_hash_destroy(vhash.historical_lvname);
if (vhash.pvid)
dm_hash_destroy(vhash.pvid);
if (vhash.lv_lock_args)
7 years, 3 months
master - metadata: also look at historical LVs when checking LV name availability
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fc628e92ba1b40...
Commit: fc628e92ba1b403988a0b058d0d3283d23bab5bf
Parent: 0ab111016470d694abf8bbd89df0360061f2736e
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 1 15:31:48 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 13:50:59 2016 +0100
metadata: also look at historical LVs when checking LV name availability
Live LVs and historical LVs are in one namespace and the name needs to
be unique in whole VG.
---
lib/metadata/lv_manip.c | 39 +++++++++++++++++++++++++++----------
lib/metadata/metadata-exported.h | 2 +
lib/metadata/metadata.c | 19 ++++++++++++++++++
lib/metadata/mirror.c | 8 ++++--
lib/metadata/pool_manip.c | 2 +-
lib/metadata/raid_manip.c | 14 +++++++-----
liblvm/lvm_vg.c | 6 +++-
7 files changed, 67 insertions(+), 23 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 85f61a1..136d232 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4028,10 +4028,12 @@ out:
static int _rename_single_lv(struct logical_volume *lv, char *new_name)
{
struct volume_group *vg = lv->vg;
+ int historical;
- if (find_lv_in_vg(vg, new_name)) {
- log_error("Logical volume \"%s\" already exists in "
- "volume group \"%s\"", new_name, vg->name);
+ if (lv_name_is_used_in_vg(vg, new_name, &historical)) {
+ log_error("%sLogical Volume \"%s\" already exists in "
+ "volume group \"%s\"", historical ? "historical " : "",
+ new_name, vg->name);
return 0;
}
@@ -4194,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 historical;
/*
* rename is not allowed on sub LVs except for pools
@@ -4205,9 +4208,10 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
return 0;
}
- if (find_lv_in_vg(vg, new_name)) {
- log_error("Logical volume \"%s\" already exists in "
- "volume group \"%s\"", new_name, vg->name);
+ if (lv_name_is_used_in_vg(vg, new_name, &historical)) {
+ log_error("%sLogical Volume \"%s\" already exists in "
+ "volume group \"%s\"", historical ? "historical " : "",
+ new_name, vg->name);
return 0;
}
@@ -5365,6 +5369,7 @@ char *generate_lv_name(struct volume_group *vg, const char *format,
char *buffer, size_t len)
{
struct lv_list *lvl;
+ struct glv_list *glvl;
int high = -1, i;
dm_list_iterate_items(lvl, &vg->lvs) {
@@ -5375,6 +5380,14 @@ char *generate_lv_name(struct volume_group *vg, const char *format,
high = i;
}
+ dm_list_iterate_items(glvl, &vg->historical_lvs) {
+ if (sscanf(glvl->glv->historical->name, format, &i) != 1)
+ continue;
+
+ if (i > high)
+ high = i;
+ }
+
if (dm_snprintf(buffer, len, format, high + 1) < 0)
return NULL;
@@ -5506,6 +5519,7 @@ struct logical_volume *lv_create_empty(const char *name,
struct format_instance *fi = vg->fid;
struct logical_volume *lv;
char dname[NAME_LEN];
+ int historical;
if (vg_max_lv_reached(vg))
stack;
@@ -5515,9 +5529,10 @@ struct logical_volume *lv_create_empty(const char *name,
log_error("Failed to generate unique name for the new "
"logical volume");
return NULL;
- } else if (find_lv_in_vg(vg, name)) {
+ } else if (lv_name_is_used_in_vg(vg, name, &historical)) {
log_error("Unable to create LV %s in Volume Group %s: "
- "name already in use.", name, vg->name);
+ "name already in use%s.", name, vg->name,
+ historical ? " by historical LV" : "");
return NULL;
}
@@ -7010,10 +7025,12 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
struct logical_volume *tmp_lv;
struct lv_segment *seg, *pool_seg;
int thin_pool_was_active = -1; /* not scanned, inactive, active */
+ int historical;
- if (new_lv_name && find_lv_in_vg(vg, new_lv_name)) {
- log_error("Logical volume \"%s\" already exists in "
- "volume group \"%s\"", new_lv_name, vg->name);
+ if (new_lv_name && lv_name_is_used_in_vg(vg, new_lv_name, &historical)) {
+ log_error("%sLogical Volume \"%s\" already exists in "
+ "volume group \"%s\"", historical ? "historical " : "",
+ new_lv_name, vg->name);
return NULL;
}
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index dc95995..ecca418 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1035,6 +1035,8 @@ struct generic_logical_volume *find_historical_glv(const struct volume_group *vg
int check_removed_list,
struct glv_list **glvl_found);
+int lv_name_is_used_in_vg(const struct volume_group *vg, const char *name, int *historical);
+
struct physical_volume *find_pv_by_name(struct cmd_context *cmd,
const char *pv_name,
int allow_orphan, int allow_unformatted);
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index a5cb15a..5ab6f8e 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -2149,6 +2149,25 @@ struct generic_logical_volume *find_historical_glv(const struct volume_group *vg
return NULL;
}
+int lv_name_is_used_in_vg(const struct volume_group *vg, const char *name, int *historical)
+{
+ struct generic_logical_volume *historical_lv;
+ struct logical_volume *lv;
+ int found = 0;
+
+ if ((lv = find_lv(vg, name))) {
+ found = 1;
+ if (historical)
+ *historical = 0;
+ } else if ((historical_lv = find_historical_glv(vg, name, 0, NULL))) {
+ found = 1;
+ if (historical)
+ *historical = 1;
+ }
+
+ return found;
+}
+
struct physical_volume *find_pv(struct volume_group *vg, struct device *dev)
{
struct pv_list *pvl;
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 2a72209..da7be6c 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -2213,10 +2213,12 @@ int lv_split_mirror_images(struct logical_volume *lv, const char *split_name,
uint32_t split_count, struct dm_list *removable_pvs)
{
int r;
+ int historical;
- if (find_lv_in_vg(lv->vg, split_name)) {
- log_error("Logical Volume \"%s\" already exists in "
- "volume group \"%s\"", split_name, lv->vg->name);
+ if (lv_name_is_used_in_vg(lv->vg, split_name, &historical)) {
+ log_error("%sLogical Volume \"%s\" already exists in "
+ "volume group \"%s\"", historical ? "historical " : "",
+ split_name, lv->vg->name);
return 0;
}
diff --git a/lib/metadata/pool_manip.c b/lib/metadata/pool_manip.c
index d2856ae..87ca992 100644
--- a/lib/metadata/pool_manip.c
+++ b/lib/metadata/pool_manip.c
@@ -867,7 +867,7 @@ int vg_remove_pool_metadata_spare(struct volume_group *vg)
*c = 0;
/* If the name is in use, generate new lvol%d */
- if (find_lv_in_vg(vg, new_name) &&
+ if (lv_name_is_used_in_vg(vg, new_name, NULL) &&
!generate_lv_name(vg, "lvol%d", new_name, sizeof(new_name))) {
log_error("Failed to generate unique name for "
"pool metadata spare logical volume.");
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index e66b533..3b9f81c 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -339,6 +339,7 @@ static char *_generate_raid_name(struct logical_volume *lv,
const char *format = (count >= 0) ? "%s_%s_%u" : "%s_%s";
size_t len = strlen(lv->name) + strlen(suffix) + ((count >= 0) ? 5 : 2);
char *name;
+ int historical;
if (!(name = dm_pool_alloc(lv->vg->vgmem, len))) {
log_error("Failed to allocate new name.");
@@ -353,9 +354,9 @@ static char *_generate_raid_name(struct logical_volume *lv,
return NULL;
}
- if (find_lv_in_vg(lv->vg, name)) {
- log_error("Logical volume %s already exists in volume group %s.",
- name, lv->vg->name);
+ if (lv_name_is_used_in_vg(lv->vg, name, &historical)) {
+ log_error("%sLogical Volume %s already exists in volume group %s.",
+ historical ? "historical " : "", name, lv->vg->name);
return NULL;
}
@@ -1093,6 +1094,7 @@ int lv_raid_split(struct logical_volume *lv, const char *split_name,
uint32_t old_count = lv_raid_image_count(lv);
struct logical_volume *tracking;
struct dm_list tracking_pvs;
+ int historical;
dm_list_init(&removal_list);
dm_list_init(&data_list);
@@ -1116,9 +1118,9 @@ int lv_raid_split(struct logical_volume *lv, const char *split_name,
return 0;
}
- if (find_lv_in_vg(lv->vg, split_name)) {
- log_error("Logical Volume \"%s\" already exists in %s",
- split_name, lv->vg->name);
+ if (lv_name_is_used_in_vg(lv->vg, split_name, &historical)) {
+ log_error("%sLogical Volume \"%s\" already exists in %s",
+ historical ? "historical " : "", split_name, lv->vg->name);
return 0;
}
diff --git a/liblvm/lvm_vg.c b/liblvm/lvm_vg.c
index 7e48df0..8b3fc91 100644
--- a/liblvm/lvm_vg.c
+++ b/liblvm/lvm_vg.c
@@ -523,6 +523,7 @@ int lvm_lv_name_validate(const vg_t vg, const char *name)
{
int rc = -1;
name_error_t name_error;
+ int historical;
struct saved_env e = store_user_env(vg->cmd);
@@ -530,10 +531,11 @@ int lvm_lv_name_validate(const vg_t vg, const char *name)
if (NAME_VALID == name_error) {
if (apply_lvname_restrictions(name)) {
- if (!find_lv_in_vg(vg, name)) {
+ if (!lv_name_is_used_in_vg(vg, name, &historical)) {
rc = 0;
} else {
- log_errno(EINVAL, "LV name exists in VG");
+ log_errno(EINVAL, "%sLV name exists in VG",
+ historical ? "historical " : "");
}
}
} else {
7 years, 3 months
master - conf: regenerate example.conf.in
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0ab111016470d6...
Commit: 0ab111016470d694abf8bbd89df0360061f2736e
Parent: ff6e124a338d1dbdde3b6280784d599e504378ef
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 1 15:31:29 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 13:50:59 2016 +0100
conf: regenerate example.conf.in
---
conf/example.conf.in | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 60f8023..975f514 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -1426,6 +1426,22 @@ activation {
# This configuration option has an automatic default value.
# check_pv_device_sizes = 1
+ # Configuration option metadata/record_lvs_history.
+ # When enabled, LVM keeps history records about removed LVs in
+ # metadata. The information that is recorded in metadata for
+ # historical LVs is reduced when compared to original
+ # information kept in metadata for live LVs. Currently, this
+ # feature is supported for thin and thin snapshot LVs only.
+ # This configuration option has an automatic default value.
+ # record_lvs_history = 0
+
+ # Configuration option metadata/lvs_history_retention_time.
+ # Retention time in seconds after which a record about individual
+ # historical logical volume is automatically destroyed.
+ # A value of 0 disables this feature.
+ # This configuration option has an automatic default value.
+ # lvs_history_retention_time = 0
+
# Configuration option metadata/pvmetadatacopies.
# Number of copies of metadata to store on each PV.
# The --pvmetadatacopies option overrides this setting.
7 years, 3 months
master - conf: add metadata/lvs_history_timeout configuration setting
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ff6e124a338d1d...
Commit: ff6e124a338d1dbdde3b6280784d599e504378ef
Parent: 74272e163de8c62208d6de41d15631cf3ecf0b2c
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 1 15:29:27 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 13:50:59 2016 +0100
conf: add metadata/lvs_history_timeout configuration setting
---
lib/config/config_settings.h | 5 +++++
lib/config/defaults.h | 1 +
lib/metadata/metadata.c | 3 ++-
3 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index b093351..1291109 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -1367,6 +1367,11 @@ cfg(metadata_record_lvs_history_CFG, "record_lvs_history", metadata_CFG_SECTION,
"information kept in metadata for live LVs. Currently, this\n"
"feature is supported for thin and thin snapshot LVs only.\n")
+cfg(metadata_lvs_history_retention_time_CFG, "lvs_history_retention_time", metadata_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_LVS_HISTORY_RETENTION_TIME, vsn(2, 2, 145), NULL, 0, NULL,
+ "Retention time in seconds after which a record about individual\n"
+ "historical logical volume is automatically destroyed.\n"
+ "A value of 0 disables this feature.\n")
+
cfg(metadata_pvmetadatacopies_CFG, "pvmetadatacopies", metadata_CFG_SECTION, CFG_ADVANCED | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_PVMETADATACOPIES, vsn(1, 0, 0), NULL, 0, NULL,
"Number of copies of metadata to store on each PV.\n"
"The --pvmetadatacopies option overrides this setting.\n"
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 6c7060a..fd7986c 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -129,6 +129,7 @@
#define DEFAULT_STRIPESIZE 64 /* KB */
#define DEFAULT_RECORD_LVS_HISTORY 0
+#define DEFAULT_LVS_HISTORY_RETENTION_TIME 0
#define DEFAULT_PVMETADATAIGNORE 0
#define DEFAULT_PVMETADATASIZE 255
#define DEFAULT_PVMETADATACOPIES 1
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 417629b..a5cb15a 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4460,6 +4460,7 @@ struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vgnam
goto out;
}
}
+
out:
if (!*consistent && (warn_flags & WARN_INCONSISTENT)) {
if (is_orphan_vg(vgname))
@@ -6013,7 +6014,7 @@ int is_lockd_type(const char *lock_type)
int vg_strip_outdated_historical_lvs(struct volume_group *vg) {
struct glv_list *glvl, *tglvl;
time_t current_time = time(NULL);
- uint64_t threshold = 0;
+ uint64_t threshold = find_config_tree_int(vg->cmd, metadata_lvs_history_retention_time_CFG, NULL);
if (!threshold)
return 1;
7 years, 3 months
master - metadata: add vg_strip_outdated_historical_lvs fn and call it during VG read
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=74272e163de8c6...
Commit: 74272e163de8c62208d6de41d15631cf3ecf0b2c
Parent: 53b064b9aed3bd2237638cab778b3bffd018ce08
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 1 15:27:21 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 13:50:59 2016 +0100
metadata: add vg_strip_outdated_historical_lvs fn and call it during VG read
The vg_strip_outdated_historical_lvs iterates over the list of historical LVs
we have and it shoots down the ones which are outdated.
Configuration hook to set the timeout will be in subsequent patch.
---
lib/metadata/metadata-exported.h | 2 +
lib/metadata/metadata.c | 39 +++++++++++++++++++++++++++++++++++++-
2 files changed, 40 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index d81166d..dc95995 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1298,4 +1298,6 @@ int is_lockd_type(const char *lock_type);
int is_system_id_allowed(struct cmd_context *cmd, const char *system_id);
+int vg_strip_outdated_historical_lvs(struct volume_group *vg);
+
#endif
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index c37c7ba..417629b 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3930,6 +3930,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
int inconsistent_pvs = 0;
int inconsistent_mdas = 0;
int inconsistent_mda_count = 0;
+ int strip_historical_lvs = *consistent;
unsigned use_precommitted = precommitted;
struct dm_list *pvids;
struct pv_list *pvl;
@@ -3965,6 +3966,10 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
lvmetad_vg_clear_outdated_pvs(correct_vg);
}
}
+
+ if (correct_vg && strip_historical_lvs && !vg_strip_outdated_historical_lvs(correct_vg))
+ return_NULL;
+
return correct_vg;
}
@@ -4405,6 +4410,10 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
}
*consistent = !inconsistent_pvs;
+
+ if (*consistent && correct_vg && strip_historical_lvs && !vg_strip_outdated_historical_lvs(correct_vg))
+ return_NULL;
+
return correct_vg;
}
@@ -4451,7 +4460,6 @@ struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vgnam
goto out;
}
}
-
out:
if (!*consistent && (warn_flags & WARN_INCONSISTENT)) {
if (is_orphan_vg(vgname))
@@ -6002,3 +6010,32 @@ int is_lockd_type(const char *lock_type)
return 0;
}
+int vg_strip_outdated_historical_lvs(struct volume_group *vg) {
+ struct glv_list *glvl, *tglvl;
+ time_t current_time = time(NULL);
+ uint64_t threshold = 0;
+
+ if (!threshold)
+ return 1;
+
+ dm_list_iterate_items_safe(glvl, tglvl, &vg->historical_lvs) {
+ /*
+ * Removal time in the future? Not likely,
+ * but skip this item in any case.
+ */
+ if ((current_time) < glvl->glv->historical->timestamp_removed)
+ continue;
+
+ if ((current_time - glvl->glv->historical->timestamp_removed) > threshold) {
+ if (!historical_glv_remove(glvl->glv)) {
+ log_error("Failed to destroy record about historical LV %s/%s.",
+ vg->name, glvl->glv->historical->name);
+ return 0;
+ }
+ log_verbose("Outdated record for historical logical volume \"%s\" "
+ "automatically destroyed.", glvl->glv->historical->name);
+ }
+ }
+
+ return 1;
+}
7 years, 3 months
master - commands: lvremove: also process historical LVs
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=53b064b9aed3bd...
Commit: 53b064b9aed3bd2237638cab778b3bffd018ce08
Parent: f833a6d074979813e8bd9980b719b09758bd833a
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 1 15:27:08 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 13:50:59 2016 +0100
commands: lvremove: also process historical LVs
---
lib/metadata/lv_manip.c | 19 +++++++++++++------
tools/commands.h | 3 ++-
tools/lvremove.c | 1 +
3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index c612873..85f61a1 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5691,7 +5691,7 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
struct volume_group *vg;
struct logical_volume *format1_origin = NULL;
int format1_reload_required = 0;
- int visible;
+ int visible, historical;
struct logical_volume *pool_lv = NULL;
struct logical_volume *lock_lv = lv;
struct lv_segment *cache_seg = NULL;
@@ -5782,7 +5782,7 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
}
}
- if ((force == PROMPT) && ask_discard &&
+ if (!lv_is_historical(lv) && (force == PROMPT) && ask_discard &&
yes_no_prompt("Do you really want to remove and DISCARD "
"logical volume %s? [y/n]: ",
lv->name) == 'n') {
@@ -5868,10 +5868,15 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
}
visible = lv_is_visible(lv);
+ historical = lv_is_historical(lv);
- log_verbose("Releasing logical volume \"%s\"", lv->name);
+ log_verbose("Releasing %slogical volume \"%s\"",
+ historical ? "historical " : "",
+ historical ? lv->this_glv->historical->name : lv->name);
if (!lv_remove(lv)) {
- log_error("Error releasing logical volume \"%s\"", lv->name);
+ log_error("Error releasing %slogical volume \"%s\"",
+ historical ? "historical ": "",
+ historical ? lv->this_glv->historical->name : lv->name);
return 0;
}
@@ -5934,8 +5939,10 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
lockd_lv(cmd, lock_lv, "un", LDLV_PERSISTENT);
lockd_free_lv(cmd, vg, lv->name, &lv->lvid.id[1], lv->lock_args);
- if (!suppress_remove_message && visible)
- log_print_unless_silent("Logical volume \"%s\" successfully removed", lv->name);
+ if (!suppress_remove_message && (visible || historical))
+ log_print_unless_silent("%sogical volume \"%s\" successfully removed",
+ historical ? "Historical l" : "L",
+ historical ? lv->this_glv->historical->name : lv->name);
return 1;
}
diff --git a/tools/commands.h b/tools/commands.h
index 97f7de1..bc5eb92 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -606,7 +606,8 @@ xx(lvremove,
"\t[--version]\n"
"\tLogicalVolume[Path] [LogicalVolume[Path]...]\n",
- autobackup_ARG, force_ARG, nohistory_ARG, noudevsync_ARG, select_ARG, test_ARG)
+ autobackup_ARG, force_ARG, nohistory_ARG, noudevsync_ARG,
+ select_ARG, test_ARG)
xx(lvrename,
"Rename a logical volume",
diff --git a/tools/lvremove.c b/tools/lvremove.c
index 220d3e3..18da1fa 100644
--- a/tools/lvremove.c
+++ b/tools/lvremove.c
@@ -24,6 +24,7 @@ int lvremove(struct cmd_context *cmd, int argc, char **argv)
}
cmd->handles_missing_pvs = 1;
+ cmd->include_historical_lvs = 1;
return process_each_lv(cmd, argc, argv, READ_FOR_UPDATE, NULL,
&lvremove_single);
7 years, 3 months
master - metadata: add historical_glv_remove
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f833a6d0749798...
Commit: f833a6d074979813e8bd9980b719b09758bd833a
Parent: ccebf3100deec6196c1a66301a36cad6892ff0aa
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 1 15:26:57 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 13:50:57 2016 +0100
metadata: add historical_glv_remove
---
lib/format_text/import_vsn1.c | 4 +-
lib/metadata/lv_manip.c | 68 ++++++++++++++++++++++++++++++++++++-
lib/metadata/metadata-exported.h | 4 ++
lib/metadata/metadata.c | 5 ++-
lib/metadata/vg.c | 1 +
lib/metadata/vg.h | 5 +++
6 files changed, 82 insertions(+), 5 deletions(-)
diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c
index 163ea38..3bf5f7b 100644
--- a/lib/format_text/import_vsn1.c
+++ b/lib/format_text/import_vsn1.c
@@ -788,7 +788,7 @@ static int _read_historical_lvnames_interconnections(struct format_instance *fid
historical_lv_name = hlvn->key;
hlvn = hlvn->child;
- if (!(glv = find_historical_glv(vg, historical_lv_name, NULL))) {
+ if (!(glv = find_historical_glv(vg, historical_lv_name, 0, NULL))) {
log_error("Unknown historical logical volume %s/%s%s",
vg->name, HISTORICAL_LV_PREFIX, historical_lv_name);
goto bad;
@@ -828,7 +828,7 @@ static int _read_historical_lvnames_interconnections(struct format_instance *fid
glvl->glv = glv;
if (!strncmp(origin_name, HISTORICAL_LV_PREFIX, strlen(HISTORICAL_LV_PREFIX))) {
- if (!(origin_glv = find_historical_glv(vg, origin_name + strlen(HISTORICAL_LV_PREFIX), NULL))) {
+ if (!(origin_glv = find_historical_glv(vg, origin_name + strlen(HISTORICAL_LV_PREFIX), 0, NULL))) {
log_error("Unknown origin %s for historical logical volume %s/%s%s",
origin_name, vg->name, HISTORICAL_LV_PREFIX, historical_lv_name);
goto bad;
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index e355cc4..c612873 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1398,11 +1398,75 @@ int lv_reduce(struct logical_volume *lv, uint32_t extents)
return _lv_reduce(lv, extents, 1);
}
+int historical_glv_remove(struct generic_logical_volume *glv)
+{
+ struct generic_logical_volume *origin_glv;
+ struct glv_list *glvl, *user_glvl;
+ struct historical_logical_volume *hlv;
+ int reconnected;
+
+ if (!glv || !glv->is_historical)
+ return_0;
+
+ hlv = glv->historical;
+
+ if (!(glv = find_historical_glv(hlv->vg, hlv->name, 0, &glvl))) {
+ if (!(find_historical_glv(hlv->vg, hlv->name, 1, NULL))) {
+ log_error(INTERNAL_ERROR "historical_glv_remove: historical LV %s/-%s not found ",
+ hlv->vg->name, hlv->name);
+ return 0;
+ } else {
+ log_verbose("Historical LV %s/-%s already on removed list ",
+ hlv->vg->name, hlv->name);
+ return 1;
+ }
+ }
+
+ if ((origin_glv = hlv->indirect_origin) &&
+ !remove_glv_from_indirect_glvs(origin_glv, glv))
+ return_0;
+
+ dm_list_iterate_items(user_glvl, &hlv->indirect_glvs) {
+ reconnected = 0;
+ if ((origin_glv && !origin_glv->is_historical) && !user_glvl->glv->is_historical)
+ log_verbose("Removing historical connection between %s and %s.",
+ origin_glv->live->name, user_glvl->glv->live->name);
+ else if (hlv->vg->cmd->record_historical_lvs) {
+ if (!add_glv_to_indirect_glvs(hlv->vg->vgmem, origin_glv, user_glvl->glv))
+ return_0;
+ reconnected = 1;
+ }
+
+ if (!reconnected) {
+ /*
+ * Break ancestry chain if we're removing historical LV and tracking
+ * historical LVs is switched off either via:
+ * - "metadata/record_lvs_history=0" config
+ * - "--nohistory" cmd line option
+ *
+ * Also, break the chain if we're unable to store such connection at all
+ * because we're removing the very last historical LV that was in between
+ * live LVs - pure live LVs can't store any indirect origin relation in
+ * metadata - we need at least one historical LV to do that!
+ */
+ if (user_glvl->glv->is_historical)
+ user_glvl->glv->historical->indirect_origin = NULL;
+ else
+ first_seg(user_glvl->glv->live)->indirect_origin = NULL;
+ }
+ }
+
+ dm_list_move(&hlv->vg->removed_historical_lvs, &glvl->list);
+ return 1;
+}
+
/*
* Completely remove an LV.
*/
int lv_remove(struct logical_volume *lv)
{
+ if (lv_is_historical(lv))
+ return historical_glv_remove(lv->this_glv);
if (!lv_reduce(lv, lv->le_count))
return_0;
@@ -5740,9 +5804,9 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
is_last_pool = 1;
}
- /* Used cache pool or COW cannot be activated */
+ /* Used cache pool, COW or historical LV cannot be activated */
if ((!lv_is_cache_pool(lv) || dm_list_empty(&lv->segs_using_this_lv)) &&
- !lv_is_cow(lv) &&
+ !lv_is_cow(lv) && !lv_is_historical(lv) &&
!deactivate_lv(cmd, lv)) {
/* FIXME Review and fix the snapshot error paths! */
log_error("Unable to deactivate logical volume %s.",
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index b8699f7..d81166d 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -807,6 +807,9 @@ int lv_extend(struct logical_volume *lv,
/* lv must be part of lv->vg->lvs */
int lv_remove(struct logical_volume *lv);
+/* historical_glv must be part of lv->vg->historical_lvs */
+int historical_glv_remove(struct generic_logical_volume *historical_glv);
+
int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
force_t force, int suppress_remove_message);
@@ -1029,6 +1032,7 @@ struct logical_volume *find_lv(const struct volume_group *vg,
struct generic_logical_volume *find_historical_glv(const struct volume_group *vg,
const char *historical_lv_name,
+ int check_removed_list,
struct glv_list **glvl_found);
struct physical_volume *find_pv_by_name(struct cmd_context *cmd,
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 8b3c53c..c37c7ba 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -2122,10 +2122,13 @@ struct logical_volume *find_lv(const struct volume_group *vg,
struct generic_logical_volume *find_historical_glv(const struct volume_group *vg,
const char *historical_lv_name,
+ int check_removed_list,
struct glv_list **glvl_found)
{
struct glv_list *glvl;
const char *ptr;
+ const struct dm_list *list = check_removed_list ? &vg->removed_historical_lvs
+ : &vg->historical_lvs;
/* Use last component */
if ((ptr = strrchr(historical_lv_name, '/')))
@@ -2133,7 +2136,7 @@ struct generic_logical_volume *find_historical_glv(const struct volume_group *vg
else
ptr = historical_lv_name;
- dm_list_iterate_items(glvl, &vg->historical_lvs) {
+ dm_list_iterate_items(glvl, list) {
if (!strcmp(glvl->glv->historical->name, ptr)) {
if (glvl_found)
*glvl_found = glvl;
diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c
index 90c459e..7ac1a2c 100644
--- a/lib/metadata/vg.c
+++ b/lib/metadata/vg.c
@@ -67,6 +67,7 @@ struct volume_group *alloc_vg(const char *pool_name, struct cmd_context *cmd,
dm_list_init(&vg->historical_lvs);
dm_list_init(&vg->tags);
dm_list_init(&vg->removed_lvs);
+ dm_list_init(&vg->removed_historical_lvs);
dm_list_init(&vg->removed_pvs);
log_debug_mem("Allocated VG %s at %p.", vg->name, vg);
diff --git a/lib/metadata/vg.h b/lib/metadata/vg.h
index c5197cb..069cdc8 100644
--- a/lib/metadata/vg.h
+++ b/lib/metadata/vg.h
@@ -142,6 +142,11 @@ struct volume_group {
struct dm_list removed_lvs;
/*
+ * List of removed historical logical volumes by historical_glv_remove.
+ */
+ struct dm_list removed_historical_lvs;
+
+ /*
* List of removed physical volumes by pvreduce.
* They have to get cleared on vg_commit.
*/
7 years, 3 months
master - conf: add metadata/record_lvs_history configuration setting
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ccebf3100deec6...
Commit: ccebf3100deec6196c1a66301a36cad6892ff0aa
Parent: b1399090cd7db6d16e10ddf0a7b0ca72e254c63c
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 1 15:25:49 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 13:49:15 2016 +0100
conf: add metadata/record_lvs_history configuration setting
The metadata/record_lvs_history is global switch which enables or
disables recording historical LVs in metadata.
If both metadata/record_lvs_history=1 lvm.conf option and
--nohistory command switch is used at the same time, the
--nohistory prevails.
---
lib/config/config_settings.h | 7 +++++++
lib/config/defaults.h | 1 +
tools/lvmcmdline.c | 4 ++--
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 95eb8ee..b093351 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -1360,6 +1360,13 @@ cfg(metadata_check_pv_device_sizes_CFG, "check_pv_device_sizes", metadata_CFG_SE
"less than corresponding PV size. You should not disable this unless\n"
"you are absolutely sure about what you are doing!\n")
+cfg(metadata_record_lvs_history_CFG, "record_lvs_history", metadata_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_RECORD_LVS_HISTORY, vsn(2, 2, 145), NULL, 0, NULL,
+ "When enabled, LVM keeps history records about removed LVs in\n"
+ "metadata. The information that is recorded in metadata for\n"
+ "historical LVs is reduced when compared to original\n"
+ "information kept in metadata for live LVs. Currently, this\n"
+ "feature is supported for thin and thin snapshot LVs only.\n")
+
cfg(metadata_pvmetadatacopies_CFG, "pvmetadatacopies", metadata_CFG_SECTION, CFG_ADVANCED | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_PVMETADATACOPIES, vsn(1, 0, 0), NULL, 0, NULL,
"Number of copies of metadata to store on each PV.\n"
"The --pvmetadatacopies option overrides this setting.\n"
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 648a168..6c7060a 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -128,6 +128,7 @@
#define DEFAULT_FORMAT "lvm2"
#define DEFAULT_STRIPESIZE 64 /* KB */
+#define DEFAULT_RECORD_LVS_HISTORY 0
#define DEFAULT_PVMETADATAIGNORE 0
#define DEFAULT_PVMETADATASIZE 255
#define DEFAULT_PVMETADATACOPIES 1
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index ffe8447..72570f7 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1102,8 +1102,8 @@ static int _get_settings(struct cmd_context *cmd)
cmd->include_foreign_vgs = arg_is_set(cmd, foreign_ARG) ? 1 : 0;
cmd->include_shared_vgs = arg_is_set(cmd, shared_ARG) ? 1 : 0;
cmd->include_historical_lvs = arg_is_set(cmd, history_ARG) ? 1 : 0;
- cmd->include_historical_lvs = arg_is_set(cmd, history_ARG) ? 1 : 0;
- cmd->record_historical_lvs = arg_is_set(cmd, nohistory_ARG) ? 0 : 1;
+ cmd->record_historical_lvs = find_config_tree_bool(cmd, metadata_record_lvs_history_CFG, NULL) ?
+ (arg_is_set(cmd, nohistory_ARG) ? 0 : 1) : 0;
/*
* This is set to zero by process_each which wants to print errors
7 years, 3 months
master - commands: lvremove: recognize --nohistory option
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b1399090cd7db6...
Commit: b1399090cd7db6d16e10ddf0a7b0ca72e254c63c
Parent: f545dd5952ee0b191ae2cda2d7b6f304442debab
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 1 15:25:37 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 3 13:49:15 2016 +0100
commands: lvremove: recognize --nohistory option
---
tools/commands.h | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/tools/commands.h b/tools/commands.h
index ffc15b5..97f7de1 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -598,6 +598,7 @@ xx(lvremove,
"\t[-d|--debug]\n"
"\t[-f|--force]\n"
"\t[-h|--help]\n"
+ "\t[--nohistory]\n"
"\t[--noudevsync]\n"
"\t[-S|--select Selection]\n"
"\t[-t|--test]\n"
@@ -605,7 +606,7 @@ xx(lvremove,
"\t[--version]\n"
"\tLogicalVolume[Path] [LogicalVolume[Path]...]\n",
- autobackup_ARG, force_ARG, noudevsync_ARG, select_ARG, test_ARG)
+ autobackup_ARG, force_ARG, nohistory_ARG, noudevsync_ARG, select_ARG, test_ARG)
xx(lvrename,
"Rename a logical volume",
7 years, 3 months