1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 03:27:58 +03:00
Commit Graph

3296 Commits

Author SHA1 Message Date
David Teigland
d3bcec5993 man: change the synopsis option style
Remove the required/optional words because it
should already be evident from the use of [ ].
2017-03-02 14:08:59 -06:00
David Teigland
910918d1c2 lvcreate: allow chunksize option when creating cache 2017-03-02 13:58:27 -06:00
David Teigland
6360ba3d2d commands: handle including an optional opt multiple times
When a cmd def includes multiple sets of options (OO_FOO),
allow multiple OO_FOO sets to contain the same option and
avoid repeating it in the cmd def.
2017-03-02 13:52:06 -06:00
David Teigland
b7831fc14a lvcreate/lvresize: the --size option accepts signed values
There was confusion in the code about whether or not the
--size option accepted a sign.  Make it consistent and clear
that it does.

This exposes a new problem in that an option can only
accept one value type, e.g. --size can only accept a
signed number, it cannot accept a positive or negative
number for some commands and reject negative numbers for
others.

In practice, lvcreate accepts only positive --size
values and lvresize accepts positive or negative --size
values.  There is currently no way to encode this
difference.  Until that is fixed, the man page output
is hacked to avoid printing the [+|-] prefix for sizes
in lvcreate.
2017-03-02 12:53:01 -06:00
Alasdair G Kergon
70c1fa3764 tools: Fix overriding of current_settings.
Settings specified in other command line args take precedence over
profiles and --config, which takes precedence over settings in actual
config files.

