summaryrefslogtreecommitdiffstats
path: root/tools/vgextend.c
Commit message (Collapse)AuthorAgeFilesLines
* vgextend: Allow PVs to be added to VGs that have PVs missingJonathan Brassow2012-07-261-2/+7
| | | | | | | | | | | | | | | | | Allowing people to add devices to a VG that has PVs missing helps people avoid the inability to repair RAID LVs in certain cases. For example, if a user creates a RAID 4/5/6 LV using all of the available devices in a VG, there will be no spare devices to repair the LV with if a device should fail. Further, because the VG is missing a device, new devices cannot be added to allow the repair. If 'vgreduce --removemissing' were attempted, the "MISSING" PV could not be removed without also destroying the RAID LV. Allowing vgextend to operate solves the circular dependency. When the PV is added by a vgextend operation, the sequence number is incremented and the 'MISSING' flag is put on the PVs which are missing.
* Replace free_vg with release_vgZdenek Kabelac2011-08-101-3/+3
| | | | | | | | 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.
* Const fixingZdenek Kabelac2011-02-181-2/+2
| | | | | | | | | | | | | | | | Fixing some const warnings - with API change in: int vg_extend(struct volume_group *vg, int pv_count, const char *const *pv_names, Change is needed - as lvm2api expects const behaviour here. So vg_extend() is doing local strdup for unescaping. skip_dev_dir return const char* from const char* vg_name. Rest of the patch is cleanup of related warnings. Also using dm_report_filed_string() API change to simplify casting in _string_disp and _lvname_disp.
* Rename vg_release to free_vg.Alasdair Kergon2010-12-081-3/+3
|
* Avoid an extraneous orphans unlock in vgextend --restoremissing.Petr Rockai2010-10-181-1/+2
|
* Implement vgextend --restoremissing (BZ 537913), which makes it possible toPetr Rockai2010-10-131-27/+65
| | | | | | | | 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>
* Shorten prompt for pvchange and vgextend.Dave Wysochanski2010-07-071-3/+2
|
* Add --force to pvchange, and allow override of prompt involving metadataignore.Dave Wysochanski2010-07-071-0/+1
| | | | Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Add prompt if using --metadataignore argument with vgmetadatacopies.Dave Wysochanski2010-07-071-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When using vgmetadatacopies value other than "umanaged" (0), prompt the user if the usage of --metadataignore would change the value of vgmetadatacopies. The main 2 cases are: 1) pvchange --metadataignore 2) vgextend --metadataignore We leave the prompt check in the tools, and do not change anything if the user says 'n'. Examples: vgextend --metadataignore y vgtest /dev/loop0 Setting metadataignore will override preferred number of copies of VG vgtest metadata. Are you sure? [y/n]: y No physical volume label read from /dev/loop0 Physical volume "/dev/loop0" successfully created Volume group "vgtest" successfully extended pvchange --metadataignore y /dev/loop3 Setting metadataignore on /dev/loop3 will override preferred number of copies of VG vgtest metadata. Are you sure? [y/n]: y WARNING: Changing preferred number of copies of VG vgtest metadata from 3 to 2 Physical volume "/dev/loop3" changed 1 physical volume changed / 0 physical volumes not changed Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Add warning to vgextend and pvchange if metadataignore given on cmdline.Dave Wysochanski2010-07-071-0/+9
| | | | | | Warn the user then change the value of vg_mda_copies. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Rename pvcreate_params processing functions to better match <object><action>.Dave Wysochanski2009-11-011-2/+2
| | | | | | Rename fill_default_pvcreate_params to pvcreate_params_set_defaults. Rename pvcreate_validate_restore_params to pvcreate_restore_params_validate. Rename pvcreate_validate_params to pvcreate_params_validate.
* Add --pvmetadatacopies as a synonym for --metadatacopies in various commands.Dave Wysochanski2009-10-051-0/+5
| | | | | | | | | | | | | | | | | | | | | | | Going forward, we would like to allow users to specify the total number of metadatacopies in a VG rather than on a per-PV basis. In order to facilitate that, introduce --pvmetadatacopes to replace --metadatacopies everywhere. We still allow --metadatacopies for pv commands, but require --pvmetadatacopies for vg commands. Eventually we will introduce --vgmetadatacopies. Once we do that, we should either deprecate --metadatacopies or make it a synonym based on the command (pvmetadatacopies for pv commands, and vgmetadatacopies for vg commands). The latter option would likely just require a simple 'strncpy' check against cmd->command->name to qualify the merge_synonym call. Update nightly tests to cover the pvmetadatacopies synonym. Note that this patch is the result of an eariler review comment for the implicit pvcreate patches. Should apply cleanly on top of the implicit pvcreate patches (I applied after patch 10/10 in that series). NOTE: This patch will require --pvmetadatacopies for vgconvert as --metadatacopies is no longer accepted.
* Add implicit pvcreate support to vgcreate and vgextend.Dave Wysochanski2009-10-051-3/+4
| | | | | | Adds implicit pvcreate support when calling vgcreate or vgextend with device paths that are not yet PVs. This changes the behavior of vgcreate and vgextend from failing with an error message to implicitly pvcreating.
* Refactor vgcreate/vgextend validation of vgname/pvname(s).Dave Wysochanski2009-10-051-5/+5
| | | | | Decrement argc and increment argv in a consistent way to allow for later code-sharing. Should be no functional change.
* Add pvcreate_params to vg_extend.Dave Wysochanski2009-10-051-1/+1
| | | | | | | | | | | | | | | | Another refactoring for implicit pvcreate support. We need to get the pvcreate parameters somehow to the vg_extend routine. Options seemed to be: 1. Attach the parameters to struct volume_group. I personally did not like this idea in most cases, though one could make an agrument why it might be ok at least for some of the parameters (e.g. metadatacopies). 2. Pass them in to the extend routine. This second route seemed to be the best approach given the constraints. Future patches will parse the command line and fill in the actual values for the pvcreate_single call. Should be no functional change.
* Add lots of missing stack debug messages to tools.Alasdair Kergon2009-09-141-4/+5
| | | | | Make readonly locking available as locking type 4. Fix readonly locking to permit writeable global locks (for vgscan). (2.02.49)
* Fix vgextend error path - if ORPHAN lock fails, unlock and release vg.Dave Wysochanski2009-08-131-10/+4
| | | | | | | | | | Full changes - Fix vgextend error path when lock_vol(VG_ORPHANS) fails - Move lock_vol(VG_ORPHANS) before archive(vg) - safe & simpler error paths - Remove legacy comment/code that no longer applies Found in review - Milan Broz <mbroz@redhat.com> Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Revert previous patch that moved VG_ORPHAN lock inside vg_extend.Dave Wysochanski2009-07-241-0/+7
| | | | | | | | | | | | | | | | | | | We must hold the VG_ORPHAN lock until we commit to disk. Otherwise, we risk a race condition on vgcreate / vgextend. Reverts the following commit: commit 72a41480ba66d7dc2d05ef8583080b6b08208507 Author: Dave Wysochanski <dwysocha@redhat.com> Date: Fri Jul 10 20:09:21 2009 +0000 Move orphan lock obtain/release inside vg_extend(). With this change we now have vgcreate/vgextend liblvm functions. Note that this changes the lock order of the following functions as the orphan lock is now obtained first. With our policy of non-blocking second locks, this should not be a problem. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Remove READ_REQUIRE_RESIZEABLE from vgextend by moving check inside vg_extend.Dave Wysochanski2009-07-141-2/+1
| | | | | | | | | | | | | | Move the check for the RESIZEABLE flag inside the vg_extend function. When we consolidated the vg locking, reading, and status flag checking, we tied the check for the RESIZEABLE flag to the vg_read() call. The problem with this is you cannot know what other APIs the application my or may not call after a vg_read() call. Thus the READ_REQUIRE_RESIZEABLE flag is not really ideal - ideally we should be checking for this flag on a specific operation, not inside the vg_read() call. This patch moves one check inside the library. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com> Acked-by: Alasdair G Kergon <agk@redhat.com>
* Move orphan lock obtain/release inside vg_extend().Dave Wysochanski2009-07-101-7/+0
| | | | | | | | | With this change we now have vgcreate/vgextend liblvm functions. Note that this changes the lock order of the following functions as the orphan lock is now obtained first. With our policy of non-blocking second locks, this should not be a problem. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Remove unneeded LOCK_NONBLOCKING from vg_read() API.Dave Wysochanski2009-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Remove unneeded LOCK_NONBLOCKING from vg_read() API and tools that use it. We no longer need this flag anywhere since we now automatically set LCK_NONBLOCK inside lock_vol() if vgs_locked(). For further details, see: commit d52b3fd3fe2006e2d13e42f8518b6512bff03710 Author: Dave Wysochanski <dwysocha@redhat.com> Date: Wed May 13 13:02:52 2009 +0000 Remove NON_BLOCKING lock flag from tools and set a policy to auto-set. As a simplification to the tools and further liblvm, this patch pushes the setting of NON_BLOCKING lock flag inside the lock_vol() call. The policy we set is if any existing VGs are currently locked, we set the NON_BLOCKING flag. At some point it may make sense to add this flag back if we get an RFE from a liblvm user, but for now let's keep it as simple as possible. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Fix vg_read() error paths to properly release upon vg_read_error().Dave Wysochanski2009-07-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Fix vg_read() error paths to properly release upon vg_read_error(). Note that in the iterator paths (process_each_*()), we release inside the iterator so no individual cleanup is needed. However there are a number of other places we missed the cleanup. Proper cleanup when vg_read_error() is true should be calling vg_release(vg), since there should be no locks held if we get an error (except in certain special cases, which IMO we should work to remove from the code). Unfortunately the testsuite is unable to detect these types of memory leaks. Most of them can be easily seen if you try an operation (e.g. lvcreate) with a volume group that does not exist. Error message looks like this: Volume group "vg2" not found You have a memory leak (not released memory pool): [0x1975eb8] You have a memory leak (not released memory pool): [0x1975eb8] Author: Dave Wysochanski <dwysocha@redhat.com>
* Convert the straight instances of vg_lock_and_read to new vg_read(_for_update).Dave Wysochanski2009-07-011-5/+4
| | | | | | | Sun May 3 11:40:51 CEST 2009 Petr Rockai <me@mornfall.net> * Convert the straight instances of vg_lock_and_read to new vg_read(_for_update). Rebased 6/26/09 by Dave W.
* revert last patch - let's do a release firstAlasdair Kergon2009-06-261-5/+6
|
* Convert the straight instances of vg_lock_and_read to new vg_read(_for_update).Dave Wysochanski2009-06-261-6/+5
| | | | | | | | | Sun May 3 11:40:51 CEST 2009 Petr Rockai <me@mornfall.net> * Convert the straight instances of vg_lock_and_read to new vg_read(_for_update). Author: Petr Rockai <prockai@redhat.com> Committer: Dave Wysochanski <dwysocha@redhat.com>
* Pre-release cleanups.Alasdair Kergon2009-05-211-1/+1
|
* Remove NON_BLOCKING lock flag from tools and set a policy to auto-set.Dave Wysochanski2009-05-131-2/+2
| | | | | | | | | As a simplification to the tools and further liblvm, this patch pushes the setting of NON_BLOCKING lock flag inside the lock_vol() call. The policy we set is if any existing VGs are currently locked, we set the NON_BLOCKING flag. Should be no functional change.
* Properly release VG memory pool in all CLI tools.Milan Broz2009-04-101-10/+6
|
* Some whitespace tidy-ups.Alasdair Kergon2008-01-301-2/+2
|
* Convert some vg_reads into vg_lock_and_readsAlasdair Kergon2007-11-151-1/+1
|
* Fix orphan-related locking in pvdisplay and pvs.Alasdair Kergon2007-11-021-10/+4
| | | | | | | | Fix missing VG unlocks in some pvchange error paths. Add some missing validation of VG names. Rename validate_vg_name() to validate_new_vg_name(). Change orphan lock to VG_ORPHANS. Change format1 to use ORPHAN as orphan VG name.
* Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1.Alasdair Kergon2007-08-201-3/+3
|
* Add CORRECT_INCONSISTENT and FAIL_INCONSISTENT flags to vg_lock_and_readDave Wysochanski2007-07-231-1/+2
|
* Add vg_lock_and_read() external library function.Dave Wysochanski2007-07-231-16/+6
|
* Make vg_extend() format_instance * parameter internal to vg_extend()Dave Wysochanski2007-06-191-1/+1
|
* Add vg_check_status to consolidate vg status flags checks and error messages.Dave Wysochanski2007-06-061-19/+2
|
* Add a few missing pieces of vgname command line validation.Alasdair Kergon2007-03-091-0/+6
|
* Support the /dev/mapper prefix on most command lines.Alasdair Kergon2007-03-091-1/+1
|
* When using local file locking, skip clustered VGs.Alasdair Kergon2006-09-021-0/+6
| | | | Add fallback_to_clustered_locking and fallback_to_local_locking parameters.
* Add skip_dev_dir() to process command line VGs.Alasdair Kergon2006-08-251-1/+1
|
* Fix vgexport/vgimport to set/reset PV exported flag so pv_attr is correct.Alasdair Kergon2006-04-121-1/+1
| | | | Add vgid to struct physical_volume and pass with vg_name to some functions.
* Use hash, bitset, malloc, pool from libdevmapper.Alasdair Kergon2005-10-161-1/+1
|
* Use ORPHAN lock definition throughout.Alasdair Kergon2005-10-031-4/+4
|
* Update copyright notices.Alasdair Kergon2004-03-301-13/+8
|
* More consistent error code usage.Alasdair Kergon2003-10-211-1/+1
|
* Another sync point - numerous fixes & clean ups.Alasdair Kergon2003-07-041-1/+1
|
* Some new features.Alasdair Kergon2002-11-181-4/+2
|
* agk, I recall you saying you had a massive commit pending; if you need meAndres Salomon2002-10-271-0/+3
| | | | | | | | | | | to back this out so you can do that commit, let me know. Also, if there's an issue with the error message that's displayed, just change it in tools.h. This causes a "device-mapper driver/module not loaded?" error message to be displayed for the commands that require dm-mod, if the tools can't get the driver version. It's not done for commands that don't require dm-mod. This should clear up some problems people have had attempting to use lvm2 without rtfm'ing.
* Merge with text format branch.Alasdair Kergon2002-04-241-3/+3
| | | | | | | | | | | | | | | | | | | Lots of changes/very little testing so far => there'll be bugs! Use 'vgcreate -M text' to create a volume group with its metadata stored in text files. Text format metadata changes should be reasonably atomic, with a (basic) automatic recovery mechanism if the system crashes while a change is in progress. Add a metadata section to lvm.conf to specify multiple directories if you want (recommended) to keep multiple copies of the metadata (eg on different filesystems). e.g. metadata { dirs = ["/etc/lvm/metadata1","/usr/local/lvm/metadata2"] } Plenty of refinements still in the pipeline.
* o activate/reactivate mergeAlasdair Kergon2002-03-111-5/+5
| | | | o unlocking macro