summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* commands: move command def parsing into lvm binarydev-dct-cmd-defs74David Teigland2017-02-0311-2467/+2740
|
* lvconvert: remove unused codedev-dct-cmd-defs73David Teigland2017-01-191-39/+7
| | | | For "split" which is not an alias for splitmirrors.
* args: split is a synonym for splitcacheDavid Teigland2017-01-193-33/+31
| | | | also tidy the other synonyms
* man: add vgsplit notesDavid Teigland2017-01-181-0/+18
| | | | from previous man page
* man: add vgimportclone notesDavid Teigland2017-01-181-0/+9
| | | | from previous man page
* man: add vgimport notesDavid Teigland2017-01-181-0/+9
| | | | from previous man page
* man: add vgexport notesDavid Teigland2017-01-181-0/+14
| | | | from previous man page
* man: add pvscan notesDavid Teigland2017-01-181-0/+103
| | | | from previous man page
* man: add pvmove notesDavid Teigland2017-01-181-0/+47
| | | | Copied from the previous man page.
* man: lvmlockd/clvmd notes about activationDavid Teigland2017-01-182-15/+53
| | | | | | activation details about lvmlockd and clvmd that were previously in the generic lvchange -a section are now moved to these man pages.
* generate man pagesDavid Teigland2017-01-1753-6663/+122
|
* man: lvmthin updatesDavid Teigland2017-01-161-12/+9
| | | | | Some minor changes to some of the command syntaxes to use more standard forms.
* ccmd: split into multiple filesDavid Teigland2017-01-166-3171/+3209
|
* command struct: remove command name refsdev-dct-cmd-defs72David Teigland2017-01-138-30/+26
| | | | | | | 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.
* command.h comment tidyingDavid Teigland2017-01-131-8/+6
|
* lvm shell: clear argv for each commanddev-dct-cmd-defs71David Teigland2017-01-131-1/+4
|
* help: accept positional argsDavid Teigland2017-01-131-0/+1
| | | | lvm help <commandname> ...
* fix lvmcmdline warningDavid Teigland2017-01-131-20/+20
| | | | declaration of ‘usage’ shadows a globa
* Makefile: clean up create-command partsDavid Teigland2017-01-131-5/+31
|
* man lvm: remove optionsDavid Teigland2017-01-131-255/+3
| | | | all options are now included in commands
* args: add man page descriptionsDavid Teigland2017-01-124-268/+1611
|
* args: use uint32 arg for maxphysicalvolumesDavid Teigland2017-01-044-4/+6
|
* lvconvert: remove unused codeDavid Teigland2017-01-041-1731/+325
|
* lvconvert: use command defs for raid/mirror typesDavid Teigland2017-01-044-797/+323
| | | | | | | | | | 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.
* tests: use swapmetadataDavid Teigland2017-01-045-33/+33
| | | | and some other pool/cache/thin related changes
* lvconvert: use command defs for mergemirrorsDavid Teigland2017-01-045-40/+111
| | | | | and route the generic --merge to one of the specific merge functions
* toollib: find VG name in option values when neededDavid Teigland2017-01-044-2/+162
|
* lvconvert: use command defs for thin/cache/pool creationDavid Teigland2017-01-0410-74/+1394
| | | | Everything related to thin and cache.
* lvconvert: add startpoll command using command defDavid Teigland2017-01-046-18/+86
| | | | | | 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.
* lvconvert: snapshot: use command definitionsDavid Teigland2017-01-0410-140/+277
| | | | | | | 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.
* lvconvert: remove unused calls for repair and replaceDavid Teigland2017-01-041-227/+10
| | | | | repair and replace are no longer called from the monolithic lvconvert code, so remove the unused code.
* lvconvert: repair and replace: use command definitionsDavid Teigland2017-01-044-18/+330
| | | | | | | 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.
* lvchange: make use of command definitionsDavid Teigland2017-01-044-452/+430
| | | | | | Reorganize the lvchange code to take advantage of the command definition, and remove the validation that is done by the command definintion rules.
* process_each_lv: add check_single_lv functionDavid Teigland2017-01-0411-15/+38
| | | | | | | | | | | | | | | | | 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.
* commands: new method for defining commandsDavid Teigland2017-01-0428-1836/+7312
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | . 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. Example of the corresponding generated structure in command-lines.h for the first lvresize prototype (these structures are never edited directly): commands[83].name = "lvresize"; commands[83].command_line_id = "lvresize_by_size"; commands[83].command_line_enum = lvresize_by_size_CMD; commands[83].fn = lvresize; commands[83].ro_count = 1; commands[83].rp_count = 1; commands[83].oo_count = 22; commands[83].op_count = 1; commands[83].cmd_flags = 0; commands[83].desc = "DESC: Resize an LV by a specified size."; commands[83].usage = "lvresize --size Number[m|unit] LV" " [ --resizefs, --poolmetadatasize Number[m|unit], COMMON_OPTIONS ]" " [ PV ... ]"; commands[83].usage_common = " [ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit, --nosync, --reportformat String, --autobackup y|n, --stripes Number, --stripesize Number[k|unit], --nofsck, --commandprofile String, --config String, --debug, --driverloaded y|n, --help, --profile String, --quiet, --verbose, --version, --yes, --test, --force, --noudevsync ]"; commands[83].required_opt_args[0].opt = size_ARG; commands[83].required_opt_args[0].def.val_bits = val_enum_to_bit(sizemb_VAL); commands[83].required_pos_args[0].pos = 1; commands[83].required_pos_args[0].def.val_bits = val_enum_to_bit(lv_VAL); commands[83].optional_opt_args[0].opt = commandprofile_ARG; commands[83].optional_opt_args[0].def.val_bits = val_enum_to_bit(string_VAL); commands[83].optional_opt_args[1].opt = config_ARG; commands[83].optional_opt_args[1].def.val_bits = val_enum_to_bit(string_VAL); commands[83].optional_opt_args[2].opt = debug_ARG; commands[83].optional_opt_args[3].opt = driverloaded_ARG; commands[83].optional_opt_args[3].def.val_bits = val_enum_to_bit(bool_VAL); commands[83].optional_opt_args[4].opt = help_ARG; commands[83].optional_opt_args[5].opt = profile_ARG; commands[83].optional_opt_args[5].def.val_bits = val_enum_to_bit(string_VAL); commands[83].optional_opt_args[6].opt = quiet_ARG; commands[83].optional_opt_args[7].opt = verbose_ARG; commands[83].optional_opt_args[8].opt = version_ARG; commands[83].optional_opt_args[9].opt = yes_ARG; commands[83].optional_opt_args[10].opt = test_ARG; commands[83].optional_opt_args[11].opt = alloc_ARG; commands[83].optional_opt_args[11].def.val_bits = val_enum_to_bit(alloc_VAL); commands[83].optional_opt_args[12].opt = autobackup_ARG; commands[83].optional_opt_args[12].def.val_bits = val_enum_to_bit(bool_VAL); commands[83].optional_opt_args[13].opt = force_ARG; commands[83].optional_opt_args[14].opt = nofsck_ARG; commands[83].optional_opt_args[15].opt = nosync_ARG; commands[83].optional_opt_args[16].opt = noudevsync_ARG; commands[83].optional_opt_args[17].opt = reportformat_ARG; commands[83].optional_opt_args[17].def.val_bits = val_enum_to_bit(string_VAL); commands[83].optional_opt_args[18].opt = resizefs_ARG; commands[83].optional_opt_args[19].opt = stripes_ARG; commands[83].optional_opt_args[19].def.val_bits = val_enum_to_bit(number_VAL); commands[83].optional_opt_args[20].opt = stripesize_ARG; commands[83].optional_opt_args[20].def.val_bits = val_enum_to_bit(sizekb_VAL); commands[83].optional_opt_args[21].opt = poolmetadatasize_ARG; commands[83].optional_opt_args[21].def.val_bits = val_enum_to_bit(sizemb_VAL); commands[83].optional_pos_args[0].pos = 2; commands[83].optional_pos_args[0].def.val_bits = val_enum_to_bit(pv_VAL); commands[83].optional_pos_args[0].def.flags = ARG_DEF_FLAG_MAY_REPEAT; 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> ] $ lvresize --help lvresize - Resize a logical volume Resize an LV by a specified size. lvresize --size Number[m|unit] LV [ --resizefs, --poolmetadatasize Number[m|unit], COMMON_OPTIONS ] [ PV ... ] Resize a pool metadata SubLV by a specified size. lvresize --poolmetadatasize Number[m|unit] LV_thinpool [ COMMON_OPTIONS ] [ PV ... ] Common options: [ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit, --nosync, --reportformat String, --autobackup y|n, --stripes Number, --stripesize Number[k|unit], --nofsck, --commandprofile String, --config String, --debug, --driverloaded y|n, --help, --profile String, --quiet, --verbose, --version, --yes, --test, --force, --noudevsync ] (Use --help --help for usage notes.) $ lvresize --poolmetadatasize 4 Failed to find a matching command definition. Closest command usage is: lvresize --poolmetadatasize Number[m|unit] LV_thinpool 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. So, this first phase validates every user-entered command against the set of command prototypes, then calls the existing implementation. The second phase can associate an implementation function with each definition, and take further advantage of the known operation to avoid the complicated option analysis.
* lvmlockd: test mode doesn't workDavid Teigland2017-01-031-0/+5
| | | | | | The --test option is not yet compatible with shared VGs because changes are made in lvmlockd that cannot be reversed or faked.
* cleanup: more use of lvseg_nameZdenek Kabelac2017-01-037-16/+7
| | | | Use existing function lvseg_name().
* cleanup: use macrosZdenek Kabelac2017-01-031-2/+2
|
* cleanup: definesZdenek Kabelac2017-01-031-5/+11
|
* cleanup: reuse existing codeZdenek Kabelac2017-01-031-20/+14
|
* cache: add missing udev waitZdenek Kabelac2017-01-032-1/+14
| | | | | | | | | | | | | | | | | | | When we need to clear dirty cache content of cached LV, there is table reload which usually is shortly followed by next metadata change. However udev can't (as of now) process udev event while device is 'suspended'. So whenever sequence of 'suspend/resume/suspend' is needed, we need to wait first for finishing of 'resume' processing before starting next 'suspend'. Otherwise there is 'race' danger of triggering unwantend umount by systemd as such event will trigger SYSTEMD_READY=0 state for a moment for such changed device. Such race is pretty ugly to trace so we may need to review more sequencies for missing 'sync'. (Other option is to enhnace 'udev' rules processing to avoid such dramatic actions to be happening for suspended devices).
* vgchange: max_pv limited to uint32Zdenek Kabelac2017-01-033-1/+9
| | | | | | | | | | | | | | | Solves: https://bugzilla.redhat.com/1280496 The only reasonable behaviour here is to error on any number out of accepted range (i.e. now numbers wrapping around with some hidden logic). As this is plain bug there is no support for backward compatibility since noone should set numbers >UINT32_MAX and expect 0 or error depending on how big number was used.... TODO: more fields might need to be converted.
* lvmcmdline: support uint32Zdenek Kabelac2017-01-032-0/+9
| | | | | | | | Add simple function to wrap usage for only uint32 numbers. Unlike 'int_arg' which accepts full range of 64bit number this function will error on numbers out of this range: <0, UINT32_MAX>
* man: fix name of 'write_time' field in dmstats.8.inBryn M. Reeves2016-12-251-1/+1
|
* tests: update testZdenek Kabelac2016-12-231-3/+12
| | | | | lvm2 now correctly reports thin_id after action of merged thin, but before physical metadata update as we know the merge has happened.
* validation: temporarily let pass linear with chunk_sizeZdenek Kabelac2016-12-231-0/+2
| | | | | Old pool format seems to be setting chunk_size. For now let validation pass with this.
* lvchange: allow a transiently failed RaidLV to be refreshedHeinz Mauelshagen2016-12-235-28/+171
| | | | | | | | | | | | | | | | | | | | | | Add to commits 87117c2b2546 and 0b8bf73a63d8 to avoid refreshing two times altogether, thus avoiding issues related to clustered, remotely activated RaidLV. Avoid need to repeat "lvchange --refresh RaidLV" two times as a workaround to refresh a RaidLV. Fix handles removal of temporary *-missing-* devices created for any missing segments in RAID SubLVs during activation. Because the kernel dm-raid target isn't able to handle transiently failing devices properly we need "[dm-devel][PATCH] dm raid: fix transient device failure processing" as well. test: add lvchange-raid-transient-failures.sh and enhance lvconvert-raid.sh Resolves: rhbz1025322 Related: rhbz1265191 Related: rhbz1399844 Related: rhbz1404425
* tests: use hold_device_openZdenek Kabelac2016-12-223-20/+5
|
* tests: add device holding functionZdenek Kabelac2016-12-221-0/+21
| | | | | Hold device open with sleep and wait till sleep really opens given devices.
* tests: workaround failure on fc23Zdenek Kabelac2016-12-221-0/+6
|