summaryrefslogtreecommitdiffstats
path: root/tools/commands.h
Commit message (Collapse)AuthorAgeFilesLines
* thin: lvcreate --discardsZdenek Kabelac2012-08-091-1/+5
|
* thin: use discards as plural rather than singularAlasdair G Kergon2012-08-071-4/+4
| | | | Global change from --discard to --discards, as that feels more natural.
* thin: tidy commands.h arg listsAlasdair G Kergon2012-08-071-11/+8
| | | | | | args are listed alphabetically. lvconvert -T is covered in the second section not the first. It could be tidied further or split out.
* thin: add lvchange for discard and zero changeZdenek Kabelac2012-07-181-2/+5
| | | | | | | Update lvchange to allow change of 'zero' flag for thinpool. Add support for changing discard handling. N.B. from/to ignore could be only changed for inactive pool.
* thin: add discard support for thin poolZdenek Kabelac2012-07-181-1/+5
| | | | | | | | Add arg support for discard. Add discard ignore, nopassdown, passdown (=default) support. Flags could be set per pool. lvcreate [--discard {ignore|no_passdown|passdown}] vg/thinlv
* lvcreate: add --activate ay (autoactivate)Peter Rajnoha2012-06-281-1/+1
| | | | | | | | | | One can use "lvcreate --aay" to have the newly created volume activated or not activated based on the activation/auto_activation_volume_list this way. Note: -Z/--zero is not compatible with -aay, zeroing is not used in this case! When using lvcreate -aay, a default warning message is also issued that zeroing is not done.
* lvchange: add --activate ay (autoactivate)Peter Rajnoha2012-06-281-1/+1
| | | | The same as for vgchange...
* pvscan: add --activate ay option (autoactivate)Peter Rajnoha2012-06-281-1/+3
| | | | | | | | | | | Define auto_activation_handler that activates VGs/LVs automatically based on the activation/auto_activation_volume_list (activating all volumes by default if the list is not defined). The autoactivation is done within the pvscan call in 69-dm-lvmetad.rules that watches for udev events (device appearance/removal). For now, this works for non-clustered and complete VGs only.
* vgchange: add --activate ay option (autoactivate)Peter Rajnoha2012-06-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | Normally, the 'vgchange -ay' activates all volume groups (that pass the activation/volume_list filter if set). This call can appear in two scenarios: - system boot (so activation within a script in general) - manual call on command line (so activaton on user's direct request) For the former one, we would like to select which VGs should be actually activated. One can define the list of VGs directly to do that. But that would require the same list to be provided in all the scripts. The 'vgchange -aay' will check for the activation/auto_activation_volume_list in adition and it will activate only those VGs/LVs that pass this filter (assuming all to be activated if the list is not defined - the same logic we already have for activation/volume_list). Init/boot scripts should use this form of activation primarily (which, anyway, becomes only a fallback now with autoactivation done on PV appearance in tandem with lvmetad in place).
* args: add --activate synonym for --available argPeter Rajnoha2012-06-281-20/+20
| | | | | | | | We're refererring to 'activation' all over the code and we're talking about 'LVs being activated' all the time so let's use 'activation/activate' everywhere for clarity and consistency (still providing the old 'available' keyword as a synonym for backward compatibility with existing environments).
* Initial support for lvconvert for thin pool volumes.Zdenek Kabelac2012-05-091-1/+9
| | | | | | | | | | | | | | | Support has many limitations and lots of FIXMEs inside, however it makes initial task when user creates a separate LV for thin pool data and thin metadata already usable, so let's enable it for testing. Easiest API: lvconvert --chunksize XX --thinpool data_lv metadata_lv More functionality extensions will follow up. TODO: Code needs some rework since a lot of same code is getting copied.
* Add 'vgscan --cache' functionality for consistency with 'pvscan --cache'.Peter Rajnoha2012-03-271-1/+2
| | | | | | | | Calling vgscan alone should reuse information from the lvmetad (if running). The --cache option should initiate direct device scan and update lvmetad appropriately (if running). This is mainly for vgscan to behave consistently compared to pvscan.
* close ]Alasdair Kergon2012-03-061-1/+1
|
* Switch pvscan --cache major:minor to --major --minor.Alasdair Kergon2012-03-061-3/+3
|
* Scan all devices for lvmetad if 'pvscan --cache' used without device list.Alasdair Kergon2012-03-031-1/+1
|
* Change pvscan --lvmetad to pvscan --cache.Alasdair Kergon2012-03-021-3/+3
|
* Allow multiple device names with pvscan --lvmetad.Alasdair Kergon2012-03-021-1/+1
| | | | | | Hold global lock in pvscan --lvmetad. (This might need refinement.) Add PV name to "PV gone" messages. Adjust some log message severities. (More changes needed.)
* Check return values after calling new lvmetad fnsAlasdair Kergon2012-02-281-1/+1
| | | | (Haven't checked error path handling though)
* The lvmetad client-side integration. Only active when use_lvmetad = 1 is set inPetr Rockai2012-02-231-1/+2
| | | | lvm.conf *and* lvmetad is running.
* Support the ability to replace specific devices in a RAID array.Jonathan Earl Brassow2011-11-301-2/+3
| | | | | | | | | | | | | | | | | RAID is not like traditional LVM mirroring. LVM mirroring required failed devices to be removed or the logical volume would simply hang. RAID arrays can keep on running with failed devices. In fact, for RAID types other than RAID1, removing a device would mean substituting an error target or converting to a lower level RAID (e.g. RAID6 -> RAID5, or RAID4/5 to RAID0). Therefore, rather than removing a failed device unconditionally and potentially allocating a replacement, RAID allows the user to "replace" a device with a new one. This approach is a 1-step solution vs the current 2-step solution. example> lvconvert --replace <dev_to_remove> vg/lv [possible_replacement_PVs] '--replace' can be specified more than once. example> lvconvert --replace /dev/sdb1 --replace /dev/sdc1 vg/lv
* Thin supports poolmetadatasize settingZdenek Kabelac2011-11-041-1/+2
| | | | | Add option to set pool metadatasize. For passing size parameter reuse region_size.
* Fix bad lvconvert help output.Jonathan Earl Brassow2011-10-181-1/+1
| | | | | | The '--merge' option to lvconvert works on snapshots and RAID1. The man pages correctly reflect this, but the CLI help output still used the term, 'SnapshotLogicalVolume'.
* Add the ability to convert linear LVs to RAID1Jonathan Earl Brassow2011-10-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | Example: ~> lvconvert --type raid1 -m 1 vg/lv The following steps are performed to convert linear to RAID1: 1) Allocate a metadata device from the same PV as the linear device to provide the metadata/data LV pair required for all RAID components. 2) Allocate the required number of metadata/data LV pairs for the remaining additional images. 3) Clear the metadata LVs. This performs a LVM metadata update. 4) Create the top-level RAID LV and add the component devices. We want to make any failure easy to unwind. This is why we don't create the top-level LV and add the components until the last step. Should anything happen before that, the user could simply remove the unnecessary images. Also, we want to ensure that the metadata LVs are cleared before forming the array to prevent stale information from polluting the new array. A new macro 'seg_is_linear' was added to allow us to distinguish linear LVs from striped LVs.
* Allow 'nosync' extension of mirrors.Jonathan Earl Brassow2011-10-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows a mirror to be extended without an initial resync of the extended portion. It compliments the existing '--nosync' option to lvcreate. This action can be done implicitly if the mirror was created with the '--nosync' option, or explicitly if the '--nosync' option is used when extending the device. Here are the operational criteria: 1) A mirror created with '--nosync' should extend with 'nosync' implicitly [EXAMPLE]# lvs vg; lvextend -L +5G vg/lv ; lvs vg LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg Mwi-a-m- 5.00g lv_mlog 100.00 Extending 2 mirror images. Extending logical volume lv to 10.00 GiB Logical volume lv successfully resized LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg Mwi-a-m- 10.00g lv_mlog 100.00 2) The 'M' attribute ('M' signifies a mirror created with '--nosync', while 'm' signifies a mirror created w/o '--nosync') must be preserved when extending a mirror created with '--nosync'. See #1 for example of 'M' attribute. 3) A mirror created without '--nosync' should extend with 'nosync' only when '--nosync' is explicitly used when extending. [EXAMPLE]# lvs vg; lvextend -L +5G vg/lv; lvs vg LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg mwi-a-m- 20.00m lv_mlog 100.00 Extending 2 mirror images. Extending logical volume lv to 5.02 GiB Logical volume lv successfully resized LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg mwi-a-m- 5.02g lv_mlog 0.39 vs. [EXAMPLE]# lvs vg; lvextend -L +5G vg/lv --nosync; lvs vg LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg mwi-a-m- 20.00m lv_mlog 100.00 Extending 2 mirror images. Extending logical volume lv to 5.02 GiB Logical volume lv successfully resized LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg Mwi-a-m- 5.02g lv_mlog 100.00 4) The 'm' attribute must change to 'M' when extending a mirror created without '--nosync' is extended with the '--nosync' option. (See #3 examples above.) 5) An inactive mirror's sync percent cannot be determined definitively, so it must not be allowed to skip resync. Instead, the extend should ask the user if they want to extend while performing a resync. [EXAMPLE]# lvchange -an vg/lv [EXAMPLE]# lvextend -L +5G vg/lv Extending 2 mirror images. Extending logical volume lv to 10.00 GiB vg/lv is not active. Unable to get sync percent. Do full resync of extended portion of vg/lv? [y/n]: y Logical volume lv successfully resized 6) A mirror that is performing recovery (as opposed to an initial sync) - like after a failure - is not allowed to extend with either an implicit or explicit nosync option. [You can simulate this with a 'corelog' mirror because when it is reactivated, it must be recovered every time.] [EXAMPLE]# lvcreate -m1 -L 5G -n lv vg --nosync --corelog WARNING: New mirror won't be synchronised. Don't read what you didn't write! Logical volume "lv" created [EXAMPLE]# lvs vg LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg Mwi-a-m- 5.00g 100.00 [EXAMPLE]# lvchange -an vg/lv; lvchange -ay vg/lv; lvs vg LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg Mwi-a-m- 5.00g 0.08 [EXAMPLE]# lvextend -L +5G vg/lv Extending 2 mirror images. Extending logical volume lv to 10.00 GiB vg/lv cannot be extended while it is recovering. 7) If 'no' is selected in #5 or if the condition in #6 is hit, it should not result in the mirror being resized or the 'm/M' attribute being changed. NOTE: A mirror created with '--nosync' behaves differently than one created without it when performing an extension. The former cannot be extended when the mirror is recovering (unless in-active), while the latter can. This is a reasonable thing to do since recovery of a mirror doesn't take long (at least in the case of an on-disk log) and it would cause far more time in degraded mode if the extension w/o '--nosync' was allowed. It might be reasonable to add the ability to force the operation in the future. This should /not/ force a nosync extension, but rather force a sync'ed extension. IOW, the user would be saying, "Yes, yes... I know recovery won't take long and that I'll be adding significantly to the time spent in degraded mode, but I need the extra space right now!".
* lvcreate parsing for thin provisioning.Alasdair Kergon2011-09-061-1/+5
| | | | The rest is incomplete so this isn't usable yet.
* Add the ability to split an image from the mirror and track changes.Jonathan Earl Brassow2011-08-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ~> lvconvert --splitmirrors 1 --trackchanges vg/lv The '--trackchanges' option allows a user the ability to use an image of a RAID1 array for the purposes of temporary read-only access. The image can be merged back into the array at a later time and only the blocks that have changed in the array since the split will be resync'ed. This operation can be thought of as a partial split. The image is never completely extracted from the array, in that the array reserves the position the device occupied and tracks the differences between the array and the split image via a bitmap. The image itself is rendered read-only and the name (<LV>_rimage_*) cannot be changed. The user can complete the split (permanently splitting the image from the array) by re-issuing the 'lvconvert' command without the '--trackchanges' argument and specifying the '--name' argument. ~> lvconvert --splitmirrors 1 --name my_split vg/lv Merging the tracked image back into the array is done with the '--merge' option (included in a follow-on patch). ~> lvconvert --merge vg/lv_rimage_<n> The internal mechanics of this are relatively simple. The 'raid' device- mapper target allows for the specification of an empty slot in an array via '- -'. This is what will be used if a partial activation of an array is ever required. (It would also be possible to use 'error' targets in place of the '- -'.) If a RAID image is found to be both read-only and visible, then it is considered separate from the array and '- -' is used to hold it's position in the array. So, all that needs to be done to temporarily split an image from the array /and/ cause the kernel target's bitmap to track (aka "mark") changes made is to make the specified image visible and read-only. To merge the device back into the array, the image needs to be returned to the read/write state of the top-level LV and made invisible.
* Add -V as short form of --virtualsize in lvcreate.Alasdair Kergon2011-08-171-1/+1
|
* Add missing new line in lvrename help text.Zdenek Kabelac2011-08-041-1/+1
|
* Permit --available with lvcreate so non-snapshot LVs need not be activated.Alasdair Kergon2011-06-011-6/+7
|
* Add global/metadata_read_only to use unrepaired metadata in read-only cmds.Alasdair Kergon2010-10-251-18/+18
|
* Implement automatic snapshot extension with dmeventd, and add two new optionsPetr Rockai2010-10-151-1/+2
| | | | | | | | to lvm.conf in the activation section: 'snapshot_autoextend_threshold' and 'snapshot_autoextend_percent', that define how to handle automatic snapshot extension. The former defines when the snapshot should be extended: when its space usage exceeds this many percent. The latter defines how much extra space should be allocated for the snapshot, in percent of its current size.
* Implement vgextend --restoremissing (BZ 537913), which makes it possible toPetr Rockai2010-10-131-1/+3
| | | | | | | | re-add a physical volume that has gone missing previously, due to a transient device failure, without re-initialising it. Signed-off-by: Petr Rockai <prockai@redhat.com> Reviewed-by: Alasdair Kergon <agk@redhat.com>
* Require --restorefile when using pvcreate --uuid.Mike Snitzer2010-08-121-2/+4
| | | | | | | | | Introduce --norestorefile to allow user to override the new requirement. This can also be overridden with "devices/require_restorefile_with_uuid" in lvm.conf -- however the default is 1. Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* Add --force to pvchange, and allow override of prompt involving metadataignore.Dave Wysochanski2010-07-071-1/+3
| | | | Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Add --metadataignore to vgextend and man pages.Dave Wysochanski2010-06-301-1/+1
|
* Add --metadataignore to pvcreate.Dave Wysochanski2010-06-301-2/+2
| | | | | | | | | Allow metadataignore flag to be passed in to pvcreate. Ideally, more refactoring of the mda allocation / initialization is warranted, but for now, we just add another parameter to 'add_mda' to take an existing mda ignored flag. We need to do this or pv_write loses the state of the mda 'ignored' flag before copying and writing to disk.
* Add --vgmetadatacopies to vgsplit man page and command.Dave Wysochanski2010-06-281-1/+2
| | | | Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Add --vgmetadatacopies to vgcreate man page, command, and lvm.conf.Dave Wysochanski2010-06-281-2/+3
| | | | | | | Allow parsing of --vgmetadatacopies for vgcreate. Accept --metadatacopies as a synonym for --vgmetadatacopies. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Update vgchange tool to accept --vgmetadatacopies.Dave Wysochanski2010-06-281-1/+3
| | | | | | | | | | Update logic in vgchange to handle --vgmetadatacopies, allow --metadatacopies as a synonym to --vgmetadatacopies, and add these parameters to args.h and commands.h Forbit both --vgmetadatacopies and --metadatacopies as only one allowed. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Add --metadataignore to pvchange, allowing for ignoring of metadata areas.Dave Wysochanski2010-06-281-1/+2
| | | | | | | | | This patch just modifies pvchange to call the underlying ignore functions for mdas. Ensure special cases do not reflect changes in metadata (PVs with 0 mdas, setting ignored when already ignored, clearing ignored when not ignored). Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Add new --sysinit option for vgchange and lvchange.Peter Rajnoha2010-05-061-2/+4
| | | | | | A shortcut for --ignorelockingfailure, --ignoremonitoring, --poll n options and LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES environment variable used all at once in initialisation scripts (e.g. rc.sysinit or initrd).
* Remove -n argument from vgcfgrestore.Milan Broz2010-04-201-2/+1
| | | | | | | This is old lvm1 syntax, because arguments changed from PVs to VGs compatibility is broken already. name_ARG is not used in code.
* Add --stripes to lvconvert too.Alasdair Kergon2010-04-131-1/+3
|
* Add ability to create mirrored logs for mirror LVs.Jonathan Earl Brassow2010-03-261-2/+2
| | | | | | | | | | This check-in enables the 'mirrored' log type. It can be specified by using the '--mirrorlog' option as follows: #> lvcreate -m1 --mirrorlog mirrored -L 5G -n lv vg I've also included a couple updates to the testsuite. These updates include tests for the new log type, and some fixes to some of the *lvconvert* tests.
* Improve activation monitoring option processingMike Snitzer2010-03-231-5/+9
| | | | | | | | | | | | | . Add "monitoring" option to "activation" section of lvm.conf . Have clvmd consult the lvm.conf "activation/monitoring" too. . Introduce toollib.c:get_activation_monitoring_mode(). . Error out when both --monitor and --ignoremonitoring are provided. . Add --monitor and --ignoremonitoring support to lvcreate. Update lvcreate man page accordingly. . Clarify that '--monitor' controls the start and stop of monitoring in the {vg,lv}change man pages. Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* Add %ORIGIN support to lv{create,extend,reduce,resize} --extents optionMike Snitzer2010-02-031-5/+5
| | | | | | | | | | | Allow the number of logical extents to be expressed (for a snapshot) as a percentage of the total space in the Origin Logical Volume with the suffix %ORIGIN. Update the relevant man pages accordingly. Eliminate inconsistencies between the man pages and tools/commands.h Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* Add --merge support to lvconvert to start merging a snapshot into itsMike Snitzer2010-01-131-4/+13
| | | | origin, example usage: lvconvert --merge vg/snaplv
* Revert so-called "redundant" log until after next release.Alasdair Kergon2010-01-121-2/+2
|
* Add the new mirror log type "redundant". The options are now:Jonathan Earl Brassow2010-01-081-2/+2
| | | | | | | | --mirrorlog core: in-memory log --mirrorlog disk: persistent log --mirrorlog redundant: redundant persistent log Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
* This patch adds the capability to split off a mirror legs.Jonathan Earl Brassow2010-01-081-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is pretty much the same as reducing the number of mirror legs, but we just don't delete them afterwards. The following command line interface is enforced: prompt> lvconvert --splitmirror <n> -n <name> <VG>/<LV> where 'n' is the number of images to split off, and where 'name' is the name of the newly split off logical volume. If more than one leg is split off, a new mirror will be the result. The newly split off mirror will have a 'core' log. Example: [root@bp-01 LVM2]# !lvs lvs -a -o name,copy_percent,devices LV Copy% Devices lv 100.00 lv_mimage_0(0),lv_mimage_1(0),lv_mimage_2(0),lv_mimage_3(0) [lv_mimage_0] /dev/sdb1(0) [lv_mimage_1] /dev/sdc1(0) [lv_mimage_2] /dev/sdd1(0) [lv_mimage_3] /dev/sde1(0) [lv_mlog] /dev/sdi1(0) [root@bp-01 LVM2]# lvconvert --splitmirrors 2 --name split vg/lv /dev/sd[ce]1 Logical volume lv converted. [root@bp-01 LVM2]# !lvs lvs -a -o name,copy_percent,devices LV Copy% Devices lv 100.00 lv_mimage_0(0),lv_mimage_2(0) [lv_mimage_0] /dev/sdb1(0) [lv_mimage_2] /dev/sdd1(0) [lv_mlog] /dev/sdi1(0) split 100.00 split_mimage_0(0),split_mimage_1(0) [split_mimage_0] /dev/sde1(0) [split_mimage_1] /dev/sdc1(0) It can be seen that '--splitmirror <n>' is exactly the same as '--mirrors -<n>' (note the minus sign), except there is the additional notion to keep the image being detached from the mirror instead of just throwing it away. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>