Since commit 1e2420bca8 ('commands: new
method for defining commands') commands like this:
  lvchange --config 'global/test=1' -ay vg
have been printing the 'TEST MODE' message, but nevertheless making
real changes.
2017-03-02 16:41:41 +00:00
David Teigland
8df3f300ba commands: adjust syntax error message 2017-03-02 09:46:41 -06:00
David Teigland
b76852bf35 man lvchange: mention special activation vals
used by lvmlockd and clvmd.
2017-03-02 09:31:06 -06:00
David Teigland
c25b95e2ef man: fix typo 2017-03-01 16:59:51 -06:00
David Teigland
51dfbf1fb3 commands: tweak some descriptions 2017-03-01 16:59:51 -06:00
David Teigland
62abae1525 man: put some commands into advanced usage section
and separate commands with --
2017-03-01 10:22:48 -06:00
David Teigland
eb9586bd3b commands: SECONDARY flag changes in cmd defs
Add/remove the SECONDARY_SYNTAX flag to cmd defs.
cmd defs with this flag will be listed under the
ADVANCED USAGE man page section, so that the main
USAGE section contains the most common commands
without distraction.

- When multiple cmd defs do the same thing, one variant
  can be displayed in the first list.
- Very advanced, unusual or uncommon commands should be
  in the second list.
2017-03-01 10:22:48 -06:00
David Teigland
1828822bd8 help: print full usage for lvm help all 2017-02-28 15:58:14 -06:00
David Teigland
21456dcf7f commands: include lvconvert cache options as group 2017-02-28 13:47:46 -06:00
David Teigland
89661981e8 man: fix syntax for PV ranges 2017-02-28 12:22:12 -06:00
David Teigland
4a14617dc4 commands: remove lvconvert raid rule
A raid0 LV also needs to be converted to other
raid levels, so this rule should be removed entirely.
2017-02-27 17:06:08 -06:00
David Teigland
f9d28f1aec man: mention regionsize default is in lvm.conf 2017-02-27 17:05:20 -06:00
David Teigland
998151e83e commands: fix lvconvert raid rule
Recent rule change was incorrect.
We want to allow 'lvconvert --type raid' on raid1 LVs.
2017-02-27 16:33:38 -06:00
David Teigland
8d0df0c011 commands: fixes for recent raid changes
- Combine the equivalent lvconvert --type raid defs.
  (Two cmd defs must be different without relying
  on LV type, which are not known at the time the
  cmd def is matched.)

- Remove unused optional options from lvconvert --stripes,
  and lvconvert --stripesize.

- Use Number for --stripes_long val type.

- Combine the cmd def for raid reshape cleanup into the
  existing start_poll cmd def (they were duplicate defs).
  Calls into the raid code from a poll opertion will be
  added.
2017-02-27 14:44:00 -06:00
David Teigland
4f7631b4ad man: change option sorting in synopsis
The options list was sorted as:
- options with both long and short forms, alphabetically
- options with only long form, alphabetically

This was done only for the visual effect.  Change to
sort alphabetically by long opt, without regard to
short forms.
2017-02-24 15:11:18 -06:00
David Teigland
5f6bdf707d man: add ENVIRONMENT VARIABLES section 2017-02-24 15:05:17 -06:00
David Teigland
84cceaf9b9 lvconvert: fix handling args in combining snapshots
Fixes commit 286d39ee3c, which was correct except
for a reversed strstr.  Now uses strchr, and modifies
a copy of the name so the original argv is preserved.
2017-02-24 14:17:58 -06:00
David Teigland
74ba326007 man: use Size variable for a number with unit
Define a separate variable type Size to represent
a number that takes an optional UNIT.
2017-02-24 13:44:05 -06:00
Heinz Mauelshagen
189fa64793 lvconvert: impose region size constraints
When requesting a regionsize change during conversions, check
for constraints or the command may fail in the kernel n case
the region size is too smalle or too large thus leaving any
new SubLVs behind.

Related: rhbz834579
Related: rhbz1191935
Related: rhbz1191978
2017-02-24 07:27:43 +01:00
Heinz Mauelshagen
2574d3257a lvconvert: allow regionsize on upconvert from linear
Allow to provide regionsize with "lvconvert -m1 -R N " on
upconverts from linear and on N -> M raid1 leg conversions.

Resolves: rhbz1394427
2017-02-24 05:20:58 +01:00
Heinz Mauelshagen
34caf83172 lvconvert: add infrastructure for RaidLV reshaping support
In order to support striped raid5/6/10 LV reshaping (change
of LV type, stripesize or number of legs), this patch
introduces the changes to call the reshaping infratructure
from lv_raid_convert().

Changes:
- add reshaping calls from lv_raid_convert()
- add command definitons for reshaping to tools/command-lines.in
- fix raid_rimage_extents()
- add 2 new test scripts lvconvert-raid-reshape-linear_to_striped.sh
  and lvconvert-raid-reshape-striped_to_linear.sh to test
  the linear <-> striped multi-step conversions
- add lvconvert-raid-reshape.sh reshaping tests
- enhance lvconvert-raid-takeover.sh with new raid10 tests

Related: rhbz834579
Related: rhbz1191935
Related: rhbz1191978
2017-02-24 05:20:58 +01:00
Heinz Mauelshagen
e2354ea344 lvconvert: add infrastructure for RaidLV reshaping support
In order to support striped raid5/6/10 LV reshaping (change
of LV type, stripesize or number of legs), this patch
introduces infrastructure prerequisites to be used
by raid_manip.c extensions in followup patches.

This base is needed for allocation of out-of-place
reshape space required by the MD raid personalities to
avoid writing over data in-place when reading off the
current RAID layout or number of legs and writing out
the new layout or to a different number of legs
(i.e. restripe)

Changes:
- add members reshape_len to 'struct lv_segment' to store
  out-of-place reshape length per component rimage
- add member data_copies to struct lv_segment
  to support more than 2 raid10 data copies
- make alloc_lv_segment() aware of both reshape_len and data_copies
- adjust all alloc_lv_segment() callers to the new API
- add functions to retrieve the current data offset (needed for
  out-of-place reshaping space allocation) and the devices count
  from the kernel
- make libdm deptree code aware of reshape_len
- add LV flags for disk add/remove reshaping
- support import/export of the new 'struct lv_segment' members
- enhance lv_extend/_lv_reduce to cope with reshape_len
- add seg_is_*/segtype_is_* macros related to reshaping
- add target version check for reshaping
- grow rebuilds/writemostly bitmaps to 246 bit to support kernel maximal
- enhance libdm deptree code to support data_offset (out-of-place reshaping)
  and delta_disk (legs add/remove reshaping) target arguments

Related: rhbz834579
Related: rhbz1191935
Related: rhbz1191978
2017-02-24 05:20:58 +01:00
David Teigland
ffe3ca26e0 man: improve line breaks
Borrow tricks from dmsetup man page to improve
the line break and indentation using .ad l, .ad b,
and soft break \%.
2017-02-23 17:06:42 -06:00
David Teigland
3fd3c9430d man/help: change syntax to UNIT
(Change to recent commit 3f4ecaf8c2.)

Use --foo Number[k|UNIT] to indicate that
the default units of the number is k, but other
units listed below are also accepted.

Previously, underlined/italic Unit was used,
like other of variables, but this UNIT is more
like a shortcut than an actual variable.
2017-02-23 14:24:28 -06:00
Heinz Mauelshagen
8ab0725077 lvchange: reject writemostly/writebehind on raid1 during resync
The MD kernel raid1 personality does no use any writemostly leg as the primary.

In case a previous linear LV holding data gets upconverted to
raid1 it becomes the primary leg of the new raid1 LV and a full
resynchronization is started to update the new legs.

No writemostly and/or writebehind setting may be allowed during
this initial, full synchronization period of this new raid1 LV
(using the lvchange(8) command), because that would change the
primary (i.e the previous linear LV) thus causing data loss.

lvchange has a bug not preventing this scenario.

Fix rejects setting writemostly and/or writebehind on resychronizing raid1 LVs.

Once we have status in the lvm2 metadata about the linear -> raid upconversion,
we may relax this constraint for other types of resynchronization
(e.g. for user requested "lvchange --resync ").

New lvchange-raid1-writemostly.sh test is added to the test suite.

Resolves: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=855895
2017-02-23 15:09:29 +01:00
David Teigland
3f4ecaf8c2 man/help: improve the style of units indicator
We use --foo Number[k|Units] to indicate that
the default units of the number is k, but other
units listed below are also accepted.

Capitalize and underline Units so it is consistent
with other variables, and reference it at the end.

Technically, the k should be bold, but this
tends to make the text visually hard to read
because of the excessive highlights scattered
everywhere.  So it's left normal text for now
(it's unlikely to confuse anyone.)
2017-02-22 16:50:30 -06:00
David Teigland
da634bfc89 man: indicate repeatable options
Print ... after a repeatable option in the OPTIONS section.
An alternative would be to just mention in the text description
that the option is repeatable.
2017-02-22 16:38:54 -06:00
David Teigland
1eb1869626 man: improve writemostly PV arg 2017-02-22 15:20:44 -06:00
Zdenek Kabelac
6716f5a2f4 WHATS_NEW: add entry 2017-02-22 15:20:52 +01:00
David Teigland
263050bc07 man/help: enclose each option in brackets
Placing [] around each individual option is the most
common style, and it improves the readability.
2017-02-21 14:59:52 -06:00
David Teigland
c1ce371b59 man/help: use separate common option lists
There are two kinds of common options:
1. options common to all variants of a given command name
2. options common to all lvm commands

Previously, both kinds of common options were listed together
under "Common options".  Now the first are printed under
"Common options for command" (when needed), and the second
are printed under "Common options for lvm" (always).
2017-02-21 14:32:54 -06:00
David Teigland
b7ae57c6a6 man: teaking output format 2017-02-21 12:27:51 -06:00
David Teigland
21fc35dd1b commands: adjust default help output
Remove the "usage notes" which should just
live in the man pages.

When there are 3 or more variants of a command,
print all the options produces a lot of output,
so require --longhelp to print all the options
in these cases.
2017-02-21 12:27:51 -06:00
David Teigland
f80d373753 man: expand type option description 2017-02-21 12:27:51 -06:00
Alasdair G Kergon
d2dbe71fb3 dmsetup: Indicate device repetition in usage summaries. 2017-02-21 11:25:18 +00:00
David Teigland
86a660be7b man: use .HP instead of .TP 2017-02-20 17:10:11 -06:00
David Teigland
e13639053b man/help: print general raid type as "raid"
Instead of printing "raid*".  There are already
notes mentioning that "raid" refers to "raid<N>"
2017-02-20 15:41:24 -06:00
David Teigland
d22cccdf63 man vgchange/lvchange: note special option usage 2017-02-20 15:36:30 -06:00
David Teigland
2396c50689 man: add variables descriptions
Add a section describing variables.

In the full options list, include common
options in the alphabetical listing instead
of at the end.
2017-02-20 15:36:10 -06:00
David Teigland
4d29d9afb2 lvresize/lvextend: accept type option
The --type option has previously been accepted for
lvresize/lvextend.  Using it did not affect the operation
of the command.  The value was simply verified as matching
the current seg type of the LV.
2017-02-20 11:23:46 -06:00
Zdenek Kabelac
13dd1ca757 cleanup: simplier code
Already know string is 'lvm-' so use name[3].
2017-02-20 00:43:40 +01:00
Zdenek Kabelac
2260c6d1e6 cleanup: same sign for compare 2017-02-20 00:43:40 +01:00
Zdenek Kabelac
d8514b24e1 cleanup: use multiline string 2017-02-20 00:43:40 +01:00
Zdenek Kabelac
aff62c74b7 cleanup: use const 2017-02-20 00:43:40 +01:00
Zdenek Kabelac
2a21a19d90 commands: fix memleak
Keep all allocations 'mempool' allocated for simple cleanup.
2017-02-19 22:59:43 +01:00
Zdenek Kabelac
87c89ac279 lvresize: fix regressiong on accepting args
Commit f45b689406 caused regression
of lvresize -m and --type  parameter

After fix this sequence may work when we also fix syntax description:

lvcreate -l1 -m1 -n lv1 vg
lvextend --type mirror -m1 -l+1 vg/lv1
2017-02-19 22:59:43 +01:00
David Teigland
13944738d4 man/help: fix description of r|R unit 2017-02-17 15:44:26 -06:00
David Teigland
fab0d63121 man: print space before built-in name
print 'lvm config' not 'lvm-config'
2017-02-17 15:33:35 -06:00
David Teigland
50e0345f9d man lvmconfig: refer to typeconfig option name 2017-02-17 14:46:10 -06:00
David Teigland
10cb8e0ec0 man/help: show recently added r|R unit 2017-02-17 14:44:11 -06:00
David Teigland
3cf3943898 args: in yes option mention qq for auto-no 2017-02-17 14:44:11 -06:00
David Teigland
f88ce5fb99 lvconvert: include swap behavior in generic pool syntax
For this syntax:
lvconvert --thinpool LV1 --poolmetadata LV2
lvconvert --cachepool LV1 --poolmetadata LV2

Restore the metadata swapping behavior in addition to
the pool creation behavior.  When LV1 is already a pool,
the metadata LV will be swapped with LV2.
When LV1 is not a pool, it will be converted to a
pool using the specified LV for metadata.

This syntax is no longer advertised because of the
ambiguous behavior.  The primary syntaxes for pool
creation and metadata swapping will be the advertised
methods.
2017-02-17 13:20:15 -06:00
Zdenek Kabelac
56deed9d54 commands: compensate --uuid
As we now user binary search - it's nondeterministict
which of the same 'args' will be give - so duplicates
need 'extra' care.

So provide same hack for output for --uuidstr_ARG as
for input.

Solves 'pvscan -u'.
2017-02-17 13:57:59 +01:00
Zdenek Kabelac
00f299b932 commands: some more dm wrappers
As man-generator is not liked with libdm as of now - some more wrappers.
2017-02-17 13:36:57 +01:00
Zdenek Kabelac
238a79aac4 cleanup: unused uninit vars 2017-02-17 13:20:55 +01:00
Zdenek Kabelac
995f7aa92f cleanup: use strchr for 1-byte lookup 2017-02-17 13:20:55 +01:00
Zdenek Kabelac
46d6c7d3ad cleanup: add comment for longer macro 2017-02-17 13:20:55 +01:00
Zdenek Kabelac
772834e40a commands: optimize binary search
Since there is a lot of options and lot of searches,
use binary search to keep strcmp at minimum.

The interesting part is - alphabetically sorted array contains
duplicates and some of them are not the 'right anwer', so
after we find matching string but not matching long_ARG,
we may need to check if the surrouding strings are the right matching
one.

The single loops is used also for strictly define --foo_long
(i.e. --stripes)  and just differs at final part.

TODO1: replace strstr call with some flag (just like short_opt).
TODO2: drop '--' from being stored and tests by strcmp.
2017-02-17 13:20:55 +01:00
Zdenek Kabelac
582a272b3f commands: use dm_strncpy
Easier code using dm_strncpy() an dm_snprintf().
2017-02-17 13:11:33 +01:00
Zdenek Kabelac
80b717af0c commands: cheap optimisation for parser
Some low-hanging fruits to cut of signification number of strcmp calls.
2017-02-17 13:00:05 +01:00
David Teigland
298b11aed1 commands: track errors in command def parsing
When parsing command defs, track and report all
errors that are found.  Add an error return case
from define_commands so the standard error exit
path is used.
2017-02-16 15:26:42 -06:00
David Teigland
1cb95fa5a0 commands: initialize commands[] once
When using liblvm2cmd, a process can do multiple
init/exit calls, i.e.

lvm2_init(); lvm2_run(); lvm2_exit();
lvm2_init(); lvm2_run(); lvm2_exit();
...

define_commands() needs to set up the global commands[]
definitions only the first time.
2017-02-16 13:59:52 -06:00
David Teigland
15f51bc421 commands: avoid factoring options until needed 2017-02-16 09:37:28 -06:00
David Teigland
22bee4fbdb help/man: remove commas from list of options
Using commas between options does not seem to
be done anywhere else, so remove them.
2017-02-15 15:51:46 -06:00
David Teigland
81c0ed9fc6 commands: use dm wrappers for malloc/free 2017-02-15 15:49:18 -06:00
David Teigland
6a5c9ba349 commands: use existing vg/lv name parsing functions
inside the new lv arg parsing function.

This includes getting the VG name from the env var,
and some added checks on the format of the vg/lv string.
2017-02-15 15:28:54 -06:00
David Teigland
2556498ee1 lvcreate: fix LVM_VG_NAME detection
Commit d3af0e7528 was
not quite right in testing if the env var was set.
2017-02-15 14:10:46 -06:00
David Teigland
4a30f5f9b0 toollib: skip dev prefix from lv names
_get_arg_lvnames_using_options() was missing skip_dev_dir()
2017-02-15 13:42:35 -06:00
David Teigland
286d39ee3c lvconvert: handle old arg quirk when combining snapshot
The old ad hoc arg parsing when combining a split snapshot
allowed the first lv to have a vgname, but not the second.
Since lvconvert now uses the standard arg parsing in
process_each_lv(), the old one-off behavior requires a
work around.
2017-02-15 12:40:35 -06:00
David Teigland
d3af0e7528 lvcreate: LVM_VG_NAME applies even without name arg
There was a small flaw in the logic regarding when LVM_VG_NAME
can replace a VG position arg.
2017-02-15 12:07:51 -06:00
David Teigland
7417c8acfa Revert "lvconvert: enable previous syntax to swap metadata"
This reverts commit 717363bb94.

These alternate forms for swapping metadata cannot be
distinguished from the command for creating a pool.
If we were to add these alternate forms for swapping
metadata, we would need to overload the pool creation
command defs, making those definitions ambiguous.
2017-02-14 16:02:54 -06:00
David Teigland
d2c5bb5c70 coverity cleanups 2017-02-14 15:53:29 -06:00
David Teigland
1236e0ed29 man-generator: fix compiler warnings 2017-02-14 10:28:52 -06:00
David Teigland
1dddb068c9 man/help: use separator in units list
h|H|b|B|... instead of hHbB...
2017-02-14 10:21:39 -06:00
David Teigland
c0f2a59993 commands: skip parsing command defs for other command names
The base command name can be used to skip parsing
command defs that will not be needed.
2017-02-14 10:16:13 -06:00
David Teigland
f46b28bdb6 commands: improve help/usage output
Replace --help --help with --long-help.
Some blank lines were needed.
Add 'lvm help all' to print help for all commands.
2017-02-14 09:52:09 -06:00
Zdenek Kabelac
22457ed4d9 makefiles: missing deps 2017-02-14 10:24:56 +01:00
Zdenek Kabelac
fc0e49297d makefiles: use configure vars
Use binaries found in configure.
2017-02-14 10:24:56 +01:00
David Teigland
5a87d8667d coverity cleanups for recent command defs commits 2017-02-13 16:11:04 -06:00
David Teigland
717363bb94 lvconvert: enable previous syntax to swap metadata 2017-02-13 14:41:54 -06:00
David Teigland
b2fd5b31d3 commands: suggest --help if command doesn't match 2017-02-13 13:46:17 -06:00
David Teigland
698abdde16 generate man pages 2017-02-13 10:31:23 -06:00
David Teigland
13a6368522 args: use arg parsing function for region size
Consolidate the validation of the region size arg
in a new arg parsing function.
2017-02-13 08:21:58 -06:00
David Teigland
a1386dcca0 lvconvert: remove code for changing region size
from the generic raid type conversion code.
2017-02-13 08:21:58 -06:00
David Teigland
46abc28a48 lvconvert: add command to change region size of a raid LV 2017-02-13 08:21:58 -06:00
David Teigland
8152e4a99e vgchange: fix uint32 parsing of logicalvolume arg 2017-02-13 08:20:10 -06:00
David Teigland
2224b6a701 commands: recognize raid variations 2017-02-13 08:20:10 -06:00
David Teigland
c3faa5816d commands: move command def parsing into lvm binary
It was previously done at build time by the ccmd binary.
2017-02-13 08:20:10 -06:00
David Teigland
942dc07402 lvconvert: remove unused code
For "split" which is not an alias for splitmirrors.
2017-02-13 08:20:10 -06:00
David Teigland
f067c0ad78 args: split is a synonym for splitcache
also tidy the other synonyms
2017-02-13 08:20:10 -06:00
David Teigland
15d9f2850e ccmd: split into multiple files 2017-02-13 08:20:10 -06:00
David Teigland
013c080756 command struct: remove command name refs
Change run time access to the command_name struct
cmd->cname instead of indirectly through
cmd->command->cname. This removes the two run time
fields from struct command.
2017-02-13 08:20:10 -06:00
David Teigland
d9d5b8414b command.h comment tidying 2017-02-13 08:20:10 -06:00
David Teigland
9a0f0c70bf lvm shell: clear argv for each command 2017-02-13 08:20:10 -06:00
David Teigland
23a1ced439 help: accept positional args
lvm help <commandname> ...
2017-02-13 08:20:10 -06:00
David Teigland
3642deb4f3 fix lvmcmdline warning
declaration of ‘usage’ shadows a globa
2017-02-13 08:20:10 -06:00