1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-21 22:04:19 +03:00

13580 Commits

Author SHA1 Message Date
David Teigland
d07977c155 makefile: fixes and improvements 2017-02-09 12:10:25 -06:00
David Teigland
5e7d9d4b92 man: break long lines that would wrap
When all the required command line elements would go
beyond 80 chars and wrap to a new line, insert a line
break and indent, and continue the required elements
on a second line.
2017-02-09 12:10:25 -06:00
David Teigland
e43203f64c man: add examples from previous man pages 2017-02-09 12:10:25 -06:00
David Teigland
985d73b03d man: use .end suffix instead of .notes 2017-02-09 12:10:24 -06:00
David Teigland
24cf2a6127 man: fix generation of builtin commands 2017-02-09 12:10:20 -06:00
David Teigland
0d929d5a3d commands: remove debugging output
Remove the command id from the error messages.
2017-02-08 10:56:07 -06:00
David Teigland
c8945374d5 commands: rename structure fields
remove "line" from command_line_id/command_line_enum
2017-02-08 10:33:16 -06:00
David Teigland
1f67df932d args: use arg parsing function for region size
Consolidate the validation of the region size arg
in a new arg parsing function.
2017-02-08 09:57:13 -06:00
David Teigland
1bef87796f lvconvert: remove code for changing region size
from the generic raid type conversion code.
2017-02-07 15:01:30 -06:00
David Teigland
cfbbb4bee9 lvconvert: add command to change region size of a raid LV 2017-02-07 13:27:58 -06:00
David Teigland
058b53cdf4 vgchange: fix uint32 parsing of logicalvolume arg 2017-02-07 10:38:30 -06:00
David Teigland
2b8019fd43 commands: recognize raid variations 2017-02-07 10:38:30 -06:00
David Teigland
c213aa76c4 commands: move command def parsing into lvm binary 2017-02-07 10:38:30 -06:00
David Teigland
15e69fae19 lvconvert: remove unused code
For "split" which is not an alias for splitmirrors.
2017-02-07 10:38:30 -06:00
David Teigland
fe0ad1157d args: split is a synonym for splitcache
also tidy the other synonyms
2017-02-07 10:38:30 -06:00
David Teigland
88a2b1dc37 man: add vgsplit notes
from previous man page
2017-02-07 10:38:30 -06:00
David Teigland
03970369c5 man: add vgimportclone notes
from previous man page
2017-02-07 10:38:30 -06:00
David Teigland
c2147bda74 man: add vgimport notes
from previous man page
2017-02-07 10:38:30 -06:00
David Teigland
a61bc922a9 man: add vgexport notes
from previous man page
2017-02-07 10:38:30 -06:00
David Teigland
d41a2e6f30 man: add pvscan notes
from previous man page
2017-02-07 10:38:30 -06:00
David Teigland
55d6e9ebb7 man: add pvmove notes
Copied from the previous man page.
2017-02-07 10:38:30 -06:00
David Teigland
0a61ea395f man: lvmlockd/clvmd notes about activation
activation details about lvmlockd and clvmd that were
previously in the generic lvchange -a section are now
moved to these man pages.
2017-02-07 10:38:30 -06:00
David Teigland
e61f84cd1f generate man pages 2017-02-07 10:38:30 -06:00
David Teigland
ca8e344041 man: lvmthin updates
Some minor changes to some of the command syntaxes
to use more standard forms.
2017-02-07 10:38:30 -06:00
David Teigland
14838f584f ccmd: split into multiple files 2017-02-07 10:38:30 -06:00
David Teigland
6033e894e2 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-07 10:38:30 -06:00
David Teigland
9b4c2027bf command.h comment tidying 2017-02-07 10:38:30 -06:00
David Teigland
61e0925844 lvm shell: clear argv for each command 2017-02-07 10:38:30 -06:00
David Teigland
214f48aa96 help: accept positional args
lvm help <commandname> ...
2017-02-07 10:38:30 -06:00
David Teigland
29ee87987c fix lvmcmdline warning
declaration of ‘usage’ shadows a globa
2017-02-07 10:38:30 -06:00
David Teigland
2391324196 Makefile: clean up create-command parts 2017-02-07 10:38:30 -06:00
David Teigland
e8230719ee man lvm: remove options
all options are now included in commands
2017-02-07 10:38:30 -06:00
David Teigland
2c5f6b8a02 args: add man page descriptions 2017-02-07 10:38:30 -06:00
David Teigland
fe3b2f5ead args: use uint32 arg for maxphysicalvolumes 2017-02-07 10:38:30 -06:00
David Teigland
91a1273d56 lvconvert: remove unused code 2017-02-07 10:38:30 -06:00
David Teigland
5507307b5f lvconvert: use command defs for raid/mirror types
All lvconvert functionality has been moved out of the
previous monolithic lvconvert code, except conversions
related to raid/mirror/striped/linear.  This switches
that remaining code to be based on command defs, and
standard process_each_lv arg processing.  This final
switch results in quite a bit of dead code that is
also removed.
2017-02-07 10:38:30 -06:00
David Teigland
91b71a8b02 tests: use swapmetadata
and some other pool/cache/thin related changes
2017-02-07 10:38:30 -06:00
David Teigland
3057fe9fec lvconvert: use command defs for mergemirrors
and route the generic --merge to one of the
specific merge functions
2017-02-07 10:38:30 -06:00
David Teigland
258027d1b1 toollib: find VG name in option values when needed 2017-02-07 10:38:30 -06:00
David Teigland
2da0f6110d lvconvert: use command defs for thin/cache/pool creation
Everything related to thin and cache.
2017-02-07 10:38:30 -06:00
David Teigland
09d6229350 lvconvert: add startpoll command using command def
This is a new explicit version of 'lvconvert LV'
which has been an obscure way of triggering polling
to be restarted on an LV that was previously converted.
2017-02-07 10:38:30 -06:00
David Teigland
6312e0872c lvconvert: snapshot: use command definitions
Lift all the snapshot utilities (merge, split, combine)
out of the monolithic lvconvert implementation, using
the command definitions.  The old code associated with
these commands is now unused and will be removed separately.
2017-02-07 10:38:30 -06:00
David Teigland
c752f4e1eb lvconvert: remove unused calls for repair and replace
repair and replace are no longer called from the
monolithic lvconvert code, so remove the unused code.
2017-02-07 10:38:30 -06:00
David Teigland
cd36b1c698 lvconvert: repair and replace: use command definitions
This lifts the lvconvert --repair and --replace commands
out of the monolithic lvconvert implementation.  The
previous calls into repair/replace can no longer be
reached and will be removed in a separate commit.
2017-02-07 10:36:18 -06:00
David Teigland
310d9a09fd lvchange: make use of command definitions
Reorganize the lvchange code to take advantage of
the command definition, and remove the validation
that is done by the command definintion rules.
2017-02-07 10:36:18 -06:00
David Teigland
81e84556b5 process_each_lv: add check_single_lv function
The new check_single_lv() function is called prior to the
existing process_single_lv().  If the check function returns 0,
the LV will not be processed.

