master - test: Restore testing of D-Bus API
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a9907bef9980dfe953a...
Commit: a9907bef9980dfe953a812e52760c174472ad0a6
Parent: eebb5e9fffd4602b0455ed9729b4b3d4d341bc1c
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Thu May 30 18:02:55 2019 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Fri May 31 08:58:30 2019 +0200
test: Restore testing of D-Bus API
---
test/Makefile.in | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index 69e2cfc..fcb612d 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -49,9 +49,9 @@ include $(top_builddir)/make.tmpl
T ?= .
S ?= @ # never match anything by default
VERBOSE ?= 0
-ALL := $(shell find -L $(srcdir) \( -path \*/shell/\*.sh -or -path \*/unit/\*.sh \) | $(SORT))
+ALL := $(shell find -L $(srcdir) \( -path \*/shell/\*.sh -or -path \*/api/\*.sh -or -path \*/unit/\*.sh \) | $(SORT))
comma = ,
-RUN := $(shell find -L $(srcdir) -regextype posix-egrep \( -path \*/shell/\*.sh -or -path \*/unit/\*.sh \) -and -regex "$(srcdir)/.*($(subst $(comma),|,$(T))).*" -and -not -regex "$(srcdir)/.*($(subst $(comma),|,$(S))).*" | $(SORT))
+RUN := $(shell find -L $(srcdir) -regextype posix-egrep \( -path \*/shell/\*.sh -or -path \*/api/\*.sh -or -path \*/unit/\*.sh \) -and -regex "$(srcdir)/.*($(subst $(comma),|,$(T))).*" -and -not -regex "$(srcdir)/.*($(subst $(comma),|,$(S))).*" | $(SORT))
RUN_BASE = $(subst $(srcdir)/,,$(RUN))
ifeq ("@BUILD_LVMPOLLD@", "yes")
@@ -200,8 +200,9 @@ LIB_SHARED = check aux inittest utils get lvm-wrapper
install: .tests-stamp lib/paths-installed
@echo $(srcdir)
- $(Q) $(INSTALL_DIR) $(DATADIR)/{shell,unit,lib,dbus} $(EXECDIR)
+ $(Q) $(INSTALL_DIR) $(DATADIR)/{shell,api,unit,lib,dbus} $(EXECDIR)
$(Q) $(INSTALL_DATA) shell/*.sh $(DATADIR)/shell
+ $(INSTALL_DATA) api/*.sh $(DATADIR)/api
$(Q) $(INSTALL_DATA) unit/*.sh $(DATADIR)/unit
-$(Q) $(INSTALL_PROGRAM) unit/unit-test $(DATADIR)/unit
-$(Q) $(INSTALL_PROGRAM) dbus/*.py $(DATADIR)/dbus/
@@ -291,7 +292,7 @@ lib/paths-installed: lib/paths-common
$(Q) $(RM) $@-t
$(Q) cat lib/paths-common > $@-t
$(Q) echo 'installed_testsuite=1' >> $@-t
- $(Q) echo 'export PATH=@libexecdir@/lvm2-testsuite:@datadir@/lvm2-testsuite/lib:$$PATH' >> $@-t
+ $(Q) echo 'export PATH=@libexecdir@/lvm2-testsuite:@datadir@/lvm2-testsuite/lib:@datadir@/lvm2-testsuite/api:$$PATH' >> $@-t
$(Q) mv $@-t $@
lib/paths: lib/paths-common
4 years, 6 months
master - tests: add debug to pvscan-cache deactivation
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=eebb5e9fffd4602b045...
Commit: eebb5e9fffd4602b0455ed9729b4b3d4d341bc1c
Parent: e055b89d2896ebe8b8067ab21f38d7ddbe2df9df
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu May 23 15:32:46 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu May 23 15:32:46 2019 -0500
tests: add debug to pvscan-cache deactivation
---
test/shell/pvscan-cache.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/test/shell/pvscan-cache.sh b/test/shell/pvscan-cache.sh
index 20d3235..c351885 100644
--- a/test/shell/pvscan-cache.sh
+++ b/test/shell/pvscan-cache.sh
@@ -59,7 +59,8 @@ check lv_field $vg1/$lv1 lv_active ""
pvscan --cache -aay "$dev1"
pvscan --cache -aay "$dev2"
check lv_field $vg1/$lv1 lv_active "active"
-lvchange -an $vg1/$lv1
+lvchange -an -vvvv $vg1/$lv1
+dmsetup ls
lvremove $vg1/$lv1
# When MDA is ignored on PV, do not read any VG
4 years, 6 months
master - tests: pvscan-cache more attempts to fix
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e055b89d2896ebe8b80...
Commit: e055b89d2896ebe8b8067ab21f38d7ddbe2df9df
Parent: 645dd276049e8dbab37b169b27cf6af29a8bd8e5
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu May 23 14:55:57 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu May 23 14:55:57 2019 -0500
tests: pvscan-cache more attempts to fix
---
test/shell/pvscan-cache.sh | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/test/shell/pvscan-cache.sh b/test/shell/pvscan-cache.sh
index 8788594..20d3235 100644
--- a/test/shell/pvscan-cache.sh
+++ b/test/shell/pvscan-cache.sh
@@ -60,6 +60,7 @@ pvscan --cache -aay "$dev1"
pvscan --cache -aay "$dev2"
check lv_field $vg1/$lv1 lv_active "active"
lvchange -an $vg1/$lv1
+lvremove $vg1/$lv1
# When MDA is ignored on PV, do not read any VG
# metadata from such PV as it may contain old
@@ -75,7 +76,4 @@ aux enable_dev "$dev2"
pvscan --cache
check pv_field "$dev1" vg_name "$vg1"
-vgchange -an $vg1
-lvremove $vg1/$lv1
-
vgremove -ff $vg1
4 years, 6 months
master - separate code for setting devices from metadata parsing
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=645dd276049e8dbab37...
Commit: 645dd276049e8dbab37b169b27cf6af29a8bd8e5
Parent: ef2d61fea81dbae3d1a32d20ee22d2afae7701af
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Feb 5 11:32:54 2019 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu May 23 11:57:38 2019 -0500
separate code for setting devices from metadata parsing
Pull the code that sets devs for PVs out of the metadata
parsing code and call it separately.
---
lib/format_text/archiver.c | 3 ++
lib/format_text/import.c | 8 +++--
lib/format_text/import_vsn1.c | 51 ----------------------------
lib/metadata/metadata.c | 75 +++++++++++++++++++++++++++++++++++++++++
lib/metadata/metadata.h | 2 +
tools/pvscan.c | 2 +
6 files changed, 87 insertions(+), 54 deletions(-)
diff --git a/lib/format_text/archiver.c b/lib/format_text/archiver.c
index 34eff55..052c2bd 100644
--- a/lib/format_text/archiver.c
+++ b/lib/format_text/archiver.c
@@ -320,6 +320,9 @@ struct volume_group *backup_read_vg(struct cmd_context *cmd,
break;
}
+ if (vg)
+ set_pv_devices(tf, vg);
+
if (!vg)
tf->fmt->ops->destroy_instance(tf);
diff --git a/lib/format_text/import.c b/lib/format_text/import.c
index d487100..64fbb08 100644
--- a/lib/format_text/import.c
+++ b/lib/format_text/import.c
@@ -229,9 +229,11 @@ static struct volume_group *_import_vg_from_config_tree(const struct dm_config_t
*/
if (!(vg = (*vsn)->read_vg(fid, cft, allow_lvmetad_extensions)))
stack;
- else if ((vg_missing = vg_missing_pv_count(vg))) {
- log_verbose("There are %d physical volumes missing.",
- vg_missing);
+ else {
+ set_pv_devices(fid, vg);
+
+ if ((vg_missing = vg_missing_pv_count(vg)))
+ log_verbose("There are %d physical volumes missing.", vg_missing);
vg_mark_partial_lvs(vg, 1);
/* FIXME: move this code inside read_vg() */
}
diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c
index 8dad8e9..43ec10b 100644
--- a/lib/format_text/import_vsn1.c
+++ b/lib/format_text/import_vsn1.c
@@ -206,21 +206,6 @@ static int _read_pv(struct format_instance *fid,
pv->is_labelled = 1; /* All format_text PVs are labelled. */
- /*
- * Convert the uuid into a device.
- */
- if (!(pv->dev = lvmcache_device_from_pvid(fid->fmt->cmd, &pv->id, &pv->label_sector))) {
- char buffer[64] __attribute__((aligned(8)));
-
- if (!id_write_format(&pv->id, buffer, sizeof(buffer)))
- buffer[0] = '\0';
-
- if (fid->fmt->cmd && !fid->fmt->cmd->pvscan_cache_single)
- log_error_once("Couldn't find device with uuid %s.", buffer);
- else
- log_debug_metadata("Couldn't find device with uuid %s.", buffer);
- }
-
if (!(pv->vg_name = dm_pool_strdup(mem, vg->name)))
return_0;
@@ -231,15 +216,6 @@ static int _read_pv(struct format_instance *fid,
return 0;
}
- if (!pv->dev)
- pv->status |= MISSING_PV;
-
- if ((pv->status & MISSING_PV) && pv->dev && pv_mda_used_count(pv) == 0) {
- pv->status &= ~MISSING_PV;
- log_info("Recovering a previously MISSING PV %s with no MDAs.",
- pv_dev_name(pv));
- }
-
/* Late addition */
if (dm_config_has_node(pvn, "dev_size") &&
!_read_uint64(pvn, "dev_size", &pv->size)) {
@@ -292,33 +268,6 @@ static int _read_pv(struct format_instance *fid,
pv->pe_align = 0;
pv->fmt = fid->fmt;
- /*
- * It would be nice to check this earlier, e.g. in or after label scan,
- * but this is first time we get far enough through the vg metadata to
- * see the PV size, and can finally compare it with the device size.
- */
- if (pv->dev && (pv->size != pv->dev->size)) {
- if (dev_is_md_component(pv->dev, NULL, 1)) {
- log_warn("WARNING: device %s is an md component, ignoring PV.", dev_name(pv->dev));
- return_0;
- }
- }
-
- /* Fix up pv size if missing or impossibly large */
- if ((!pv->size || pv->size > (1ULL << 62)) && pv->dev) {
- if (!dev_get_size(pv->dev, &pv->size)) {
- log_error("%s: Couldn't get size.", pv_dev_name(pv));
- return 0;
- }
- log_verbose("Fixing up missing size (%s) "
- "for PV %s", display_size(fid->fmt->cmd, pv->size),
- pv_dev_name(pv));
- size = pv->pe_count * (uint64_t) vg->extent_size + pv->pe_start;
- if (size > pv->size)
- log_warn("WARNING: Physical Volume %s is too large "
- "for underlying device", pv_dev_name(pv));
- }
-
if (!alloc_pv_segment_whole_pv(mem, pv))
return_0;
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index e9d4fa2..8f6de26 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3866,6 +3866,9 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
continue;
}
+ if (vg)
+ set_pv_devices(fid, vg);
+
/* Use previous VG because checksum matches */
if (!vg) {
vg = correct_vg;
@@ -4073,6 +4076,9 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
continue;
}
+ if (vg)
+ set_pv_devices(fid, vg);
+
/* Use previous VG because checksum matches */
if (!vg) {
vg = correct_vg;
@@ -4498,6 +4504,75 @@ bad:
return NULL;
}
+/*
+ * FIXME: we only want to print the warnings when this is called from
+ * vg_read, not from import_vg_from_metadata, so do the warnings elsewhere
+ * or avoid calling this from import_vg_from.
+ */
+static void _set_pv_device(struct format_instance *fid,
+ struct volume_group *vg,
+ struct physical_volume *pv)
+{
+ char buffer[64] __attribute__((aligned(8)));
+ uint64_t size;
+
+ if (!(pv->dev = lvmcache_device_from_pvid(fid->fmt->cmd, &pv->id, &pv->label_sector))) {
+ if (!id_write_format(&pv->id, buffer, sizeof(buffer)))
+ buffer[0] = '\0';
+
+ if (fid->fmt->cmd && !fid->fmt->cmd->pvscan_cache_single)
+ log_error_once("Couldn't find device with uuid %s.", buffer);
+ else
+ log_debug_metadata("Couldn't find device with uuid %s.", buffer);
+ }
+
+ /*
+ * A previous command wrote the VG while this dev was missing, so
+ * the MISSING flag was included in the PV.
+ */
+ if ((pv->status & MISSING_PV) && pv->dev)
+ log_warn("WARNING: VG %s was previously updated while PV %s was missing.", vg->name, dev_name(pv->dev));
+
+ /*
+ * If this command writes the VG, we want the MISSING flag to be
+ * written for this PV with no device.
+ */
+ if (!pv->dev)
+ pv->status |= MISSING_PV;
+
+ /* is this correct? */
+ if ((pv->status & MISSING_PV) && pv->dev && (pv_mda_used_count(pv) == 0)) {
+ pv->status &= ~MISSING_PV;
+ log_info("Found a previously MISSING PV %s with no MDAs.", pv_dev_name(pv));
+ }
+
+ /* Fix up pv size if missing or impossibly large */
+ if ((!pv->size || pv->size > (1ULL << 62)) && pv->dev) {
+ if (!dev_get_size(pv->dev, &pv->size)) {
+ log_error("%s: Couldn't get size.", pv_dev_name(pv));
+ return;
+ }
+ log_verbose("Fixing up missing size (%s) for PV %s", display_size(fid->fmt->cmd, pv->size),
+ pv_dev_name(pv));
+ size = pv->pe_count * (uint64_t) vg->extent_size + pv->pe_start;
+ if (size > pv->size)
+ log_warn("WARNING: Physical Volume %s is too large "
+ "for underlying device", pv_dev_name(pv));
+ }
+}
+
+/*
+ * Finds the 'struct device' that correponds to each PV in the metadata,
+ * and may make some adjustments to vg fields based on the dev properties.
+ */
+void set_pv_devices(struct format_instance *fid, struct volume_group *vg)
+{
+ struct pv_list *pvl;
+
+ dm_list_iterate_items(pvl, &vg->pvs)
+ _set_pv_device(fid, vg, pvl->pv);
+}
+
int get_vgnameids(struct cmd_context *cmd, struct dm_list *vgnameids,
const char *only_this_vgname, int include_internal)
{
diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h
index 8e9c18a..a140c29 100644
--- a/lib/metadata/metadata.h
+++ b/lib/metadata/metadata.h
@@ -502,4 +502,6 @@ struct id pv_vgid(const struct physical_volume *pv);
uint64_t find_min_mda_size(struct dm_list *mdas);
char *tags_format_and_copy(struct dm_pool *mem, const struct dm_list *tagsl);
+void set_pv_devices(struct format_instance *fid, struct volume_group *vg);
+
#endif
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 6d89426..d41345f 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -617,6 +617,8 @@ static int _online_pvscan_one(struct cmd_context *cmd, struct device *dev,
if (pvid_without_metadata)
*pvid_without_metadata = dm_pool_strdup(cmd->mem, dev->pvid);
fmt->ops->destroy_instance(baton.fid);
+ } else {
+ set_pv_devices(baton.fid, baton.vg);
}
if (baton.vg && vg_is_shared(baton.vg)) {
4 years, 6 months
master - WHATS_NEW: pvck --dump
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ef2d61fea81dbae3d1a...
Commit: ef2d61fea81dbae3d1a32d20ee22d2afae7701af
Parent: 52586b1039a0c1d273676416ba074cadde308bc4
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu May 23 11:50:16 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu May 23 11:50:16 2019 -0500
WHATS_NEW: pvck --dump
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6ab973d..fd27c33 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.02 -
===================================
+ Add pvck --dump option to extract metadata.
Fix signal delivery checking race in libdaemon (lvmetad).
Add missing Before=shutdown.target to LVM2 services to fix shutdown ordering.
Skip autoactivation for a PV when PV size does not match device size.
4 years, 6 months
master - pvck: new dump option to extract metadata
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=52586b1039a0c1d2736...
Commit: 52586b1039a0c1d273676416ba074cadde308bc4
Parent: 1022b88a66dd02e981e738719e17452cd5c1bd59
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed May 22 14:25:08 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu May 23 11:49:06 2019 -0500
pvck: new dump option to extract metadata
The new command 'pvck --dump metadata PV' will extract
the current version of VG metadata from a PV for testing
and debugging. --dump metadata_area extracts the entire
text metadata area.
---
lib/cache/lvmcache.c | 31 ++++++
lib/cache/lvmcache.h | 5 +
lib/format_text/format-text.c | 218 +++++++++++++++++++++++++++++++++++++++++
lib/format_text/format-text.h | 14 +++
man/pvck.8_des | 9 ++-
tools/args.h | 5 +
tools/command-lines.in | 6 +
tools/commands.h | 2 +-
tools/pvck.c | 99 ++++++++++++++++++-
9 files changed, 386 insertions(+), 3 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 7d0c60d..a4037a5 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -2301,3 +2301,34 @@ int lvmcache_vginfo_has_pvid(struct lvmcache_vginfo *vginfo, char *pvid)
}
return 0;
}
+
+struct metadata_area *lvmcache_get_mda(struct cmd_context *cmd,
+ const char *vgname,
+ struct device *dev,
+ int use_mda_num)
+{
+ struct lvmcache_vginfo *vginfo;
+ struct lvmcache_info *info;
+ struct metadata_area *mda;
+
+ if (!use_mda_num)
+ use_mda_num = 1;
+
+ if (!(vginfo = lvmcache_vginfo_from_vgname(vgname, NULL)))
+ return NULL;
+
+ dm_list_iterate_items(info, &vginfo->infos) {
+ if (info->dev != dev)
+ continue;
+
+ dm_list_iterate_items(mda, &info->mdas) {
+ if ((use_mda_num == 1) && (mda->status & MDA_PRIMARY))
+ return mda;
+ if ((use_mda_num == 2) && !(mda->status & MDA_PRIMARY))
+ return mda;
+ }
+ return NULL;
+ }
+ return NULL;
+}
+
diff --git a/lib/cache/lvmcache.h b/lib/cache/lvmcache.h
index 26e0953..5e59b94 100644
--- a/lib/cache/lvmcache.h
+++ b/lib/cache/lvmcache.h
@@ -168,6 +168,11 @@ unsigned lvmcache_mda_count(struct lvmcache_info *info);
int lvmcache_vgid_is_cached(const char *vgid);
uint64_t lvmcache_smallest_mda_size(struct lvmcache_info *info);
+struct metadata_area *lvmcache_get_mda(struct cmd_context *cmd,
+ const char *vgname,
+ struct device *dev,
+ int use_mda_num);
+
int lvmcache_found_duplicate_pvs(void);
int lvmcache_found_duplicate_vgnames(void);
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 3828d5f..abf8afc 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -2602,3 +2602,221 @@ bad:
return NULL;
}
+
+static char *_read_metadata_text(struct cmd_context *cmd, struct device *dev,
+ uint64_t area_start, uint64_t area_size,
+ uint32_t *len, uint64_t *disk_offset)
+{
+ struct mda_header *mh;
+ struct raw_locn *rlocn_slot0;
+ uint64_t text_offset, text_size;
+ char *area_buf;
+ char *text_buf;
+
+ /*
+ * Read the entire metadata area, including mda_header and entire
+ * circular buffer.
+ */
+ if (!(area_buf = malloc(area_size)))
+ return_NULL;
+
+ if (!dev_read_bytes(dev, area_start, area_size, area_buf)) {
+ log_error("Failed to read device %s at %llu size %llu",
+ dev_name(dev),
+ (unsigned long long)area_start,
+ (unsigned long long)area_size);
+ return NULL;
+ }
+
+ mh = (struct mda_header *)area_buf;
+ _xlate_mdah(mh);
+
+ rlocn_slot0 = &mh->raw_locns[0];
+ text_offset = rlocn_slot0->offset;
+ text_size = rlocn_slot0->size;
+
+ /*
+ * Copy and return the current metadata text out of the metadata area.
+ */
+
+ if (!(text_buf = malloc(text_size)))
+ return_NULL;
+
+ memcpy(text_buf, area_buf + text_offset, text_size);
+
+ if (len)
+ *len = (uint32_t)text_size;
+ if (disk_offset)
+ *disk_offset = area_start + text_offset;
+
+ free(area_buf);
+
+ return text_buf;
+}
+
+int dump_metadata_text(struct cmd_context *cmd,
+ const char *vgname,
+ const char *vgid,
+ struct device *dev,
+ struct metadata_area *mda,
+ const char *tofile)
+{
+ char *textbuf;
+ struct format_instance *fid;
+ struct format_instance_ctx fic;
+ struct mda_context *mdac;
+ struct volume_group *vg;
+ unsigned use_previous_vg = 0;
+ uint32_t textlen = 0;
+ uint32_t textcrc;
+ uint64_t text_disk_offset;
+ int ret = 0;
+
+ /*
+ * Set up overhead/abstractions for reading a given vgname
+ * (fmt/fid/fic/vgid).
+ */
+
+ fic.type = FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS;
+ fic.context.vg_ref.vg_name = vgname;
+ fic.context.vg_ref.vg_id = vgid;
+
+ if (!(fid = _text_create_text_instance(cmd->fmt, &fic))) {
+ log_error("Failed to create format instance");
+ return 0;
+ }
+
+ mdac = mda->metadata_locn;
+
+ /*
+ * Read the VG metadata from the device as a raw chunk of original text.
+ */
+ textbuf = _read_metadata_text(cmd, dev,
+ mdac->area.start, mdac->area.size,
+ &textlen, &text_disk_offset);
+ if (!textbuf || !textlen) {
+ log_error("No metadata text found on %s", dev_name(dev));
+ _text_destroy_instance(fid);
+ return 0;
+ }
+
+ textcrc = calc_crc(INITIAL_CRC, (uint8_t *)textbuf, textlen);
+
+ /*
+ * Read the same VG metadata, but imported/parsed into a vg struct
+ * format so we know it's valid/parsable, and can look at values in it.
+ */
+ if (!(vg = _vg_read_raw(fid, vgname, mda, NULL, &use_previous_vg))) {
+ log_warn("WARNING: parse error for metadata on %s.", dev_name(dev));
+ _text_destroy_instance(fid);
+ }
+
+ log_print("Metadata for %s from %s at %llu size %u with seqno %u checksum 0x%x.",
+ vgname, dev_name(dev),
+ (unsigned long long)text_disk_offset, textlen,
+ vg ? vg->seqno : 0, textcrc);
+
+ if (!tofile) {
+ log_print("---");
+ printf("%s\n", textbuf);
+ log_print("---");
+ } else {
+ FILE *fp;
+ if (!(fp = fopen(tofile, "wx"))) {
+ log_error("Failed to create file %s", tofile);
+ goto out;
+ }
+
+ fprintf(fp, "%s", textbuf);
+
+ if (fflush(fp))
+ stack;
+ if (fclose(fp))
+ stack;
+ }
+
+ if (vg)
+ release_vg(vg);
+
+ free(textbuf);
+ ret = 1;
+out:
+ return ret;
+}
+
+static char *_read_metadata_area(struct cmd_context *cmd, struct device *dev,
+ uint64_t area_start, uint64_t area_size)
+{
+ char *area_buf;
+
+ /*
+ * Read the entire metadata area, including mda_header and entire
+ * circular buffer.
+ */
+ if (!(area_buf = malloc(area_size)))
+ return_NULL;
+
+ if (!dev_read_bytes(dev, area_start, area_size, area_buf)) {
+ log_error("Failed to read device %s at %llu size %llu",
+ dev_name(dev),
+ (unsigned long long)area_start,
+ (unsigned long long)area_size);
+ return NULL;
+ }
+
+ return area_buf;
+}
+
+int dump_metadata_area(struct cmd_context *cmd,
+ const char *vgname,
+ const char *vgid,
+ struct device *dev,
+ struct metadata_area *mda,
+ const char *tofile)
+{
+ char *areabuf;
+ char *textbuf;
+ struct mda_context *mdac;
+ int ret = 0;
+
+ mdac = mda->metadata_locn;
+
+ areabuf = _read_metadata_area(cmd, dev,
+ mdac->area.start, mdac->area.size);
+ if (!areabuf) {
+ log_error("No metadata area found on %s", dev_name(dev));
+ return 0;
+ }
+
+ log_print("Metadata buffer for %s from %s in area at %llu size %llu offset 512.",
+ vgname, dev_name(dev),
+ (unsigned long long)mdac->area.start,
+ (unsigned long long)mdac->area.size);
+
+ /* text starts after mda_header which uses 512 bytes */
+ textbuf = areabuf + 512;
+
+ if (!tofile) {
+ /* N.B. this will often include unprintable data */
+ log_print("---");
+ fwrite(textbuf, mdac->area.size - 512, 1, stdout);
+ log_print("---");
+ } else {
+ FILE *fp;
+ if (!(fp = fopen(tofile, "wx"))) {
+ log_error("Failed to create file %s", tofile);
+ goto out;
+ }
+
+ fwrite(textbuf, mdac->area.size - 512, 1, fp);
+
+ if (fflush(fp))
+ stack;
+ if (fclose(fp))
+ stack;
+ }
+ ret = 1;
+out:
+ free(areabuf);
+ return ret;
+}
diff --git a/lib/format_text/format-text.h b/lib/format_text/format-text.h
index 1300e58..6be237b 100644
--- a/lib/format_text/format-text.h
+++ b/lib/format_text/format-text.h
@@ -76,4 +76,18 @@ struct data_area_list {
struct disk_locn disk_locn;
};
+int dump_metadata_text(struct cmd_context *cmd,
+ const char *vgname,
+ const char *vgid,
+ struct device *dev,
+ struct metadata_area *mda,
+ const char *tofile);
+
+int dump_metadata_area(struct cmd_context *cmd,
+ const char *vgname,
+ const char *vgid,
+ struct device *dev,
+ struct metadata_area *mda,
+ const char *tofile);
+
#endif
diff --git a/man/pvck.8_des b/man/pvck.8_des
index 0a32657..fb826d3 100644
--- a/man/pvck.8_des
+++ b/man/pvck.8_des
@@ -1 +1,8 @@
-pvck checks the LVM metadata for consistency on PVs.
+pvck checks LVM metadata on PVs.
+
+Use the --dump option to extract metadata from PVs for debugging.
+With dump, set --pvmetadatacopies 2 to extract metadata from a
+second metadata area at the end of the device. Use the --file
+option to save the raw metadata to a specified file. (The raw
+metadata is not usable with vgcfgbackup and vgcfgrestore.)
+
diff --git a/tools/args.h b/tools/args.h
index 3d72e8a..c1efdd6 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -213,6 +213,11 @@ arg(driverloaded_ARG, '\0', "driverloaded", bool_VAL, 0, 0,
"If set to no, the command will not attempt to use device-mapper.\n"
"For testing and debugging.\n")
+arg(dump_ARG, '\0', "dump", string_VAL, 0, 0,
+ "Dump metadata from a PV. Option values include \\fBmetadata\\fP\n"
+ "to extract the current text metadata, and \\fBmetadata_area\\fP\n"
+ "to extract the entire text metadata area.\n")
+
arg(errorwhenfull_ARG, '\0', "errorwhenfull", bool_VAL, 0, 0,
"Specifies thin pool behavior when data space is exhausted.\n"
"When yes, device-mapper will immediately return an error\n"
diff --git a/tools/command-lines.in b/tools/command-lines.in
index 0de3de7..0d97348 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -1427,6 +1427,12 @@ ID: pvresize_general
pvck PV ...
OO: --labelsector Number
ID: pvck_general
+DESC: Check for metadata on a device
+
+pvck --dump String PV
+OO: --file String, --pvmetadatacopies MetadataCopiesPV
+ID: pvck_dumpmetadata
+DESC: Dump raw metadata from a device
---
diff --git a/tools/commands.h b/tools/commands.h
index 83e50e7..612182b 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -114,7 +114,7 @@ xx(pvresize,
0)
xx(pvck,
- "Check the consistency of physical volume(s)",
+ "Check metadata on physical volumes",
LOCKD_VG_SH)
xx(pvcreate,
diff --git a/tools/pvck.c b/tools/pvck.c
index ce74036..15c7e6d 100644
--- a/tools/pvck.c
+++ b/tools/pvck.c
@@ -15,17 +15,115 @@
#include "base/memory/zalloc.h"
#include "tools.h"
+#include "lib/format_text/format-text.h"
+
+/*
+ * TODO: option to dump all copies of metadata that are found
+ *
+ * TODO: option to intelligently search for mda locations on
+ * disk in case the pv_header and/or mda_header are damaged.
+ */
+
+static int _dump_metadata(struct cmd_context *cmd, int argc, char **argv, int full_area)
+{
+ struct dm_list devs;
+ struct device_list *devl;
+ struct device *dev;
+ const char *pv_name;
+ const char *vgname;
+ const char *vgid;
+ struct lvmcache_info *info;
+ struct metadata_area *mda;
+ const char *tofile = NULL;
+ int mda_num = 1;
+ int ret;
+
+ dm_list_init(&devs);
+
+ if (arg_is_set(cmd, file_ARG)) {
+ if (!(tofile = arg_str_value(cmd, file_ARG, NULL)))
+ return ECMD_FAILED;
+ }
+
+ /* 1: dump metadata from first mda, 2: dump metadata from second mda */
+ if (arg_is_set(cmd, pvmetadatacopies_ARG))
+ mda_num = arg_int_value(cmd, pvmetadatacopies_ARG, 1);
+
+ pv_name = argv[0];
+
+ if (!(dev = dev_cache_get(cmd, pv_name, cmd->filter))) {
+ log_error("No device found for %s %s.", pv_name, dev_cache_filtered_reason(pv_name));
+ return ECMD_FAILED;
+ }
+
+ if (!(devl = zalloc(sizeof(*devl))))
+ return ECMD_FAILED;
+
+ devl->dev = dev;
+ dm_list_add(&devs, &devl->list);
+
+ label_scan_setup_bcache();
+ label_scan_devs(cmd, cmd->filter, &devs);
+
+ if (!dev->pvid[0]) {
+ log_error("No PV ID found for %s", dev_name(dev));
+ return ECMD_FAILED;
+ }
+
+ if (!(info = lvmcache_info_from_pvid(dev->pvid, dev, 0))) {
+ log_error("No VG info found for %s", dev_name(dev));
+ return ECMD_FAILED;
+ }
+
+ if (!(vgname = lvmcache_vgname_from_info(info))) {
+ log_error("No VG name found for %s", dev_name(dev));
+ return ECMD_FAILED;
+ }
+
+ if (!(vgid = lvmcache_vgid_from_vgname(cmd, vgname))) {
+ log_error("No VG ID found for %s", dev_name(dev));
+ return ECMD_FAILED;
+ }
+
+ if (!(mda = lvmcache_get_mda(cmd, vgname, dev, mda_num))) {
+ log_error("No mda %d found for %s", mda_num, dev_name(dev));
+ return ECMD_FAILED;
+ }
+
+ if (full_area)
+ ret = dump_metadata_area(cmd, vgname, vgid, dev, mda, tofile);
+ else
+ ret = dump_metadata_text(cmd, vgname, vgid, dev, mda, tofile);
+
+ if (!ret)
+ return ECMD_FAILED;
+ return ECMD_PROCESSED;
+}
int pvck(struct cmd_context *cmd, int argc, char **argv)
{
struct dm_list devs;
struct device_list *devl;
struct device *dev;
+ const char *dump;
const char *pv_name;
uint64_t labelsector;
int i;
int ret_max = ECMD_PROCESSED;
+ if (arg_is_set(cmd, dump_ARG)) {
+ dump = arg_str_value(cmd, dump_ARG, NULL);
+
+ if (!strcmp(dump, "metadata"))
+ return _dump_metadata(cmd, argc, argv, 0);
+
+ if (!strcmp(dump, "metadata_area"))
+ return _dump_metadata(cmd, argc, argv, 1);
+
+ log_error("Unknown dump value.");
+ return ECMD_FAILED;
+ }
+
labelsector = arg_uint64_value(cmd, labelsector_ARG, UINT64_C(0));
dm_list_init(&devs);
@@ -53,7 +151,6 @@ int pvck(struct cmd_context *cmd, int argc, char **argv)
label_scan_devs(cmd, cmd->filter, &devs);
dm_list_iterate_items(devl, &devs) {
-
/*
* The scan above will populate lvmcache with any info from the
* standard locations at the start of the device. Now populate
4 years, 6 months
master - tests: change mkfs usage in lvconvert raid tests
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1022b88a66dd02e981e...
Commit: 1022b88a66dd02e981e738719e17452cd5c1bd59
Parent: 6169c0a51b8098e4ffa15fb52cafccf7a73ab22c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu May 23 11:45:26 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu May 23 11:45:26 2019 -0500
tests: change mkfs usage in lvconvert raid tests
The "echo y | mkfs" was failing at times from echo y.
Remove echo y and replace with wipefs -a prior to mkfs.
---
...ert-raid-reshape-linear_to_raid6-single-type.sh | 3 ++-
...t-raid-reshape-linear_to_striped-single-type.sh | 3 ++-
.../lvconvert-raid-reshape-linear_to_striped.sh | 3 ++-
test/shell/lvconvert-raid-reshape-load.sh | 3 ++-
...t-raid-reshape-striped_to_linear-single-type.sh | 3 ++-
.../lvconvert-raid-reshape-striped_to_linear.sh | 3 ++-
.../lvconvert-raid-reshape-stripes-load-fail.sh | 3 ++-
.../lvconvert-raid-reshape-stripes-load-reload.sh | 3 ++-
test/shell/lvconvert-raid-reshape-stripes-load.sh | 3 ++-
test/shell/lvconvert-raid-restripe-linear.sh | 3 ++-
test/shell/lvconvert-raid5_to_raid10.sh | 3 ++-
11 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/test/shell/lvconvert-raid-reshape-linear_to_raid6-single-type.sh b/test/shell/lvconvert-raid-reshape-linear_to_raid6-single-type.sh
index cbacf4a..b75e690 100644
--- a/test/shell/lvconvert-raid-reshape-linear_to_raid6-single-type.sh
+++ b/test/shell/lvconvert-raid-reshape-linear_to_raid6-single-type.sh
@@ -32,7 +32,8 @@ lvcreate -aey -L 16M -n $lv $vg
check lv_field $vg/$lv segtype "linear"
check lv_field $vg/$lv stripes 1
check lv_field $vg/$lv data_stripes 1
-echo y|mkfs -t ext4 $DM_DEV_DIR/$vg/$lv
+wipefs -a $DM_DEV_DIR/$vg/$lv
+mkfs -t ext4 $DM_DEV_DIR/$vg/$lv
fsck -fn $DM_DEV_DIR/$vg/$lv
# Convert linear -> raid1 (takeover)
diff --git a/test/shell/lvconvert-raid-reshape-linear_to_striped-single-type.sh b/test/shell/lvconvert-raid-reshape-linear_to_striped-single-type.sh
index 6d49f54..62bf482 100644
--- a/test/shell/lvconvert-raid-reshape-linear_to_striped-single-type.sh
+++ b/test/shell/lvconvert-raid-reshape-linear_to_striped-single-type.sh
@@ -31,7 +31,8 @@ lvcreate -aey -L 16M -n $lv $vg
check lv_field $vg/$lv segtype "linear"
check lv_field $vg/$lv stripes 1
check lv_field $vg/$lv data_stripes 1
-echo y|mkfs -t ext4 $DM_DEV_DIR/$vg/$lv
+wipefs -a $DM_DEV_DIR/$vg/$lv
+mkfs -t ext4 $DM_DEV_DIR/$vg/$lv
fsck -fn $DM_DEV_DIR/$vg/$lv
# Convert linear -> raid1
diff --git a/test/shell/lvconvert-raid-reshape-linear_to_striped.sh b/test/shell/lvconvert-raid-reshape-linear_to_striped.sh
index c398c5e..b77a1d9 100644
--- a/test/shell/lvconvert-raid-reshape-linear_to_striped.sh
+++ b/test/shell/lvconvert-raid-reshape-linear_to_striped.sh
@@ -30,7 +30,8 @@ lvcreate -aey -L 16M -n $lv1 $vg
check lv_field $vg/$lv1 segtype "linear"
check lv_field $vg/$lv1 stripes 1
check lv_field $vg/$lv1 data_stripes 1
-echo y|mkfs -t ext4 $DM_DEV_DIR/$vg/$lv1
+wipefs -a $DM_DEV_DIR/$vg/$lv1
+mkfs -t ext4 $DM_DEV_DIR/$vg/$lv1
fsck -fn $DM_DEV_DIR/$vg/$lv1
# Convert linear -> raid1
diff --git a/test/shell/lvconvert-raid-reshape-load.sh b/test/shell/lvconvert-raid-reshape-load.sh
index 11af24d..7cd149b 100644
--- a/test/shell/lvconvert-raid-reshape-load.sh
+++ b/test/shell/lvconvert-raid-reshape-load.sh
@@ -44,7 +44,8 @@ lvcreate --yes --type raid5_ls --stripes 13 -L190M -n$lv1 $vg
check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
check lv_first_seg_field $vg/$lv1 data_stripes 13
check lv_first_seg_field $vg/$lv1 stripes 14
-echo y|mkfs -t ext4 /dev/$vg/$lv1
+wipefs -a /dev/$vg/$lv1
+mkfs -t ext4 /dev/$vg/$lv1
aux wait_for_sync $vg $lv1
mkdir -p $mount_dir
diff --git a/test/shell/lvconvert-raid-reshape-striped_to_linear-single-type.sh b/test/shell/lvconvert-raid-reshape-striped_to_linear-single-type.sh
index 60fc59f..9840eea 100644
--- a/test/shell/lvconvert-raid-reshape-striped_to_linear-single-type.sh
+++ b/test/shell/lvconvert-raid-reshape-striped_to_linear-single-type.sh
@@ -32,7 +32,8 @@ check lv_first_seg_field $vg/$lv segtype "striped"
check lv_first_seg_field $vg/$lv stripes 4
check lv_first_seg_field $vg/$lv data_stripes 4
check lv_first_seg_field $vg/$lv stripesize "64.00k"
-echo y|mkfs -t ext4 $DM_DEV_DIR/$vg/$lv
+wipefs -a $DM_DEV_DIR/$vg/$lv
+mkfs -t ext4 $DM_DEV_DIR/$vg/$lv
fsck -fn $DM_DEV_DIR/$vg/$lv
lvextend -y -L64M $DM_DEV_DIR/$vg/$lv
diff --git a/test/shell/lvconvert-raid-reshape-striped_to_linear.sh b/test/shell/lvconvert-raid-reshape-striped_to_linear.sh
index e217ea3..77e04bc 100644
--- a/test/shell/lvconvert-raid-reshape-striped_to_linear.sh
+++ b/test/shell/lvconvert-raid-reshape-striped_to_linear.sh
@@ -33,7 +33,8 @@ check lv_field $vg/$lv1 data_stripes 4
check lv_field $vg/$lv1 stripes 4
check lv_field $vg/$lv1 stripesize "32.00k"
check lv_field $vg/$lv1 reshape_len_le ""
-echo y|mkfs -t ext4 $DM_DEV_DIR/$vg/$lv1
+wipefs -a $DM_DEV_DIR/$vg/$lv1
+mkfs -t ext4 $DM_DEV_DIR/$vg/$lv1
fsck -fn $DM_DEV_DIR/$vg/$lv1
# Convert striped -> raid5(_n)
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh b/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
index 5fa21dc..8dda252 100644
--- a/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
+++ b/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
@@ -45,7 +45,8 @@ check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
check lv_first_seg_field $vg/$lv1 data_stripes 10
check lv_first_seg_field $vg/$lv1 stripes 11
-echo y|mkfs -t ext4 /dev/$vg/$lv1
+wipefs -a /dev/$vg/$lv1
+mkfs -t ext4 /dev/$vg/$lv1
fsck -fn /dev/$vg/$lv1
mkdir -p $mount_dir
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh b/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
index 61afa88..7318561 100644
--- a/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
+++ b/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
@@ -48,7 +48,8 @@ check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
check lv_first_seg_field $vg/$lv1 data_stripes 10
check lv_first_seg_field $vg/$lv1 stripes 11
-echo y|mkfs -t ext4 /dev/$vg/$lv1
+wipefs -a /dev/$vg/$lv1
+mkfs -t ext4 /dev/$vg/$lv1
mkdir -p "$mount_dir"
mount "$DM_DEV_DIR/$vg/$lv1" "$mount_dir"
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load.sh b/test/shell/lvconvert-raid-reshape-stripes-load.sh
index dd04798..32c8174 100644
--- a/test/shell/lvconvert-raid-reshape-stripes-load.sh
+++ b/test/shell/lvconvert-raid-reshape-stripes-load.sh
@@ -45,7 +45,8 @@ check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
check lv_first_seg_field $vg/$lv1 data_stripes 10
check lv_first_seg_field $vg/$lv1 stripes 11
-echo y|mkfs -t ext4 /dev/$vg/$lv1
+wipefs -a /dev/$vg/$lv1
+mkfs -t ext4 /dev/$vg/$lv1
mkdir -p $mount_dir
mount "$DM_DEV_DIR/$vg/$lv1" $mount_dir
diff --git a/test/shell/lvconvert-raid-restripe-linear.sh b/test/shell/lvconvert-raid-restripe-linear.sh
index 70d31db..b770a47 100644
--- a/test/shell/lvconvert-raid-restripe-linear.sh
+++ b/test/shell/lvconvert-raid-restripe-linear.sh
@@ -29,7 +29,8 @@ lvcreate -aey -L 16M -n $lv $vg
check lv_field $vg/$lv segtype "linear"
check lv_field $vg/$lv stripes 1
check lv_field $vg/$lv data_stripes 1
-echo y|mkfs -t ext4 $DM_DEV_DIR/$vg/$lv
+wipefs -a $DM_DEV_DIR/$vg/$lv
+mkfs -t ext4 $DM_DEV_DIR/$vg/$lv
fsck -fn $DM_DEV_DIR/$vg/$lv
# Convert linear -> raid1
diff --git a/test/shell/lvconvert-raid5_to_raid10.sh b/test/shell/lvconvert-raid5_to_raid10.sh
index e38e4d3..28f3026 100644
--- a/test/shell/lvconvert-raid5_to_raid10.sh
+++ b/test/shell/lvconvert-raid5_to_raid10.sh
@@ -30,7 +30,8 @@ check lv_field $vg/$lv1 segtype "raid5"
check lv_field $vg/$lv1 stripes 4
check lv_field $vg/$lv1 data_stripes 3
check lv_field $vg/$lv1 region_size "256.00k"
-echo y|mkfs -t ext4 $DM_DEV_DIR/$vg/$lv1
+wipefs -a $DM_DEV_DIR/$vg/$lv1
+mkfs -t ext4 $DM_DEV_DIR/$vg/$lv1
fsck -fn $DM_DEV_DIR/$vg/$lv1
aux wait_for_sync $vg $lv1
fsck -fn $DM_DEV_DIR/$vg/$lv1
4 years, 6 months
master - tests: fix error detection in lvconvert-raid-takeover.sh
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6169c0a51b8098e4ffa...
Commit: 6169c0a51b8098e4ffa15fb52cafccf7a73ab22c
Parent: 2036608423117626eb1905b38e09c767983b2ef4
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu May 23 10:29:52 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu May 23 10:29:52 2019 -0500
tests: fix error detection in lvconvert-raid-takeover.sh
---
test/shell/lvconvert-raid-takeover.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvconvert-raid-takeover.sh b/test/shell/lvconvert-raid-takeover.sh
index b57cbe9..6a4d554 100644
--- a/test/shell/lvconvert-raid-takeover.sh
+++ b/test/shell/lvconvert-raid-takeover.sh
@@ -26,7 +26,7 @@ aux prepare_vg 8
# FIXME: lvconvert leaks 'error' devices
detect_error_leak_()
{
- dmsetup table -S "name=~^$vg-" | not grep "error" || \
+ dmsetup table -S "name=~^$vg-" | awk '{print $3}'| not grep error || \
die "Device(s) with error target should not be here."
}
4 years, 6 months
master - tests: pvscan-cache try to fix teardown problems
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2036608423117626eb1...
Commit: 2036608423117626eb1905b38e09c767983b2ef4
Parent: 78afe75b08c01e70d52e42b62acf0d6eab7874dc
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed May 22 11:55:48 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed May 22 11:55:48 2019 -0500
tests: pvscan-cache try to fix teardown problems
teardown after the test was failing, probably because
of uncoordinated udev actions running on the test
system. Try to avoid this by doing some work before
teardown.
---
test/shell/pvscan-cache.sh | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/test/shell/pvscan-cache.sh b/test/shell/pvscan-cache.sh
index e0576f9..8788594 100644
--- a/test/shell/pvscan-cache.sh
+++ b/test/shell/pvscan-cache.sh
@@ -75,4 +75,7 @@ aux enable_dev "$dev2"
pvscan --cache
check pv_field "$dev1" vg_name "$vg1"
+vgchange -an $vg1
+lvremove $vg1/$lv1
+
vgremove -ff $vg1
4 years, 6 months
stable-2.02 - man: updates to lvmlockd
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c733e9644537c7901ca...
Commit: c733e9644537c7901caf245c1b3fdcdeba76cc12
Parent: 3669c33af4279c93c8a9104de9501ba9cf6a2745
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue May 21 15:14:24 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue May 21 15:14:24 2019 -0500
man: updates to lvmlockd
- remove references to adopting locks which is not used
- move some sanlock-specific info out of a general section
- remove info about doing automatic lockstart by the system
since this was never used (the resource agent does it)
---
man/lvmlockd.8_main | 61 ++++++++++++--------------------------------------
1 files changed, 15 insertions(+), 46 deletions(-)
diff --git a/man/lvmlockd.8_main b/man/lvmlockd.8_main
index 3f0e3ed..b917d93 100644
--- a/man/lvmlockd.8_main
+++ b/man/lvmlockd.8_main
@@ -76,9 +76,6 @@ For default settings, see lvmlockd -h.
.I seconds
Override the default sanlock I/O timeout.
-.B --adopt | -A 0|1
- Adopt locks from a previous instance of lvmlockd.
-
.SH USAGE
@@ -261,6 +258,16 @@ does for foreign VGs.
.SS creating the first sanlock VG
+When use_lvmlockd is first enabled in lvm.conf, and before the first
+sanlock VG is created, no global lock will exist. In this initial state,
+LVM commands try and fail to acquire the global lock, producing a warning,
+and some commands are disallowed. Once the first sanlock VG is created,
+the global lock will be available, and LVM will be fully operational.
+
+When a new sanlock VG is created, its lockspace is automatically started on
+the host that creates it. Other hosts need to run 'vgchange --lock-start'
+to start the new VG before they can use it.
+
Creating the first sanlock VG is not protected by locking, so it requires
special attention. This is because sanlock locks exist on storage within
the VG, so they are not available until after the VG is created. The
@@ -288,19 +295,7 @@ See below for more information about managing the sanlock global lock.
.SS using shared VGs
-There are some special considerations when using shared VGs.
-
-When use_lvmlockd is first enabled in lvm.conf, and before the first
-shared VG is created, no global lock will exist. In this initial state,
-LVM commands try and fail to acquire the global lock, producing a warning,
-and some commands are disallowed. Once the first shared VG is created,
-the global lock will be available, and LVM will be fully operational.
-
-When a new shared VG is created, its lockspace is automatically started on
-the host that creates it. Other hosts need to run 'vgchange --lock-start'
-to start the new VG before they can use it.
-
-From the 'vgs' command, shared VGs are indicated by "s" (for shared) in
+In the 'vgs' command, shared VGs are indicated by "s" (for shared) in
the sixth attr field, and by "shared" in the "--options shared" report
field. The specific lock type and lock args for a shared VG can be
displayed with 'vgs -o+locktype,lockargs'.
@@ -379,31 +374,6 @@ activation {
.fi
-.SS automatic starting and automatic activation
-
-When system-level scripts/programs automatically start VGs, they should
-use the "auto" option. This option indicates that the command is being
-run automatically by the system:
-
-vgchange --lock-start --lock-opt auto [<vgname> ...]
-
-The "auto" option causes the command to follow the lvm.conf
-activation/auto_lock_start_list. If auto_lock_start_list is undefined,
-all VGs are started, just as if the auto option was not used.
-
-When auto_lock_start_list is defined, it lists the shared VGs that should
-be started by the auto command. VG names that do not match an item in the
-list will be ignored by the auto start command.
-
-(The lock_start_list is also still used to filter VG names from all start
-commands, i.e. with or without the auto option. When the lock_start_list
-is defined, only VGs matching a list item can be started with vgchange.)
-
-The auto_lock_start_list allows a user to select certain shared VGs that
-should be automatically started by the system (or indirectly, those that
-should not).
-
-
.SS internal command locking
To optimize the use of LVM with lvmlockd, be aware of the three kinds of
@@ -411,8 +381,8 @@ locks and when they are used:
.I Global lock
-The global lock s associated with global information, which is information
-not isolated to a single VG. This includes:
+The global lock is associated with global information, which is
+information not isolated to a single VG. This includes:
\[bu]
The global VG namespace.
@@ -456,7 +426,7 @@ held only while an LVM command is running.)
.I lock retries
-If a request for a Global or VG lock fails due to a lock conflict with
+If a request for a global or VG lock fails due to a lock conflict with
another host, lvmlockd automatically retries for a short time before
returning a failure to the LVM command. If those retries are
insufficient, the LVM command will retry the entire lock request a number
@@ -579,8 +549,7 @@ necessary locks.
.B lvmlockd failure
If lvmlockd fails or is killed while holding locks, the locks are orphaned
-in the lock manager. lvmlockd can be restarted with an option to adopt
-locks in the lock manager that had been held by the previous instance.
+in the lock manager.
.B dlm/corosync failure
4 years, 6 months