]> sourceware.org Git - lvm2.git/log
lvm2.git
15 years agoAdd liblvm2app Makefile installation targets.
Alasdair Kergon [Wed, 22 Jul 2009 21:09:13 +0000 (21:09 +0000)]
Add liblvm2app Makefile installation targets.
Add liblvm pkgconfig file.

15 years agofix dir in generated file list for cflow
Alasdair Kergon [Wed, 22 Jul 2009 20:29:56 +0000 (20:29 +0000)]
fix dir in generated file list for cflow

15 years agoUse newly-independent LVM_LIBAPI in liblvm soname. E.g. liblvm2app.so.2.1.
Alasdair Kergon [Wed, 22 Jul 2009 20:12:14 +0000 (20:12 +0000)]
Use newly-independent LVM_LIBAPI in liblvm soname.  E.g. liblvm2app.so.2.1.

15 years agoAdd an API version number, LVM_LIBAPI, to the VERSION string.
Alasdair Kergon [Wed, 22 Jul 2009 20:01:28 +0000 (20:01 +0000)]
Add an API version number, LVM_LIBAPI, to the VERSION string.

15 years agoUpdate api/test/vgtest.c error handling.
Dave Wysochanski [Wed, 22 Jul 2009 16:49:54 +0000 (16:49 +0000)]
Update api/test/vgtest.c error handling.

Reverts some of my 'cleanup' from last night.  For now we will use pass/fail
on API calls (either 'int' return or NULL/non-NULL handle), then use
lvm_errno() to get more specific errors.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate test/api/vgtest.c to use lvm_errno and lvm_errmsg.
Dave Wysochanski [Wed, 22 Jul 2009 03:13:57 +0000 (03:13 +0000)]
Update test/api/vgtest.c to use lvm_errno and lvm_errmsg.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoFix lvm_vg_close() when locking fails.
Dave Wysochanski [Wed, 22 Jul 2009 03:13:35 +0000 (03:13 +0000)]
Fix lvm_vg_close() when locking fails.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoExport lvm_errno and lvm_errmsg in liblvm.
Dave Wysochanski [Wed, 22 Jul 2009 03:13:13 +0000 (03:13 +0000)]
Export lvm_errno and lvm_errmsg in liblvm.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoPass struct cmd_context as a first argument to init_multiple_segtypes.
Mikulas Patocka [Tue, 21 Jul 2009 20:00:02 +0000 (20:00 +0000)]
Pass struct cmd_context as a first argument to init_multiple_segtypes.

Remove redundant assignment seglib.cmd = cmd (done already at the beginning
of the function).

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
15 years agoAfter rebasing the cluster logging code, adjustments need to be
Jonathan Earl Brassow [Tue, 21 Jul 2009 15:34:53 +0000 (15:34 +0000)]
After rebasing the cluster logging code, adjustments need to be
made to compensate for the changes in the kernel-side component
that recently went upstream.  (Things like: renamed structures,
removal of structure fields, and changes to arguments passed
between userspace and kernel.)

15 years agoRebasing the cluster log daemon code from the most current
Jonathan Earl Brassow [Tue, 21 Jul 2009 15:32:13 +0000 (15:32 +0000)]
Rebasing the cluster log daemon code from the most current
sources in the 'cluster' tree.  There have been a number of
bug fixes and I don't want to loose them.

15 years agoFix build environment of test/api: Make it usable for more than one test case.
Dave Wysochanski [Tue, 21 Jul 2009 13:51:05 +0000 (13:51 +0000)]
Fix build environment of test/api: Make it usable for more than one test case.

Author: Thomas Woerner <twoerner@redhat.com>
Committer: Dave Wysochanski <dwysocha@redhat.com>

15 years agoReturn EINVALID_CMD_LINE not success when invalid VG name format is used.
Alasdair Kergon [Tue, 21 Jul 2009 11:10:49 +0000 (11:10 +0000)]
Return EINVALID_CMD_LINE not success when invalid VG name format is used.

15 years agoRename test/api/vgcreate.c to vgtest.c to reduce filename conflicts in tree.
Dave Wysochanski [Tue, 21 Jul 2009 10:46:45 +0000 (10:46 +0000)]
Rename test/api/vgcreate.c to vgtest.c to reduce filename conflicts in tree.

