1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 03:27:58 +03:00
Commit Graph

1108 Commits

Author SHA1 Message Date
Dave Wysochanski
501fda8056 Refactor vgsplit - create _vgsplit_to function which creates or opens dest vg.
Move the creating/opening of the destination vg into its own function so later
we can reorder the source / destination vg opening based on the alphabetical
lock order rule.

Should be no functional change but code is a bit tricky.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-09-02 21:26:34 +00:00
Dave Wysochanski
ab2d981a97 Refactor vgsplit - add 'lock_vg_from_first' flag.
Introduce 'lock_vg_from_first' flag to retain which vg was locked first.
Should be no functional change.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-09-02 21:26:18 +00:00
Dave Wysochanski
9cc31e6dff Refactor vgsplit - remove bad2 label.
No functional change.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-09-02 21:26:01 +00:00
Dave Wysochanski
5bad8ac847 Refactor vgsplit to move existing_vg logic in a separate 'if' statement.
This will aid in future refactorings and allow for us to reorder the source
and destination vg based on alphabetical names.
Should be no functional change.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-09-02 21:25:44 +00:00
Milan Broz
3c0cfa8f3c Fix global locking in PV reporting commands (2.02.49). 2009-08-24 11:37:20 +00:00
Dave Wysochanski
cdc8e54e3d Fix error paths for vgcfgrestore when locking fails. 2009-08-13 17:16:38 +00:00
Petr Rockai
ea30184099 Make lvchange --refresh only take a read lock on volume group. 2009-08-13 14:27:32 +00:00
Dave Wysochanski
acac361359 Fix vgextend error path - if ORPHAN lock fails, unlock and release vg.
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>
2009-08-13 12:03:46 +00:00
Peter Rajnoha
b23fadb965 Fix semaphore includes in dmsetup for udev sync. 2009-08-06 15:56:50 +00:00
Peter Rajnoha
e637f732ed Add 'udevcookies' command for dmsetup. 2009-08-06 15:05:10 +00:00
Peter Rajnoha
f9ff23dffe Add 'udevcomplete_all' command for dmsetup. Export DM_COOKIE_MAGIC in libdevmapper.h. 2009-08-06 15:04:30 +00:00
Peter Rajnoha
49886d0982 Add --noudevsync option for relevant LVM tools. 2009-08-04 15:53:04 +00:00
Alasdair Kergon
cf8235e0aa Add activation/udev_sync to lvm.conf. 2009-08-04 15:36:13 +00:00
Alasdair Kergon
a74be32bf6 Manage without dm_udev_cleanup? 2009-08-03 18:01:45 +00:00
Alasdair Kergon
f86117e3d5 cleanup some ignored return values & 'stack's 2009-08-03 11:20:15 +00:00
Petr Rockai
f5cb304acb Make lvconvert honour log mirror options combined with downconversion.
(RHBZ 463272)
2009-08-02 21:59:21 +00:00
Petr Rockai
d25584e4fb Slightly refactor mirror log conversions in lvconvert. 2009-08-02 21:56:29 +00:00
Alasdair Kergon
2c0dfdf839 Add udevcomplete and --noudevwait to dmsetup. 2009-07-31 17:51:45 +00:00
Mike Snitzer
04b2a4bdcf Add --dataalignmentoffset to pvcreate to shift start of aligned data area
Adds pe_align_offset to 'struct physical_volume'; is initialized with
set_pe_align_offset().  After pe_start is established pe_align_offset is
added to it.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
2009-07-30 17:45:28 +00:00
Dave Wysochanski
9085c301e0 Rename _override_settings into override_config_tree_from_string and move.
Move _override_settings from tools/lvmcmdline.c into lib/config/config.c
and export so we can re-use in liblvm.
2009-07-27 21:01:56 +00:00
Dave Wysochanski
776ac1562e Refactor _override_settings to take the new config string as input.
We will re-use this function from liblvm.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-27 21:01:36 +00:00
Dave Wysochanski
9963d0710e Move extents_from_size from lvcreate into internal library so we can reuse.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 02:34:09 +00:00
Dave Wysochanski
c42b235610 Move _lvcreate into the internal library and rename to lv_create_single.
After some refactorings, we can now move the bulk of _lvcreate into the
internal library, and we can call from liblvm.  In the future, we should
refactor lv_create_single further, probably by segtype, to reduce the
size of struct lvcreate_params.  For now this is a reasonable refactor
and allows us to re-use the function from liblvm.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 02:33:35 +00:00
Dave Wysochanski
e6479dff9f Move pvs and pv_count fields from lvcreate_params to lvcreate_cmdline_params.
No functional change.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 02:32:50 +00:00
Dave Wysochanski
81779abd54 Comment lvcreate_params struct.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 02:32:26 +00:00
Dave Wysochanski
7a0b0db17e Move 'size' from lvcreate_params into lvcreate_cmdline_params.
The main _lvcreate function should deal with extents - the 'size' parameter
is just an intermediate step.
Should be no functional change.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 02:32:00 +00:00
Dave Wysochanski
8842d526b2 Move percent_t from struct lvcreate_params to struct lvcreate_cmdline_params.
Create a new structure, lvcreate_cmdline_params, to store parameters only
relevant for the cmdline, not the library call to lvcreate.
Should be no functional change.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 02:31:41 +00:00
Dave Wysochanski
8675b317ff Refactor extents calculations / updates in _lvcreate.
Move extents calculation adjustments into their own local functions
right after we read the vg.  This calculation really is not part of
the LV create function but is rather an adjustment to the parameters
based on what is given on the cmdline.  So we move it outside the main
_lvcreate.

