summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* lvresize: add new options and defaults for fs handlingdev-dct-lvresize-8David Teigland2022-08-1925-188/+3532
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new option "--fs String" for lvresize/lvreduce/lvextend controls the handling of file systems before/after resizing the LV. --resizefs is the same as --fs resize. Possible --fs values: checksize Only used when reducing the size, does nothing when exending. Check the fs size, and reduce the LV if the fs is not using the affected space, i.e. the fs does not need to be shrunk. Fail the command without reducing the fs or LV if the fs is using the affected space. resize_remount | resize Resize the fs if needed. Mounts or unmounts the fs as required (avoids mounting/unmounting when possible.) Attempts to restore the original mount state when finished. resize_keepmount Resize the fs if needed, only if it can be done without changing the current mount state. Fail the command without resizing the fs or LV if an fs resize requires mounting or unmounting. resize_unmount Resize the fs if needed, only while unmounted. Unmount the fs if needed. Fail the command without resizing the fs or LV if an fs resize is needed that requires the the fs to be mounted. resize_fsadm Use the old method of calling fsadm to do handle the fs (deprecated). ignore Resize the LV without checking for or handling a file system. Notes on lvreduce: When no --fs or --resizefs option is specified: . lvextend default behavior is fs ignore. . lvreduce default behavior is fs checksize (includes activating the LV.) With the exception of --fs resize_fsadm|ignore, lvreduce requires the recent libblkid fields FSLASTBLOCK and FSBLOCKSIZE. FSLASTBLOCK*FSBLOCKSIZE is the last byte used by the fs on the LV, which determines if reducing the fs is necessary.
* lvresize: restructure codeDavid Teigland2022-08-1915-557/+889
| | | | | Rewrite top level resize function to prepare for adding new fs resizing.
* devices file: fix pvcreate --uuid matching pvid entry with no device idDavid Teigland2022-08-192-3/+17
| | | | | | pvcreate with --uuid would segfault if a devices file entry matched the specified pvid, but the devices file entry had no device_id, which could happen if the entry has a devname idtype.
* devices: drop double // from sysfs pathZdenek Kabelac2022-08-193-7/+7
| | | | dm_sysfs_dir() comes internally as /sys/.
* dmsetup: check also for ouf of range valueZdenek Kabelac2022-08-191-1/+2
| | | | Check errno result from strtoull().
* mm: remove libaio from being skippedZdenek Kabelac2022-08-191-1/+0
| | | | | Since libaio is now used also in critical section, keep the libaio locked in memory.
* vdo: extend volume and pool without flushZdenek Kabelac2022-08-193-1/+8
| | | | | | | | | | | | When the volume size is extended, there is no need to flush IO operations (nothing can be targeting new space yet). VDO target is supported as target that can safely work with this condition. Such support is also needed, when extending VDOPOOL size while the pool is reaching its capacity - since this allows to continue working without reaching 'out-of-space' condition due to flushing of all in flight IO.
* vdo: reset errno before strtoullZdenek Kabelac2022-08-191-0/+1
| | | | Missed errno reset in commit ebad057579aeff0980a1b8af7eaacd56e62ed0c9.
* config: check for possible mempool errors in _out_line_fnPeter Rajnoha2022-08-171-3/+9
|
* config: remove unnecessary copy of config line's space prefix before printingPeter Rajnoha2022-08-171-5/+3
| | | | | | | | | | | | | | | | When we wanted to insert '#' before a config line (to comment it out), we used dm_pool_strndup to temporarily copy the space prefix first so we can assemble the final line with: "<space_prefix># <key>=<value>": out of original: "<space_prefix><key>=<value>". The space_prefix copy is not necessary, we can just use fprintf's precision modifier "%.*s" to print the exact part if we alrady know space_prefix length.
* lvmconfig: add --valuesonly optionPeter Rajnoha2022-08-177-3/+43
| | | | | | | | | | | | | | | | | | | | | The new --valuesonly option causes the lvmconfig output to contain only values without keys for each config node. This is practical mainly in case where we use lvmconfig in scripts and we want to assign the value to a different custom key or simply output the value itself without the key. For example: # lvmconfig --type full activation/raid_fault_policy raid_fault_policy="warn" # lvmconfig --type full activation/raid_fault_policy --valuesonly "warn" # my_var=$(lvmconfig --type full activation/raid_fault_policy --valuesonly) # echo $my_var "warn"
* report: report numeric values (not string synonyms) for NUM and BIN fields ↵Peter Rajnoha2022-08-164-3/+19
| | | | | | | | | | | | | | | | with json_std format Internally, NUM and BIN fields are marked as DM_REPORT_FIELD_TYPE_NUM_NUMBER through libdevmapper API. The new 'json_std' format mandates that the report string representing such a value must be a number, not an arbitrary string. This is because numeric values in 'json_std' format do not have double quotes around them. This practically means, we can't use string synonyms ("named reserved values") for such values and the report string must always represent a proper number. With 'json' and 'basic' formats, this is not an issue because 'basic' format doesn't have any structure or typing at all and 'json' format puts all values in quotes, including numeric ones.
* _vg_read_raw_area: fix segfault caused by using null pointerWu Guanghao2022-08-151-1/+1
| | | | | | | | | | | | | When we tested lvm2, the kernel injected various random faults. (gdb) bt ... (gdb) p vg $1 = (struct volume_group *) 0x0 (gdb) p use_previous_vg $2 = (unsigned int *) 0x0 Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
* autoreconf: support newer archsZdenek Kabelac2022-08-157-6690/+8343
| | | | | | | | | | | Update to more recent version of configure script to support more new architecture types like RISCV64. Tools in use ATM: autoconf-2.71-3.fc37.noarch autoconf-archive-2022.02.11-3.fc37.noarch automake-1.16.5-9.fc37.noarch Resolves https://bugzilla.redhat.com/show_bug.cgi?id=2118243
* vdo: fix --vdosettings parserZdenek Kabelac2022-08-151-5/+9
| | | | | Parser was incorrectly parsing vdo_use_features - move the skip of 'use_' prefix into internal loop which handles skipping of '_'.
* vdo: use only verbose log level for reformatingZdenek Kabelac2022-08-151-2/+8
| | | | | | | | | When lvcreate is makeing VDO pool and user has not specified -V size, ATM we actually run 'vdoformat' twice to get properly 'extent' aligned size matching lvm2 properties - so the 2nd. run of vdoformat actually can stay with 'log_verbose()' so the standard printed result is not showing confusing info (which is now also correctly using print_unless_silent)
* lvconvert: correct test support for vdo-poolZdenek Kabelac2022-08-153-2/+7
|
* WHATS_NEW: updatePeter Rajnoha2022-08-112-1/+3
|
* test: add report-format testPeter Rajnoha2022-08-111-0/+74
|
* report: fix pe_start column type from NUM to SIZPeter Rajnoha2022-08-111-1/+1
| | | | | | | | | | | | | | | | The 'pe_start' column was incorrectly marked as being of type NUM. This was not correct as pe_start is actually of type SIZ, which means it can have a size suffix and hence it's not a pure numeric value. Proper column type is important for selection to work correctly, so we can also do comparisons while using suffixes. This is also important for new "json_std" output format which does not put double quotes around pure numeric values. With pe_start incorrectly marked as NUM instead of SIZ, this produced invalid JSON output like '"pe_start" = 1.00m' because it contained the 'm' (or other) size suffix. If properly marked as SIZ, this is then put in double quotes like '"pe_start" = "1.00m"'.
* make: generatePeter Rajnoha2022-08-1134-112/+184
|
* man: update lvmreport man page about json_std formatPeter Rajnoha2022-08-111-8/+28
|
* args: recognize 'json_std' for --reportformat cmd line argPeter Rajnoha2022-08-113-3/+6
|
* config: recognize 'json_std' for report/output_format config settingPeter Rajnoha2022-08-112-3/+14
|
* libdm: report: use proper JSON array for string list output in JSON_STD formatPeter Rajnoha2022-08-112-8/+168
| | | | | | | | | | In JSON format, we print string list this way: "key" = "item1,item2,...,itemN" while in JSON_STD format, we print string list this way: "key" = ["item1","item2",...,"itemN"]
* libdm: report: separate basic and JSON+JSON_STD format in _output_fieldPeter Rajnoha2022-08-112-142/+188
| | | | | Use separate functions to handle basic and JSON+JSON_STD format. It's clearer this way than interleaving both in the same function.
* libdm: report: enhance the way string list is stored internallyPeter Rajnoha2022-08-112-232/+380
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, we stored only the report string itself for a string list in field->report_string. The field->report_string has either sorted items or not, depending on what we need for a field - some report fields have sorted output, some don't... The field->sort_value.value then contains pointer to the exact field->report_string. The field->sort_value.items ALWAYS keeps sorted array of individual items, represented as '[position,length]' pairs pointing to the field->sort_value.value string. This approach was fine as far as we didn't need to apply further formatting to field->report_string. However, if we need to apply further formatting to field->report_string content, taking into account individual items, we also need to know where each item starts and what is its length. Before, we only knew this when items in report string were sorted, but not in the unsorted version. We can't rely on the delimiter (default ",") only to separate items back out of report string, because that delimiter can be contained in the item value itself. So this patch enhances the field->report_string for a string list so it also contains '[position,length]' pairs for each individual item inside field->report_string. We store this array right beyond the string itself and we encode it in the same manner we already did for field->sort_value.items before. If field->report_string has sorted items, the field->sort_value.items just points to the array of items we store beyond the report string. If field->report_string has unsorted items, we store separate array of items for both field->report_string and field->sort_value. This patch also cleans up the _report_field_string_list function a bit so it's easier and more straightforward to follow than the original version. Example. If we have "abc", "xy", "defgh" as list on input with "," as delimiter, then: - field->report_string will have: - if we need field->report_string unsorted: abc,xy,defgh\0{[3,12],[0,3],[4,2],[7,5]} |____________||________________________| string array of [pos,len] pairs |____||________________| #items items - if we need field->report_string sorted: repstr_extra | V abc,defgh,xy\0{[3,12],[0,3],[4,5],[10,2]} |____________||________________________| string array of [pos,len] pairs |____||________________| #items items - field->sort_value will have: - if field->report_string is unsorted: field->sort_value.value = field->report_string field->sort_value.items = {[0,3],[0,3],[7,5],[4,2]} (that is 'abc,defgh,xy') - if field->report_string is sorted already: field->sort_value.value = field->report_string field->sort_value.items = repstr_extra (that is also 'abc,defgh,xy')
* libdm: report: use 'null' for undefined numeric values in JSON_STD outputPeter Rajnoha2022-08-112-2/+14
| | | | | | | | | | | | | | | For JSON_STD format, use 'null' if a field has no value at all. In JSON format, we print undefined numeric values this way: "key" = "" while in JSON_STD format, we print undefined numeric values this way: "key" = null (Keep in mind that 'null' is different from 0 (zero value) which is a defined value.)
* libdm: report: remove double quotes around numeric values in JSON_STD outputPeter Rajnoha2022-08-112-14/+40
| | | | | | | | | | | | In JSON format, we print numeric values this way: "key" = "N" while in JSON_STD format, we print numeric value this way: "key" = N (Where N is a numeric value.)
* libdm: report: add DM_REPORT_GROUP_JSON_STD groupPeter Rajnoha2022-08-114-6/+26
| | | | | | | The original JSON formatting will be still available using the original DM_REPORT_GROUP_JSON identifier. Subsequent patches will add enhancements to JSON formatting code so that it adheres more to JSON standard - this will be identified by new DM_REPORT_GROUP_JSON_STD identifier.
* config: add correct unconfigured value for use_devicesfileMarian Csontos2022-08-092-2/+2
|
* spec: use --with-default-use-devices-file=1 for rhel9+Marian Csontos2022-08-091-0/+4
|
* configure: fix typoMarian Csontos2022-08-091-1/+1
|
* spec: Use libedit for newer distributionsMarian Csontos2022-08-092-0/+15
|
* shell: also output error message about max number of args hit with JSON formatPeter Rajnoha2022-08-081-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If using JSON format for lvm shell's output, the error message about exceeding the maximum number of arguments was not reported on output if this condition was ever hit. This is because the JSON format (as well as any other future format) requires extra formatting compared to "basic" format and so it also requires extra calls when it comes to reporting. The report needs to be added to a report group and then popped and put on output with specialized "dm_report_group_output_and_pop_all". This "output and pop" is normally executed after we execute the command in the lvm shell. When we didn't get to the command exection at all because some precondition was not met (like hitting the limit for the number of arguments for the command here), we skipped this important call and so there was no log report output. Right now, it's only this exact error message for which we need to call "output and pop" directly, all the other error messages are about initializing and setting the log report itself which we can't report obviously. Before this patch: lvm> pvs 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 lvm> With this patch applied: lvm> pvs 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 { "log": [ {"log_seq_num":"1", "log_type":"error", "log_context":"shell", "log_object_type":"cmd", "log_object_name":"", "log_object_id":"", "log_object_group":"", "log_object_group_id":"", "log_message":"Too many arguments, sorry.", "log_errno":"-1", "log_ret_code":"0"} ] } If there's any other error message in the future before we execute the command itself, we also need to call the "output and pop" directly.
* apply multipath_component_detection=0 to duplicate PV handlingDavid Teigland2022-07-252-3/+10
| | | | | | | multipath_component_detection=0 has always applied to the filter-based component detection. Also apply this setting to the duplicate-PV handling which also eliminates multipath components (based on duplicate PVs having the same wwid.)
* make: generateZdenek Kabelac2022-07-111-0/+12
|
* cov: restore disable_dm_devs also for error pathZdenek Kabelac2022-07-111-3/+4
| | | | | Keep the structure correct for failing error path, alhtough likely this particual var will not be used.
* cov: remove unused headersZdenek Kabelac2022-07-114-4/+0
|
* vdo: suffle code for better error path handlingZdenek Kabelac2022-07-111-14/+14
| | | | | For failing dm_ no need to report 2nd. error, but we missed to report error with 'updated==NULL'.
* vdo: enhance lvcreate validationZdenek Kabelac2022-07-113-8/+56
| | | | | | | | | | | When creating VDO pool based of % values, lvm2 is now more clever and avoids to create 'unsupportable' sizes of physical backend volumes as 16TiB is maximum size supported by VDO target (and also limited by maximum supportable slabs (8192) based on slab size. If the requested virtual size is approaching max supported size 4PiB, switch header size to 0.
* vdo: support v4 kernel target lineZdenek Kabelac2022-07-115-14/+37
| | | | Check and use new available table line v4, if kernel supports it.
* vdo: add reformating to extent size aligned virtual sizeZdenek Kabelac2022-07-111-3/+19
| | | | | | | | | Newer VDO kernel target require to have matching virtual size - this however cause incompatiblity when lvcreate is let to format VDO data device and read the usable size from vdoformat. Altough this is a kernel regression and will likely get fixed, lvm2 can actually reformat VDO device to use properly aligned VDO LV size to make this problem disappear.
* vdo: check vdo memory constrainsZdenek Kabelac2022-07-114-2/+156
| | | | | | | | | | | | | | | | | | | Add function to check for avaialble memory for particular VDO configuration - to avoid unnecessary machine swapping for configs that will not fit into memory (possibly in locked section). Formula tries to estimate RAM size machine can use also with swapping for kernel target - but still leaving some amount of usable RAM. Estimation is based on documented RAM usage of VDO target. If the /proc/meminfo would be theoretically unavailable, try to use 'sysinfo()' function, however this is giving only free RAM without the knowledge about how much RAM could be eventually swapped. TODO: move _get_memory_info() into generic lvm2 API function used by other targets with non-trivial memory requirements.
* vdo: report supported range in error pathZdenek Kabelac2022-07-111-18/+45
|
* vdo: use defines also for configuration definesZdenek Kabelac2022-07-114-47/+60
| | | | | | | | | | | | | Keep single source for most of values printed in lvm.conf (still needs some conversion) Correct max for logical threads to 60 (we may refuse some older configuration which might eventually user higher numbers - but so far let's assume no user have ever set this as it's been non-trivial and if would complicate code unnecessarily.) Accept maximum of 4PiB for virtual size of VDO LV (lvm2 will drop 'header borders to 0 for this case').
* vdo: update info about memoryZdenek Kabelac2022-07-111-3/+12
| | | | | Add more info about kernel target memory allocation associated with VDO pool usage.
* vdo: use single validatorZdenek Kabelac2022-07-112-36/+10
| | | | | Add era lenght validation into dm_vdo_validate_target_params() and reuse this validator also for _check_lv_segment().
* man: space after sizeZdenek Kabelac2022-07-1110-43/+44
| | | | | Put space between size and SI unit. Automatically make this 'space' as fixed size by Makefile sed script.
* vdo: fix conversion of vdo_slab_size_mb 2ndZdenek Kabelac2022-07-111-1/+1
| | | | | | | Patch 1b070f366ba57a6eb24df03241284732db5047e9 should have been already fixing this issue but since it the incorrect patch rebasing the change to vdo_slabSize got lost. So again now with explicit one-line patch.