main - label_read_pvid: separate error and no-pvid
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4dc5d4ac7e7a9457ccc...
Commit: 4dc5d4ac7e7a9457ccc46ff04796b347e58bf4da
Parent: fcbed26393f57d49daa7da73922b1a922f9523a2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Apr 23 17:32:37 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Apr 23 17:37:08 2021 -0500
label_read_pvid: separate error and no-pvid
error reading dev and no pvid on dev were both
returning 0. make it easier for callers to
know which, if they care.
return 1 if the device could be read, regardless
of whether a pvid was found or not.
set has_pvid=1 if a pvid is found and 0 if no
pvid is found.
---
lib/device/device_id.c | 11 +++++++++--
lib/label/label.c | 14 ++++++++++----
lib/label/label.h | 2 +-
tools/lvmdevices.c | 14 +++++++++++---
tools/pvscan.c | 10 +++++++++-
5 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index 6fa3b0360..67f72e51b 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -1912,6 +1912,7 @@ void device_ids_find_renamed_devs(struct cmd_context *cmd, struct dm_list *dev_l
*/
dm_list_iterate_items(devl, &search_devs) {
dev = devl->dev;
+ int has_pvid;
/*
* We only need to check devs that would use ID_TYPE_DEVNAME
@@ -1935,11 +1936,17 @@ void device_ids_find_renamed_devs(struct cmd_context *cmd, struct dm_list *dev_l
/*
* Reads 4K from the start of the disk.
+ * Returns 0 if the dev cannot be read.
* Looks for LVM header, and sets dev->pvid if the device is a PV.
- * Returns 0 if the dev has no lvm label or no PVID.
+ * Sets has_pvid=1 if the dev has an lvm PVID.
* This loop may look at and skip many non-LVM devices.
*/
- if (!label_read_pvid(dev)) {
+ if (!label_read_pvid(dev, &has_pvid)) {
+ no_pvid++;
+ continue;
+ }
+
+ if (!has_pvid) {
no_pvid++;
continue;
}
diff --git a/lib/label/label.c b/lib/label/label.c
index 9ebbb4ec9..cfb9ebc80 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -1277,7 +1277,7 @@ int label_scan(struct cmd_context *cmd)
* Read the header of the disk and if it's a PV
* save the pvid in dev->pvid.
*/
-int label_read_pvid(struct device *dev)
+int label_read_pvid(struct device *dev, int *has_pvid)
{
char buf[4096] __attribute__((aligned(8)));
struct label_header *lh;
@@ -1296,14 +1296,17 @@ int label_read_pvid(struct device *dev)
*/
if (!dev_read_bytes(dev, 0, 4096, buf)) {
label_scan_invalidate(dev);
- return 0;
+ return_0;
}
+ if (has_pvid)
+ *has_pvid = 0;
+
lh = (struct label_header *)(buf + 512);
if (memcmp(lh->id, LABEL_ID, sizeof(lh->id))) {
/* Not an lvm deice */
label_scan_invalidate(dev);
- return 0;
+ return 1;
}
/*
@@ -1313,9 +1316,12 @@ int label_read_pvid(struct device *dev)
if (memcmp(lh->type, LVM2_LABEL, sizeof(lh->type))) {
/* Not an lvm deice */
label_scan_invalidate(dev);
- return 0;
+ return 1;
}
+ if (has_pvid)
+ *has_pvid = 1;
+
pvh = (struct pv_header *)(buf + 512 + 32);
memcpy(dev->pvid, pvh->pv_uuid, ID_LEN);
return 1;
diff --git a/lib/label/label.h b/lib/label/label.h
index fae0f1bcc..fcdc309ac 100644
--- a/lib/label/label.h
+++ b/lib/label/label.h
@@ -117,7 +117,7 @@ int label_scan_open(struct device *dev);
int label_scan_open_excl(struct device *dev);
int label_scan_open_rw(struct device *dev);
int label_scan_reopen_rw(struct device *dev);
-int label_read_pvid(struct device *dev);
+int label_read_pvid(struct device *dev, int *has_pvid);
int label_scan_for_pvid(struct cmd_context *cmd, char *pvid, struct device **dev_out);
diff --git a/tools/lvmdevices.c b/tools/lvmdevices.c
index b67db7464..6b3e05683 100644
--- a/tools/lvmdevices.c
+++ b/tools/lvmdevices.c
@@ -62,8 +62,12 @@ static void _search_devs_for_pvids(struct cmd_context *cmd, struct dm_list *sear
* searching for.
*/
dm_list_iterate_items_safe(devl, devl2, &devs) {
+ int has_pvid;
+
/* sets dev->pvid if an lvm label with pvid is found */
- if (!label_read_pvid(devl->dev))
+ if (!label_read_pvid(devl->dev, &has_pvid))
+ continue;
+ if (!has_pvid)
continue;
found = 0;
@@ -181,7 +185,8 @@ int lvmdevices(struct cmd_context *cmd, int argc, char **argv)
continue;
dev = du->dev;
- label_read_pvid(dev);
+ if (!label_read_pvid(dev, NULL))
+ continue;
/*
* label_read_pvid has read the first 4K of the device
@@ -283,7 +288,10 @@ int lvmdevices(struct cmd_context *cmd, int argc, char **argv)
* (it's ok if the device is not a PV and has no PVID)
*/
label_scan_setup_bcache();
- label_read_pvid(dev);
+ if (!label_read_pvid(dev, NULL)) {
+ log_error("Failed to read %s.", devname);
+ goto bad;
+ }
/*
* Allow filtered devices to be added to devices_file, but
diff --git a/tools/pvscan.c b/tools/pvscan.c
index df38e1758..f8d27372b 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -1546,7 +1546,15 @@ static int _pvscan_cache_args(struct cmd_context *cmd, int argc, char **argv,
label_scan_setup_bcache();
dm_list_iterate_items_safe(devl, devl2, &pvscan_devs) {
- if (!label_read_pvid(devl->dev)) {
+ int has_pvid;
+
+ if (!label_read_pvid(devl->dev, &has_pvid)) {
+ log_print("pvscan[%d] %s cannot read.", getpid(), dev_name(devl->dev));
+ dm_list_del(&devl->list);
+ continue;
+ }
+
+ if (!has_pvid) {
/* Not an lvm device */
log_print("pvscan[%d] %s not an lvm device.", getpid(), dev_name(devl->dev));
dm_list_del(&devl->list);
2 years, 5 months
main - Revert "cov: check label_read_pvid return value"
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fcbed26393f57d49daa...
Commit: fcbed26393f57d49daa7da73922b1a922f9523a2
Parent: 9cdd4dcca7e6d166e44270a81425a50e598836f4
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Apr 23 17:12:24 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Apr 23 17:12:24 2021 -0500
Revert "cov: check label_read_pvid return value"
This reverts commit bf461b99c6d26e550835b77eaffe2204cbc9bed3.
label_read_pvid returns 0 for non-PVs and these callers want
to handle non-PVs.
---
tools/lvmdevices.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tools/lvmdevices.c b/tools/lvmdevices.c
index c6cb1fcff..b67db7464 100644
--- a/tools/lvmdevices.c
+++ b/tools/lvmdevices.c
@@ -181,8 +181,7 @@ int lvmdevices(struct cmd_context *cmd, int argc, char **argv)
continue;
dev = du->dev;
- if (!label_read_pvid(dev))
- continue;
+ label_read_pvid(dev);
/*
* label_read_pvid has read the first 4K of the device
@@ -284,8 +283,7 @@ int lvmdevices(struct cmd_context *cmd, int argc, char **argv)
* (it's ok if the device is not a PV and has no PVID)
*/
label_scan_setup_bcache();
- if (!label_read_pvid(dev))
- goto_bad;
+ label_read_pvid(dev);
/*
* Allow filtered devices to be added to devices_file, but
2 years, 5 months
main - make: generate
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9cdd4dcca7e6d166e44...
Commit: 9cdd4dcca7e6d166e44270a81425a50e598836f4
Parent: 64a8505b96548631ed8fb251dce794077402ad77
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 22 11:28:56 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:02:58 2021 +0200
make: generate
---
conf/example.conf.in | 15 +++---
man/lvconvert.8_pregen | 26 ++++++-----
man/lvcreate.8_pregen | 121 ++++++++++++++++++++++---------------------------
man/lvextend.8_pregen | 2 +-
man/lvreduce.8_pregen | 2 +-
man/lvresize.8_pregen | 2 +-
6 files changed, 79 insertions(+), 89 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 19efe6b6d..b4a55ae6a 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -1084,13 +1084,14 @@ global {
# Configuration option global/event_activation.
# Activate LVs based on system-generated device events.
- # When a device appears on the system, a system-generated event runs
- # the pvscan command to activate LVs if the new PV completes the VG.
- # When event_activation is disabled, the system will generally run
- # a direct activation command to activate LVs in complete VGs.
- # Activation commands that are run by the system, either from events
- # or at fixed points during startup, use autoactivation (-aay). See
- # the --setautoactivation option or the auto_activation_volume_list
+ # When a PV appears on the system, a system-generated uevent triggers
+ # the lvm2-pvscan service which runs the pvscan --cache -aay command.
+ # If the new PV completes a VG, pvscan autoactivates LVs in the VG.
+ # When event_activation is disabled, the lvm2-activation services are
+ # generated and run at fixed points during system startup. These
+ # services run vgchange -aay to autoactivate LVs in VGs that happen
+ # to be present at that point in time.
+ # See the --setautoactivation option or the auto_activation_volume_list
# setting to configure autoactivation for specific VGs or LVs.
# This configuration option has an automatic default value.
# event_activation = 1
diff --git a/man/lvconvert.8_pregen b/man/lvconvert.8_pregen
index a921438b6..84b4ac75e 100644
--- a/man/lvconvert.8_pregen
+++ b/man/lvconvert.8_pregen
@@ -1650,23 +1650,22 @@ LV1 types: mirror
.P
\(em
.P
-Convert LV to a thin LV, using the original LV as an external origin
-.br
-(infers --type thin).
+Convert LV to a thin LV, using the original LV as an external origin.
.br
.P
\fBlvconvert\fP \fB-T\fP|\fB--thin\fP \fB--thinpool\fP \fILV\fP \fILV1\fP
.br
.RS 4
.ad l
+[ \fB--type thin\fP ] (implied)
+.br
+.br
[ \fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP ]
.br
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
.br
[ \fB-Z\fP|\fB--zero\fP \fBy\fP|\fBn\fP ]
.br
-[ \fB--type\fP \fBthin\fP ]
-.br
[ \fB--originname\fP \fILV\fP\fI_new\fP ]
.br
[ \fB--poolmetadata\fP \fILV\fP ]
@@ -1687,21 +1686,22 @@ LV1 types: linear striped thin cache raid error zero
.P
\(em
.P
-Attach a cache pool to an LV (infers --type cache).
+Attach a cache pool to an LV.
.br
.P
\fBlvconvert\fP \fB-H\fP|\fB--cache\fP \fB--cachepool\fP \fILV\fP \fILV1\fP
.br
.RS 4
.ad l
+[ \fB--type cache\fP ] (implied)
+.br
+.br
[ \fB-Z\fP|\fB--zero\fP \fBy\fP|\fBn\fP ]
.br
[ \fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP ]
.br
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
.br
-[ \fB--type\fP \fBcache\fP ]
-.br
[ \fB--cachemetadataformat\fP \fBauto\fP|\fB1\fP|\fB2\fP ]
.br
[ \fB--cachemode\fP \fBwritethrough\fP|\fBwriteback\fP|\fBpassthrough\fP ]
@@ -1766,6 +1766,9 @@ Convert LV to type vdopool.
.br
.RS 4
.ad l
+[ \fB--type vdo-pool\fP ] (implied)
+.br
+.br
[ \fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP ]
.br
[ \fB-Z\fP|\fB--zero\fP \fBy\fP|\fBn\fP ]
@@ -1774,8 +1777,6 @@ Convert LV to type vdopool.
.br
[ \fB-V\fP|\fB--virtualsize\fP \fISize\fP[m|UNIT] ]
.br
-[ \fB--type\fP \fBvdo-pool\fP ]
-.br
[ \fB--metadataprofile\fP \fIString\fP ]
.br
[ \fB--compression\fP \fBy\fP|\fBn\fP ]
@@ -1875,12 +1876,13 @@ origin LV (first arg) to reverse a splitsnapshot command.
.br
.RS 4
.ad l
+[ \fB--type snapshot\fP ] (implied)
+.br
+.br
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
.br
[ \fB-Z\fP|\fB--zero\fP \fBy\fP|\fBn\fP ]
.br
-[ \fB--type\fP \fBsnapshot\fP ]
-.br
[ COMMON_OPTIONS ]
.ad b
.RE
diff --git a/man/lvcreate.8_pregen b/man/lvcreate.8_pregen
index c73d1bafc..b642ad0c2 100644
--- a/man/lvcreate.8_pregen
+++ b/man/lvcreate.8_pregen
@@ -225,9 +225,9 @@ Create a linear LV.
.br
.RS 4
.ad l
-[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
+[ \fB--type linear\fP ] (implied)
.br
-[ \fB--type\fP \fBlinear\fP ]
+[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -238,19 +238,19 @@ Create a linear LV.
.P
\(em
.P
-Create a striped LV (infers --type striped).
+Create a striped LV.
.br
.P
\fBlvcreate\fP \fB-i\fP|\fB--stripes\fP \fINumber\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT] \fIVG\fP
.br
.RS 4
.ad l
+[ \fB--type striped\fP ] (implied)
+.br
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
.br
[ \fB-I\fP|\fB--stripesize\fP \fISize\fP[k|UNIT] ]
.br
-[ \fB--type\fP \fBstriped\fP ]
-.br
[ COMMON_OPTIONS ]
.ad b
.RE
@@ -260,16 +260,16 @@ Create a striped LV (infers --type striped).
.P
\(em
.P
-Create a raid1 or mirror LV (infers --type raid1|mirror).
+Create a raid1 or mirror LV.
.br
.P
\fBlvcreate\fP \fB-m\fP|\fB--mirrors\fP \fINumber\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT] \fIVG\fP
.br
.RS 4
.ad l
-[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
+[ \fB--type raid1\fP|\fBmirror\fP ] (implied)
.br
-[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
+[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
.br
[ \fB-I\fP|\fB--stripesize\fP \fISize\fP[k|UNIT] ]
.br
@@ -336,6 +336,8 @@ Create a raid10 LV.
.br
.RS 4
.ad l
+[ \fB--type raid10\fP ] (implied)
+.br
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
.br
[ \fB-I\fP|\fB--stripesize\fP \fISize\fP[k|UNIT] ]
@@ -362,6 +364,8 @@ Create a COW snapshot LV of an origin LV.
.br
.RS 4
.ad l
+[ \fB--type snapshot\fP ] (implied)
+.br
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
.br
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
@@ -370,8 +374,6 @@ Create a COW snapshot LV of an origin LV.
.br
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
.br
-[ \fB--type\fP \fBsnapshot\fP ]
-.br
[ COMMON_OPTIONS ]
.ad b
.RE
@@ -455,16 +457,17 @@ Create a cache pool.
.P
\(em
.P
-Create a thin LV in a thin pool (infers --type thin).
+Create a thin LV in a thin pool.
.br
.P
\fBlvcreate\fP \fB-V\fP|\fB--virtualsize\fP \fISize\fP[m|UNIT] \fB--thinpool\fP \fILV\fP \fIVG\fP
.br
.RS 4
.ad l
-[ \fB-T\fP|\fB--thin\fP ]
+[ \fB--type thin\fP ] (implied)
+.br
.br
-[ \fB--type\fP \fBthin\fP ]
+[ \fB-T\fP|\fB--thin\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -472,16 +475,15 @@ Create a thin LV in a thin pool (infers --type thin).
.P
\(em
.P
-Create a thin LV that is a snapshot of an existing thin LV
-.br
-(infers --type thin).
+Create a thin LV that is a snapshot of an existing thin LV.
.br
.P
\fBlvcreate\fP \fB-s\fP|\fB--snapshot\fP \fILV1\fP
.br
.RS 4
.ad l
-[ \fB--type\fP \fBthin\fP ]
+[ \fB--type thin\fP ] (implied)
+.br
.br
[ COMMON_OPTIONS ]
.ad b
@@ -1685,13 +1687,15 @@ Create a sparse COW snapshot LV of a virtual origin LV
.P
\(em
.P
-Create a thin pool (infers --type thin-pool).
+Create a thin pool.
.br
.P
\fBlvcreate\fP \fB-T\fP|\fB--thin\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT] \fIVG\fP
.br
.RS 4
.ad l
+[ \fB--type thin-pool\fP ] (implied)
+.br
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
.br
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
@@ -1700,8 +1704,6 @@ Create a thin pool (infers --type thin-pool).
.br
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
.br
-[ \fB--type\fP \fBthin-pool\fP ]
-.br
[ \fB--discards\fP \fBpassdown\fP|\fBnopassdown\fP|\fBignore\fP ]
.br
[ \fB--errorwhenfull\fP \fBy\fP|\fBn\fP ]
@@ -1719,15 +1721,15 @@ Create a thin pool (infers --type thin-pool).
.P
\(em
.P
-Create a thin pool named by the --thinpool arg
-.br
-(infers --type thin-pool).
+Create a thin pool named in --thinpool.
.br
.P
\fBlvcreate\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT] \fB--thinpool\fP \fILV\fP\fI_new\fP \fIVG\fP
.br
.RS 4
.ad l
+[ \fB--type thin-pool\fP ] (implied)
+.br
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
.br
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
@@ -1738,8 +1740,6 @@ Create a thin pool named by the --thinpool arg
.br
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
.br
-[ \fB--type\fP \fBthin-pool\fP ]
-.br
[ \fB--discards\fP \fBpassdown\fP|\fBnopassdown\fP|\fBignore\fP ]
.br
[ \fB--errorwhenfull\fP \fBy\fP|\fBn\fP ]
@@ -1841,18 +1841,17 @@ LV1 types: thinpool
.P
Create a thin LV in the thin pool named in the first arg
.br
-(variant, infers --type thin, also see --thinpool for
-.br
-naming pool.)
+(also see --thinpool for naming pool.)
.br
.P
\fBlvcreate\fP \fB-V\fP|\fB--virtualsize\fP \fISize\fP[m|UNIT] \fILV1\fP
.br
.RS 4
.ad l
-[ \fB-T\fP|\fB--thin\fP ]
+[ \fB--type thin\fP ] (implied)
.br
-[ \fB--type\fP \fBthin\fP ]
+.br
+[ \fB-T\fP|\fB--thin\fP ]
.br
[ COMMON_OPTIONS ]
.ad b
@@ -1883,16 +1882,15 @@ LV1 types: thin
.P
\(em
.P
-Create a thin LV that is a snapshot of an existing thin LV
-.br
-(infers --type thin).
+Create a thin LV that is a snapshot of an existing thin LV.
.br
.P
\fBlvcreate\fP \fB-T\fP|\fB--thin\fP \fILV1\fP
.br
.RS 4
.ad l
-[ \fB--type\fP \fBthin\fP ]
+[ \fB--type thin\fP ] (implied)
+.br
.br
[ COMMON_OPTIONS ]
.ad b
@@ -1904,16 +1902,15 @@ LV1 types: thin
.P
\(em
.P
-Create a thin LV that is a snapshot of an external origin LV
-.br
-(infers --type thin).
+Create a thin LV that is a snapshot of an external origin LV.
.br
.P
\fBlvcreate\fP \fB-s\fP|\fB--snapshot\fP \fB--thinpool\fP \fILV\fP \fILV\fP
.br
.RS 4
.ad l
-[ \fB--type\fP \fBthin\fP ]
+[ \fB--type thin\fP ] (implied)
+.br
.br
[ COMMON_OPTIONS ]
.ad b
@@ -1928,6 +1925,8 @@ Create a VDO LV with VDO pool.
.br
.RS 4
.ad l
+[ \fB--type vdo\fP ] (implied)
+.br
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
.br
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
@@ -1936,8 +1935,6 @@ Create a VDO LV with VDO pool.
.br
[ \fB-V\fP|\fB--virtualsize\fP \fISize\fP[m|UNIT] ]
.br
-[ \fB--type\fP \fBvdo\fP ]
-.br
[ \fB--vdopool\fP \fILV\fP\fI_new\fP ]
.br
[ \fB--compression\fP \fBy\fP|\fBn\fP ]
@@ -1960,6 +1957,8 @@ Create a VDO LV with VDO pool.
.br
.RS 4
.ad l
+[ \fB--type vdo\fP ] (implied)
+.br
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
.br
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
@@ -1968,10 +1967,6 @@ Create a VDO LV with VDO pool.
.br
[ \fB-V\fP|\fB--virtualsize\fP \fISize\fP[m|UNIT] ]
.br
-[ \fB--vdo\fP ]
-.br
-[ \fB--type\fP \fBvdo\fP ]
-.br
[ \fB--compression\fP \fBy\fP|\fBn\fP ]
.br
[ \fB--deduplication\fP \fBy\fP|\fBn\fP ]
@@ -2026,9 +2021,7 @@ where the new thin pool is named by the --thinpool arg.
.P
Create a thin LV, first creating a thin pool for it,
.br
-where the new thin pool is named by the --thinpool arg
-.br
-(variant, infers --type thin).
+where the new thin pool is named by --thinpool.
.br
.P
\fBlvcreate\fP \fB-V\fP|\fB--virtualsize\fP \fISize\fP[m|UNIT] \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT]
@@ -2038,6 +2031,8 @@ where the new thin pool is named by the --thinpool arg
.br
.RS 4
.ad l
+[ \fB--type thin\fP ] (implied)
+.br
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
.br
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
@@ -2048,8 +2043,6 @@ where the new thin pool is named by the --thinpool arg
.br
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
.br
-[ \fB--type\fP \fBthin\fP ]
-.br
[ \fB--discards\fP \fBpassdown\fP|\fBnopassdown\fP|\fBignore\fP ]
.br
[ \fB--errorwhenfull\fP \fBy\fP|\fBn\fP ]
@@ -2116,7 +2109,7 @@ where the new thin pool is named in the first arg,
.br
or the new thin pool name is generated when the first
.br
-arg is a VG name (variant, infers --type thin).
+arg is a VG name.
.br
.P
\fBlvcreate\fP \fB-T\fP|\fB--thin\fP \fB-V\fP|\fB--virtualsize\fP \fISize\fP[m|UNIT]
@@ -2126,6 +2119,8 @@ arg is a VG name (variant, infers --type thin).
.br
.RS 4
.ad l
+[ \fB--type thin\fP ] (implied)
+.br
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
.br
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
@@ -2134,8 +2129,6 @@ arg is a VG name (variant, infers --type thin).
.br
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
.br
-[ \fB--type\fP \fBthin\fP ]
-.br
[ \fB--discards\fP \fBpassdown\fP|\fBnopassdown\fP|\fBignore\fP ]
.br
[ \fB--errorwhenfull\fP \fBy\fP|\fBn\fP ]
@@ -2153,15 +2146,11 @@ arg is a VG name (variant, infers --type thin).
.P
\(em
.P
-Create a thin LV, first creating a thin pool for it
-.br
-(infers --type thin).
+Create a thin LV, first creating a thin pool for it.
.br
Create a sparse snapshot of a virtual origin LV
.br
-(infers --type snapshot).
-.br
-Chooses --type thin or --type snapshot according to
+Chooses type thin or snapshot according to
.br
config setting sparse_segtype_default.
.br
@@ -2170,6 +2159,8 @@ config setting sparse_segtype_default.
.br
.RS 4
.ad l
+[ \fB--type thin\fP|\fBsnapshot\fP ] (implied)
+.br
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
.br
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
@@ -2182,8 +2173,6 @@ config setting sparse_segtype_default.
.br
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
.br
-[ \fB--type\fP \fIString\fP ]
-.br
[ \fB--discards\fP \fBpassdown\fP|\fBnopassdown\fP|\fBignore\fP ]
.br
[ \fB--errorwhenfull\fP \fBy\fP|\fBn\fP ]
@@ -2203,15 +2192,15 @@ config setting sparse_segtype_default.
.P
Create a new LV, then attach the specified cachepool
.br
-which converts the new LV to type cache
-.br
-(variant, infers --type cache.)
+which converts the new LV to type cache.
.br
.P
\fBlvcreate\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT] \fB--cachepool\fP \fILV\fP \fIVG\fP
.br
.RS 4
.ad l
+[ \fB--type cache\fP ] (implied)
+.br
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
.br
[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
@@ -2222,8 +2211,6 @@ which converts the new LV to type cache
.br
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
.br
-[ \fB--type\fP \fBcache\fP ]
-.br
[ \fB--cachemode\fP \fBwritethrough\fP|\fBwriteback\fP|\fBpassthrough\fP ]
.br
[ \fB--cachepolicy\fP \fIString\fP ]
@@ -2302,6 +2289,8 @@ and attach it to the LV arg (alternative, use lvconvert.)
.br
.RS 4
.ad l
+[ \fB--type cache\fP ] (implied)
+.br
[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
.br
[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
@@ -2310,8 +2299,6 @@ and attach it to the LV arg (alternative, use lvconvert.)
.br
[ \fB-I\fP|\fB--stripesize\fP \fISize\fP[k|UNIT] ]
.br
-[ \fB--type\fP \fBcache\fP ]
-.br
[ \fB--cachemode\fP \fBwritethrough\fP|\fBwriteback\fP|\fBpassthrough\fP ]
.br
[ \fB--cachepolicy\fP \fIString\fP ]
diff --git a/man/lvextend.8_pregen b/man/lvextend.8_pregen
index fc4d55233..fa0aec63a 100644
--- a/man/lvextend.8_pregen
+++ b/man/lvextend.8_pregen
@@ -456,7 +456,7 @@ output in JSON format. See \fBlvmreport\fP(7) for more information.
.HP
\fB-r\fP|\fB--resizefs\fP
.br
-Resize underlying filesystem together with the LV using fsadm(8).
+Resize underlying filesystem together with the LV using \fBfsadm\fP(8).
.
.HP
\fB-L\fP|\fB--size\fP [\fB+\fP]\fISize\fP[m|UNIT]
diff --git a/man/lvreduce.8_pregen b/man/lvreduce.8_pregen
index 13522bb70..0a659e1c8 100644
--- a/man/lvreduce.8_pregen
+++ b/man/lvreduce.8_pregen
@@ -234,7 +234,7 @@ output in JSON format. See \fBlvmreport\fP(7) for more information.
.HP
\fB-r\fP|\fB--resizefs\fP
.br
-Resize underlying filesystem together with the LV using fsadm(8).
+Resize underlying filesystem together with the LV using \fBfsadm\fP(8).
.
.HP
\fB-L\fP|\fB--size\fP [\fB-\fP]\fISize\fP[m|UNIT]
diff --git a/man/lvresize.8_pregen b/man/lvresize.8_pregen
index 4e27cf4ee..36c1760fc 100644
--- a/man/lvresize.8_pregen
+++ b/man/lvresize.8_pregen
@@ -409,7 +409,7 @@ output in JSON format. See \fBlvmreport\fP(7) for more information.
.HP
\fB-r\fP|\fB--resizefs\fP
.br
-Resize underlying filesystem together with the LV using fsadm(8).
+Resize underlying filesystem together with the LV using \fBfsadm\fP(8).
.
.HP
\fB-L\fP|\fB--size\fP [\fB+\fP|\fB-\fP]\fISize\fP[m|UNIT]
2 years, 5 months
main - tests: use should for expected state
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=64a8505b96548631ed8...
Commit: 64a8505b96548631ed8fb251dce794077402ad77
Parent: 05eb90db68dcaa89fbfcce52cf122f25488ee69f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 22 18:28:50 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
tests: use should for expected state
While we heavily try to spot arrays that are not yet in-sync,
some kernels tends to block our lvm2 command in kernel,
while we resume these smaller raid arrays even for 5 seconds.
But since the result is not really wrong - report these
check failures only as TEST WARNING.
---
test/shell/lvcreate-raid-nosync.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/shell/lvcreate-raid-nosync.sh b/test/shell/lvcreate-raid-nosync.sh
index c7c2d1535..2818e9450 100644
--- a/test/shell/lvcreate-raid-nosync.sh
+++ b/test/shell/lvcreate-raid-nosync.sh
@@ -60,7 +60,7 @@ done
# raid1 supports resynchronization
lvcreate --type raid1 -m 2 -Zn -l 4 -n $lv1 $vg
-check raid_leg_status $vg $lv1 "aaa"
+should check raid_leg_status $vg $lv1 "aaa"
_sync "AAA"
# raid1 supports --nosync
@@ -72,7 +72,7 @@ for r in $segtypes
do
# raid4/5 support resynchronization
lvcreate --type $r -Zn -i 3 -L10 -n $lv1 $vg
- check raid_leg_status $vg $lv1 "aaaa"
+ should check raid_leg_status $vg $lv1 "aaaa"
_sync "AAAA"
# raid4/5 support --nosync
@@ -83,7 +83,7 @@ done
# raid6 supports resynchronization
lvcreate --type raid6 -Zn -i 3 -l 4 -n $lv1 $vg
-check raid_leg_status $vg $lv1 "aaaaa"
+should check raid_leg_status $vg $lv1 "aaaaa"
_sync "AAAAA"
# raid6 rejects --nosync; it has to initialize P- and Q-Syndromes
@@ -91,7 +91,7 @@ not lvcreate --type raid6 --nosync -Zn -i 3 -l 1 -n $lv1 $vg
# raid10 supports resynchronization
lvcreate --type raid10 -m 1 -Zn -i 3 -L10 -n $lv1 $vg
-check raid_leg_status $vg $lv1 "aaaaaa"
+should check raid_leg_status $vg $lv1 "aaaaaa"
_sync "AAAAAA"
# raid10 supports --nosync
2 years, 5 months
main - cleanup: indent
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=05eb90db68dcaa89fbf...
Commit: 05eb90db68dcaa89fbfcce52cf122f25488ee69f
Parent: fccd6e034625dade9ca302f2fcd99eb32d90974f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 23 19:45:34 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
cleanup: indent
---
lib/label/label.c | 2 +-
tools/vgsplit.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/label/label.c b/lib/label/label.c
index 203c5b6bb..9ebbb4ec9 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -1097,7 +1097,7 @@ int label_scan(struct cmd_context *cmd)
* so this will usually do nothing.
*/
label_scan_invalidate(dev);
- };
+ }
dev_iter_destroy(iter);
/*
diff --git a/tools/vgsplit.c b/tools/vgsplit.c
index 8a785bdbd..296248e7c 100644
--- a/tools/vgsplit.c
+++ b/tools/vgsplit.c
@@ -311,7 +311,7 @@ static int _move_raids(struct volume_group *vg_from,
/* Ignore, if no allocations on PVs of @vg_to */
if (!lv_is_on_pvs(lv, &vg_to->pvs))
continue;
-
+
/* If allocations are on PVs of @vg_to -> move RAID LV stack across */
if (!_move_one_lv(vg_from, vg_to, lvh, &lvht))
return_0;
@@ -460,7 +460,7 @@ static int _move_cache(struct volume_group *vg_from,
!lv_is_on_pvs(meta, &vg_to->pvs))
continue;
}
-
+
if (fast && orig &&
!lv_is_on_pvs(orig, &vg_to->pvs) && !lv_is_on_pvs(fast, &vg_to->pvs))
continue;
2 years, 5 months
main - makefiles: add target for man-generator
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fccd6e034625dade9ca...
Commit: fccd6e034625dade9ca302f2fcd99eb32d90974f
Parent: 348c46c8fcc285b1c7495a3792f2c3b1c2939e8e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 23 13:49:52 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
makefiles: add target for man-generator
Add supporting target for recreating man-generator when dependencies needs it.
---
man/Makefile.in | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/man/Makefile.in b/man/Makefile.in
index 7f4664b01..29afc776b 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -128,6 +128,10 @@ all_man: man
$(MAN5) $(MAN7) $(MAN8) $(MAN8SO) $(MAN8DM) $(MAN8CLUSTER) $(MAN8SYSTEMD_GENERATORS): Makefile
+$(MANGENERATOR):
+ @echo " [MAKE] $<"
+ $(Q) $(MAKE) -C $(top_builddir) tools
+
# Test whether or not the man page generator works
$(TESTMAN): $(MANGENERATOR) Makefile
@echo " [TSTMAN] $@"
2 years, 5 months
main - man: add some resizing examples
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=348c46c8fcc285b1c74...
Commit: 348c46c8fcc285b1c7495a3792f2c3b1c2939e8e
Parent: a21028dea71464f93cd1c0836aee63ebfc3add10
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 23 12:53:14 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
man: add some resizing examples
Add some examples with -l% usage.
---
man/lvextend.8_end | 6 ++++++
man/lvresize.8_end | 6 +++++-
man/see_also.end | 1 +
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/man/lvextend.8_end b/man/lvextend.8_end
index 3cffe1d25..4b25c2c3b 100644
--- a/man/lvextend.8_end
+++ b/man/lvextend.8_end
@@ -14,3 +14,9 @@ space on PV /dev/sdk3. This is equivalent to specifying
Extend an LV by 16MiB using specific physical extents.
.br
.B lvextend -L+16m vg01/lvol01 /dev/sda:8-9 /dev/sdb:8-9
+.P
+Extend an LV to use all remaining free space in volume group
+and all resize its filesystem with
+.BR fsadm (8).
+.br
+.B lvextend -l+100%FREE -r vg01/lvol01
diff --git a/man/lvresize.8_end b/man/lvresize.8_end
index b69d6acd3..d16248ce1 100644
--- a/man/lvresize.8_end
+++ b/man/lvresize.8_end
@@ -1,6 +1,10 @@
.
.SH EXAMPLES
.
-Extend an LV by 16MB using specific physical extents:
+Extend an LV by 16MB using specific physical extents.
.br
.B lvresize -L+16M vg1/lv1 /dev/sda:0-1 /dev/sdb:0-1
+.P
+Resize an LV to use 50% of the size volume group.
+.br
+.B lvresize -l50%VG vg1/lv1
diff --git a/man/see_also.end b/man/see_also.end
index e740ce588..cf7834052 100644
--- a/man/see_also.end
+++ b/man/see_also.end
@@ -63,6 +63,7 @@
.BR lvmlockctl (8),
.BR cmirrord (8),
.BR lvmdbusd (8),
+.BR fsadm (8),
.P
.BR lvmsystemid (7),
.BR lvmreport (7),
2 years, 5 months
main - man: add missing _iorig suffix
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a21028dea71464f93cd...
Commit: a21028dea71464f93cd1c0836aee63ebfc3add10
Parent: 579c9413212deb80c56628a11bd36ba9bace3a22
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 22 12:37:18 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
man: add missing _iorig suffix
---
man/lvm.8_main | 1 +
1 file changed, 1 insertion(+)
diff --git a/man/lvm.8_main b/man/lvm.8_main
index 234442e64..6f86d0353 100644
--- a/man/lvm.8_main
+++ b/man/lvm.8_main
@@ -288,6 +288,7 @@ The LV name may also not contain any of the following strings:
.RB ' _cdata ',
.RB ' _cmeta ',
.RB ' _corig ',
+.RB ' _iorig ',
.RB ' _mimage ',
.RB ' _mlog ',
.RB ' _pmspare ',
2 years, 5 months
main - man: document fsadm -l option
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=579c9413212deb80c56...
Commit: 579c9413212deb80c56628a11bd36ba9bace3a22
Parent: 6f61de300980a55381c70347712c22a96c22807b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 22 11:09:05 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
man: document fsadm -l option
Missed -l option in man page, although users should prefer
lvresize -r when the also want to do a volume management,
as there they can specify i.e. extents for allocation.
Also mention dm-crypt support in command description.
---
man/fsadm.8_main | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/man/fsadm.8_main b/man/fsadm.8_main
index d83e99292..dfff5bb97 100644
--- a/man/fsadm.8_main
+++ b/man/fsadm.8_main
@@ -25,13 +25,14 @@ fsadm \(em utility to resize or check filesystem on a device
.
.SH DESCRIPTION
.
-fsadm utility checks or resizes the filesystem on a device.
+fsadm utility checks or resizes the filesystem on a device (can be
+also dm-crypt encrypted device).
It tries to use the same API for
.BR ext2 ,
.BR ext3 ,
.BR ext4 ,
.BR ReiserFS
-.RB and
+and
.BR XFS
filesystem.
.
@@ -50,6 +51,12 @@ Bypass some sanity checks.
Display the help text.
.
.TP
+.BR -l | --lvresize
+Resize also given lvm2 logical volume. More volume management
+functionality is provided with complementary \fBlvresize\fP(8) and the option
+.BR -r | --resizefs.
+.
+.TP
.BR -n | --dry-run
Print commands without running them.
.
2 years, 5 months
main - args.h: bold command refference
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6f61de300980a55381c...
Commit: 6f61de300980a55381c70347712c22a96c22807b
Parent: f678052385dd7fe04e4d4c3681b7dd58b1bca64b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 23 22:45:20 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 23 23:00:55 2021 +0200
args.h: bold command refference
---
tools/args.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/args.h b/tools/args.h
index 93ee737ce..741c82b9f 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -1386,7 +1386,7 @@ arg(readahead_ARG, 'r', "readahead", readahead_VAL, 0, 0,
"\\fBnone\\fP is equivalent to zero.\n")
arg(resizefs_ARG, 'r', "resizefs", 0, 0, 0,
- "Resize underlying filesystem together with the LV using fsadm(8).\n")
+ "Resize underlying filesystem together with the LV using \\fBfsadm\\fP(8).\n")
/* Not used */
arg(reset_ARG, 'R', "reset", 0, 0, 0, NULL)
2 years, 5 months