Signed-off-by: Thomas Woerner <twoerner@redhat.com>
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoFix compile warnings in vgcreate liblvm api unit test case.
Dave Wysochanski [Tue, 21 Jul 2009 10:41:47 +0000 (10:41 +0000)]
Fix compile warnings in vgcreate liblvm api unit test case.

Use const and PRIu64.

Signed-off-by: Thomas Woerner <twoerner@redhat.com>
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Author: Thomas Woerner <twoerner@redhat.com>
Committer: Dave Wysochanski <dwysocha@redhat.com>

15 years agoCast MINOR() in _md_sysfs_attribute_snprintf()'s dm_snprintf() call.
Mike Snitzer [Mon, 20 Jul 2009 18:44:13 +0000 (18:44 +0000)]
Cast MINOR() in _md_sysfs_attribute_snprintf()'s dm_snprintf() call.

15 years agoCast MAJOR() and MINOR() to int when used with "%d" in dm_snprintf() call.
Mike Snitzer [Mon, 20 Jul 2009 18:33:16 +0000 (18:33 +0000)]
Cast MAJOR() and MINOR() to int when used with "%d" in dm_snprintf() call.
Fixes SEGV in _md_sysfs_attribute_snprintf() on 32-bit systems.

15 years agoRemove 'is already' message from vg_set_* functions.
Dave Wysochanski [Thu, 16 Jul 2009 20:18:16 +0000 (20:18 +0000)]
Remove 'is already' message from vg_set_* functions.

These messages are unnecessary in the set functions.  We check for this
condition and print a message in the vgchange tool but not the library
functions.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoFix so only log_error and log_fatal set EUNCLASSIFIED.
Alasdair Kergon [Thu, 16 Jul 2009 13:13:33 +0000 (13:13 +0000)]
Fix so only log_error and log_fatal set EUNCLASSIFIED.

15 years agoRemove extraneous messages for extent_size and alloc_policy upon vgcreate.
Dave Wysochanski [Thu, 16 Jul 2009 03:25:26 +0000 (03:25 +0000)]
Remove extraneous messages for extent_size and alloc_policy upon vgcreate.

When converting to the new liblvm functions, the vgcreate code path
changed to create a new vg, then set values.  As a result of this
change, and the fact that we give a user a message if they try to
set the same value of a VG attribute (extent_size, alloc_policy, etc),
you'll see these 2 extraneous "is already" messages with vgcreate:
tools/lvm vgcreate vg2 /dev/loop2
  Physical extent size of VG vg2 is already 4.00 MB
  Volume group allocation policy is already normal
  Volume group "vg2" successfully created

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

15 years agoChange default errno value to 0 (no error) and add prototypes in lvm.h
Dave Wysochanski [Thu, 16 Jul 2009 03:07:45 +0000 (03:07 +0000)]
Change default errno value to 0 (no error) and add prototypes in lvm.h

Since we are using errno values, we should use '0' as a default value
which indicates a non-error, rather than defining some made-up default
value that is not defined in errno.  If we need to deviate from errno
values, this will most likely indicate a flaw in our design.

Add prototypes for lvm_errno and lvm_errmsg inside lvm.h and provide
a basic description of their function.  This fixes a couple compile
warnings.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoAdd log_errno to set a specific errno and replace log_error in due course.
Alasdair Kergon [Thu, 16 Jul 2009 00:52:06 +0000 (00:52 +0000)]
Add log_errno to set a specific errno and replace log_error in due course.

15 years agoAdd lvm_errno and lvm_errmsg to liblvm to obtain failure information.
Alasdair Kergon [Thu, 16 Jul 2009 00:36:59 +0000 (00:36 +0000)]
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.

15 years agoStore any errno and error messages issued while processing each command.
Alasdair Kergon [Wed, 15 Jul 2009 23:57:54 +0000 (23:57 +0000)]
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.)

15 years agoUse log_error macro consistently throughout in place of log_err.
Alasdair Kergon [Wed, 15 Jul 2009 20:02:46 +0000 (20:02 +0000)]
Use log_error macro consistently throughout in place of log_err.

15 years agoRevert broken commit:
Alasdair Kergon [Wed, 15 Jul 2009 17:26:26 +0000 (17:26 +0000)]
Revert broken commit:
  2009-07-15 06:10:51  Un-export vg_read_internal.

lvm-functions.c:774: warning: implicit declaration of function 'vg_read_internal'