Should be no functional change.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 02:31:18 +00:00
Dave Wysochanski
9091827c46 Refactor _lvcreate - move *_ARG into _lvcreate_params and get 'cmd' from 'vg'.
A couple simple refactorings of _lvcreate - should be no functional change.
Move tags_ARG parsing into _lvcreate_params.  Also use lp->voriginsize
instread of arg_count().  These refactorings make it easier to move the
bulk of _lvcreate into the library.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 02:30:57 +00:00
Dave Wysochanski
aa496e4c23 Move ORPHAN_VG lock outside pvcreate_single.
The implicit pvcreate require either moving the ORPHAN_VG lock outside
pvcreate_single or somehow having the function know or detect whether
the ORPHAN_VG lock is already held.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 01:54:20 +00:00
Dave Wysochanski
d4b6a8aa2a Move bulk of pvcreate logic into library.
In preparation for implicit pvcreate during vgcreate / vgextend,
move bulk of pvcreate logic inside library.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 01:53:09 +00:00
Dave Wysochanski
e6923120b9 Revert previous patch that moved VG_ORPHAN lock inside vg_extend.
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 72a41480ba
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>
2009-07-24 15:01:43 +00:00
Dave Wysochanski
fd443e0245 Remove redundant validate_name in vgreduce.
This check is now done in vg_read_for_update, thanks to mornfall.
Should be no functional change.

Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-24 11:13:36 +00:00
Alasdair Kergon
b68cc09932 Return EINVALID_CMD_LINE not success when invalid VG name format is used. 2009-07-21 11:10:49 +00:00
Alasdair Kergon
d917192f00 Add lvm_errno and lvm_errmsg to liblvm to obtain failure information.
Change create_toolcontext to still return an object if it fails part-way.
Add EUNCLASSIFIED (-1) as the default LVM errno code.
2009-07-16 00:36:59 +00:00
Alasdair Kergon
d614646157 Store any errno and error messages issued while processing each command.
(Enabled by default while we test it, but in due course we'll only store
the error messages when we need to.)
2009-07-15 23:57:54 +00:00
Alasdair Kergon
b8f47d5f69 Use log_error macro consistently throughout in place of log_err. 2009-07-15 20:02:46 +00:00
Dave Wysochanski
e7c3fdd048 Fix memory leak in process_each_pv path.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-15 12:22:59 +00:00
Dave Wysochanski
d2ee20a42a Fix memory leak in _process_one_vg error path.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-15 12:15:36 +00:00
Petr Rockai
21a98eda88 Port process_each_pv to new vg_read. 2009-07-15 05:50:22 +00:00
Petr Rockai
6ee7d2aa53 Remove lockingfailed().
We provide a lock type that behaves like no_locking, but is not
  clustered. Moreover, it also forbids any write locks. This magically (and
  consistently) prevents use of clustered VGs, or changing local VGs with
  --ignorelockingfailure. As a bonus, we can remove the special hacks in a few
  places. Of course, people looking for trouble can always set their locking_type
  to 0 to override.
