master - vgimportclone: make sure there's no prefix in VG name list
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=75420282e17e44...
Commit: 75420282e17e44d5c7b56126a5c7fd170f0ef417
Parent: 38df48d108e3b040501edfd9e0517bfcb31373de
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Oct 12 12:51:13 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Oct 12 12:54:59 2015 +0200
vgimportclone: make sure there's no prefix in VG name list
Make sure log/prefix is set to "" when getting the list of VG names.
We need this for the format to be correct so it's properly searched
through later on.
---
scripts/vgimportclone.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/vgimportclone.sh b/scripts/vgimportclone.sh
index 52f3884..0ac987a 100755
--- a/scripts/vgimportclone.sh
+++ b/scripts/vgimportclone.sh
@@ -220,7 +220,7 @@ fi
### :vgname1:vgname2:...:vgnameN:
#####################################################################
-OLDVGS=":`"${LVM}" vgs ${LVM_OPTS} -o name --noheadings --rows --separator :`:"
+OLDVGS=":`"${LVM}" vgs ${LVM_OPTS} -o name --noheadings --rows --separator : --config 'log{prefix=""}'`:"
checkvalue $? "Current VG names could not be collected without errors"
#####################################################################
7 years, 5 months
master - vgimportclone: fix vgimportclone with -n to not add number unnecessarily to base VG name
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=38df48d108e3b0...
Commit: 38df48d108e3b040501edfd9e0517bfcb31373de
Parent: 21a8ac0cd3a392feaa049ab509c4727eee548d6b
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Oct 12 11:11:34 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Oct 12 11:11:34 2015 +0200
vgimportclone: fix vgimportclone with -n to not add number unnecessarily to base VG name
$ vgcreate vgA /dev/sda
Volume group "vgA" successfully created
$ dd if=/dev/sda of=/dev/sdb bs=1M
$ dd if=/dev/sda of=/dev/sdc bs=1M
(the new VG name is prefix of existing VG name)
$ vgimportclone -n vg /dev/sdb
(the new VG name is suffix of existing VG name)
$ vgimportclone -n gA /dev/sdc
Before this patch:
------------------
(we end up with "vg1" and "gA1" names with the "1" suffix which is not needed)
$ vgs -o vg_name
VG
gA1
vg1
vgA
With this patch applied:
------------------------
(we end up with "vg" and "gA" names as they're unique already and no extra suffix is added)
$ # vgs -o vg_name
VG
gA
vg
vgA
Of course, if the name supplied is not unique, the number is added correctly:
$ dd if=/dev/sda of=/dev/sdb bs=1M
$ vgimportclone -n vgA /dev/sdb
$ vgs -o vg_name
VG
vgA
vgA1
---
WHATS_NEW | 1 +
scripts/vgimportclone.sh | 8 +++++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9af759e..5fa6e7f 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.133 -
======================================
+ Fix vgimportclone with -n to not add number unnecessarily to base VG name.
Cleanup vgimportclone script and remove dependency on awk, grep, cut and tr.
Add vg_missing_pv_count report field to report number of missing PVs in a VG.
Properly identify internal LV holding sanlock locks within lv_role field.
diff --git a/scripts/vgimportclone.sh b/scripts/vgimportclone.sh
index d14a170..52f3884 100755
--- a/scripts/vgimportclone.sh
+++ b/scripts/vgimportclone.sh
@@ -48,7 +48,7 @@ function getvgname {
NAME="${BNAME}"
I=0
- while [[ "${VGLIST}" =~ "${NAME}" ]]
+ while [[ "${VGLIST}" =~ ":${NAME}:" ]]
do
I=$(($I+1))
NAME="${BNAME}$I"
@@ -215,10 +215,12 @@ then
fi
#####################################################################
-### Get the existing state so we can use it later
+### Get the existing state so we can use it later.
+### The list of VG names is saved in this format:
+### :vgname1:vgname2:...:vgnameN:
#####################################################################
-OLDVGS=`"${LVM}" vgs ${LVM_OPTS} -o name --noheadings`
+OLDVGS=":`"${LVM}" vgs ${LVM_OPTS} -o name --noheadings --rows --separator :`:"
checkvalue $? "Current VG names could not be collected without errors"
#####################################################################
7 years, 5 months
master - Fix segfault when lvmlockd is running but not lvmetad
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=21a8ac0cd3a392...
Commit: 21a8ac0cd3a392feaa049ab509c4727eee548d6b
Parent: 1f30ba6178df6c3faac06328f17158f549b9d4f7
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Oct 9 12:20:22 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Oct 9 12:20:22 2015 -0500
Fix segfault when lvmlockd is running but not lvmetad
If lvmlockd is running, lvmetad is configured (use_lvmetad=1),
but lvmetad is not running, then commands will seg fault
when trying to send a message to lvmetad.
The difference is lvmetad being "active", not just "used".
---
lib/cache/lvmetad.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 20d2001..c7f6ecb 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -1683,7 +1683,7 @@ void lvmetad_validate_global_cache(struct cmd_context *cmd, int force)
return;
}
- if (!lvmetad_used())
+ if (!lvmetad_active())
return;
log_debug_lvmetad("Validating global lvmetad cache");
7 years, 5 months
master - vgimportclone: cleanup the script and remove dependency on awk, grep, cut and tr
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1f30ba6178df6c...
Commit: 1f30ba6178df6c3faac06328f17158f549b9d4f7
Parent: 8733a8d89040820f66a99d4d4e8f524ab2497983
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Oct 9 16:26:27 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Oct 9 16:31:02 2015 +0200
vgimportclone: cleanup the script and remove dependency on awk, grep, cut and tr
We can replace the expressions with awk/grep/cut/tr with --select now and
more suitable reporting options and modes. Also, we don't need to check
the temporary lvm.conf generated within vgimportclone script since we're
generating it ourselves now using lvmconfig, not using sed anymore like
it was before (so we can be pretty sure it's correct - we use lvmconfig
now even for generating the lvm.conf itself).
---
WHATS_NEW | 1 +
scripts/vgimportclone.sh | 87 +++++++++++++--------------------------------
2 files changed, 26 insertions(+), 62 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ac9f6b8..9af759e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.133 -
======================================
+ Cleanup vgimportclone script and remove dependency on awk, grep, cut and tr.
Add vg_missing_pv_count report field to report number of missing PVs in a VG.
Properly identify internal LV holding sanlock locks within lv_role field.
Add metadata_devices and seg_metadata_le_ranges report fields for raid vols.
diff --git a/scripts/vgimportclone.sh b/scripts/vgimportclone.sh
index af8cf5c..d14a170 100755
--- a/scripts/vgimportclone.sh
+++ b/scripts/vgimportclone.sh
@@ -21,11 +21,7 @@
RM=rm
BASENAME=basename
MKTEMP=mktemp
-AWK=awk
-CUT=cut
-TR=tr
READLINK=readlink
-GREP=grep
GETOPT=getopt
# user may override lvm location by setting LVM_BINARY
@@ -253,59 +249,37 @@ checkvalue $? "Failed to generate ${LVMCONF}"
# Only keep TMP_LVM_SYSTEM_DIR if it contains something worth keeping
[ -n "${DEBUG}" ] && KEEP_TMP_LVM_SYSTEM_DIR=1
-# verify the config contains the filter, scan and cache_dir (or cache) config keywords
-"$GREP" -q '^[[:space:]]*filter[[:space:]]*=' ${LVMCONF} || \
- die 5 "Temporary lvm.conf must contain 'filter' config."
-"$GREP" -q '^[[:space:]]*scan[[:space:]]*=' ${LVMCONF} || \
- die 6 "Temporary lvm.conf must contain 'scan' config."
-
-# check for either 'cache' or 'cache_dir' config values
-"$GREP" -q '[[:space:]]*cache[[:space:]]*=' ${LVMCONF}
-CACHE_RET=$?
-"$GREP" -q '^[[:space:]]*cache_dir' ${LVMCONF}
-CACHE_DIR_RET=$?
-[ $CACHE_RET -eq 0 -o $CACHE_DIR_RET -eq 0 ] || \
- die 7 "Temporary lvm.conf must contain 'cache' or 'cache_dir' config."
-
### set to use new lvm.conf
export LVM_SYSTEM_DIR=${TMP_LVM_SYSTEM_DIR}
+# Check if there are any PVs that don't belong to any VG
+# or even if there are disks which are not PVs at all.
+NOVGDEVLIST=`${LVM} pvs -a -o pv_name --select vg_name="" --noheadings`
+checkvalue $? "Failed to collect information for PV check"
+if [ -n "${NOVGDEVLIST}" ]; then
+ FOLLOWLIST=""
+ while read PVNAME; do
+ FOLLOW=`$READLINK $PVNAME`
+ FOLLOWLIST="$FOLLOWLIST $FOLLOW"
+ done <<< "`echo "${NOVGDEVLIST}"`"
+ die 8 "Specified devices don't belong to a VG:$FOLLOWLIST"
+fi
#####################################################################
### Rename the VG(s) and change the VG and PV UUIDs.
#####################################################################
+VGLIST=`${LVM} vgs -o vg_name,vg_exported,vg_missing_pv_count --noheadings --binary`
+checkvalue $? "Failed to collect VG information"
-PVINFO=`"${LVM}" pvs ${LVM_OPTS} -o pv_name,vg_name,vg_attr --noheadings --separator :`
-checkvalue $? "PV info could not be collected without errors"
-
-# output VG info so each line looks like: name:exported?:disk1,disk2,...
-VGINFO=`echo "${PVINFO}" | \
- "$AWK" -F : '{{sub(/^[ \t]*/,"")} \
- {sub(/unknown device/,"unknown_device")} \
- {vg[$2]=$1","vg[$2]} if($3 ~ /^..x/){x[$2]="x"}} \
- END{for(k in vg){printf("%s:%s:%s\n", k, x[k], vg[k])}}'`
-checkvalue $? "PV info could not be parsed without errors"
-
-for VG in ${VGINFO}
-do
- VGNAME=`echo "${VG}" | "$CUT" -d: -f1`
- EXPORTED=`echo "${VG}" | "$CUT" -d: -f2`
- PVLIST=`echo "${VG}" | "$CUT" -d: -f3- | "$TR" , ' '`
-
- if [ -z "${VGNAME}" ]
- then
- FOLLOWLIST=""
- for DEV in $PVLIST; do
- FOLLOW=`"$READLINK" $DEV`
- FOLLOWLIST="$FOLLOW $FOLLOWLIST"
- done
- die 8 "Specified PV(s) ($FOLLOWLIST) don't belong to a VG."
+while read VGNAME VGEXPORTED VGMISSINGPVCOUNT; do
+ if [ $VGMISSINGPVCOUNT -gt 0 ]; then
+ echo "Volume Group ${VGNAME} has unknown PV(s), skipping."
+ echo "- Were all associated PV(s) supplied as arguments?"
+ continue
fi
- if [ -n "${EXPORTED}" ]
- then
- if [ ${IMPORT} -eq 1 ]
- then
+ if [ "$VGEXPORTED" = "1" ]; then
+ if [ ${IMPORT} -eq 1 ]; then
"$LVM" vgimport ${LVM_OPTS} ${TEST_OPT} "${VGNAME}"
checkvalue $? "Volume Group ${VGNAME} could not be imported"
else
@@ -314,23 +288,12 @@ do
fi
fi
- ### change the pv uuids
- if [[ "${PVLIST}" =~ "unknown" ]]
- then
- echo "Volume Group ${VGNAME} has unknown PV(s), skipping."
- echo "- Were all associated PV(s) supplied as arguments?"
- continue
- fi
-
- for BLOCKDEV in ${PVLIST}
- do
- "$LVM" pvchange ${LVM_OPTS} ${TEST_OPT} --uuid ${BLOCKDEV} --config 'global{activation=0}'
- checkvalue $? "Unable to change PV uuid for ${BLOCKDEV}"
- done
+ "$LVM" pvchange ${LVM_OPTS} ${TEST_OPT} --uuid --config 'global{activation=0}' --select "vg_name=${VGNAME}"
+ checkvalue $? "Unable to change all PV uuids in VG ${VG_NAME}"
NEWVGNAME=`getvgname "${OLDVGS}" "${VGNAME}" "${NEWVG}"`
- "$LVM" vgchange ${LVM_OPTS} ${TEST_OPT} --uuid "${VGNAME}" --config 'global{activation=0}'
+ "$LVM" vgchange ${LVM_OPTS} ${TEST_OPT} --uuid --config 'global{activation=0}' ${VGNAME}
checkvalue $? "Unable to change VG uuid for ${VGNAME}"
## if the name isn't going to get changed dont even try.
@@ -341,7 +304,7 @@ do
fi
CHANGES_MADE=1
-done
+done <<< "`echo "${VGLIST}"`"
#####################################################################
### Restore the old environment
7 years, 5 months
master - report: add vg_missing_pv_count field
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8733a8d8904082...
Commit: 8733a8d89040820f66a99d4d4e8f524ab2497983
Parent: 5446d177569ca10476c935013ae03e6a0763ab34
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Oct 9 16:20:29 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Oct 9 16:28:58 2015 +0200
report: add vg_missing_pv_count field
We already have pv_count to report number of PVs that a VG has based
on metadata.
This patch exposes the information about how many of these PVs are
missing which is also useful information for a VG. Wwe could count
the sum of pv_missing reporting fields for each PV in the VG before,
but the new field is practical when reporting VG as a whole and there's
no need to process each PV from VG alone.
---
WHATS_NEW | 1 +
lib/report/columns.h | 3 ++-
lib/report/properties.c | 2 ++
lib/report/report.c | 11 +++++++++++
4 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 227530d..ac9f6b8 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.133 -
======================================
+ Add vg_missing_pv_count report field to report number of missing PVs in a VG.
Properly identify internal LV holding sanlock locks within lv_role field.
Add metadata_devices and seg_metadata_le_ranges report fields for raid vols.
Fix lvm2-{activation,clvmd,cmirrord,monitor} service to exec before mounting.
diff --git a/lib/report/columns.h b/lib/report/columns.h
index 6041eeb..41a03f4 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -158,7 +158,8 @@ FIELD(VGS, vg, NUM, "#Ext", extent_count, 4, uint32, vg_extent_count, "Total num
FIELD(VGS, vg, NUM, "Free", free_count, 4, uint32, vg_free_count, "Total number of unallocated Physical Extents.", 0)
FIELD(VGS, vg, NUM, "MaxLV", max_lv, 5, uint32, max_lv, "Maximum number of LVs allowed in VG or 0 if unlimited.", 0)
FIELD(VGS, vg, NUM, "MaxPV", max_pv, 5, uint32, max_pv, "Maximum number of PVs allowed in VG or 0 if unlimited.", 0)
-FIELD(VGS, vg, NUM, "#PV", pv_count, 3, uint32, pv_count, "Number of PVs.", 0)
+FIELD(VGS, vg, NUM, "#PV", pv_count, 3, uint32, pv_count, "Number of PVs in VG.", 0)
+FIELD(VGS, vg, NUM, "#PV Missing", cmd, 11, vgmissingpvcount, vg_missing_pv_count, "Number of PVs in VG which are missing.", 0)
FIELD(VGS, vg, NUM, "#LV", cmd, 3, lvcount, lv_count, "Number of LVs.", 0)
FIELD(VGS, vg, NUM, "#SN", cmd, 3, snapcount, snap_count, "Number of snapshots.", 0)
FIELD(VGS, vg, NUM, "Seq", seqno, 3, uint32, vg_seqno, "Revision number of internal metadata. Incremented whenever it changes.", 0)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index 262cc26..7dafbe5 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -420,6 +420,8 @@ GET_VG_NUM_PROPERTY_FN(vg_mda_copies, (vg_mda_copies(vg)))
SET_VG_NUM_PROPERTY_FN(vg_mda_copies, vg_set_mda_copies)
GET_VG_STR_PROPERTY_FN(vg_profile, vg_profile_dup(vg))
#define _vg_profile_set prop_not_implemented_set
+GET_VG_NUM_PROPERTY_FN(vg_missing_pv_count, vg_missing_pv_count(vg))
+#define _vg_missing_pv_count_set prop_not_implemented_set
/* LVSEG */
GET_LVSEG_STR_PROPERTY_FN(segtype, lvseg_segtype_dup(lvseg->lv->vg->vgmem, lvseg))
diff --git a/lib/report/report.c b/lib/report/report.c
index 7ac1ac5..dea66ee 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -2438,6 +2438,17 @@ static int _vgprofile_disp(struct dm_report *rh, struct dm_pool *mem,
return _field_set_value(field, "", NULL);
}
+static int _vgmissingpvcount_disp(struct dm_report *rh, struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data, void *private)
+{
+ const struct volume_group *vg = (const struct volume_group *) data;
+ uint32_t count = vg_missing_pv_count(vg);
+
+ return _uint32_disp(rh, mem, field, &count, private);
+}
+
+
static int _pvmdafree_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
7 years, 5 months
master - man lvmsystemid: fix typos
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5446d177569ca1...
Commit: 5446d177569ca10476c935013ae03e6a0763ab34
Parent: c9ff5c8223c6c2d23829aef076d58c32382891c8
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Oct 8 13:21:42 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Oct 8 13:26:09 2015 -0500
man lvmsystemid: fix typos
---
man/lvmsystemid.7.in | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/man/lvmsystemid.7.in b/man/lvmsystemid.7.in
index eb10ac5..0048873 100644
--- a/man/lvmsystemid.7.in
+++ b/man/lvmsystemid.7.in
@@ -274,7 +274,7 @@ cache with pvscan --cache will allow a host to recognize the newly
exported VG.
vgimport sets the VG system_id to the local system_id as determined by
-lvm.conf system_id_sources. vgimport automatically scans storage for
+lvm.conf system_id_source. vgimport automatically scans storage for
newly exported VGs.
After vgimport, the exporting host will continue to see the VG as
@@ -300,9 +300,9 @@ To move a VG from one host to another, vgexport and vgimport should be
used.
To forcibly gain ownership of a foreign VG, a host can add the foreign
-system_id to its allow_system_id list, change the system_id of the foreign
-VG to its own, and remove the foreign system_id from its allow_system_id
-list.
+system_id to its extra_system_ids list, change the system_id of the
+foreign VG to its own, and remove the foreign system_id from its
+extra_system_ids list.
.SS shared VGs
@@ -328,7 +328,7 @@ creation_host will be the same.
Orphan PVs are unused devices; they are not currently used in any VG.
Because of this, they are not protected by a system_id, and any host can
-use them. Coodination of changes to orphan PVs is beyond the scope of
+use them. Coordination of changes to orphan PVs is beyond the scope of
system_id. The same is true of any block device that is not a PV.
The effects of this are especially evident when lvm uses lvmetad caching.
@@ -337,7 +337,7 @@ using the orphan, the other hosts will continue to report the PV as an
orphan. Nothing would automatically prevent the other hosts from using
the newly allocated PV and corrupting it. If the other hosts run a
command to rescan devices, and update lvmetad, they would then recognize
-the PV has been used by another host. A command that rescans devices
+that the PV has been used by another host. A command that rescans devices
could be pvscan --cache, or vgs --foreign.
.SH SEE ALSO
7 years, 5 months
master - man lvmsystemd: fix typo
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c9ff5c8223c6c2...
Commit: c9ff5c8223c6c2d23829aef076d58c32382891c8
Parent: d99dd4086da5ab2ed7bf02a8711d4a4998fe2b31
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Oct 8 13:14:28 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Oct 8 13:14:28 2015 -0500
man lvmsystemd: fix typo
---
man/lvmsystemid.7.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/man/lvmsystemid.7.in b/man/lvmsystemid.7.in
index 37a01af..eb10ac5 100644
--- a/man/lvmsystemid.7.in
+++ b/man/lvmsystemid.7.in
@@ -84,7 +84,7 @@ version without the system_id feature.
.SS Types of VG access
-A local VG is mean to be used by a single host.
+A local VG is meant to be used by a single host.
.br
A shared or clustered VG is meant to be used by multiple hosts.
.br
7 years, 5 months
master - vgcreate: improve error message for multiple lock managers
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d99dd4086da5ab...
Commit: d99dd4086da5ab2ed7bf02a8711d4a4998fe2b31
Parent: 09981afc1c03e1d79109c483b3d19ae1c207e158
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Oct 8 10:38:35 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Oct 8 10:41:13 2015 -0500
vgcreate: improve error message for multiple lock managers
If 'vgcreate --shared' finds both sanlock and dlm are running,
print a more accurate error message:
"Found multiple lock managers, select one with --lock-type."
When neither is running, we still print:
"Failed to detect a running lock manager to select lock type."
---
lib/locking/lvmlockd.c | 5 ++---
lib/locking/lvmlockd.h | 4 ++--
tools/toollib.c | 9 +++++++--
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index f741940..2bc34c8 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -2561,7 +2561,7 @@ int lockd_rename_vg_final(struct cmd_context *cmd, struct volume_group *vg, int
return 1;
}
-const char *lockd_running_lock_type(struct cmd_context *cmd)
+const char *lockd_running_lock_type(struct cmd_context *cmd, int *found_multiple)
{
daemon_reply reply;
const char *lock_type = NULL;
@@ -2583,10 +2583,9 @@ const char *lockd_running_lock_type(struct cmd_context *cmd)
switch (result) {
case -EXFULL:
- log_error("lvmlockd found multiple lock managers, use --lock-type to select one.");
+ *found_multiple = 1;
break;
case -ENOLCK:
- log_error("lvmlockd found no lock manager running.");
break;
case LOCK_TYPE_SANLOCK:
log_debug("lvmlockd found sanlock");
diff --git a/lib/locking/lvmlockd.h b/lib/locking/lvmlockd.h
index 7e6505d..8b282d8 100644
--- a/lib/locking/lvmlockd.h
+++ b/lib/locking/lvmlockd.h
@@ -89,7 +89,7 @@ int lockd_init_lv_args(struct cmd_context *cmd, struct volume_group *vg,
int lockd_free_lv(struct cmd_context *cmd, struct volume_group *vg,
const char *lv_name, struct id *lv_id, const char *lock_args);
-const char *lockd_running_lock_type(struct cmd_context *cmd);
+const char *lockd_running_lock_type(struct cmd_context *cmd, int *found_multiple);
int handle_sanlock_lv(struct cmd_context *cmd, struct volume_group *vg);
@@ -223,7 +223,7 @@ static inline int lockd_free_lv(struct cmd_context *cmd, struct volume_group *vg
return 1;
}
-static inline const char *lockd_running_lock_type(struct cmd_context *cmd)
+static inline const char *lockd_running_lock_type(struct cmd_context *cmd, int *found_multiple)
{
log_error("Using a shared lock type requires lvmlockd.");
return NULL;
diff --git a/tools/toollib.c b/tools/toollib.c
index cf5e236..dfb2b87 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -931,9 +931,14 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
}
} else if (arg_is_set(cmd, shared_ARG)) {
+ int found_multiple = 0;
+
if (use_lvmlockd) {
- if (!(lock_type = lockd_running_lock_type(cmd))) {
- log_error("Failed to detect a running lock manager to select lock type.");
+ if (!(lock_type = lockd_running_lock_type(cmd, &found_multiple))) {
+ if (found_multiple)
+ log_error("Found multiple lock managers, select one with --lock-type.");
+ else
+ log_error("Failed to detect a running lock manager to select lock type.");
return 0;
}
7 years, 5 months
master - vgcreate: allow both --shared and --lock-type options
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=09981afc1c03e1...
Commit: 09981afc1c03e1d79109c483b3d19ae1c207e158
Parent: 3d03e504cda6307f692c5879f6850b2e27af7d71
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Oct 8 10:14:33 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Oct 8 10:14:33 2015 -0500
vgcreate: allow both --shared and --lock-type options
Using --lock-type sanlock|dlm implies --shared.
Using --shared selects lock type sanlock|dlm
(by choosing the one that's running.)
Using both --shared and --lock-type sanlock|dlm should
also be allowed (--shared is just redundant information.)
---
tools/toollib.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index 01146a4..cf5e236 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -898,12 +898,18 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
use_clvmd = (locking_type == 3);
if (arg_is_set(cmd, locktype_ARG)) {
- if (arg_is_set(cmd, clustered_ARG) || arg_is_set(cmd, shared_ARG)) {
- log_error("A lock type cannot be specified with --shared or --clustered.");
+ if (arg_is_set(cmd, clustered_ARG)) {
+ log_error("A lock type cannot be specified with --clustered.");
return 0;
}
+
lock_type = arg_str_value(cmd, locktype_ARG, "");
+ if (arg_is_set(cmd, shared_ARG) && !is_lockd_type(lock_type)) {
+ log_error("The --shared option requires lock type sanlock or dlm.");
+ return 0;
+ }
+
} else if (arg_is_set(cmd, clustered_ARG)) {
const char *arg_str = arg_str_value(cmd, clustered_ARG, "");
int clustery = strcmp(arg_str, "y") ? 0 : 1;
7 years, 5 months
master - metadata: format_text: provide more detailed error message when metadata too large for PV mda
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3d03e504cda630...
Commit: 3d03e504cda6307f692c5879f6850b2e27af7d71
Parent: e04424e87e66df22578d1e4d2488615cd3692873
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Oct 8 16:25:10 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Oct 8 16:27:03 2015 +0200
metadata: format_text: provide more detailed error message when metadata too large for PV mda
Also, leave out the note about "circular buffer" which is
an internal imeplementation detail anyway and not quite
informational for users:
Before this patch:
$ vgcreate vg1 /dev/sda
VG vg1 metadata too large for circular buffer
Failed to write VG vg1.
With this patch applied:
$ vgcreate vg1 /dev/sda
VG vg1 metadata too large: size of metadata to write is 691 bytes while PV metadata area size on /dev/sda is 512 bytes.
Failed to write VG vg1.
---
lib/format_text/format-text.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index e0ec8ed..c1c4787 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -655,8 +655,11 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
if ((new_wrap && old_wrap) ||
(rlocn && (new_wrap || old_wrap) && (new_end > rlocn->offset)) ||
(mdac->rlocn.size >= mdah->size)) {
- log_error("VG %s metadata too large for circular buffer",
- vg->name);
+ log_error("VG %s metadata too large: size of metadata to write "
+ "is %" PRIu64 " bytes while PV metadata area size "
+ "on %s is %" PRIu64 " bytes.",
+ vg->name, mdac->rlocn.size,
+ dev_name(mdac->area.dev), mdah->size);
goto out;
}
7 years, 5 months