15 years agopost-release
Alasdair Kergon [Wed, 15 Jul 2009 15:38:41 +0000 (15:38 +0000)]
post-release

15 years agopre-release
Alasdair Kergon [Wed, 15 Jul 2009 15:16:48 +0000 (15:16 +0000)]
pre-release

15 years agopre-release clarification
Alasdair Kergon [Wed, 15 Jul 2009 14:59:14 +0000 (14:59 +0000)]
pre-release clarification

15 years agoNew LOG_MESG macro to fix file/line number logging for memory leaks after
Alasdair Kergon [Wed, 15 Jul 2009 14:18:38 +0000 (14:18 +0000)]
New LOG_MESG macro to fix file/line number logging for memory leaks after
LOG_LINENO macro was added.

15 years agopre-release
Alasdair Kergon [Wed, 15 Jul 2009 13:20:06 +0000 (13:20 +0000)]
pre-release

15 years agoFix memory leak in process_each_pv path.
Dave Wysochanski [Wed, 15 Jul 2009 12:22:59 +0000 (12:22 +0000)]
Fix memory leak in process_each_pv path.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoFix memory leak in _process_one_vg error path.
Dave Wysochanski [Wed, 15 Jul 2009 12:15:36 +0000 (12:15 +0000)]
Fix memory leak in _process_one_vg error path.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoFix warning.
Petr Rockai [Wed, 15 Jul 2009 06:11:25 +0000 (06:11 +0000)]
Fix warning.

15 years agoUn-export vg_read_internal.
Petr Rockai [Wed, 15 Jul 2009 06:10:51 +0000 (06:10 +0000)]
Un-export vg_read_internal.

15 years agoFix bad prototype from previous checkin.
Petr Rockai [Wed, 15 Jul 2009 05:57:11 +0000 (05:57 +0000)]
Fix bad prototype from previous checkin.

15 years agoPort process_each_pv to new vg_read.
Petr Rockai [Wed, 15 Jul 2009 05:50:22 +0000 (05:50 +0000)]
Port process_each_pv to new vg_read.

15 years agoRemove lockingfailed().
Petr Rockai [Wed, 15 Jul 2009 05:49:47 +0000 (05:49 +0000)]
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.

15 years agoTake just a read lock when activating in lvchange.
Petr Rockai [Wed, 15 Jul 2009 05:48:36 +0000 (05:48 +0000)]
Take just a read lock when activating in lvchange.

15 years agoRefuse to open VG with MISSING_PVs for update unless handles_missing_pvs is set.
Petr Rockai [Wed, 15 Jul 2009 05:47:55 +0000 (05:47 +0000)]
Refuse to open VG with MISSING_PVs for update unless handles_missing_pvs is set.

15 years agoCheck for certain vg_read errors in _process_one_vg iterator.
Dave Wysochanski [Wed, 15 Jul 2009 05:23:19 +0000 (05:23 +0000)]
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>

15 years agoFix FAILED_INCONSISTENT case in vg_backup_single - typeo on 'if' condition.
Dave Wysochanski [Wed, 15 Jul 2009 03:30:04 +0000 (03:30 +0000)]
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>

15 years agoFix pvremove test breakage.
Dave Wysochanski [Tue, 14 Jul 2009 19:59:41 +0000 (19:59 +0000)]
Fix pvremove test breakage.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoFix vgck and vgremove segfault if non-existent vg given.
Dave Wysochanski [Tue, 14 Jul 2009 19:37:18 +0000 (19:37 +0000)]
Fix vgck and vgremove segfault if non-existent vg given.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoAdd a few negative tests which should fail cleanly if pv, vg, lvs don't exist.
Dave Wysochanski [Tue, 14 Jul 2009 19:35:35 +0000 (19:35 +0000)]
Add a few negative tests which should fail cleanly if pv, vg, lvs don't exist.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoEnable use of new multi-segment registration for static registration too.
Milan Broz [Tue, 14 Jul 2009 12:17:14 +0000 (12:17 +0000)]
Enable use of new multi-segment registration for static registration too.

so it allows this use:

#ifdef MYNEWSEG_INTERNAL
        if (!init_mynewseg_segtypes(&seglib))
                        return 0;
#endif

15 years agoExclude VG_GLOBAL from vg_write_lock_held so scans open devs read-only again. (mbroz)
Alasdair Kergon [Tue, 14 Jul 2009 11:01:26 +0000 (11:01 +0000)]
Exclude VG_GLOBAL from vg_write_lock_held so scans open devs read-only again. (mbroz)

