summaryrefslogtreecommitdiffstats
path: root/tools/lvconvert.c
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
|
* Taka's fix for handling failure of all mirrored log devices andJonathan Earl Brassow2010-08-021-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | all but one mirror leg. <patch header> To handle a double failure of a mirrored log, Jon's two patches are commited, however, lvconvert command can't still handle an error when mirror leg and mirrored log got failure at the same time. [Patch]: Handle both devices of a mirrored log failing (bug 607347) posted: https://www.redhat.com/archives/lvm-devel/2010-July/msg00009.html commit: https://www.redhat.com/archives/lvm-devel/2010-July/msg00027.html [Patch]: Handle both devices of a mirrored log failing (bug 607347) - additional fix posted: https://www.redhat.com/archives/lvm-devel/2010-July/msg00093.html commit: https://www.redhat.com/archives/lvm-devel/2010-July/msg00101.html In the second patch, the target type of mirrored log is replaced with error target when remove_log is set to 1, but this procedure should be also used in other cases such as the number of mirror leg is 1. This patch relocates the procedure to the main path. In addition, I added following three changes. - Removed tmp_orphan_lvs handling procedure It seems that _delete_lv() can handle detached_log_lv properly without adding mirror legs in mirrored log to tmp_orphan_lvs. Therefore, I removed the procedure. - Removed vg_write()/vg_commit() Metadata is saved by vg_write()/vg_commit() just after detached_log_lv is handled. Therefore, I removed vg_write()/vg_commit(). - With Jon's second patch, we think that we don't have to call remove_mirror_log() in _lv_update_mirrored_log() because will be handled remove_mirror_images() in _lvconvert_mirrors_repaire(). </patch header> Signed-off-by: Takahiro Yasui <takahiro.yasui@hds.com> Reviewed-by: Petr Rockai <prockai@redhat.com> Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
* Disallow mirrored logs in cluster mirrors.Jonathan Earl Brassow2010-08-021-0/+9
| | | | | | | | | | | | | | | | The cluster log daemon (cmirrord) is not multi-threaded and can handle only one request at a time. When a log is stacked on top of a mirror (which itself contains a 'core' log), it creates a situation that cannot be solved without threading. When the top level mirror issues a "resume", the log daemon attempts to read from the log device to retrieve the log state. However, the log is a mirror which, before issuing the read, attempts to determine the 'sync' status of the region of the mirror which is to be read. This sync status request cannot be completed by the daemon because it is blocked on a read I/O to the very mirror requesting the sync status.
* Fix wrong number of mirror log at allocate policyTakahiro Yasui2010-07-301-4/+6
| | | | | | | | | | | | | | With mirror_log_fault_policy of 'remove' and mirror_image_fault_policy of 'allocate', the log type of the mirror volume is converted from 'disk' or 'mirrored' to 'core' when all mirror legs but one in a mirror volume broke. Keep new_log_count as a number of valid log devices by using log_count variable for a temporary usage in the first phase of error recovery in _lvconvert_mirrors_repair(). Signed-off-by: Takahiro Yasui <takahiro.yasui@hds.com> Reviewed-by: Petr Rockai <prockai@redhat.com>
* Fix reversal of LV list before performing a split mirror.Jonathan Earl Brassow2010-07-131-1/+1
| | | | | | | | | | | | | | | | | | | When splitting off mirror images from a mirror, we always take LVs from the end of a list. For example, if the mirror sub-devices are lv_mimage_[012], we should select lv_mimage_2 if splitting off one image. However, lv_mimage_0 was being selected instead. The problem came from calling '_move_removable_mimages_to_end' when it was unnecessary to do so. When the user /does/ specify specific devices to be removed, this function properly moved the appropriate LVs to the end of the list for extraction. However, if the user /doesn't/ give any specific PVs, the function should do nothing. '_move_removable_mimages_to_end' was keying off of whether 'removable_pvs' was NULL or not and this value was improperly being populated with the set of all available PVs. This was causing '_move_removable_mimages_to_end' to completely reverse the list, which in turn caused us to extract the hithertofore front-of-the-list LVs.
* Fix for bug 612311: Split of linear provides no error msgJonathan Earl Brassow2010-07-131-4/+7
| | | | | | | | | An unhandled condition allowed the command to terminate cleanly without a warning. Added a check for the '--splitmirrors' argument to allow execution to the lower level function that has the check to see if the user is trying to split a linear device. You should now see a message if you try to use --splitmirrors on a linear device.
* Use __attribute__ consistently throughout.Alasdair Kergon2010-07-091-7/+7
|
* Fix for bug 607347: failing both redundant mirror log legs...Jonathan Earl Brassow2010-07-061-3/+6
| | | | | | | | | | | | Rather than attempting to remove all the images of a mirrored log volume via remove_mirror_images, simply remove the log if all its devices have failed. Taka was the first to report that there is still an outstanding issue with handling this case. I've managed to reproduce it only very rarely, and am still working on identifying the problem. Failing to handle the problem rarely is better than not handling the scenario at all, so I'm checking this in.
* Restore the "removemissing" behaviour of lvconvert --repair --use-policies.Petr Rockai2010-07-011-5/+3
|
* Committing Taka's patch... He found a problem duringJonathan Earl Brassow2010-06-231-2/+31
| | | | | | | | | the failure of a device that contained both a image of a mirror and an image of the mirrored log. The order of the handling of those faults was important (and wrong), this patch corrects that. Patch-From: Takahiro Yasui <tyasui@redhat.com>
* Account for mirror transient status when doing lvconvert --repair.Petr Rockai2010-05-241-32/+67
|
* Don't attempt to convert the log type of an LV if the LVJonathan Earl Brassow2010-04-281-1/+1
| | | | is not a mirror.
* Fix lvconvert error message when existing mirrored LV is not found.Alasdair Kergon2010-04-261-4/+5
|
* add commentsAlasdair Kergon2010-04-261-0/+6
|
* Disallow the addition of mirror images while a mirror up-convertJonathan Earl Brassow2010-04-211-0/+10
| | | | | is already occurring. The addition of new legs can be retried once the current conversion is complete.
* typo in commentAlasdair Kergon2010-04-201-1/+1
|
* Allow incomplete mirror restore in lvconvert --repair upon insufficient space.Petr Rockai2010-04-141-36/+37
|
* Call add_pvl_to_vgs() and del_pvl_from_vgs() from more places.Dave Wysochanski2010-04-131-2/+1
| | | | | | | Now that we have library functions to add/delete a pv from the vg->pvs list, call them from everywhere. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Add --stripes to lvconvert too.Alasdair Kergon2010-04-131-6/+21
|
* Permit mimage LVs to be striped in lvcreate and lvresize.Alasdair Kergon2010-04-091-10/+2
|
* remove unused varAlasdair Kergon2010-03-311-1/+0
|
* Add ability to create mirrored logs for mirror LVs.Jonathan Earl Brassow2010-03-261-189/+391
| | | | | | | | | | 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.
* Introduce is_missing_pv().Alasdair Kergon2010-03-161-3/+3
|
* Refactor snapshot-merge deptree and device removal to support info-by-uuidMike Snitzer2010-02-171-5/+0
| | | | | | | | | | | | | | | | | | | | | Add a merging snapshot to the deptree, using the "error" target, rather than avoid adding it entirely. This allows proper cleanup of the -cow device without having to rename the -cow to use the origin's name as a prefix. Move the preloading of the origin LV, after a merge, from lv_remove_single() to vg_remove_snapshot(). Having vg_remove_snapshot() preload the origin allows the -cow device to be released so that it can be removed via deactivate_lv(). lv_remove_single()'s deactivate_lv() reliably removes the -cow device because the associated snapshot LV, that is to be removed when a snapshot-merge completes, is always added to the deptree (and kernel -- via "error" target). Now when the snapshot LV is removed both the -cow and -real devices get removed using uuid rather than device name. This paves the way for us to switch over to info-by-uuid queries. Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* Make lvconvert --repair --use-policies exit with success when no action is ↵Petr Rockai2010-02-061-0/+2
| | | | needed.
* Switch lvconvert_single() over to using get_vg_lock_and_logical_volume()Mike Snitzer2010-02-051-18/+10
| | | | | | | | This change was deferred to help ease the review of previous refactoring related to using process_each_lv() for lvconvert's merge support. Not that doing so _really_ helped but... Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* lvconvert --merge @tag supportMike Snitzer2010-02-051-32/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch lvconvert's --merge code over to using process_each_lv(). Doing so adds support for a single 'lvconvert --merge' to start merging multiple LVs (which includes @tag expansion). Add 'lvconvert --merge @tag' testing to test/t-snapshot-merge.sh Adjust man/lvconvert.8.in to reflect these expanded capabilities. The lvconvert.c implementation requires rereading the VG each iteration of process_each_lv(). Otherwise a stale VG instance associated with the LV passed to lvconvert_single_merge() would result in stale VG metadata being written back out to disk. This overwrote new metadata that was written when a previous snapshot LV finished merging (via lvconvert_poll). This is only an issue when merging multiple LVs that share the same VG (a single VG is typical for most LVM configurations on system disks). In the end this new support is very useful for performing a "system rollback" that requires multiple snapshot LVs be merged to their respective origin LV. The yum-utils 'fs-snapshot' plugin tags all snapshot LVs that it creates with a common 'snapshot_tag' that is unique to the yum transaction. Rolling back a yum transaction, that created LVM snapshots with the tag 'yum_20100129133223', is as simple as: lvconvert --merge @yum_20100129133223 Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* Prepare for _get_lvconvert_vg() reuse as part of a larger lvconvert.cMike Snitzer2010-02-051-3/+16
| | | | | | | | | | refactoring. Document the need to cleanup the "name" args passed around polldaemon, lvconvert and pvmove. It is quite a mess. Annotate the unused nature of the existing poll_fns->get_copy_vg methods' 'uuid' arg.
* Adding a new mimage (leg/copy) to a mirror behaves differentlyJonathan Earl Brassow2010-02-051-1/+5
| | | | | | | | | | | | | | | | | depending on if the mirror has a 'core' or 'disk' log. When there is a disk log, the new leg is added by stacking a new mirror on top of the old (one leg is the old mirror and the other leg is the newly added device). When the log is a 'core' log, the new leg is simply added to the existing mirror and all the devices are re-synced. The logic that handles collapsing the stacked 'disk' log mirror was having the effect of causing 'core' logged mirrors to begin resync'ing for a second time. I have used the 'CONVERTING' flag to indicate that a mirror is converting by way of stacking. This is no longer set for up-converting core logs. The final 'collapse' logic can safely be skipped for 'core' log mirrors - getting rid of the second resync. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
* Change dev_manager_mirror_percent()'s 'struct logical_volume *' to beMike Snitzer2010-01-151-1/+1
| | | | | | | | | | | | | | | | | | | 'const'. Be consistent with its use (and dev_manager_snapshot_percent()). Pass 'lv' from dev_manager_snapshot_percent() to _percent() to _percent_run(). _percent_run() always dereferenced 'lv' (when initializing segh) even though it may have been NULL (as was the case until now for dev_manager_snapshot_percent()). If a "snapshot-origin" LV (snapshot-merge whose merge was deferred becuase it was open) was passed to _percent_run() it would always return 100%. Update _percent_run() to NOT return PERCENT_100 et. al. if ->target_percent() wasn't ever called and supplied 'lv' is a merging origin. A default return of 100% does not work for snapshot-merge. Also tweak a related lvconvert log_error() to include "Aborting merge."
* Add snapshot merge wrappers to abstract the associations and flags usedMike Snitzer2010-01-131-5/+5
| | | | to represent merging origin and snapshot volumes.
* Merge on activate support.Mike Snitzer2010-01-131-4/+17
| | | | | | | | | | | If either the origin or snapshot that is to be merged is open the merge will not start; only the merge metadata will be written. The merge will start on the next activation of the origin (or via lvchange --refresh) IFF both the origin and snapshot are closed. Merge on activate is particularly important if we want to merge over a mounted filesystem that cannot be unmounted (until next boot) --- for example root.
* Background poll for lvconvert --merge command.Mike Snitzer2010-01-131-4/+69
| | | | The merging snapshot is removed when the merge finishes.
* Do not allow merging over mounted logical volumes.Mike Snitzer2010-01-131-0/+22
| | | | When preserving origin, check that the snapshot is not mounted.
* Add --merge support to lvconvert to start merging a snapshot into itsMike Snitzer2010-01-131-6/+100
| | | | origin, example usage: lvconvert --merge vg/snaplv
* Revert so-called "redundant" log until after next release.Alasdair Kergon2010-01-121-4/+2
|
* Testsuite updates and fixes for recently added features.Jonathan Earl Brassow2010-01-111-6/+1
| | | | | | | | | | | | | | | | | 1. Found bug in 'redundant log' implementation that caused problems when converting a linear that spanned multiple devices to a mirror (wasn't checking for NULL value of provided parameter in _alloc_parallel_area) 2. Testsuite was failing to perform tests when 'not' modifier was used. This allowed a couple issues to slip through. Added a 'not_sh' modifier that negates tests performed by functions defined in the shell source file. 3. Was initializing a variable to far down, which cause previously set value to be overridden. (This was the result of the collision of the "redundant log" and lvconvert fix patches.)
* Found 2 problems with my previous check-in:Jonathan Earl Brassow2010-01-111-3/+4
| | | | | | | | | | | | | | date: 2010/01/07 20:42:55; author: jbrassow; state: Exp; lines: +11 -0 The patch fixes some lvconvert issues (WRT mirror <-> mirror). 1) 'exisiting_mirrors' and 'lp->mirrors' where taken to be in 'n-1' notation (i.e a 2-way mirror is '1' and a linear is '0'), but the variables were in 'n' notation. 2) After adding the redundant mirror log support, I was calculating log_count by looking at the mirror log LV, but didn't take into account the fact that there could be no mirror log! Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
* Add the new mirror log type "redundant". The options are now:Jonathan Earl Brassow2010-01-081-27/+40
| | | | | | | | --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-5/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Change background polldaemon's process name to "(lvm2)".Mike Snitzer2010-01-081-11/+0
| | | | | | | | | Made .update_metadata optional in 'struct poll_functions' definitions; eliminated _update_lvconvert_mirror() stub. Tweak a mirror-specific error message in the generic polldaemon code. Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* In lvconvert --repair --use-policies, for the allocate policies, return successPetr Rockai2010-01-081-16/+33
| | | | | even if allocation fails, as long as the downconversion or corelog conversion succeeded.
* The patch fixes some lvconvert issues (WRT mirror <-> mirror).Jonathan Earl Brassow2010-01-071-0/+11
| | | | | | | | | | | | | | | | | | | | The default log option for a mirror is 'disk'. If the log type is not explicitly stated on the command line when converting from an X-way mirror to a Y-way mirror, 'disk' is chosen. So, if you have a 'core' log mirror and you convert, your result will contain a 'disk' log. This patch remembers what the old log type was. If the user is merely trying to switch the number of mirror images, the log type is now kept the same. There is one historical behaviour I left in place... If you have a 2-way, core-log mirror and you use lvconvert to specify you want a 2-way mirror - without specifying the log type - you will get a 2-way, disk-log mirror. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Informal-IRC-ACK-by: agk
* Rename mirror_device_fault_policy to mirror_image_fault policyMilan Broz2010-01-061-0/+3
|
* Remove empty "repaired" devices if empty in lvconvert.Milan Broz2010-01-061-1/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | The logic was that lvconvert repair volumes, marking PV as MISSING and following vgreduce --removemissing removes these missing devices. Previously dmeventd mirror DSO removed all LV and PV from VG by simply relying on vgreduce --removemissing --force. Now, there are two subsequent calls: lvconvert --repair --use-policies vgreduce --removemissing So the VG is locked twice, opening space for all races between other running lvm processes. If the PV reappears with old metadata on it (so the winner performs autorepair, if locking VG for update) the situation is even worse. Patch simply adds removemissing PV functionality into lvconcert BUT ONLY if running with --repair and --use-policies and removing only these empty missing PVs which are involved in repair. (This combination is expected to run only from dmeventd.)
* Add missing 'stack;' for all suspend_lv and resume_lv callers.Mike Snitzer2010-01-051-1/+2
| | | | Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* Do not allow creating mirrors of more than 8 images.Milan Broz2009-11-271-0/+6
| | | | | This is kernel limitation in all kernel versions, so better detect this early.
* Tidy some uses of arg_count and introduce arg_is_set.Alasdair Kergon2009-11-031-3/+1
|
* Permit snapshots of mirrors. (brassow)Alasdair Kergon2009-10-261-6/+14
|