The check_single_lv function is meant to be a standard method
to validate the combination of specific command + specific LV,
and decide if the combination is allowed.  The check_single
function can be used by anything that calls process_each_lv.

As commands are migrated to take advantage of command
definitions, each command definition gets its own entry
point which calls process_each for itself, passing a
pair of check_single/process_single functions which can
be specific to the narrowly defined command def.
2017-02-07 10:36:18 -06:00
David Teigland
c903d0e4b3 commands: new method for defining commands
. Define a prototype for every lvm command.
. Match every user command with one definition.
. Generate help text and man pages from them.

The new file command-lines.in defines a prototype for every
unique lvm command.  A unique lvm command is a unique
combination of: command name + required option args +
required positional args.  Each of these prototypes also
includes the optional option args and optional positional
args that the command will accept, a description, and a
unique string ID for the definition.  Any valid command
will match one of the prototypes.

Here's an example of the lvresize command definitions from
command-lines.in, there are three unique lvresize commands:

lvresize --size SizeMB LV
OO: --alloc Alloc, --autobackup Bool, --force,
--nofsck, --nosync, --noudevsync, --reportformat String, --resizefs,
--stripes Number, --stripesize SizeKB, --poolmetadatasize SizeMB
OP: PV ...
ID: lvresize_by_size
DESC: Resize an LV by a specified size.