15 years agoAdd liblvm test case for creating of a vg.
Dave Wysochanski [Tue, 14 Jul 2009 03:08:56 +0000 (03:08 +0000)]
Add liblvm test case for creating of a vg.

liblvm unit test case uses the following APIs:
- lvm_create, lvm_destroy
- lvm_vg_create, lvm_vg_extend, lvm_vg_set_extent_size, lvm_vg_write,
lvm_vg_remove, lvm_vg_close

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Acked-by: Alasdair G Kergon <agk@redhat.com>
15 years agoAdd VG APIs to liblvm/.exported_symbols.
Dave Wysochanski [Tue, 14 Jul 2009 03:02:44 +0000 (03:02 +0000)]
Add VG APIs to liblvm/.exported_symbols.

Add the following VG APIs to liblvm/.exported_symbols:
-lvm_reload_config
-lvm_vg_create
-lvm_vg_extend
-lvm_vg_set_extent_size
-lvm_vg_write
-lvm_vg_close
-lvm_vg_remove

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Acked-by: Alasdair G Kergon <agk@redhat.com>
15 years agoAdd lvm_vg_* APIs to create and modify VGs.
Dave Wysochanski [Tue, 14 Jul 2009 03:02:14 +0000 (03:02 +0000)]
Add lvm_vg_* APIs to create and modify VGs.

Add some liblvm APIs for VGs.  Most of these APIs simply call into the internal
liblvm library.  Ideally we should call the liblvm functions directly from
the tools.  However, until we convert more of the code to liblvm functions,
things like the cmd_context will get in the way.  For now just implement the
liblvm functions as wrappers around the internal functions, with a little
error checking and return code handling.  We put all these vg APIs into a
new file, lvm_vg.c

The following APIs are implemented:
lvm_vg_create, lvm_vg_extend, lvm_vg_set_extent_size, lvm_vg_write,
lvm_vg_remove, lvm_vg_close.

Still TODO:
- cleanup error handling by using lvm_errno() and related APIs
- cleanup naming / clarify which functions commit to disk vs not
- implement more 'set' functions
- decide on 'set' / 'change' nomenclature

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Acked-by: Alasdair G Kergon <agk@redhat.com>
15 years agoAdd default cmd->cmd_line initialization for liblvm lvm_create().
Dave Wysochanski [Tue, 14 Jul 2009 03:01:18 +0000 (03:01 +0000)]
Add default cmd->cmd_line initialization for liblvm lvm_create().

This needs initialized to non-NULL before using the archive() call.
Normally this is set to the cmdline string when lvm is called from a tool.
We could think about using it in another way, as a potential audit trail
of liblvm calls, or just leave it set to the default "liblvm", similar to
what clvmd does.  For now, just set it to "liblvm".

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Acked-by: Alasdair G Kergon <agk@redhat.com>
15 years agoDefine handles to liblvm objects for pv, vg, lv, lvseg, pvseg.
Dave Wysochanski [Tue, 14 Jul 2009 03:00:30 +0000 (03:00 +0000)]
Define handles to liblvm objects for pv, vg, lv, lvseg, pvseg.

Define the 5 main liblvm objects to be the pv, vg, lv, lvseg, and pvseg.
We need handles defined to all these objects in order for liblvm to be
equivalent to the reporting commands pvs, vgs, and lvs.

- move vg_t, lv_t, and pv_t from metadata-exported.h into lvm.h
- move lv_segment and pv_segment forward declarations into lvm.h
- add lvseg_t and pvseg_t to lvm.h

