summaryrefslogtreecommitdiffstats
path: root/tools/lvconvert.c
Commit message (Collapse)AuthorAgeFilesLines
* lvconvert: count % upwards when merging a snapshotPeter Rajnoha2012-07-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | Before: # lvconvert --merge -i 1 vg/lvol1 Merging of volume lvol1 started. lvol0: Merged: 36.7% lvol0: Merged: 21.3% lvol0: Merged: 5.8% lvol0: Merged: 0.0% Merge of snapshot into logical volume lvol0 has finished. Logical volume "lvol1" successfully removed After: # lvconvert --merge -i 1 vg/lvol1 Merging of volume lvol1 started. lvol0: Merged: 61.4% lvol0: Merged: 73.0% lvol0: Merged: 88.4% lvol0: Merged: 100.0% Merge of snapshot into logical volume lvol0 has finished. Logical volume "lvol1" successfully removed
* thin: fix lvconvert error path NULL dereferenceZdenek Kabelac2012-06-221-2/+2
| | | | For printing the name, use given command line parameter.
* Initial support for lvconvert for thin pool volumes.Zdenek Kabelac2012-05-091-0/+221
| | | | | | | | | | | | | | | 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.
* Fix for bug 807776: invalid lvconvert --merge output should mention raid1 nowJonathan Earl Brassow2012-04-191-1/+1
| | | | s/snapshot/mergeable volume/
* Detect VG name being part of the LV name in lvconvert --splitmirrors -n.Peter Rajnoha2012-03-301-3/+13
| | | | | | | | | | | | | | | Before: devel/~ # lvconvert --splitmirrors 1 -n vg/splitted_one vg/mirrored_one Internal error: LV name vg/splitted_one has invalid form. Intermediate VG metadata write failed. After: devel/~ # lvconvert --splitmirrors 1 -n vg/splitted_one vg/mirrored_one Logical volume mirrored_one converted. devel/~ # lvconvert --splitmirrors 1 -n abc/splitted_one vg/mirrored_one Please use a single volume group name ("vg" or "abc") Run `lvconvert --help' for more information.
* Correct enum typeZdenek Kabelac2012-03-011-2/+2
| | | | Using debug_t and some forgetten alloc_policy_t, force_t from past commit.
* Using enum types for enumsZdenek Kabelac2012-02-281-3/+3
| | | | alloc_policy_t, dm_string_mangling_t, percent_range_t, sign_t
* Keep same sign for 's' counterZdenek Kabelac2012-02-231-1/+2
|
* Allow 'lvconvert --repair' to operate on RAID 4/5/6.Jonathan Earl Brassow2012-02-221-1/+2
| | | | | The higher level RAIDs should be allowed for repair along with 'mirror' and 'raid1' segment types.
* Add some messages that indicate completion of RAID device replacement.Jonathan Earl Brassow2012-02-221-1/+9
| | | | | | There were no messages printed upon completiion of RAID device replacement. This could cause confusion/concern during automated recovery, because the user sees the failure messages but no other messages indicating correction.
* Fix a bad return code in 'lvconvert_raid'Jonathan Earl Brassow2012-02-221-4/+3
| | | | Functions at this level do return 0 or 1, not ECMD_* values.
* Change confusing message that is printed when a RAID device fails.Jonathan Earl Brassow2012-02-131-1/+1
| | | | | | s/Issue/Use/, otherwise it is easy to misread "Issue" as "Issuing" - causing the user confusion as to whether the action was performed automatically or whether they need to issue the command.
* Fix possible NULL pointer dereferences when updating mirror log.Jonathan Earl Brassow2012-02-131-5/+7
| | | | | | | | | | | | | | | | '_lv_update_log_type' takes a lvconvert_params argument so that it can pass down the user's preference of 'region_size' and allocation_policy. When 'mirror_remove_missing' was introduced (commit ID 95986e42a18ca98c9b1d777346978b7297c85558) it didn't make sense to pass down user preferences - so NULL was given instead. While it may never happen in practice, static analysis reveals that this argument could be dereferenced. So, if the user preferences were not passed in, glean the necessary fields from what is already set in the LV. Reported-by: Zdenek Kabelac <zkabelac@redhat.com> Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> (Not updating WHATSNEW for this simple clean-up.)
* Cosmetic change use return macro with implicit stackZdenek Kabelac2012-01-251-4/+3
|
* Allow removal of an invalid snapshot that was to be merged on next activation.Mike Snitzer2012-01-201-0/+9
| | | | Don't allow a user to merge an invalid snapshot.
* Differentiate between snapshot status of "Invalid" and "Merge failed".Mike Snitzer2012-01-201-0/+3
|
* tag uninit varAlasdair Kergon2011-12-081-1/+1
|
* Add policy based automated repair of RAID logical volumesJonathan Earl Brassow2011-12-061-0/+54
| | | | | | | | The RAID plug-in for dmeventd now calls 'lvconvert --repair' to address failures of devices in a RAID logical volume. The action taken can be either to "warn" or "allocate" a new device from any spares that may be available in the volume group. The action is designated by setting 'raid_fault_policy' in lvm.conf - the default being "warn".
* Support the ability to replace specific devices in a RAID array.Jonathan Earl Brassow2011-11-301-2/+41
| | | | | | | | | | | | | | | | | 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
* Add the ability to convert LVs of "mirror" segtype to "raid1" segtype.Jonathan Earl Brassow2011-10-071-0/+3
| | | | | | | | | | | | | | | | | Example: ~> lvconvert --type raid1 vg/mirror_lv Steps to convert "mirror" to "raid1" 1) Allocate a RAID metadata LV for each mirror image from the same PVs on which they are located. 2) Clear the metadata LVs. This involves writing LVM metadata, so we don't change any aspects of the mirror LV before this so that the user can easily remove LVs from the failed convert attempt while retaining the original mirror. 3) Remove the mirror log, if it exists. 4) Add metadata LVs to mirror LV 5) Rename mirror sub-lvs (s/mimage/rimage/) 6) Change flags and segtype from mirror to raid1
* Add the ability to convert linear LVs to RAID1Jonathan Earl Brassow2011-10-071-3/+6
| | | | | | | | | | | | | | | | | | | | | | 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.
* Start using 64-bit status flags - most of the code already handles them.Alasdair Kergon2011-09-061-1/+1
| | | | | | tdata -> tpool remove commented out definitions from metadata.h formatting clean-ups
* Add ability to merge back a RAID1 image that has been split w/ --trackchangesJonathan Earl Brassow2011-08-181-13/+29
| | | | Argument layout is very similar to the merge command for snapshots.
* Add the ability to split an image from the mirror and track changes.Jonathan Earl Brassow2011-08-181-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ~> 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 --splitmirrors support for RAID1 (1 image only)Jonathan Earl Brassow2011-08-181-3/+10
| | | | | | | | | Users already have the ability to split an image from an LV of "mirror" segtype. This patch extends that ability to LVs of "raid1" segtype. This patch only allows a single image to be split off, however. (The "mirror" segtype allows an arbitrary number of images to be split off. e.g. 4-way => 3-way/linear, 2-way/2-way, linear,3-way)
* Add ability to down-convert RAID1 arrays.Jonathan Earl Brassow2011-08-111-1/+75
| | | | Also, add some simple RAID tests to testsuite.
* Replace free_vg with release_vgZdenek Kabelac2011-08-101-5/+5
| | | | | | | | Move the free_vg() to vg.c and replace free_vg with release_vg and make the _free_vg internal. Patch is needed for sharing VG in vginfo cache so the release_vg function name is a better fit here.
* remove unnecessary lvconvert.hAlasdair Kergon2011-07-081-1/+0
|
* Fix error message - the parameter name is '--mirrorlog' not '--log'Jonathan Earl Brassow2011-06-291-1/+1
|
* Remove unnecesary conditional.Jonathan Earl Brassow2011-06-281-5/+0
| | | | | | | | | The conditional is not just unnecessary, it would have been wrong. The code is suppose to be checking if the 'splitmirrors_ARG' is negative, but it instead is checking 'mirrors_ARG'. Rather than changing the argument being checked, I've pulled the check entirely because 'splitmirrors_ARG' is already guarenteed to not be negative by virtue of the fact that it is a 'int_arg'. Negative values will be caught in _process_command_line().
* Clarify error message when unable to convert an LV into a snapshot of an LV.Peter Rajnoha2011-06-011-1/+1
|
* Add a new entry point in the mirror lvconvert code, for removing missing mirrorPetr Rockai2011-05-071-107/+116
| | | | images and/or logs, without attempting any further actions.
* Fix incorrect tests for dm_snprintf() failureZdenek Kabelac2011-04-091-1/+1
| | | | | As the memory is preallocated based on arg size in these cases, the error would be quite hard to trigger here anyway.
* Fix some unmatching sign comparation gcc warningsZdenek Kabelac2011-04-081-1/+1
| | | | Simple replacement for unsigned type - usually in for() loops.
* s/MIRROR_NOTSYNCED/LV_NOTSYNCED/ - Flag will may refer to more than just mirrorsJonathan Earl Brassow2011-03-291-1/+1
|
* Add new free_pv_fid fn and use it throughout to free all attached fids.Peter Rajnoha2011-03-111-0/+1
| | | | | | | | Since format instances will use own memory pool, it's necessary to properly deallocate it. For now, only fid is deallocated. The PV structure itself still uses cmd mempool mostly, but anytime we'd like to add a mempool in the struct physical_volume, we can just rename this fn to free_pv and add the code (like we have free_vg fn for VGs).
* Do not check for open_count when not needed.Zdenek Kabelac2011-02-031-1/+1
| | | | | | Disable open_count checking in lv_info it it's not used. Fix previous commit (comment out unsable code for now).
* Remove duplicate statement (pasted twice by patch at some point?)Jonathan Earl Brassow2011-01-191-10/+0
|
* Add disk to mirrored log type conversion.Jonathan Earl Brassow2011-01-111-12/+14
|
* Reverting recent commit to disallow adding/removing mirror log whileJonathan Earl Brassow2011-01-051-21/+2
| | | | | | removing/adding mirror images... There was already code in there to do the job - I just didn't find it in WHATS_NEW (or in the code right away).
* Prevent the user from simultaneously adding a mirror log while removingJonathan Earl Brassow2011-01-051-0/+19
| | | | | | | | | | | | a mirror image (or removing a log while adding a mirror). Advise the user to use two separate commands instead. This issue become especially problematic when PVs are specified, as they tend to mean different things when adding vs removing. In a command that mixes adding and removing, it is impossible to decern exactly what the user wants. This change prevents bug 603912.
* Rename vg_release to free_vg.Alasdair Kergon2010-12-081-5/+5
|
* Refactor the percent (mirror sync, snapshot usage) handling code to usePetr Rockai2010-11-301-7/+8
| | | | fixed-point values instead of a combination of a float value and an enum.
* Fix "it's" typo to be "its" in lvconvert error message.Mike Snitzer2010-11-281-1/+1
|
* Disallow certain lvconvert operations that need to both allocate and freePetr Rockai2010-11-251-0/+9
| | | | extents, while physical volumes are specified. Fixes BZ 640051.
* Convey need for snapshot-merge target in lvconvert error message and manMike Snitzer2010-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | page. Add ->target_name to segtype_handler to allow a more specific target name to be returned based on the state of the segment. Result of trying to merge a snapshot using a kernel that doesn't have the snapshot-merge target: Before: # lvconvert --merge vg/snap Can't expand LV lv: snapshot target support missing from kernel? Failed to suspend origin lv After: # lvconvert --merge vg/snap Can't process LV lv: snapshot-merge target support missing from kernel? Failed to suspend origin lv Unable to merge LV "snap" into it's origin.
* Make lvconvert respect --yes/--force in the inactive log conversionPetr Rockai2010-10-121-1/+3
| | | | | | | prompt. Fixes BZs 642055, 621281. Patch by Taka. Signed-off-by: Takahiro Yasui <tyasui@redhat.com> Reviewed-by: Petr Rockai <prockai@redhat.com>
* Allow internal suspend and resume of origin without its snapshots.Alasdair Kergon2010-08-171-3/+3
|
* Fix for bug 619221 - log device splitting regressionJonathan Earl Brassow2010-08-061-1/+1
| | | | | | | | | | | | | | | | | | An incorrect fix on July 13, 2010 for an annoyance has caused a regression. The offending check-in was part of the 2.02.71 release of LVM. That check-in caused any PVs specified on the command line to be ignored when performing a mirror split. This patch reverses the aforementioned check-in (solving the regressions) and posits a new solution to the list reversal problem. The original problem was that we would always take the lowest mimage LVs from a mirror when performing a split, but what we really want is to take the highest mimage LVs. This patch accomplishes that by working through the list in reverse order - choosing the higher numbered mimages first. (This also reduces the amount of processing necessary.) Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Reviewed-by: Takahiro Yasui <takahiro.yasui@hds.com>
* Require logical volume(s) to be explicitly named for lvconvert --merge.Mike Snitzer2010-08-031-1/+6
|