2009-07-15 05:49:47 +00:00
Petr Rockai
51dfb124e1 Take just a read lock when activating in lvchange. 2009-07-15 05:48:36 +00:00
Petr Rockai
19089ba331 Refuse to open VG with MISSING_PVs for update unless handles_missing_pvs is set. 2009-07-15 05:47:55 +00:00
Dave Wysochanski
b5fd1544d5 Check for certain vg_read errors in _process_one_vg iterator.
In _process_one_vg, we should never proceed if the VG read fails with certain
conditions.  If we cannot allocate or construct the volume_group structure,
we should not proceed - this is true regardless of the tool calling the
iterator.  In other cases, when the volume group structure is constructed but
there is some error (PVs missing, metadata corrupted, etc), some tools may
want to process the VG while others may not.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-15 05:23:19 +00:00
Dave Wysochanski
1a4366df60 Fix FAILED_INCONSISTENT case in vg_backup_single - typeo on 'if' condition.
In vg_backup_single, we should error out if we vg_read_error(vg) and the
error code we received was anything other than FAILED_INCONSISTENT.
Original code contained an error because C operator precedence.
Note - this was part of the vg_read() so no WHATS_NEW entry neceesary.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-15 03:30:04 +00:00
Dave Wysochanski
1f74536332 Fix vgck and vgremove segfault if non-existent vg given.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-14 19:37:18 +00:00
Dave Wysochanski
ffc12b3fc1 Remove READ_REQUIRE_RESIZEABLE flag from vgsplit.
Remove READ_REQUIRE_RESIZEABLE flag from vgsplit similar to the removal from
vgextend.  Move the check inside the functions that actually move pvs from
one vg structure to another.  Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Acked-by: Alasdair G Kergon <agk@redhat.com>
2009-07-14 02:16:05 +00:00
Dave Wysochanski
6452d4ae9d Refactor vgsplit - move move_pvs_used_by_lv and move_pv inside library.
In the future we may export these functions or something like them in liblvm
For now this helps in cleaning up the checks for RESIZEABLE since we can
use the internal library function vg_bad_status_bits.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Acked-by: Alasdair G Kergon <agk@redhat.com>
2009-07-14 02:15:21 +00:00
Dave Wysochanski
5b57e82508 Remove READ_REQUIRE_RESIZEABLE from vgextend by moving check inside vg_extend.
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>
2009-07-14 02:14:04 +00:00
Mikulas Patocka
3395d72881 Change exit() to _exit() in the child process. exit flushes stdio file buffers,
_exit doesn't. If there were some open files, an error in exec and subsequent
exit() would cause the buffers to be flushed twice.

Example:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>

int main()
{
	printf("buu");
	if (!fork()) {
		execl("/bin/true-not-exists", "/bin/true", NULL);
		exit(1);
	}
	wait(NULL);
	return 0;
}

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com

---
 daemons/dmeventd/libdevmapper-event.c |    2 +-
 lib/misc/lvm-exec.c                   |    2 +-
 test/harness.c                        |    3 ++-
 tools/dmsetup.c                       |    2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)
2009-07-13 21:26:41 +00:00