lvresize LV PV ...
OO: --alloc Alloc, --autobackup Bool, --force,
--nofsck, --nosync, --noudevsync,
--reportformat String, --resizefs, --stripes Number, --stripesize SizeKB
ID: lvresize_by_pv
DESC: Resize an LV by specified PV extents.
FLAGS: SECONDARY_SYNTAX

lvresize --poolmetadatasize SizeMB LV_thinpool
OO: --alloc Alloc, --autobackup Bool, --force,
--nofsck, --nosync, --noudevsync,
--reportformat String, --stripes Number, --stripesize SizeKB
OP: PV ...
ID: lvresize_pool_metadata_by_size
DESC: Resize a pool metadata SubLV by a specified size.

The three commands have separate definitions because they have
different required parameters.  Required parameters are specified
on the first line of the definition.  Optional options are
listed after OO, and optional positional args are listed after OP.

This data is used to generate corresponding command definition
structures for lvm in command-lines.h.  usage/help output is also
auto generated, so it is always in sync with the definitions.

Every user-entered command is compared against the set of
command structures, and matched with one.  An error is
reported if an entered command does not have the required
parameters for any definition.  The closest match is printed
as a suggestion, and running lvresize --help will display
the usage for each possible lvresize command.

The prototype syntax used for help/man output includes
required --option and positional args on the first line,
and optional --option and positional args enclosed in [ ]
on subsequent lines.

  command_name <required_opt_args> <required_pos_args>
          [ <optional_opt_args> ]
          [ <optional_pos_args> ]

Command definitions that are not to be advertised/suggested
have the flag SECONDARY_SYNTAX.  These commands will not be
printed in the normal help output.

Man page prototypes are also generated from the same original
command definitions, and are always in sync with the code
and help text.

Very early in command execution, a matching command definition
is found.  lvm then knows the operation being done, and that
the provided args conform to the definition.  This will allow
lots of ad hoc checking/validation to be removed throughout
the code.

Each command definition can also be routed to a specific
function to implement it.  The function is associated with
an enum value for the command definition (generated from
the ID string.)  These per-command-definition implementation
functions have not yet been created, so all commands
currently fall back to the existing per-command-name
implementation functions.

Using per-command-definition functions will allow lots of
code to be removed which tries to figure out what the
command is meant to do.  This is currently based on ad hoc
and complicated option analysis.  When using the new
functions, what the command is doing is already known
from the associated command definition.
2017-02-07 10:36:18 -06:00
David Teigland
2da7b10988 lvmlockd: test mode doesn't work
The --test option is not yet compatible with shared VGs
because changes are made in lvmlockd that cannot be
reversed or faked.
2017-02-07 10:36:18 -06:00
Heinz Mauelshagen
46a772fbc4 lvconvert: add support to change RAID region size (fixup)
Commit cfb6ef654d3d1f1dd02569a1d5bd2fc252ae2494 introduced
support to change RAID region size.

Add:
- missing conditions to support any types to function with
  it in lv_raid_convert();  temporary workaround used until
  cli validation patches get merged
- tests requesting "-R " to lvconvert-raid-takeover.sh
  involving a cleanup of the script

Related: rhbz1392947
2017-02-07 16:52:04 +01:00
Heinz Mauelshagen
91c4bd14d0 lvconvert: add segtype raid5_n and conversions to/from it (cleanup)
Cleanups as of Jons review:
- enhance comment about mandatory raid4 <-> raid5_n activation w/o metadata SubLVs
- remove bogus segment flag setting
- fix to sync related comments on conversions to raid0/striped and amongst raid4/5
- add missing error message for non-synced conversion to raid0/striped

Related: rhbz1366296
2017-02-07 12:25:26 +01:00