summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* lvconvert snapshot cleanup checksdev-dct-cmd-defs61David Teigland2016-12-154-52/+6
|
* lvconvert merge old snapshot missing lv_info checkDavid Teigland2016-12-151-1/+4
|
* lvmlockd: test mode doesn't workDavid Teigland2016-12-151-0/+5
| | | | | | The --test option is not yet compatible with shared VGs because changes are made in lvmlockd that cannot be reversed or faked.
* lvconvert: use command defs for raid/mirror typesDavid Teigland2016-12-154-347/+370
|
* lvconvert: move codeDavid Teigland2016-12-1510-2642/+2703
| | | | | | | | | | | | | | | | | | | | | Should be no functional changes. lvconvert.c type conversions for raid/mirror/linear/striped lvconvert_pool.c thin/cache/pool creation and utilities lvconvert_snapshot.c cow snapshot creation and utilties lvconvert_other.c generic commands that are routed to a specific command in another file once the LV type is known. lvconvert_poll.c polling utilities
* tests: use swapmetadataDavid Teigland2016-12-155-33/+33
| | | | and some other pool/cache/thin related changes
* lvconvert: remove unused codeDavid Teigland2016-12-151-1641/+16
| | | | for merge, cache, thin, pool
* lvconvert: use command defs for mergemirrorsDavid Teigland2016-12-155-33/+104
| | | | | and route the generic --merge to one of the specific merge functions
* toollib: find VG name in option values when neededDavid Teigland2016-12-154-2/+162
|
* lvconvert: use command defs for thin/cache/pool creationDavid Teigland2016-12-1510-70/+1366
| | | | Everything related to thin and cache.
* lvconvert: add startpoll command using command defDavid Teigland2016-12-146-35/+86
| | | | | This is a new explicit version of 'lvconvert LV' which has never been well defined or understood.
* lvconvert: add hidden lv access restrictionsDavid Teigland2016-12-141-5/+49
| | | | | This copies the previous logic which is probably not correct.
* lvconvert: remove unused calls for snapshotsDavid Teigland2016-12-141-174/+6
| | | | | snapshot commands are no longer called from the monolithic lvconvert code, so remove the unused code.
* lvconvert: snapshot: use command definitionsDavid Teigland2016-12-149-137/+266
| | | | | | | 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 Teigland2016-12-141-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 Teigland2016-12-144-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 Teigland2016-12-144-454/+426
| | | | | | 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 Teigland2016-12-1411-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 Teigland2016-12-1428-1836/+7176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | . 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.
* libdm: fix region overlap testsBryn M. Reeves2016-12-131-1/+7
|
* libdm: fix _stats_get_extents_for_file()Bryn M. Reeves2016-12-132-20/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | Handle files that contain multiple logical extents in a single physical extent properly: - In FIEMAP terms a logical extent is a contiguous range of sectors in the file's address space. - One or more physically adjacent logical extents comprise a physical extent: these are the disk areas that will be mapped to regions. - An extent boundary occurs when the start sector of extent n+1 is not equal to (n.start + n.length). This requires that we accumulate the length values of extents returned by FIEMAP until a discontinuity is found (since each struct fiemap_extent returned by FIEMAP only represents a single logical extent, which may be contiguous with other logical extents on-disk). This avoids creating large numbers of regions for physically adjacent (logical) extents and fixes the earlier behaviour which would only map the first logical extent of the physical extent, leaving gaps in the region table for these files.
* lvchange: allow a transiently failed RaidLV to be refreshedHeinz Mauelshagen2016-12-121-10/+16
| | | | | | | Enhance commit 0b8bf73a63d8 to refresh the top-level LV correctly in case of a clustered, remotely activated RaidLV. Related: rhbz1399844
* tests: update seg_size_peZdenek Kabelac2016-12-122-2/+2
| | | | Default prepare_vg uses 512K - so update test accordingly
* tests: use prepare_vg more oftenZdenek Kabelac2016-12-1213-34/+15
|
* tests: no left devices check for skipped testZdenek Kabelac2016-12-121-1/+4
|
* cov: use unsigned for single bit valuesZdenek Kabelac2016-12-121-2/+2
| | | | Avoid using signed int.
* tests: track leaked devices in testsZdenek Kabelac2016-12-111-0/+8
| | | | | When test calls teardown, no devices created by test are expected to be left in table. Trap such orphans and make the test fail.
* tests: remove unwanted exitZdenek Kabelac2016-12-111-1/+1
| | | | | Exit seemes slipped in from local testing in: eb6b2a11e3548f7598c726787494be2c3ea4dca1
* tests: remove some leaking deviceZdenek Kabelac2016-12-112-0/+7
| | | | | | | These tests leaks devices (known bugs). Remove them via dmsetup. TODO: fix actual commands
* tests: test should clean devices it has createdZdenek Kabelac2016-12-1117-4/+31
| | | | | | | To be able to detect lvm2 command is not leaking some 'unexpected' device - remove all devices before test exits by its own command so test teardown now can check what was 'left' unexpectedly.
* tests: slower deviceZdenek Kabelac2016-12-111-1/+1
| | | | Some of test machines are too fast, slow raid syncing even more.
* cov: declaration matchingZdenek Kabelac2016-12-111-1/+1
|
* cov: add internal error for impossible code pathZdenek Kabelac2016-12-111-0/+5
|
* debug: missing stack tracesZdenek Kabelac2016-12-111-5/+5
|
* cleanup: use NAME_LEN stack bufferZdenek Kabelac2016-12-111-26/+14
| | | | | Using NAME_LEN we get at least easy max LV name size validation. Also code gets more simple.
* cleanup: reuse existing functionZdenek Kabelac2016-12-111-32/+2
| | | | Call lv_update_and_reload implementation.
* libdm: validate vsnprintfZdenek Kabelac2016-12-112-4/+9
| | | | | Avoid using buffer when no output has been generated. Missed in ee13f265f043b47a1b023321fb9e8470fb5703c1.
* pvmove: fix activation orderZdenek Kabelac2016-12-112-5/+6
| | | | | For proper locking we need to gain lock first for mirror which needs to be deactivated later to be working in cluster.
* raid: avoid _ at end of name of extracted metadata LVZdenek Kabelac2016-12-112-1/+2
| | | | Do not generate @PREFIX@vg/LV1_rmeta_1_extracted_.
* raid: optimize clearing of lvsZdenek Kabelac2016-12-112-46/+47
| | | | | | | Activate whole list of metadata lvs first before clearing them. (Similar to commit ada5733c5652d456ffa138b0d07e6897824813b0) TODO: make this clearing in a single common function.
* raid: fix delete on clustered vgZdenek Kabelac2016-12-112-0/+13
| | | | | | | For clustered VG ensure lock is grabbed first, so later deactivation works. TODO: fix tree to solve device removal automatically.
* raid: fix raid1 to mirror conversionZdenek Kabelac2016-12-112-6/+8
| | | | | | | | | | Fix order of operation when converting raid1 into old mirror. Before any later metadata modification are initiated prepare mirror_log device with all clearing. Then directly convert raid1 into mirror with mirror_log. This convertion now properly see as precommitted metadata new 'mirror' and committed old 'raid' and is able to preload all LVs.
* mirror: add prepare_mirror_logZdenek Kabelac2016-12-113-0/+48
| | | | | | Function prepares new mirror log LV in-sync optionaly. This is useful to have such device ready when converting raid1 to mirror.
* test: add results/ to .gitignoreBryn M. Reeves2016-12-101-0/+1
|
* lvmdbusd: add path.py to .gitignoreBryn M. Reeves2016-12-101-0/+1
|
* scripts: add systemd unit files to .gitignoreBryn M. Reeves2016-12-101-0/+2
| | | | | | | com.redhat.lvmdbus1.service lvm2_lvmdbusd_systemd_red_hat.service .gitignore
* scripts: add lvmdump.sh to .gitignoreBryn M. Reeves2016-12-101-0/+1
|
* libdm: fix filemap cleanup loop conditionBryn M. Reeves2016-12-101-3/+3
|
* libdm: use a private pool for filemap extent tableBryn M. Reeves2016-12-102-3/+17
| | | | | | | | | | | | | | | | | | | | | | When mapping regions to a file descriptor, a temporary table of extent descriptors is built using the dm_pool object building interface. Previously this use borrowed the dms->mem region and counter table pool (since nothing can interleave with the allocation while the caller is still in dm_stats_create_regions_from_fd()). This turns out to be problematic for error recovery. When a region creation operation fails partway through file mapping, we need to roll back the set of already created regions and this requires a listed handle: the dm_stats_list() will then allocate from the same pool as the extents; we either have to throw away valid list data, or leak the extent table, to return the handle in a valid state. Avoid this problem by creating a new, temporary mem pool in _stats_create_file_regions() to hold the extent data, and discarding it on exit from the function.
* doc: add filemap creation fixes to WHATS_NEW_DMBryn M. Reeves2016-12-101-0/+3
|