master - test: fix typo
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=17838e6439f7cabfa46...
Commit: 17838e6439f7cabfa4609dbfb48197d5a33138f8
Parent: 11589891d7793e6ba1fc520ef9496bd35b497912
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Mar 3 23:22:29 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Mar 3 23:22:29 2017 +0100
test: fix typo
---
test/shell/lvchange-raid1-writemostly.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvchange-raid1-writemostly.sh b/test/shell/lvchange-raid1-writemostly.sh
index edf11bd..1414398 100644
--- a/test/shell/lvchange-raid1-writemostly.sh
+++ b/test/shell/lvchange-raid1-writemostly.sh
@@ -25,7 +25,7 @@ do
done
#
-# Test writemostly prohibited on resyncrhonizing raid1
+# Test writemostly prohibited on resynchronizing raid1
#
# Create 4-way striped LV
6 years
master - man: move the full UNIT description
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=11589891d7793e6ba1f...
Commit: 11589891d7793e6ba1fc520ef9496bd35b497912
Parent: b6c4b7cfb07504229cb7ff1f02f4cce4ebdead6d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Mar 3 16:10:40 2017 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Mar 3 16:12:02 2017 -0600
man: move the full UNIT description
Part of the UNIT description was still living in the
--size description. Move it to the Size[UNIT] description
since it is used by other options, not just --size.
---
tools/args.h | 12 ------------
tools/command.c | 3 +++
2 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/tools/args.h b/tools/args.h
index 448f6aa..7c44256 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -1062,12 +1062,6 @@ arg(size_ARG, 'L', "size", ssizemb_VAL, 0, 0,
"The --size and --extents options are alternate methods of specifying size.\n"
"The total number of physical extents used will be\n"
"greater when redundant data is needed for RAID levels.\n"
- "A suffix can be chosen from: \\fBbBsSkKmMgGtTpPeE\\fP.\n"
- "All units are base two values, regardless of letter capitalization:\n"
- "b|B is bytes, s|S is sectors of 512 bytes,\n"
- "k|K is kilobytes, m|M is megabytes,\n"
- "g|G is gigabytes, t|T is terabytes,\n"
- "p|P is petabytes, e|E is exabytes.\n"
"#lvreduce\n"
"#lvextend\n"
"#lvresize\n"
@@ -1075,12 +1069,6 @@ arg(size_ARG, 'L', "size", ssizemb_VAL, 0, 0,
"The --size and --extents options are alternate methods of specifying size.\n"
"The total number of physical extents used will be\n"
"greater when redundant data is needed for RAID levels.\n"
- "A suffix can be chosen from: \\fBbBsSkKmMgGtTpPeE\\fP.\n"
- "All units are base two values, regardless of letter capitalization:\n"
- "b|B is bytes, s|S is sectors of 512 bytes,\n"
- "k|K is kilobytes, m|M is megabytes,\n"
- "g|G is gigabytes, t|T is terabytes,\n"
- "p|P is petabytes, e|E is exabytes.\n"
"The plus prefix \\fB+\\fP can be used, in which case\n"
"the value is added to the current size,\n"
"or the minus prefix \\fB-\\fP can be used, in which case\n"
diff --git a/tools/command.c b/tools/command.c
index 70f9bee..5fc5ff3 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -3093,6 +3093,9 @@ void print_man_all_positions_desc(struct command_name *cname)
"capitalization, e.g. 'k' and 'K' both refer to 1024.\n"
"The default input unit is specified by letter, followed by |UNIT.\n"
"UNIT represents other possible input units: \\fBbBsSkKmMgGtTpPeE\\fP.\n"
+ "b|B is bytes, s|S is sectors of 512 bytes, k|K is kilobytes,\n"
+ "m|M is megabytes, g|G is gigabytes, t|T is terabytes,\n"
+ "p|P is petabytes, e|E is exabytes.\n"
"(This should not be confused with the output control --units, where\n"
"capital letters mean multiple of 1000.)\n");
6 years
master - man/help: poolmetadatasize option can take relative value
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b6c4b7cfb07504229cb...
Commit: b6c4b7cfb07504229cb7ff1f02f4cce4ebdead6d
Parent: c5b6c9ad44a3057cd3d8e81e29b65149151ff1e7
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Mar 3 15:57:51 2017 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Mar 3 16:12:02 2017 -0600
man/help: poolmetadatasize option can take relative value
In lvcreate/lvconvert, --poolmetdatasize can only be an
absolute value, but in lvresize/lvextend, --poolmetadatasize
can be given a + relative value.
The val types only currently support relative values that
go in both directions +|-. Further work is needed to add
val types that can be relative in only one direction, and
switching various option values to one those depending on
the command name. Then poolmetdatasize will not appear
with a +|- option in lvcreate/lvconvert, and will
appear with only the + option in lvresize/lvextend.
---
tools/args.h | 11 +++++++++--
tools/command-lines.in | 12 ++++++------
tools/command.c | 8 ++++++++
3 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/tools/args.h b/tools/args.h
index 5512bed..448f6aa 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -414,8 +414,15 @@ arg(pooldatasize_ARG, '\0', "pooldatasize", sizemb_VAL, 0, 0, NULL)
arg(poolmetadata_ARG, '\0', "poolmetadata", lv_VAL, 0, 0,
"The name of a an LV to use for storing pool metadata.\n")
-arg(poolmetadatasize_ARG, '\0', "poolmetadatasize", sizemb_VAL, 0, 0,
- "The size of the pool metadata LV created by the command.\n")
+arg(poolmetadatasize_ARG, '\0', "poolmetadatasize", ssizemb_VAL, 0, 0,
+ "#lvcreate\n"
+ "#lvconvert\n"
+ "Specifies the size of the new pool metadata LV.\n"
+ "#lvresize\n"
+ "#lvextend\n"
+ "Specifies the new size of the pool metadata LV.\n"
+ "The plus prefix \\fB+\\fP can be used, in which case\n"
+ "the value is added to the current size.\n")
arg(poolmetadataspare_ARG, '\0', "poolmetadataspare", bool_VAL, 0, 0,
"Enable or disable the automatic creation and management of a\n"
diff --git a/tools/command-lines.in b/tools/command-lines.in
index f6a4414..b1405b6 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -307,7 +307,7 @@ RULE: all not LV_thinpool LV_cachepool
OO_LVCONVERT_RAID: --mirrors SNumber, --stripes_long Number,
--stripesize SizeKB, --regionsize RegionSize, --interval Number
-OO_LVCONVERT_POOL: --poolmetadata LV, --poolmetadatasize SizeMB,
+OO_LVCONVERT_POOL: --poolmetadata LV, --poolmetadatasize SSizeMB,
--poolmetadataspare Bool, --readahead Readahead, --chunksize SizeKB
OO_LVCONVERT_CACHE: --cachemode CacheMode, --cachepolicy String,
@@ -702,7 +702,7 @@ OO_LVCREATE: --addtag Tag, --alloc Alloc, --autobackup Bool, --activate Active,
OO_LVCREATE_CACHE: --cachemode CacheMode, --cachepolicy String, --cachesettings String,
--chunksize SizeKB
-OO_LVCREATE_POOL: --poolmetadatasize SizeMB, --poolmetadataspare Bool, --chunksize SizeKB
+OO_LVCREATE_POOL: --poolmetadatasize SSizeMB, --poolmetadataspare Bool, --chunksize SizeKB
OO_LVCREATE_THIN: --discards Discards, --errorwhenfull Bool
@@ -1148,7 +1148,7 @@ ID: lvdisplay_general
lvextend --size SSizeMB LV
OO: --alloc Alloc, --autobackup Bool, --force, --mirrors SNumber,
--nofsck, --nosync, --noudevsync, --reportformat ReportFmt, --resizefs,
---stripes Number, --stripesize SizeKB, --poolmetadatasize SizeMB,
+--stripes Number, --stripesize SizeKB, --poolmetadatasize SSizeMB,
--type SegType
OP: PV ...
ID: lvextend_by_size
@@ -1162,7 +1162,7 @@ OO: --alloc Alloc, --autobackup Bool, --force, --mirrors SNumber,
ID: lvextend_by_pv
DESC: Extend an LV by specified PV extents.
-lvextend --poolmetadatasize SizeMB LV_thinpool
+lvextend --poolmetadatasize SSizeMB LV_thinpool
OO: --alloc Alloc, --autobackup Bool, --force, --mirrors SNumber,
--nofsck, --nosync, --noudevsync,
--reportformat ReportFmt, --stripes Number, --stripesize SizeKB,
@@ -1220,7 +1220,7 @@ ID: lvrename_lv_lv
lvresize --size SSizeMB LV
OO: --alloc Alloc, --autobackup Bool, --force,
--nofsck, --nosync, --noudevsync, --reportformat ReportFmt, --resizefs,
---stripes Number, --stripesize SizeKB, --poolmetadatasize SizeMB,
+--stripes Number, --stripesize SizeKB, --poolmetadatasize SSizeMB,
--type SegType
OP: PV ...
ID: lvresize_by_size
@@ -1234,7 +1234,7 @@ OO: --alloc Alloc, --autobackup Bool, --force,
ID: lvresize_by_pv
DESC: Resize an LV by specified PV extents.
-lvresize --poolmetadatasize SizeMB LV_thinpool
+lvresize --poolmetadatasize SSizeMB LV_thinpool
OO: --alloc Alloc, --autobackup Bool, --force,
--nofsck, --nosync, --noudevsync,
--reportformat ReportFmt, --stripes Number, --stripesize SizeKB,
diff --git a/tools/command.c b/tools/command.c
index 436e759..70f9bee 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -1596,6 +1596,10 @@ static void print_val_usage(struct command *cmd, int val_enum)
* lvcreate does not take a relative [+|-] value
* for --size or --extents.
* Should we also squash - for lvextend and + for lvreduce?
+ *
+ * Should also squash +|- in front of poolmetadatasize value
+ * in lvcreate and lvconvert, and squash - in front of
+ * poolmetadatasize value in lvresize/lvextend.
*/
squash_sign_prefix = !strcmp(cmd->name, "lvcreate");
@@ -2070,6 +2074,10 @@ static void print_val_man(struct command_name *cname, int val_enum)
* lvcreate does not take a relative [+|-] value
* for --size or --extents.
* Should we also squash - for lvextend and + for lvreduce?
+ *
+ * Should also squash +|- in front of poolmetadatasize value
+ * in lvcreate and lvconvert, and squash - in front of
+ * poolmetadatasize value in lvresize/lvextend.
*/
squash_sign_prefix = !strcmp(cname->name, "lvcreate");
6 years
master - report: raid enhancements for --select
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c5b6c9ad44a3057cd3d...
Commit: c5b6c9ad44a3057cd3d8e81e29b65149151ff1e7
Parent: 6dea1ed5ae47018d75532203660eca0decbda08e
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Mar 3 22:29:50 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Mar 3 22:29:50 2017 +0100
report: raid enhancements for --select
Enhance the raid report functions for the recently added LV fields
reshape_len, reshape_len_le, data_offset, new_data_offset, data_copies,
data_stripes and parity_chunks to cope with "lvs --select".
Related: rhbz834579
Related: rhbz1191935
Related: rhbz1191978
---
lib/metadata/lv.c | 21 +++++++++
lib/report/columns.h | 4 +-
lib/report/report.c | 110 +++++++++++++++++++++++++++++---------------------
3 files changed, 87 insertions(+), 48 deletions(-)
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index b54e391..a7e1dcd 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -1104,6 +1104,19 @@ int lv_raid_healthy(const struct logical_volume *lv)
return 1;
}
+/* Helper: check for any sub LVs after a disk removing reshape */
+static int _sublvs_remove_after_reshape(const struct logical_volume *lv)
+{
+ uint32_t s;
+ struct lv_segment *seg = first_seg(lv);
+
+ for (s = seg->area_count -1; s; s--)
+ if (seg_lv(seg, s)->status & LV_REMOVE_AFTER_RESHAPE)
+ return 1;
+
+ return 0;
+}
+
char *lv_attr_dup_with_info_and_seg_status(struct dm_pool *mem, const struct lv_with_info_and_seg_status *lvdm)
{
const struct logical_volume *lv = lvdm->lv;
@@ -1269,6 +1282,8 @@ char *lv_attr_dup_with_info_and_seg_status(struct dm_pool *mem, const struct lv_
repstr[8] = 'p';
else if (lv_is_raid_type(lv)) {
uint64_t n;
+ char *sync_action;
+
if (!activation())
repstr[8] = 'X'; /* Unknown */
else if (!lv_raid_healthy(lv))
@@ -1276,6 +1291,12 @@ char *lv_attr_dup_with_info_and_seg_status(struct dm_pool *mem, const struct lv_
else if (lv_is_raid(lv)) {
if (lv_raid_mismatch_count(lv, &n) && n)
repstr[8] = 'm'; /* RAID has 'm'ismatches */
+ else if (lv_raid_sync_action(lv, &sync_action) &&
+ !strcmp(sync_action, "reshape"))
+ repstr[8] = 's'; /* LV is re(s)haping */
+ else if (_sublvs_remove_after_reshape(lv))
+ repstr[8] = 'R'; /* sub-LV got freed from raid set by reshaping
+ and has to be 'R'emoved */
} else if (lv->status & LV_WRITEMOSTLY)
repstr[8] = 'w'; /* sub-LV has 'w'ritemostly */
else if (lv->status & LV_REMOVE_AFTER_RESHAPE)
diff --git a/lib/report/columns.h b/lib/report/columns.h
index 31255d7..f723ded 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -243,8 +243,8 @@ FIELD(VGS, vg, NUM, "#VMdaCps", cmd, 0, vgmdacopies, vg_mda_copies, "Target numb
FIELD(SEGS, seg, STR, "Type", list, 0, segtype, segtype, "Type of LV segment.", 0)
FIELD(SEGS, seg, NUM, "#Str", list, 0, seg_stripes, stripes, "Number of stripes or mirror/raid1 legs.", 0)
FIELD(SEGS, seg, NUM, "#DStr", list, 0, seg_data_stripes, data_stripes, "Number of data stripes or mirror/raid1 legs.", 0)
-FIELD(SEGS, seg, NUM, "RSize", list, 0, seg_reshape_len, reshape_len, "Size of out-of-place reshape space in current units.", 0)
-FIELD(SEGS, seg, SIZ, "RSize", list, 0, seg_reshape_len_le, reshape_len_le, "Size of out-of-place reshape space in physical extents.", 0)
+FIELD(SEGS, seg, SIZ, "RSize", list, 0, seg_reshape_len, reshape_len, "Size of out-of-place reshape space in current units.", 0)
+FIELD(SEGS, seg, NUM, "RSize", list, 0, seg_reshape_len_le, reshape_len_le, "Size of out-of-place reshape space in logical extents.", 0)
FIELD(SEGS, seg, NUM, "#Cpy", list, 0, seg_data_copies, data_copies, "Number of data copies.", 0)
FIELD(SEGS, seg, NUM, "DOff", list, 0, seg_data_offset, data_offset, "Data offset on each image device.", 0)
FIELD(SEGS, seg, NUM, "NOff", list, 0, seg_new_data_offset, new_data_offset, "New data offset after any reshape on each image device.", 0)
diff --git a/lib/report/report.c b/lib/report/report.c
index 5142f72..1808a2b 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -2412,6 +2412,7 @@ static int _segstartpe_disp(struct dm_report *rh,
return dm_report_field_uint32(rh, field, &seg->le);
}
+/* Hepler: get used stripes = total stripes minux any to remove after reshape */
static int _get_seg_used_stripes(const struct lv_segment *seg)
{
uint32_t s;
@@ -2437,6 +2438,7 @@ static int _seg_stripes_disp(struct dm_report *rh, struct dm_pool *mem,
return dm_report_field_uint32(rh, field, &seg->area_count);
}
+/* Report the number of data stripes, which is less than total stripes (e.g. 2 less for raid6) */
static int _seg_data_stripes_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
@@ -2451,95 +2453,111 @@ static int _seg_data_stripes_disp(struct dm_report *rh, struct dm_pool *mem,
return dm_report_field_uint32(rh, field, &stripes);
}
+/* Helper: return the top-level, reshapable raid LV in case @seg belongs to an raid rimage LV */
+static struct logical_volume *_lv_for_raid_image_seg(const struct lv_segment *seg, struct dm_pool *mem)
+{
+ char *lv_name;
+
+ if (seg_is_reshapable_raid(seg))
+ return seg->lv;
+
+ if (seg->lv &&
+ lv_is_raid_image(seg->lv) && !seg->le &&
+ (lv_name = dm_pool_strdup(mem, seg->lv->name))) {
+ char *p = strchr(lv_name, '_');
+
+ if (p) {
+ /* Handle duplicated sub LVs */
+ if (strstr(p, "_dup_"))
+ p = strchr(p + 5, '_');
+
+ if (p) {
+ struct lv_list *lvl;
+
+ *p = '\0';
+ if ((lvl = find_lv_in_vg(seg->lv->vg, lv_name)) &&
+ seg_is_reshapable_raid(first_seg(lvl->lv)))
+ return lvl->lv;
+
+ }
+ }
+ }
+
+ return NULL;
+}
+
+/* Helper: return the top-level raid LV in case it is reshapale for @seg or @seg if it is */
+static const struct lv_segment *_get_reshapable_seg(const struct lv_segment *seg, struct dm_pool *mem)
+{
+ return _lv_for_raid_image_seg(seg, mem) ? seg : NULL;
+}
+
+/* Display segment reshape length in current units */
static int _seg_reshape_len_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
- const struct lv_segment *seg = (const struct lv_segment *) data;
- uint32_t reshape_len = seg->reshape_len;
+ const struct lv_segment *seg = _get_reshapable_seg((const struct lv_segment *) data, mem);
- if (reshape_len && seg->lv) {
- reshape_len *= seg->area_count * seg->lv->vg->extent_size;
+ if (seg) {
+ uint32_t reshape_len = seg->reshape_len * seg->area_count * seg->lv->vg->extent_size;
return _size32_disp(rh, mem, field, &reshape_len, private);
}
- return _field_set_value(field, "", &GET_TYPE_RESERVED_VALUE(num_undef_32));
+ return _field_set_value(field, "", &GET_TYPE_RESERVED_VALUE(num_undef_64));
}
+/* Display segment reshape length of in logical extents */
static int _seg_reshape_len_le_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
- const struct lv_segment *seg = (const struct lv_segment *) data;
- uint32_t reshape_len = seg->reshape_len;
+ const struct lv_segment *seg = _get_reshapable_seg((const struct lv_segment *) data, mem);
- if (reshape_len) {
- reshape_len *= seg->area_count;
+ if (seg) {
+ uint32_t reshape_len = seg->reshape_len* seg->area_count;
return dm_report_field_uint32(rh, field, &reshape_len);
}
- return _field_set_value(field, "", &GET_TYPE_RESERVED_VALUE(num_undef_32));
+ return _field_set_value(field, "", &GET_TYPE_RESERVED_VALUE(num_undef_64));
}
+/* Display segment data copies (e.g. 3 for raid6) */
static int _seg_data_copies_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
const struct lv_segment *seg = (const struct lv_segment *) data;
- if (seg->data_copies > 1)
+ if (seg->data_copies)
return dm_report_field_uint32(rh, field, &seg->data_copies);
- return _field_set_value(field, "", &GET_TYPE_RESERVED_VALUE(num_undef_32));
+ return _field_set_value(field, "", &GET_TYPE_RESERVED_VALUE(num_undef_64));
}
+/* Helper: display segment data offset/new data offset in sectors */
static int _segdata_offset(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private, int new_data_offset)
{
const struct lv_segment *seg = (const struct lv_segment *) data;
- const char *what = "";
+ struct logical_volume *lv;
- if (lv_is_raid_image(seg->lv) &&
- !seg->le &&
- (seg->reshape_len || !new_data_offset)) {
- struct lv_list *lvl;
- char *lv_name;
+ if ((lv = _lv_for_raid_image_seg(seg, mem))) {
+ uint64_t data_offset;
- if ((lv_name = strdup(seg->lv->name))) {
- char *p = strchr(lv_name, '_');
+ if (lv_raid_data_offset(lv, &data_offset)) {
+ if (new_data_offset && !lv_raid_image_in_sync(seg->lv))
+ data_offset = data_offset ? 0 : seg->reshape_len * lv->vg->extent_size;
- if (p) {
- /* Handle duplicated sub LVs */
- if (strstr(p, "_dup_"))
- p = strchr(p + 5, '_');
-
- if (p) {
- *p = '\0';
- if ((lvl = find_lv_in_vg(seg->lv->vg, lv_name))) {
- if (seg_is_reshapable_raid(first_seg(lvl->lv))) {
- uint64_t data_offset;
-
- if (lv_raid_data_offset(lvl->lv, &data_offset)) {
- if (new_data_offset && !lv_raid_image_in_sync(seg->lv))
- data_offset = data_offset ? 0 :
- seg->reshape_len * seg->lv->vg->extent_size;
-
- return dm_report_field_uint64(rh, field, &data_offset);
- }
-
- what = _str_unknown;
- }
- }
- }
- }
+ return dm_report_field_uint64(rh, field, &data_offset);
}
}
- return _field_set_value(field, what, &GET_TYPE_RESERVED_VALUE(num_undef_64));
+ return _field_set_value(field, "", &GET_TYPE_RESERVED_VALUE(num_undef_64));
}
static int _seg_data_offset_disp(struct dm_report *rh, struct dm_pool *mem,
@@ -2582,7 +2600,7 @@ static int _seg_parity_chunks_disp(struct dm_report *rh, struct dm_pool *mem,
return dm_report_field_uint32(rh, field, &parity_chunks);
}
- return _field_set_value(field, "", &GET_TYPE_RESERVED_VALUE(num_undef_32));
+ return _field_set_value(field, "", &GET_TYPE_RESERVED_VALUE(num_undef_64));
}
static int _segsize_disp(struct dm_report *rh, struct dm_pool *mem,
6 years
master - man: fix term in lvmraid(7)
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6dea1ed5ae47018d755...
Commit: 6dea1ed5ae47018d75532203660eca0decbda08e
Parent: e4ef3d04ad3a2870f94557250006e4c93431b0bb
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Mar 3 22:24:13 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Mar 3 22:24:53 2017 +0100
man: fix term in lvmraid(7)
Adjust commit af7c8e710663 to use "image/leg".
Related: rhbz834579
Related: rhbz1191935
Related: rhbz1191978
---
man/lvmraid.7.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/man/lvmraid.7.in b/man/lvmraid.7.in
index e0657b8..832242c 100644
--- a/man/lvmraid.7.in
+++ b/man/lvmraid.7.in
@@ -22,7 +22,7 @@ devices, and MD is used to place data on physical devices.
LVM creates hidden LVs (dm devices) layered between the visible LV and
physical devices. LVs in that middle layers are called sub LVs.
For LVM raid, a sub LV pair to store data and metadata (raid superblock
-and bitmap) is created per raid leg (see lvs command examples below).
+and bitmap) is created per raid image/leg (see lvs command examples below).
.SH Create a RAID LV
6 years
master - help: show short opt with long opt
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e4ef3d04ad3a2870f94...
Commit: e4ef3d04ad3a2870f94557250006e4c93431b0bb
Parent: 547bdb63e1757288586ea5b74b228f35bb8d2af2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Mar 3 15:12:46 2017 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Mar 3 15:14:18 2017 -0600
help: show short opt with long opt
e.g. show -n|--name instead of just --name
---
tools/command.c | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 140 insertions(+), 5 deletions(-)
diff --git a/tools/command.c b/tools/command.c
index cab6f09..436e759 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -1675,9 +1675,14 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
if (cmd->ro_count) {
first = 1;
+ /* print options with short opts */
+
for (ro = 0; ro < cmd->ro_count; ro++) {
opt_enum = cmd->required_opt_args[ro].opt;
+ if (!opt_names[opt_enum].short_opt)
+ continue;
+
if ((opt_enum == size_ARG) && command_has_alternate_extents(cmd->name))
include_extents = 1;
@@ -1689,12 +1694,41 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
first = 0;
}
- printf(" %s", opt_names[cmd->required_opt_args[ro].opt].long_opt);
+ printf(" -%c|%s", opt_names[opt_enum].short_opt, opt_names[opt_enum].long_opt);
+ if (cmd->required_opt_args[ro].def.val_bits) {
+ printf(" ");
+ print_usage_def(cmd, opt_enum, &cmd->required_opt_args[ro].def);
+ }
+ }
+
+ /* print options without short opts */
+
+ for (ro = 0; ro < cmd->ro_count; ro++) {
+ opt_enum = cmd->required_opt_args[ro].opt;
+
+ if (opt_names[opt_enum].short_opt)
+ continue;
+
+ if ((opt_enum == size_ARG) && command_has_alternate_extents(cmd->name))
+ include_extents = 1;
+
+ if (onereq) {
+ if (first)
+ printf("\n\t(");
+ else {
+ printf(",\n\t ");
+ printf(" "); /* align for no short opt */
+ }
+ first = 0;
+ }
+
+ printf(" %s", opt_names[opt_enum].long_opt);
if (cmd->required_opt_args[ro].def.val_bits) {
printf(" ");
print_usage_def(cmd, opt_enum, &cmd->required_opt_args[ro].def);
}
}
+
if (onereq)
printf(" )\n");
}
@@ -1718,14 +1752,19 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
if (cmd->oo_count) {
if (include_extents) {
- printf("\n\t[ --extents ");
+ printf("\n\t[ -l|--extents ");
print_val_usage(cmd, extents_VAL);
printf(" ]");
}
+ /* print optional options with short opts */
+
for (oo = 0; oo < cmd->oo_count; oo++) {
opt_enum = cmd->optional_opt_args[oo].opt;
+ if (!opt_names[opt_enum].short_opt)
+ continue;
+
/*
* Skip common lvm options in lvm_all which
* are printed at the end under "Common options for lvm"
@@ -1749,7 +1788,47 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
printf("\n\t[");
- printf(" %s", opt_names[opt_enum].long_opt);
+ printf(" -%c|%s", opt_names[opt_enum].short_opt, opt_names[opt_enum].long_opt);
+ if (cmd->optional_opt_args[oo].def.val_bits) {
+ printf(" ");
+ print_usage_def(cmd, opt_enum, &cmd->optional_opt_args[oo].def);
+ }
+
+ printf(" ]");
+ }
+
+ /* print optional options without short opts */
+
+ for (oo = 0; oo < cmd->oo_count; oo++) {
+ opt_enum = cmd->optional_opt_args[oo].opt;
+
+ if (opt_names[opt_enum].short_opt)
+ continue;
+
+ /*
+ * Skip common lvm options in lvm_all which
+ * are printed at the end under "Common options for lvm"
+ * see print_common_options_lvm()
+ */
+
+ if (is_lvm_all_opt(opt_enum))
+ continue;
+
+ /*
+ * When there is more than one variant,
+ * skip common command options from
+ * cname->common_options (options common
+ * to all variants), which are printed at
+ * the end under "Common options for command"
+ * see print_common_options_cmd()
+ */
+
+ if ((cname->variants > 1) && cname->common_options[opt_enum])
+ continue;
+
+ printf("\n\t[");
+
+ printf(" %s", opt_names[opt_enum].long_opt);
if (cmd->optional_opt_args[oo].def.val_bits) {
printf(" ");
print_usage_def(cmd, opt_enum, &cmd->optional_opt_args[oo].def);
@@ -1794,12 +1873,35 @@ void print_usage_common_lvm(struct command_name *cname, struct command *cmd)
printf(" Common options for lvm:");
+ /* print options with short opts */
+
+ for (oo = 0; oo < lvm_all.oo_count; oo++) {
+ opt_enum = lvm_all.optional_opt_args[oo].opt;
+
+ if (!opt_names[opt_enum].short_opt)
+ continue;
+
+ printf("\n\t[");
+
+ printf(" -%c|%s", opt_names[opt_enum].short_opt, opt_names[opt_enum].long_opt);
+ if (lvm_all.optional_opt_args[oo].def.val_bits) {
+ printf(" ");
+ print_usage_def(cmd, opt_enum, &lvm_all.optional_opt_args[oo].def);
+ }
+ printf(" ]");
+ }
+
+ /* print options without short opts */
+
for (oo = 0; oo < lvm_all.oo_count; oo++) {
opt_enum = lvm_all.optional_opt_args[oo].opt;
+ if (opt_names[opt_enum].short_opt)
+ continue;
+
printf("\n\t[");
- printf(" %s", opt_names[opt_enum].long_opt);
+ printf(" %s", opt_names[opt_enum].long_opt);
if (lvm_all.optional_opt_args[oo].def.val_bits) {
printf(" ");
print_usage_def(cmd, opt_enum, &lvm_all.optional_opt_args[oo].def);
@@ -1824,6 +1926,8 @@ void print_usage_common_cmd(struct command_name *cname, struct command *cmd)
printf(" Common options for command:");
+ /* print options with short opts */
+
for (opt_enum = 0; opt_enum < ARG_COUNT; opt_enum++) {
if (!cname->common_options[opt_enum])
continue;
@@ -1831,13 +1935,44 @@ void print_usage_common_cmd(struct command_name *cname, struct command *cmd)
if (is_lvm_all_opt(opt_enum))
continue;
+ if (!opt_names[opt_enum].short_opt)
+ continue;
+
printf("\n\t[");
for (oo = 0; oo < cmd->oo_count; oo++) {
if (cmd->optional_opt_args[oo].opt != opt_enum)
continue;
- printf(" %s", opt_names[opt_enum].long_opt);
+ printf(" -%c|%s", opt_names[opt_enum].short_opt, opt_names[opt_enum].long_opt);
+ if (cmd->optional_opt_args[oo].def.val_bits) {
+ printf(" ");
+ print_usage_def(cmd, opt_enum, &cmd->optional_opt_args[oo].def);
+ }
+ break;
+ }
+ printf(" ]");
+ }
+
+ /* print options without short opts */
+
+ for (opt_enum = 0; opt_enum < ARG_COUNT; opt_enum++) {
+ if (!cname->common_options[opt_enum])
+ continue;
+
+ if (is_lvm_all_opt(opt_enum))
+ continue;
+
+ if (opt_names[opt_enum].short_opt)
+ continue;
+
+ printf("\n\t[");
+
+ for (oo = 0; oo < cmd->oo_count; oo++) {
+ if (cmd->optional_opt_args[oo].opt != opt_enum)
+ continue;
+
+ printf(" %s", opt_names[opt_enum].long_opt);
if (cmd->optional_opt_args[oo].def.val_bits) {
printf(" ");
print_usage_def(cmd, opt_enum, &cmd->optional_opt_args[oo].def);
6 years
master - dev_manager: remove reshape message
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=547bdb63e1757288586...
Commit: 547bdb63e1757288586ea5b74b228f35bb8d2af2
Parent: 9a50df291a616e4fe2b0f569b41ac3b2b7d08a33
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Mar 3 22:10:21 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Mar 3 22:10:21 2017 +0100
dev_manager: remove reshape message
The dm-raid target doesn't support a "reshape" message.
---
lib/activate/dev_manager.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 49d9ad3..a2e399d 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1316,14 +1316,13 @@ int dev_manager_raid_message(struct dev_manager *dm,
return 0;
}
- /* These are the supported RAID messages for dm-raid v1.5.0 */
+ /* These are the supported RAID messages for dm-raid v1.9.0 */
if (strcmp(msg, "idle") &&
strcmp(msg, "frozen") &&
strcmp(msg, "resync") &&
strcmp(msg, "recover") &&
strcmp(msg, "check") &&
- strcmp(msg, "repair") &&
- strcmp(msg, "reshape")) {
+ strcmp(msg, "repair")) {
log_error(INTERNAL_ERROR "Unknown RAID message: %s.", msg);
return 0;
}
6 years
master - man/help: rework extents and size output
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9a50df291a616e4fe2b...
Commit: 9a50df291a616e4fe2b0f569b41ac3b2b7d08a33
Parent: e7ee89d80b0b876cd73573338022b1308d59b209
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Mar 3 14:21:36 2017 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Mar 3 14:23:50 2017 -0600
man/help: rework extents and size output
Clean up and correct the details around --extents and --size.
lvcreate/lvresize/lvreduce/lvextend all now display the
extents option in usages.
The Size and Number value variables for --size and --extents
are now displayed without the [+|-] prefix for lvcreate.
---
man/lvcreate.8.des | 2 +-
man/lvextend.8.des | 4 +
man/lvreduce.8.des | 5 ++
man/lvresize.8.des | 5 ++
tools/args.h | 15 +++-
tools/command.c | 177 ++++++++++++++++++++++++++++------------------------
tools/command.h | 1 +
tools/lvmcmdline.c | 10 +--
tools/vals.h | 4 +-
9 files changed, 128 insertions(+), 95 deletions(-)
diff --git a/man/lvcreate.8.des b/man/lvcreate.8.des
index b77006b..acc07b3 100644
--- a/man/lvcreate.8.des
+++ b/man/lvcreate.8.des
@@ -29,7 +29,7 @@ to improve performance.
.SS Usage notes
In the usage section below, \fB--size\fP \fISize\fP can be replaced
-in each case with \fB--extents\fP \fINumber\fP. See both descriptions
+with \fB--extents\fP \fINumber\fP. See both descriptions
the options section.
In the usage section below, \fB--name\fP is omitted from the required
diff --git a/man/lvextend.8.des b/man/lvextend.8.des
index 2a3781d..346bd23 100644
--- a/man/lvextend.8.des
+++ b/man/lvextend.8.des
@@ -3,3 +3,7 @@ extents from the VG's free physical extents. A copy\-on\-write snapshot LV
can also be extended to provide more space to hold COW blocks. Use
\fBlvconvert\fP(8) to change the number of data images in a RAID or
mirrored LV.
+
+In the usage section below, \fB--size\fP \fISize\fP can be replaced
+with \fB--extents\fP \fINumber\fP. See both descriptions
+the options section.
diff --git a/man/lvreduce.8.des b/man/lvreduce.8.des
index 7f0ba0c..3d5fc2a 100644
--- a/man/lvreduce.8.des
+++ b/man/lvreduce.8.des
@@ -12,3 +12,8 @@ system.
Sizes will be rounded if necessary. For example, the LV size must be an
exact number of extents, and the size of a striped segment must be a
multiple of the number of stripes.
+
+In the usage section below, \fB--size\fP \fISize\fP can be replaced
+with \fB--extents\fP \fINumber\fP. See both descriptions
+the options section.
+
diff --git a/man/lvresize.8.des b/man/lvresize.8.des
index 7fdcacc..6f39ef7 100644
--- a/man/lvresize.8.des
+++ b/man/lvresize.8.des
@@ -1,2 +1,7 @@
lvresize resizes an LV in the same way as lvextend and lvreduce. See
\fBlvextend\fP(8) and \fBlvreduce\fP(8) for more information.
+
+In the usage section below, \fB--size\fP \fISize\fP can be replaced
+with \fB--extents\fP \fINumber\fP. See both descriptions
+the options section.
+
diff --git a/tools/args.h b/tools/args.h
index 83700b3..5512bed 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -1022,10 +1022,9 @@ arg(extents_ARG, 'l', "extents", extents_VAL, 0, 0,
"When expressed as a percentage, the size defines an upper limit for the\n"
"number of logical extents in the new LV. The precise number of logical\n"
"extents in the new LV is not determined until the command has completed.\n"
- "The plus prefix \\fB+\\fP can be used, in which case\n"
- "the value is added to the current size,\n"
- "or the minus prefix \\fB-\\fP can be used, in which case\n"
- "the value is subtracted from the current size.\n")
+ "The plus \\fB+\\fP or minus \\fB-\\fP prefix can be used, in which case\n"
+ "the value is not an absolute size, but is an amount added or subtracted\n"
+ "relative to the current size.\n")
arg(list_ARG, 'l', "list", 0, 0, 0,
"#lvmconfig\n"
@@ -1042,6 +1041,14 @@ arg(list_ARG, 'l', "list", 0, 0, 0,
arg(lvmpartition_ARG, 'l', "lvmpartition", 0, 0, 0,
"Only report PVs.\n")
+/*
+ * FIXME: for lvcreate, size only accepts absolute values, no +|-,
+ * for lvresize, size can relative +|-, for lvreduce, size
+ * can be relative -, and for lvextend, size can be relative +.
+ * Should we define separate val enums for each of those cases,
+ * and at the start of the command, change the val type for
+ * size_ARG? The same for extents_ARG.
+ */
arg(size_ARG, 'L', "size", ssizemb_VAL, 0, 0,
"#lvcreate\n"
"Specifies the size of the new LV.\n"
diff --git a/tools/command.c b/tools/command.c
index 7f6bd2b..cab6f09 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -1319,6 +1319,20 @@ void factor_common_options(void)
}
}
+/* FIXME: use a flag in command_name struct? */
+
+int command_has_alternate_extents(const char *name)
+{
+ if (name[0] != 'l')
+ return 0;
+ if (!strcmp(name, "lvcreate") ||
+ !strcmp(name, "lvresize") ||
+ !strcmp(name, "lvextend") ||
+ !strcmp(name, "lvreduce"))
+ return 1;
+ return 0;
+}
+
static int long_name_compare(const void *on1, const void *on2)
{
const struct opt_name * const *optname1 = (const void *)on1;
@@ -1574,6 +1588,33 @@ static void _print_usage_description(struct command *cmd)
}
}
+static void print_val_usage(struct command *cmd, int val_enum)
+{
+ int squash_sign_prefix;
+
+ /*
+ * lvcreate does not take a relative [+|-] value
+ * for --size or --extents.
+ * Should we also squash - for lvextend and + for lvreduce?
+ */
+ squash_sign_prefix = !strcmp(cmd->name, "lvcreate");
+
+ if ((val_enum == ssizemb_VAL) && squash_sign_prefix) {
+ printf("Size[m|UNIT]");
+ return;
+ }
+
+ if ((val_enum == extents_VAL) && squash_sign_prefix) {
+ printf("Number[PERCENT]");
+ return;
+ }
+
+ if (!val_names[val_enum].usage)
+ printf("%s", val_names[val_enum].name);
+ else
+ printf("%s", val_names[val_enum].usage);
+}
+
static void print_usage_def(struct command *cmd, int opt_enum, struct arg_def *def)
{
int val_enum;
@@ -1591,25 +1632,7 @@ static void print_usage_def(struct command *cmd, int opt_enum, struct arg_def *d
else {
if (sep) printf("|");
-
- /*
- * FIXME: this is a terrible hack that's needed
- * until we can differentiate which commands
- * use --size with a signed number and which
- * commands use only a positive --size.
- * (See the same hack when generating man pages
- * in print_val_man.)
- */
- if (!strcmp(cmd->name, "lvcreate") &&
- (opt_enum == size_ARG) &&
- (!strcmp(val_names[val_enum].usage, "[+|-]Size[m|UNIT]")))
- printf("Size[m|UNIT]");
-
- else if (!val_names[val_enum].usage)
- printf("%s", val_names[val_enum].name);
- else
- printf("%s", val_names[val_enum].usage);
-
+ print_val_usage(cmd, val_enum);
sep = 1;
}
@@ -1655,8 +1678,7 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
for (ro = 0; ro < cmd->ro_count; ro++) {
opt_enum = cmd->required_opt_args[ro].opt;
- /* special case */
- if (!strcmp(cmd->name, "lvcreate") && (opt_enum == size_ARG))
+ if ((opt_enum == size_ARG) && command_has_alternate_extents(cmd->name))
include_extents = 1;
if (onereq) {
@@ -1695,8 +1717,11 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
goto op_count;
if (cmd->oo_count) {
- if (include_extents)
- printf("\n\t[ --extents Number[PERCENT] ]");
+ if (include_extents) {
+ printf("\n\t[ --extents ");
+ print_val_usage(cmd, extents_VAL);
+ printf(" ]");
+ }
for (oo = 0; oo < cmd->oo_count; oo++) {
opt_enum = cmd->optional_opt_args[oo].opt;
@@ -1827,13 +1852,15 @@ void print_usage_common_cmd(struct command_name *cname, struct command *cmd)
void print_usage_notes(struct command_name *cname, struct command *cmd)
{
-
- if (!strcmp(cname->name, "lvcreate")) {
+ if (command_has_alternate_extents(cname->name)) {
printf(" Special options for command:\n");
printf(" [ --extents Number[PERCENT] ]\n"
- " The --extents option can be used in place of --size in each case.\n"
- " The number allows an optional percent suffix (see man lvcreate).\n");
+ " The --extents option can be used in place of --size.\n"
+ " The number allows an optional percent suffix.\n");
printf("\n");
+ }
+
+ if (!strcmp(cname->name, "lvcreate")) {
printf(" [ --name String ]\n"
" The --name option is not required but is typically used.\n"
" When a name is not specified, a new LV name is generated\n"
@@ -1887,68 +1914,73 @@ void print_usage_notes(struct command_name *cname, struct command *cmd)
#ifdef MAN_PAGE_GENERATOR
-static void print_val_man(struct command_name *cname, const char *str)
+/*
+ * FIXME: this just replicates the val usage strings
+ * that officially lives in vals.h. Should there
+ * be some programatic way to add man markup to
+ * the strings in vals.h without replicating it?
+ * Otherwise, this function has to be updated in
+ * sync with any string changes in vals.h
+ */
+static void print_val_man(struct command_name *cname, int val_enum)
{
+ const char *str = val_names[val_enum].usage;
char *line;
char *line_argv[MAX_LINE_ARGC];
int line_argc;
int i;
+ int squash_sign_prefix;
/*
- * FIXME: this is a terrible hack that needs to be fixed.
- * lvcreate and lvresize both use --size, and --size
- * accepts a signed number, and a signed number is
- * printed with a [+|-] prefix. But lvcreate does not
- * accept negative numbers. We need to do something to
- * have two (or more) variants of --size, one that can
- * accept a sign and one that cannot. For now, this
- * hack just detects when we're going to print
- * [+|-]Size for "lvcreate" and overrides it to
- * omit the +|-.
+ * lvcreate does not take a relative [+|-] value
+ * for --size or --extents.
+ * Should we also squash - for lvextend and + for lvreduce?
*/
- if (!strcmp(cname->name, "lvcreate") && !strcmp(str, "[+|-]Size[m|UNIT]")) {
- printf("\\fISize\\fP[m|UNIT]");
+ squash_sign_prefix = !strcmp(cname->name, "lvcreate");
+
+ if (val_enum == ssizemb_VAL) {
+ if (squash_sign_prefix)
+ printf("\\fISize\\fP[m|UNIT]");
+ else
+ printf("[\\fB+\\fP|\\fB-\\fP]\\fISize\\fP[m|UNIT]");
return;
}
- if (!strcmp(cname->name, "lvcreate") && !strcmp(str, "[+|-]Number[%VG|%PVS|%FREE]")) {
- printf("\\fINumber\\fP[\\fB%%VG\\fP|\\fB%%PVS\\fP|\\fB%%FREE\\fP]");
+
+ if (val_enum == extents_VAL) {
+ if (squash_sign_prefix)
+ printf("\\fINumber\\fP[PERCENT]");
+ else
+ printf("[\\fB+\\fP|\\fB-\\fP]\\fINumber\\fP[PERCENT]");
return;
}
- /*
- * Doing bold k before UNIT creates a lot of
- * visual "noise" that makes the text hard to read.
- * The extra markup in this case doesn't add anything
- * that isn't already obvious.
- */
-
- if (!strcmp(str, "Size[k|UNIT]")) {
+ if (val_enum == sizekb_VAL) {
printf("\\fISize\\fP[k|UNIT]");
return;
}
- if (!strcmp(str, "Size[m|UNIT]")) {
+ if (val_enum == sizemb_VAL) {
printf("\\fISize\\fP[m|UNIT]");
return;
}
- if (!strcmp(str, "[+|-]Size[k|UNIT]")) {
+ if (val_enum == ssizekb_VAL) {
printf("[\\fB+\\fP|\\fB-\\fP]\\fISize\\fP[k|UNIT]");
return;
}
- if (!strcmp(str, "[+|-]Size[m|UNIT]")) {
+ if (val_enum == ssizemb_VAL) {
printf("[\\fB+\\fP|\\fB-\\fP]\\fISize\\fP[m|UNIT]");
return;
}
- if (!strcmp(str, "[+|-]Number")) {
- printf("[\\fB+\\fP|\\fB-\\fP]\\fINumber\\fP");
+ if (val_enum == regionsize_VAL) {
+ printf("\\fISize\\fP[m|UNIT]");
return;
}
- if (!strcmp(str, "[+|-]Number[%VG|%PVS|%FREE]")) {
- printf("[\\fB+\\fP|\\fB-\\fP]\\fINumber\\fP[\\fB%%VG\\fP|\\fB%%PVS\\fP|\\fB%%FREE\\fP]");
+ if (val_enum == snumber_VAL) {
+ printf("[\\fB+\\fP|\\fB-\\fP]\\fINumber\\fP");
return;
}
@@ -1957,24 +1989,6 @@ static void print_val_man(struct command_name *cname, const char *str)
return;
}
- /*
- * I think this bit is almost unnecessary with the specific
- * ones checked above.
- */
- if (strstr(str, "Number[") || strstr(str, "]Number")) {
- for (i = 0; i < strlen(str); i++) {
- if (str[i] == 'N')
- printf("\\fI");
- if (str[i] == 'r') {
- printf("%c", str[i]);
- printf("\\fP");
- continue;
- }
- printf("%c", str[i]);
- }
- return;
- }
-
if (!strcmp(str, "Number") ||
!strcmp(str, "String") ||
!strncmp(str, "VG", 2) ||
@@ -2032,7 +2046,7 @@ static void print_def_man(struct command_name *cname, struct arg_def *def, int u
printf("%s", val_names[val_enum].name);
printf("\\fP");
} else {
- print_val_man(cname, val_names[val_enum].usage);
+ print_val_man(cname, val_enum);
}
sep = 1;
@@ -2242,8 +2256,7 @@ void print_man_usage(char *lvmname, struct command *cmd)
opt_enum = cmd->required_opt_args[ro].opt;
- /* special case */
- if (!strcmp(cmd->name, "lvcreate") && (opt_enum == size_ARG))
+ if ((opt_enum == size_ARG) && command_has_alternate_extents(cmd->name))
include_extents = 1;
if (opt_names[opt_enum].short_opt) {
@@ -2293,7 +2306,9 @@ void print_man_usage(char *lvmname, struct command *cmd)
if (include_extents) {
printf(".ad l\n");
- printf("[ \\fB-l\\fP|\\fB--extents\\fP \\fINumber\\fP[PERCENT] ]\n");
+ printf("[ \\fB-l\\fP|\\fB--extents\\fP ");
+ print_val_man(cname, extents_VAL);
+ printf(" ]\n");
printf(".ad b\n");
sep = 1;
}
@@ -2724,7 +2739,7 @@ void print_man_all_options_list(struct command_name *cname)
printf("\\fP");
} else {
printf(" ");
- print_val_man(cname, val_names[val_enum].usage);
+ print_val_man(cname, val_enum);
}
printf("\n.ad b\n");
@@ -2772,7 +2787,7 @@ void print_man_all_options_desc(struct command_name *cname)
printf("\\fP");
} else {
printf(" ");
- print_val_man(cname, val_names[val_enum].usage);
+ print_val_man(cname, val_enum);
}
if (opt_names[opt_enum].flags & ARG_COUNTABLE)
diff --git a/tools/command.h b/tools/command.h
index 33f083b..0109853 100644
--- a/tools/command.h
+++ b/tools/command.h
@@ -218,5 +218,6 @@ void print_usage_common_cmd(struct command_name *cname, struct command *cmd);
void print_usage_common_lvm(struct command_name *cname, struct command *cmd);
void print_usage_notes(struct command_name *cname, struct command *cmd);
void factor_common_options(void);
+int command_has_alternate_extents(const char *name);
#endif
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 4a109a6..53856ce 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1275,13 +1275,9 @@ static int _command_required_opt_matches(struct cmd_context *cmd, int ci, int ro
* For some commands, --size and --extents are interchangable,
* but command[] definitions use only --size.
*/
- if ((opt_enum == size_ARG) && arg_is_set(cmd, extents_ARG)) {
- if (!strcmp(commands[ci].name, "lvcreate") ||
- !strcmp(commands[ci].name, "lvresize") ||
- !strcmp(commands[ci].name, "lvextend") ||
- !strcmp(commands[ci].name, "lvreduce"))
- goto check_val;
- }
+ if ((opt_enum == size_ARG) && arg_is_set(cmd, extents_ARG) &&
+ command_has_alternate_extents(commands[ci].name))
+ goto check_val;
return 0;
diff --git a/tools/vals.h b/tools/vals.h
index b946742..ed572ee 100644
--- a/tools/vals.h
+++ b/tools/vals.h
@@ -121,14 +121,14 @@ val(ssizekb_VAL, ssize_kb_arg, "SSizeKB", "[+|-]Size[k|UNIT]")
val(ssizemb_VAL, ssize_mb_arg, "SSizeMB", "[+|-]Size[m|UNIT]")
val(regionsize_VAL, regionsize_arg, "RegionSize", "Size[m|UNIT]")
val(snumber_VAL, int_arg_with_sign, "SNumber", "[+|-]Number")
-val(extents_VAL, extents_arg, "Extents", "[+|-]Number[%VG|%PVS|%FREE]")
+val(extents_VAL, extents_arg, "Extents", "[+|-]Number[PERCENT]")
val(permission_VAL, permission_arg, "Permission", "rw|r")
val(metadatatype_VAL, metadatatype_arg, "MetadataType", "lvm2|lvm1")
val(units_VAL, string_arg, "Units", "r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E")
val(segtype_VAL, segtype_arg, "SegType", "linear|striped|snapshot|mirror|raid|thin|cache|thin-pool|cache-pool")
val(alloc_VAL, alloc_arg, "Alloc", "contiguous|cling|cling_by_tags|normal|anywhere|inherit")
val(locktype_VAL, locktype_arg, "LockType", "sanlock|dlm|none")
-val(readahead_VAL, readahead_arg, "Readahead", "auto|none|NumberSectors")
+val(readahead_VAL, readahead_arg, "Readahead", "auto|none|Number")
val(vgmetadatacopies_VAL, vgmetadatacopies_arg, "MetadataCopiesVG", "all|unmanaged|Number")
val(pvmetadatacopies_VAL, pvmetadatacopies_arg, "MetadataCopiesPV", "0|1|2")
val(metadatacopies_VAL, metadatacopies_arg, "unused", "unused")
6 years
master - man/help: improve the PV range description
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e7ee89d80b0b876cd73...
Commit: e7ee89d80b0b876cd73573338022b1308d59b209
Parent: 2a5e24580abbb103cddc4ec24fe9423e11be5e64
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Mar 3 11:07:49 2017 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Mar 3 11:15:27 2017 -0600
man/help: improve the PV range description
---
tools/command.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/tools/command.c b/tools/command.c
index 25be87f..7f6bd2b 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -1848,10 +1848,12 @@ void print_usage_notes(struct command_name *cname, struct command *cmd)
printf(" PV\n"
" Physical Volume name, a device path under /dev.\n"
- " For commands managing physical extents, a PV positional\n"
- " arg generally accepts a suffix indicating a range of PEs:\n"
- " PV[:PE[-PE]] is start and end range (inclusive),\n"
- " PV[:PE[+PE]] is start and length range (counting from 0).\n");
+ " For commands managing physical extents, a PV positional arg\n"
+ " generally accepts a suffix indicating a range (or multiple ranges)\n"
+ " of PEs. When the first PE is omitted, it defaults to the start of\n"
+ " the device, and when the last PE is omitted it defaults to the end.\n"
+ " PV[:PE-PE]... is start and end range (inclusive),\n"
+ " PV[:PE+PE]... is start and length range (counting from 0).\n");
printf("\n");
printf(" LV\n"
@@ -2882,9 +2884,11 @@ void print_man_all_positions_desc(struct command_name *cname)
printf(".br\n");
printf("Physical Volume name, a device path under /dev.\n"
"For commands managing physical extents, a PV positional arg\n"
- "generally accepts a suffix indicating a range of physical extents.\n"
- "Start and end range (inclusive): \\fIPV\\fP[\\fB:\\fP\\fIPE\\fP[\\fB-\\fP\\fIPE\\fP]].\n"
- "Start and length range (counting from 0): \\fIPV\\fP[\\fB:\\fP\\fIPE\\fP[\\fB+\\fP\\fIPE\\fP]].\n");
+ "generally accepts a suffix indicating a range (or multiple ranges)\n"
+ "of physical extents (PEs). When the first PE is omitted, it defaults\n"
+ "to the start of the device, and when the last PE is omitted it defaults to end.\n"
+ "Start and end range (inclusive): \\fIPV\\fP[\\fB:\\fP\\fIPE\\fP\\fB-\\fP\\fIPE\\fP]...\n"
+ "Start and length range (counting from 0): \\fIPV\\fP[\\fB:\\fP\\fIPE\\fP\\fB+\\fP\\fIPE\\fP]...\n");
}
if (has_tag_val) {
6 years
master - args: in cachemode option fix passthrough value
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2a5e24580abbb103cdd...
Commit: 2a5e24580abbb103cddc4ec24fe9423e11be5e64
Parent: 191a2517beb85fcb041ecb92fad3b45a8d008b0e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Mar 3 10:53:18 2017 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Mar 3 10:53:18 2017 -0600
args: in cachemode option fix passthrough value
---
tools/args.h | 4 ++--
tools/vals.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/args.h b/tools/args.h
index 53ff870..83700b3 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -109,10 +109,10 @@ arg(cachemode_ARG, '\0', "cachemode", cachemode_VAL, 0, 0,
"been stored in both the cache pool and on the origin LV.\n"
"While writethrough may be slower for writes, it is more\n"
"resilient if something should happen to a device associated with the\n"
- "cache pool LV. With writethrough, all reads are served\n"
+ "cache pool LV. With \\fBpassthrough\\fP, all reads are served\n"
"from the origin LV (all reads miss the cache) and all writes are\n"
"forwarded to the origin LV; additionally, write hits cause cache\n"
- "block invalidates. See lvmcache(7) for more information.\n")
+ "block invalidates. See \\fBlvmcache\\fP(7) for more information.\n")
arg(cachepool_ARG, '\0', "cachepool", lv_VAL, 0, 0,
"The name of a cache pool LV.\n")
diff --git a/tools/vals.h b/tools/vals.h
index ab1b715..b946742 100644
--- a/tools/vals.h
+++ b/tools/vals.h
@@ -112,7 +112,7 @@ val(tag_VAL, tag_arg, "Tag", NULL)
val(select_VAL, NULL, "Select", NULL) /* used only for command defs */
val(activationmode_VAL, string_arg, "ActivationMode", "partial|degraded|complete")
val(activation_VAL, activation_arg, "Active", "y|n|ay")
-val(cachemode_VAL, cachemode_arg, "CacheMode", "writethrough|writeback")
+val(cachemode_VAL, cachemode_arg, "CacheMode", "writethrough|writeback|passthrough")
val(discards_VAL, discards_arg, "Discards", "passdown|nopassdown|ignore")
val(mirrorlog_VAL, mirrorlog_arg, "MirrorLog", "core|disk")
val(sizekb_VAL, size_kb_arg, "SizeKB", "Size[k|UNIT]")
6 years