NOTE: We currently have an inconsistency in handle definitions.
lvm_t is defined as a pointer, while these other handles are just
structures.  We should pick one scheme and be consistent - perhaps
define all handles as pointers (this is what I've seen elsewhere).

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Acked-by: Alasdair G Kergon <agk@redhat.com>
15 years agoRemove READ_REQUIRE_RESIZEABLE flag from vg_read() interface - no users.
Dave Wysochanski [Tue, 14 Jul 2009 02:19:19 +0000 (02:19 +0000)]
Remove READ_REQUIRE_RESIZEABLE flag from vg_read() interface - no users.

The checks for RESIZEABLE_VG should now be inside the various functions that
have to do such operations.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Acked-by: Alasdair G Kergon <agk@redhat.com>
15 years agoRemove READ_REQUIRE_RESIZEABLE flag from vgsplit.
Dave Wysochanski [Tue, 14 Jul 2009 02:16:05 +0000 (02:16 +0000)]
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>
15 years agoRefactor vgsplit - move move_pvs_used_by_lv and move_pv inside library.
Dave Wysochanski [Tue, 14 Jul 2009 02:15:21 +0000 (02:15 +0000)]
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>
15 years agoRemove READ_REQUIRE_RESIZEABLE from vgextend by moving check inside vg_extend.
Dave Wysochanski [Tue, 14 Jul 2009 02:14:04 +0000 (02:14 +0000)]
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>
15 years agoWHATS_NEW
Mikulas Patocka [Mon, 13 Jul 2009 23:16:17 +0000 (23:16 +0000)]
WHATS_NEW

15 years agoChange exit() to _exit() in the child process. exit flushes stdio file buffers,
Mikulas Patocka [Mon, 13 Jul 2009 21:26:41 +0000 (21:26 +0000)]
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(-)

15 years agoSuppress warning on 64-bit big-endian computers (Sparc 64).
Mikulas Patocka [Mon, 13 Jul 2009 21:23:48 +0000 (21:23 +0000)]
Suppress warning on 64-bit big-endian computers (Sparc 64).

xlate64 produces unsigned long long type, but PRIu64 is defined
to accept argument unsigned long type (on 64-bit machines).

On existing machines, both types have the same size, so it works,
but it is still wrong and produces a warning.

Fix it by using a cast to uint64_t --- according to the standard,
PRIu64 argument matches type uint64_t.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
15 years agoMake cmd->cmd_line const.
Alasdair Kergon [Mon, 13 Jul 2009 19:49:48 +0000 (19:49 +0000)]
Make cmd->cmd_line const.

15 years agoGet rid of the mdadm presence check in t-000-basic: no actual test uses
Petr Rockai [Mon, 13 Jul 2009 12:42:26 +0000 (12:42 +0000)]
Get rid of the mdadm presence check in t-000-basic: no actual test uses
it. When we need mdadm in the tests, we can easily do 'which mdadm || exit 200'
to skip the test.

15 years agoFix dev name mismatch in vgcreate man page example.
Alasdair Kergon [Mon, 13 Jul 2009 11:25:35 +0000 (11:25 +0000)]
Fix dev name mismatch in vgcreate man page example.

15 years agoRemove unused code vg_lock_and_read() and related flags.
Dave Wysochanski [Fri, 10 Jul 2009 21:19:37 +0000 (21:19 +0000)]
Remove unused code vg_lock_and_read() and related flags.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate WHATS_NEW for vgremove and ORPAHN_LOCK refactoring
Dave Wysochanski [Fri, 10 Jul 2009 20:16:15 +0000 (20:16 +0000)]
Update WHATS_NEW for vgremove and ORPAHN_LOCK refactoring

15 years agoChange lock ordering of vgcfgrestore to be consistent with other tools.
Dave Wysochanski [Fri, 10 Jul 2009 20:10:18 +0000 (20:10 +0000)]
Change lock ordering of vgcfgrestore to be consistent with other tools.

Orphan lock is now obtained second and released first, and all tools
are consistent in this regard.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoMove orphan lock obtain/release inside vg_extend().
Dave Wysochanski [Fri, 10 Jul 2009 20:09:21 +0000 (20:09 +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>
15 years agoMove orphan lock inside vg_remove_single.
Dave Wysochanski [Fri, 10 Jul 2009 20:08:37 +0000 (20:08 +0000)]
Move orphan lock inside vg_remove_single.

Move the vg orphan lock inside vg_remove_single, now a complete liblvm
function.  Note that this changes the order of the locks - originally
VG_ORPHAN was obtained first, then the vgname lock.  With the current
policy of non-blocking second locks, this could mean we get a failure
obtaining the orphan lock.  In the case of a vg with lvs being removed,
this could result in the lvs being removed but not the vg.  Such a
scenario could have happened prior though with a different failure.
Other tools were examined for side-effects, and no major problems
were noted.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoRemove force parameter from vg_remove_single, now the liblvm function.
Dave Wysochanski [Fri, 10 Jul 2009 20:07:02 +0000 (20:07 +0000)]
Remove force parameter from vg_remove_single, now the liblvm function.

Move check for active LVs outside of library function.  The vgremove
liblvm function function will fail if there are active LVs.  It will
be the application's responsibility to check this condition and remove
the LVs individually before calling vgremove.  Note also that we've
duplicated the EXPORTED_VG check in vgremove_single (tools) and
vg_remove_single (library).  Duplication seemed the only option here
since we don't want to do the automatic removal of LVs (in the tools)
if the vg is exported, and we still need to protect the library call
from removal if the vg is exported.

We still need to deal with the ORPHAN lock but vg_remove_single is now
very close to our liblvm function.

TODO: Refactor lvremove in a similar way.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoRemove unnecessary parameters from vg_remove_single().
Dave Wysochanski [Fri, 10 Jul 2009 20:05:29 +0000 (20:05 +0000)]
Remove unnecessary parameters from vg_remove_single().

Use vg_t instead of struct volume_group.
Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoAdd dm_log_with_errno and dm_log_with_errno_init, deprecating the old
Alasdair Kergon [Fri, 10 Jul 2009 09:59:37 +0000 (09:59 +0000)]
Add dm_log_with_errno and dm_log_with_errno_init, deprecating the old
Change plog to use dm_log_with_errno unless deprecated dm_log_init was used.
Rename plog macro to LOG_LINE and use in dm_dump_memory_debug.

15 years agoCheck MD devices for a partition table during device scan.
Mike Snitzer [Thu, 9 Jul 2009 22:50:45 +0000 (22:50 +0000)]
Check MD devices for a partition table during device scan.

15 years agoAdd extended device (blkext) and MD partition (mdp) types to filters.
Mike Snitzer [Thu, 9 Jul 2009 22:34:02 +0000 (22:34 +0000)]
Add extended device (blkext) and MD partition (mdp) types to filters.

Both types were added with a 'max_partitions' of 1 because these devices
are _not_ partitionable (they are the partitions).

15 years agoFix and precise metadata read errors for segment areas.
Milan Broz [Thu, 9 Jul 2009 11:29:41 +0000 (11:29 +0000)]
Fix and precise metadata read errors for segment areas.

15 years agoFix confusing metadata syntax error messages.
Milan Broz [Thu, 9 Jul 2009 11:29:00 +0000 (11:29 +0000)]
Fix confusing metadata syntax error messages.

If there is syntax error in metadata, it now prints messages
like:
  Couldn't read 'start_extent' for segment 'extent_count'.
  Couldn't read all logical volumes for volume group vg_test.

The segment specification is wrong and confusing.

Patch fixes it by introducing "parent" member in config_node which
points to parent section and config_parent_name function, which
provides pointer to node section name.

Also it adds several LV references where possible.

15 years agoFix segment import functions to print segment name and logical volume name.
Milan Broz [Thu, 9 Jul 2009 11:28:09 +0000 (11:28 +0000)]
Fix segment import functions to print segment name and logical volume name.

15 years agoUpdate WHATS_NEW for recent vgcreate changes
Dave Wysochanski [Thu, 9 Jul 2009 10:19:07 +0000 (10:19 +0000)]
Update WHATS_NEW for recent vgcreate changes

15 years agoChange vg_create() to take only minimal parameters and obtain a lock.
Dave Wysochanski [Thu, 9 Jul 2009 10:09:33 +0000 (10:09 +0000)]
Change vg_create() to take only minimal parameters and obtain a lock.

vg_t *vg_create(struct cmd_context *cmd, const char *vg_name);
This is the first step towards the API called to create a VG.
Call vg_lock_newname() inside this function.  Use _vg_make_handle()
where possible.
Now we have 2 ways to construct a volume group:
1) vg_read: Used when constructing an existing VG from disks
2) vg_create: Used when constructing a new VG
Both of these interfaces obtain a lock, and return a vg_t *.
The usage of _vg_make_handle() inside vg_create() doesn't fit
perfectly but it's ok for now.  Needs some cleanup though and I've
noted "FIXME" in the code.

Add the new vg_create() plus vg 'set' functions for non-default
VG parameters in the following tools:
- vgcreate: Fairly straightforward refactoring.  We just moved
vg_lock_newname inside vg_create so we check the return via
vg_read_error.
- vgsplit: The refactoring here is a bit more tricky.  Originally
we called vg_lock_newname and depending on the error code, we either
read the existing vg or created the new one.  Now vg_create()
calls vg_lock_newname, so we first try to create the VG.  If this
fails with FAILED_EXIST, we can then do the vg_read.  If the
create succeeds, we check the input parameters and set any new
values on the VG.

TODO in future patches:
1. The VG_ORPHAN lock needs some thought.  We may want to treat
this as any other VG, and require the application to obtain a handle
and pass it to other API calls (for example, vg_extend).  Or,
we may find that hiding the VG_ORPHAN lock inside other APIs is
the way to go.  I thought of placing the VG_ORPHAN lock inside
vg_create() and tying it to the vg handle, but was not certain
this was the right approach.
2. Cleanup error paths. Integrate vg_read_error() with vg_create and
vg_read* error codes and/or the new error APIs.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoAdd vg_set_alloc_policy() liblvm function and move vgchange logic inside.
Dave Wysochanski [Thu, 9 Jul 2009 10:08:54 +0000 (10:08 +0000)]
Add vg_set_alloc_policy() liblvm function and move vgchange logic inside.

NOTE: vg_set_alloc_policy() returns success if you try to set a value that
is already stored.  The behavior of vgchange is the same though - it fails.
There is a fixme noted in the code about this inconsistency, which should
be resolved if possible.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoAdd vg_set_max_pv() liblvm function and move vgchange logic inside.
Dave Wysochanski [Thu, 9 Jul 2009 10:07:47 +0000 (10:07 +0000)]
Add vg_set_max_pv() liblvm function and move vgchange logic inside.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoAdd vg_set_max_lv() liblvm function and move vgchange logic inside.
Dave Wysochanski [Thu, 9 Jul 2009 10:06:00 +0000 (10:06 +0000)]
Add vg_set_max_lv() liblvm function and move vgchange logic inside.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoRename vg_change_pesize to vg_set_extent_size and use vg_t.
Dave Wysochanski [Thu, 9 Jul 2009 10:04:52 +0000 (10:04 +0000)]
Rename vg_change_pesize to vg_set_extent_size and use vg_t.

In liblvm, we will reserve the word 'change' to mean an API that
both sets one or more values, and commits to disk.  This will be
consistent with the LVM commandline.  The existing vg_change_pesize()
function does not commit to disk, but just changes the extent_size
and ensures all internal structures are updated.  This logic should
be contained in a function that sets the value.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoRemove unused 'cmd' from vg_change_pesize().
Dave Wysochanski [Thu, 9 Jul 2009 10:03:37 +0000 (10:03 +0000)]
Remove unused 'cmd' from vg_change_pesize().

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoUpdate vg_change_pesize() to contain all validity checks.
Dave Wysochanski [Thu, 9 Jul 2009 10:02:15 +0000 (10:02 +0000)]
Update vg_change_pesize() to contain all validity checks.

It would be nice to have one function that does all the validation
and setting of the VG's pesize.  However, currently some checks
are in the higher-level function _vgchange_pesize(), and some
checks are in the lower function vg_change_pesize().
This patch moves most of the higher-level checks inside
vg_change_pesize.  In one case a failure return code is
changed from ECMD_FAILED to EINVALID_CMD_LINE.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoAdd defines for default vgcreate parameters.
Dave Wysochanski [Thu, 9 Jul 2009 10:00:36 +0000 (10:00 +0000)]
Add defines for default vgcreate parameters.

15 years agoUpdate t-vgcreate-usage.sh to check for default vg properties.
Dave Wysochanski [Thu, 9 Jul 2009 08:50:55 +0000 (08:50 +0000)]
Update t-vgcreate-usage.sh to check for default vg properties.

15 years agoFix memory leak in vgsplit when re-reading the VG.
Dave Wysochanski [Thu, 9 Jul 2009 05:40:59 +0000 (05:40 +0000)]
Fix memory leak in vgsplit when re-reading the VG.

Call vg_release() before re-reading the vg.
Remove vgsplit whitespace and update copyright.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years ago.
Dave Wysochanski [Wed, 8 Jul 2009 22:22:12 +0000 (22:22 +0000)]
.

15 years agoMake exit paths more robust when some init function fails.
Dave Wysochanski [Wed, 8 Jul 2009 22:18:32 +0000 (22:18 +0000)]
Make exit paths more robust when some init function fails.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoRefactor a couple log_error() statements in prep for larger log_error() patch.
Dave Wysochanski [Wed, 8 Jul 2009 18:15:51 +0000 (18:15 +0000)]
Refactor a couple log_error() statements in prep for larger log_error() patch.

Part of twoerner's log_error() patches.

Signed-off-by: Thomas Woerner <twoerner@redhat.com>
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoAdd t-lvm-init.sh - test lvm init routines and error paths.
Dave Wysochanski [Wed, 8 Jul 2009 18:14:47 +0000 (18:14 +0000)]
Add t-lvm-init.sh - test lvm init routines and error paths.

15 years agoFix segfault in persistent_filter_dump() if lvm init fails.
Dave Wysochanski [Wed, 8 Jul 2009 18:13:32 +0000 (18:13 +0000)]
Fix segfault in persistent_filter_dump() if lvm init fails.

Just return_0 in persistent_filter_dump() if passed a NULL filter;

15 years agoMake destroy_toolcontext() better able to handle NULL pointers.
Dave Wysochanski [Wed, 8 Jul 2009 18:12:08 +0000 (18:12 +0000)]
Make destroy_toolcontext() better able to handle NULL pointers.

Part of twoerner's log_error() patches.

Signed-off-by: Thomas Woerner <twoerner@redhat.com>
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoUpdate WHATS_NEW for vgread cleanup
Dave Wysochanski [Wed, 8 Jul 2009 14:41:00 +0000 (14:41 +0000)]
Update WHATS_NEW for vgread cleanup

15 years agoRemove unneeded LOCK_NONBLOCKING from vg_read() API.
Dave Wysochanski [Wed, 8 Jul 2009 14:33:17 +0000 (14:33 +0000)]
Remove unneeded LOCK_NONBLOCKING from vg_read() API.

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>
15 years agoRemove READ_CHECK_EXISTENCE and vg_might_exist().
Dave Wysochanski [Wed, 8 Jul 2009 14:31:17 +0000 (14:31 +0000)]
Remove READ_CHECK_EXISTENCE and vg_might_exist().

Remove READ_CHECK_EXISTENCE and vg_might_exist().
This flag and API is no longer used now that we have a separate
API to check for existence.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoRemove unneeded LOCK_KEEP from vg_read() interface.
Dave Wysochanski [Wed, 8 Jul 2009 14:28:30 +0000 (14:28 +0000)]
Remove unneeded LOCK_KEEP from vg_read() interface.

Remove unneeded LOCK_KEEP from vg_read() interface.
Update comment to clarify cases where _vg_lock_and_read() may return
with an error but the lock held.  Would be nice to make the vg_read()
interface consistent with regards to lock held and error behavior.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoRemove LOCK_KEEP and READ_CHECK_EXISTENCE from vgsplit.
Dave Wysochanski [Wed, 8 Jul 2009 14:27:37 +0000 (14:27 +0000)]
Remove LOCK_KEEP and READ_CHECK_EXISTENCE from vgsplit.

Remove LOCK_KEEP and READ_CHECK_EXISTENCE from vgsplit.
These flags are no longer necessary.  We now check for existence
in a differnet function, and it is not necessary to keep the lock.
Removing these flags simplifies the new vg_read() interface.
After this patch, we can fully remove LOCK_KEEP.
READ_CHECK_EXISTENCE needs a bit more work before full removal.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoPermit several segment types to be registered by a single shared object.
Alasdair Kergon [Wed, 8 Jul 2009 12:36:01 +0000 (12:36 +0000)]
Permit several segment types to be registered by a single shared object.

15 years agoContinue to make --units and --size consistent (in code and man pages):
Mike Snitzer [Tue, 7 Jul 2009 19:28:57 +0000 (19:28 +0000)]
Continue to make --units and --size consistent (in code and man pages):

Update units_to_bytes() to support (S)ectors: 500 bytes.
- 500 byte (S)ectors is of questionable value but it adds to consistency
  if a user happens to use --units S.  This seems better than an error.

Updated test/t-covercmd.sh to test --units [hS]

Document the units that can be displayed via --units uniformly.
- (p)etabytes and (e)xabytes were missing in pvs, vgs and lvs man pages.

Made lvreduce man page "... in units of megabytes." consistent (with the
lvextend and lvresize man pages).

15 years ago.
Alasdair Kergon [Tue, 7 Jul 2009 17:19:38 +0000 (17:19 +0000)]
.

This page took 0.069553 seconds and 5 git commands to generate.