]> sourceware.org Git - lvm2.git/log
lvm2.git
15 years agoAdd doxygen mainpage tag to lvm.h
Dave Wysochanski [Tue, 28 Jul 2009 15:33:59 +0000 (15:33 +0000)]
Add doxygen mainpage tag to lvm.h

15 years agoAdd an open_mode to the vg struct for liblvm - enforce read / write semantics.
Dave Wysochanski [Tue, 28 Jul 2009 15:14:56 +0000 (15:14 +0000)]
Add an open_mode to the vg struct for liblvm - enforce read / write semantics.

For now, a simple way to enforce the read/write semantics is to just save the
open mode of the VG.  If the caller uses lvm_vg_create, the mode is write.
The caller using lvm_vg_open can use either read or write to open the VG.
Once we have this, we enforce the permissions on each API call and don't allow
a caller to modify a VG that has not been opened properly.

This may be better combined with the locking mode, but I view that as future
cleanup, past this initial release.  The intial release should enforce the
basic object semantics though, as described in the lvm.h file.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoUpdate interactive unit test - fix silly vg_close error.
Dave Wysochanski [Tue, 28 Jul 2009 14:12:29 +0000 (14:12 +0000)]
Update interactive unit test - fix silly vg_close error.

15 years agoUpdate interactive unit test for liblvm - add vg_write, general cleanup.
Dave Wysochanski [Tue, 28 Jul 2009 13:49:28 +0000 (13:49 +0000)]
Update interactive unit test for liblvm - add vg_write, general cleanup.

15 years agoAdd lvm_vg_get_seqno, updating lvm.h and unit test.
Dave Wysochanski [Tue, 28 Jul 2009 13:17:04 +0000 (13:17 +0000)]
Add lvm_vg_get_seqno, updating lvm.h and unit test.

Adding the ability to get the seqno is important for an application to
determine if something has changed in a VG.  Otherwise, the only way to
know is to open the VG with write permission and hold the handle.

15 years agoUpdate lvm.h - remove remaining FIXMEs, note limitations of a few functions.
Dave Wysochanski [Tue, 28 Jul 2009 13:16:40 +0000 (13:16 +0000)]
Update lvm.h - remove remaining FIXMEs, note limitations of a few functions.

Almost done...

15 years agoFix lvm.h formatting.
Dave Wysochanski [Tue, 28 Jul 2009 12:19:58 +0000 (12:19 +0000)]
Fix lvm.h formatting.

15 years agoAdd lvm_library_get_version() and update unit tests to display version.
Dave Wysochanski [Tue, 28 Jul 2009 11:03:28 +0000 (11:03 +0000)]
Add lvm_library_get_version() and update unit tests to display version.

15 years agoUse dm_malloc and dm_free in liblvm instead of malloc/free.
Dave Wysochanski [Tue, 28 Jul 2009 09:56:48 +0000 (09:56 +0000)]
Use dm_malloc and dm_free in liblvm instead of malloc/free.

15 years agoRename lvm_create to lvm_init and lvm_destroy to lvm_quit.
Dave Wysochanski [Tue, 28 Jul 2009 09:16:18 +0000 (09:16 +0000)]
Rename lvm_create to lvm_init and lvm_destroy to lvm_quit.

15 years agoUpdate lvm.h to address feeback.
Dave Wysochanski [Tue, 28 Jul 2009 00:36:58 +0000 (00:36 +0000)]
Update lvm.h to address feeback.

This addresses a a large amount of Alasdair's review.  Subsequent patches
will address remaining issues.
Addressed:
// FIXME Mention that's also required on error.
// FIXME Be consistent in terminology.  It's called "system_dir" then last sentence says "system directory setting".  Is it referring to "system_dir" there or something else?
// FIXME Mention it frees all resources and cannot be used subsequently?
// FIXME What does "any system configuration" mean?
// FIXME Expand on that explanation a bit, now that we know what the other fns look like.
// FIXME Not sure about that - it needs to scan sometimes.  "will not" or "might not" ?
// FIXME: That's a FIXME in the code!!!
// FIXME What does "copied" mean in this context???
// FIXME Say what struct the returned struct dm_list is a list of...
// FIXME "This API" ?  This function creates an object in memory?
// FIXME This function commits the Volume Group object referenced by the VG handle to disk?
// FIXME Where is "Name" defined?  Absolute pathname?

Outstanding:
// FIXME Version function first?  No structs or handles needed for that.
// FIXME Sort out this alignment.  "Set an" directly below "system_dir" looks awful.  Indent differently?  More blank lines?
// FIXME Check how doxygen processes this.  E.g. "return: LVM handle.  You must use lvm_error() to check there were no errors and confirm that the handle is valid for passing to other functions."
// FIXME Find a better name.  lvm_init.
// FIXME Consider renaming according to the new name for lvm_create.
// FIXME Please can we use dm_malloc throughout?

15 years agoAdd warning to lvm.h stating API development in progress.
Dave Wysochanski [Mon, 27 Jul 2009 21:13:54 +0000 (21:13 +0000)]
Add warning to lvm.h stating API development in progress.

15 years agoUpdate WHATS_NEW for latest liblvm changes
Dave Wysochanski [Mon, 27 Jul 2009 21:10:30 +0000 (21:10 +0000)]
Update WHATS_NEW for latest liblvm changes

15 years agoRemove unnecessary \n's from log_error in liblvm.
Dave Wysochanski [Mon, 27 Jul 2009 21:03:15 +0000 (21:03 +0000)]
Remove unnecessary \n's from log_error in liblvm.

15 years agoAdd config_reload and config_override to test.c, change prompt.
Dave Wysochanski [Mon, 27 Jul 2009 21:02:51 +0000 (21:02 +0000)]
Add config_reload and config_override to test.c, change prompt.

  PV         PV UUID                                VG
  /dev/loop1 A95EvV-iqmb-ZFuJ-u8MV-Npwn-wlc2-Ul1Mnn vg1
  /dev/loop0 R16FDG-OmoS-HNGt-LSZY-OAlC-7qeU-t2gztp vg1
lvm> config_override loop0
Success overriding LVM configuration
lvm> config_reload
Success reloading LVM configuration
lvm> vg_open vg1
Couldn't find device with uuid 'A95EvV-iqmb-ZFuJ-u8MV-Npwn-wlc2-Ul1Mnn'.
Success opening vg vg1
lvm> vg_close vg1
lvm> quit

Maybe a bug in lvm_vg_open for missing pvs but the filter seems to work.

Change prompt from "lvm>" to "liblvm>".

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoUpdate return code for lvm_config_reload.
Dave Wysochanski [Mon, 27 Jul 2009 21:02:35 +0000 (21:02 +0000)]
Update return code for lvm_config_reload.

15 years agoAdd lvm_config_override - allow caller to override config, similar to --config.
Dave Wysochanski [Mon, 27 Jul 2009 21:02:17 +0000 (21:02 +0000)]
Add lvm_config_override - allow caller to override config, similar to --config.

Allowing the caller to override the LVM configuration with an API will
enable them to use things such as device filters.
While very flexible, there is some danger to this API in that it will
make it harder to debug setups that have a changing config and deduce
what might have happened.  At some point we may want to limit the scope
of this API but for now it is as open as the --config option to lvm commands.

Update exported symbols.  When I renamed lvm_reload_config to lvm_config_reload
I forgot to rename so I renamed that one here.

This I believe is the last liblvm API for now.  ;-)

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoRename _override_settings into override_config_tree_from_string and move.
Dave Wysochanski [Mon, 27 Jul 2009 21:01:56 +0000 (21:01 +0000)]
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.

15 years agoRefactor _override_settings to take the new config string as input.
Dave Wysochanski [Mon, 27 Jul 2009 21:01:36 +0000 (21:01 +0000)]
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>
15 years agoAdd skeletons of lvm_lv_resize and lvm_pv_resize - not yet implemented.
Dave Wysochanski [Mon, 27 Jul 2009 21:00:50 +0000 (21:00 +0000)]
Add skeletons of lvm_lv_resize and lvm_pv_resize - not yet implemented.

These lower-priority interfaces are not currently implemented in liblvm
but are on the TODO list in the near term.

Author: Thomas Woerner <twoerner@redhat.com>
Acked-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoUpdate test/api/test.c to include lvm_vg_reduce and lvm_vg_extend.
Dave Wysochanski [Mon, 27 Jul 2009 17:45:21 +0000 (17:45 +0000)]
Update test/api/test.c to include lvm_vg_reduce and lvm_vg_extend.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate test/api/vgtest.c to include lvm_vg_reduce.
Dave Wysochanski [Mon, 27 Jul 2009 17:44:58 +0000 (17:44 +0000)]
Update test/api/vgtest.c to include lvm_vg_reduce.

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

15 years agoAdd lvm_vg_reduce to liblvm2app
Dave Wysochanski [Mon, 27 Jul 2009 17:44:29 +0000 (17:44 +0000)]
Add lvm_vg_reduce to liblvm2app

Extend lvm_vg_write to remove pvs removed in lvm_vg_reduce. The lvm
volume_group internal structure removed_pvs is used for that. The list is
empty afterwards.

Add new test for vg->pvs emptyness to lvm_vg_write to prevent to write empty
vgs. This is needed because of lvm_vg_reduce and lv_vg_create, which creates
empty vgs.

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

15 years agoAdd vg_reduce to metadata.c and metadata-exported.h
Dave Wysochanski [Mon, 27 Jul 2009 17:43:39 +0000 (17:43 +0000)]
Add vg_reduce to metadata.c and metadata-exported.h

This function behaves a little bit different than vg_reduce_single, because
it allowes to remove even the latest pv. This has been done to be consistent
to lvm_vg_create, which creates an empty vg.

removed_pvs has been added to the volume_group struct. vg_reduce adds remove
pvs to this list to be able to commit the changes for the pvs in lvm_vg_comm
in liblvm2app.

Initialize removed_pvs list in format-specific volume_group constructors.
Ideally, we should have a base constructor here that initializes the general
non-format specific members of struct volume_group.  But until then, there
are multiple places to initialize these members.  Maybe a better patch would
be a base constructor patch for struct volume_group.  That is more work
though.

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

15 years agoUpdate error return and comments for lvm_list_vg_names/uuids.
Dave Wysochanski [Mon, 27 Jul 2009 11:00:17 +0000 (11:00 +0000)]
Update error return and comments for lvm_list_vg_names/uuids.

The two liblvm functions that return a list of vgnames and vguuids use
cmd->mem to allocate the list.  Make it clear to the caller that this
memory will be freed when the LVM handle is freed.

Clean up and clarify the return value of the functions.  In the
case of a memory allocation error, add a couple log_errnos to the internal
code, and make it clear that memory allocation returns a NULL pointer.
If there are no VGs in the system, the list returned is an empty list.

Make a note of the fact that currently we return hidden VG names, how
these can be detected (always start with "#"), and that they should
not be used.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoRename lvm_reload_config to lvm_config_reload.
Dave Wysochanski [Mon, 27 Jul 2009 10:18:51 +0000 (10:18 +0000)]
Rename lvm_reload_config to lvm_config_reload.

The general naming scheme for most liblvm APIs is:
lvm_<object>_<action>

As there are likely to be other things to do on the lvm 'config' object
(i.e. lvm_config_set_device_filter), we should use consistent naming.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate display.c to use vg_free(vg) instead of duplicating the calculation.
Dave Wysochanski [Mon, 27 Jul 2009 10:18:31 +0000 (10:18 +0000)]
Update display.c to use vg_free(vg) instead of duplicating the calculation.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoMore liblvm header file cleanups.
Dave Wysochanski [Mon, 27 Jul 2009 08:28:13 +0000 (08:28 +0000)]
More liblvm header file cleanups.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate WHATS_NEW for latest liblvm changes
Dave Wysochanski [Sun, 26 Jul 2009 22:19:14 +0000 (22:19 +0000)]
Update WHATS_NEW for latest liblvm changes

15 years agoUpdate test/api/test.c to display lvm_lv_is_active and lvm_lv_is_suspended.
Dave Wysochanski [Sun, 26 Jul 2009 20:59:02 +0000 (20:59 +0000)]
Update test/api/test.c to display lvm_lv_is_active and lvm_lv_is_suspended.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate test/api/test.c to call lv_deactivate and lv_activate.
Dave Wysochanski [Sun, 26 Jul 2009 20:58:38 +0000 (20:58 +0000)]
Update test/api/test.c to call lv_deactivate and lv_activate.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoAdd lvm_lv_is_active and lvm_lv_is_suspended.
Dave Wysochanski [Sun, 26 Jul 2009 20:58:11 +0000 (20:58 +0000)]
Add lvm_lv_is_active and lvm_lv_is_suspended.

Return whether an LV is active in the kernel (live table) or suspended
(table suspend).

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoImplement lvm_lv_activate and lvm_lv_deactivate liblvm calls.
Dave Wysochanski [Sun, 26 Jul 2009 20:57:37 +0000 (20:57 +0000)]
Implement lvm_lv_activate and lvm_lv_deactivate liblvm calls.

Limited implementation but other types of activation should probably have
separate calls.  We also currently do not handle pvmoves or lvconverts.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate test/api/*.c to use consistent liblvm error returns.
Dave Wysochanski [Sun, 26 Jul 2009 20:29:56 +0000 (20:29 +0000)]
Update test/api/*.c to use consistent liblvm error returns.

For now, liblvm will return -1 (fail) / 0 (success) or
NULL (fail) / non-NULL (success).  Upon failure, lvm_errno and
lvm_errmsg should be used to determine the precise error.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate a few liblvm calls with log_errno.
Dave Wysochanski [Sun, 26 Jul 2009 20:29:28 +0000 (20:29 +0000)]
Update a few liblvm calls with log_errno.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate liblvm status return codes to be consistent.
Dave Wysochanski [Sun, 26 Jul 2009 20:28:59 +0000 (20:28 +0000)]
Update liblvm status return codes to be consistent.

For now, we use the following scheme.
For APIs that return an int, success is 0, fail is -1.
APIs that return handles, success is non-NULL, fail is NULL.
At this early stage, liblvm error handling mechanism is subject to change,
but for now we go with this simple scheme consistent with system
programming.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoA few more lvm.h updates that got missed.
Dave Wysochanski [Sun, 26 Jul 2009 16:49:52 +0000 (16:49 +0000)]
A few more lvm.h updates that got missed.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoRename lvm_scan_vgs to lvm_scan.
Dave Wysochanski [Sun, 26 Jul 2009 16:44:05 +0000 (16:44 +0000)]
Rename lvm_scan_vgs to lvm_scan.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate lvm.h - comments describing function behavior, divide into sections.
Dave Wysochanski [Sun, 26 Jul 2009 16:35:57 +0000 (16:35 +0000)]
Update lvm.h - comments describing function behavior, divide into sections.

Hard to divide into smaller patches because of the moving around and
commenting, so just put in the new file diffs.  We will review and can
update as necessary.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate lvm.h handle and handle list comments.
Dave Wysochanski [Sun, 26 Jul 2009 16:11:58 +0000 (16:11 +0000)]
Update lvm.h handle and handle list comments.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoRename lvm_vg_get_free to lvm_vg_get_free_size.
Dave Wysochanski [Sun, 26 Jul 2009 16:06:46 +0000 (16:06 +0000)]
Rename lvm_vg_get_free to lvm_vg_get_free_size.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoRename lvm_list_vg_ids to lvm_list_vg_uuids.
Dave Wysochanski [Sun, 26 Jul 2009 16:06:21 +0000 (16:06 +0000)]
Rename lvm_list_vg_ids to lvm_list_vg_uuids.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoRename lvm_vg_get_free_count to lvm_vg_get_free_extent_count.
Dave Wysochanski [Sun, 26 Jul 2009 16:05:49 +0000 (16:05 +0000)]
Rename lvm_vg_get_free_count to lvm_vg_get_free_extent_count.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate test/api/test.c to call lvm_lv_remove.
Dave Wysochanski [Sun, 26 Jul 2009 14:37:15 +0000 (14:37 +0000)]
Update test/api/test.c to call lvm_lv_remove.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoAdd lvm_vg_remove_lv liblvm function.
Dave Wysochanski [Sun, 26 Jul 2009 14:36:52 +0000 (14:36 +0000)]
Add lvm_vg_remove_lv liblvm function.

Add a very simple version of lvm_vg_remove_lv.
Since we currently can only create linear LVs, this simple remove function
is adequate.  We must refactor lvremove_single a bit.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate test/api/test.c - correct list_vg_names and list_vg_ids.
Dave Wysochanski [Sun, 26 Jul 2009 13:08:00 +0000 (13:08 +0000)]
Update test/api/test.c - correct list_vg_names and list_vg_ids.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate test/api/test.c for liblvm 'get' functions.
Dave Wysochanski [Sun, 26 Jul 2009 13:07:41 +0000 (13:07 +0000)]
Update test/api/test.c for liblvm 'get' functions.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoAdd most all liblvm 'get' functions needed for anaconda.
Dave Wysochanski [Sun, 26 Jul 2009 13:06:59 +0000 (13:06 +0000)]
Add most all liblvm 'get' functions needed for anaconda.

Add the most straightforward 'get' functions required for anaconda.
These are the ones that return simple uint64_t values.
The other more complex ones involve the lv_attr bits.  These will
come in a separate patch series since each lv_attr bit will be returned
in a separate API instred of returning the string and requiring the
user to parse it.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUse vg_size in vg_set_extent_size.
Dave Wysochanski [Sun, 26 Jul 2009 12:41:36 +0000 (12:41 +0000)]
Use vg_size in vg_set_extent_size.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoRefactor a few report field calculations into separate functions.
Dave Wysochanski [Sun, 26 Jul 2009 12:41:09 +0000 (12:41 +0000)]
Refactor a few report field calculations into separate functions.

For liblvm 'get' functions, we should share code with the reporting functions.
This means we need common code to return the values for the fields.
In this patch we refactor a few of the fields needed in liblvm.
Unfortunately, for the simple fields that do derefernces of structure
members (for example, vg_extent_count), we cannot call the common function
from the reporting infrastructure without more refactoring.  The reason is
that the dereference of the simple fields is done deep inside the reporting
code (to get the generic "data" pointer), and the display function is a
generic 'size32' function.  We can fix these issues later with more
refactoring.

Should be no functional change and the testsuite should cover any possible
regressions.  The only fields in the report affected by this patch are:
vg_size, vg_free, and pv_mda_count.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoRename vg_size to vgsize to avoid naming conflicts.
Dave Wysochanski [Sun, 26 Jul 2009 12:40:27 +0000 (12:40 +0000)]
Rename vg_size to vgsize to avoid naming conflicts.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate WHATS_NEW for recent checkins
Dave Wysochanski [Sun, 26 Jul 2009 11:21:32 +0000 (11:21 +0000)]
Update WHATS_NEW for recent checkins

15 years agoUpdate test/api/test.c to call lvm_vg_create_lv_linear.
Dave Wysochanski [Sun, 26 Jul 2009 02:35:47 +0000 (02:35 +0000)]
Update test/api/test.c to call lvm_vg_create_lv_linear.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate test/api/test.c to handle read/write open modes.
Dave Wysochanski [Sun, 26 Jul 2009 02:35:19 +0000 (02:35 +0000)]
Update test/api/test.c to handle read/write open modes.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoAdd lvm_vg_create_lv_linear liblvm function.
Dave Wysochanski [Sun, 26 Jul 2009 02:34:36 +0000 (02:34 +0000)]
Add lvm_vg_create_lv_linear liblvm function.

Create a default linear logical volume from a volume group.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoMove extents_from_size from lvcreate into internal library so we can reuse.
Dave Wysochanski [Sun, 26 Jul 2009 02:34:09 +0000 (02:34 +0000)]
Move extents_from_size from lvcreate into internal library so we can reuse.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoMove _lvcreate into the internal library and rename to lv_create_single.
Dave Wysochanski [Sun, 26 Jul 2009 02:33:35 +0000 (02:33 +0000)]
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>

15 years agoMove pvs and pv_count fields from lvcreate_params to lvcreate_cmdline_params.
Dave Wysochanski [Sun, 26 Jul 2009 02:32:50 +0000 (02:32 +0000)]
Move pvs and pv_count fields from lvcreate_params to lvcreate_cmdline_params.

No functional change.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoComment lvcreate_params struct.
Dave Wysochanski [Sun, 26 Jul 2009 02:32:26 +0000 (02:32 +0000)]
Comment lvcreate_params struct.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoMove 'size' from lvcreate_params into lvcreate_cmdline_params.
Dave Wysochanski [Sun, 26 Jul 2009 02:32:00 +0000 (02:32 +0000)]
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>

15 years agoMove percent_t from struct lvcreate_params to struct lvcreate_cmdline_params.
Dave Wysochanski [Sun, 26 Jul 2009 02:31:41 +0000 (02:31 +0000)]
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>

15 years agoRefactor extents calculations / updates in _lvcreate.
Dave Wysochanski [Sun, 26 Jul 2009 02:31:18 +0000 (02:31 +0000)]
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>

15 years agoRefactor _lvcreate - move *_ARG into _lvcreate_params and get 'cmd' from 'vg'.
Dave Wysochanski [Sun, 26 Jul 2009 02:30:57 +0000 (02:30 +0000)]
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>

15 years agoRemove use of void * from pvcreate_single.
Dave Wysochanski [Sun, 26 Jul 2009 02:02:22 +0000 (02:02 +0000)]
Remove use of void * from pvcreate_single.

We should use struct pvcreate_params to utilize compiler typechecking.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate lvm_vg_extend to do an implicit pvcreate on the device.
Dave Wysochanski [Sun, 26 Jul 2009 01:54:40 +0000 (01:54 +0000)]
Update lvm_vg_extend to do an implicit pvcreate on the device.

Although the tools do not currently do this, we update lvm_vg_extend
to do an implicit pvcreate on an uninitialized device.  The tools will
soon be refactored to do this as well, but more work is needed in the
tools.  For now we update lvm_vg_extend since this is the behavior
required by liblvm.
With this change, the simple liblvm unit test, test/api/vgtest.c
should pass whether or not the device is initialized.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoMove ORPHAN_VG lock outside pvcreate_single.
Dave Wysochanski [Sun, 26 Jul 2009 01:54:20 +0000 (01:54 +0000)]
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>

15 years agoChange pvcreate_single to return pv_t and update function description.
Dave Wysochanski [Sun, 26 Jul 2009 01:53:57 +0000 (01:53 +0000)]
Change pvcreate_single to return pv_t and update function description.

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

15 years agoAllow pvcreate_single to be called with NULL for default pvcreate params.
Dave Wysochanski [Sun, 26 Jul 2009 01:53:30 +0000 (01:53 +0000)]
Allow pvcreate_single to be called with NULL for default pvcreate params.

Passing NULL for pvcreate parameters gives you default parameters for
pvcreate_single.

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

15 years agoMove bulk of pvcreate logic into library.
Dave Wysochanski [Sun, 26 Jul 2009 01:53:09 +0000 (01:53 +0000)]
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>

15 years agoRemove unneeded pv_create wrapper function.
Dave Wysochanski [Sun, 26 Jul 2009 01:52:19 +0000 (01:52 +0000)]
Remove unneeded pv_create wrapper function.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoAdd global/wait_for_locks to lvm.conf so blocking on locks can be disabled.
Alasdair Kergon [Fri, 24 Jul 2009 23:28:55 +0000 (23:28 +0000)]
Add global/wait_for_locks to lvm.conf so blocking on locks can be disabled.

15 years agoremove no-longer-needed NONBLOCK
Alasdair Kergon [Fri, 24 Jul 2009 18:26:42 +0000 (18:26 +0000)]
remove no-longer-needed NONBLOCK

15 years agoAll LV locks are non-blocking so remove LCK_NONBLOCK from separate macros.
Alasdair Kergon [Fri, 24 Jul 2009 18:15:06 +0000 (18:15 +0000)]
All LV locks are non-blocking so remove LCK_NONBLOCK from separate macros.

15 years agoEliminate compile warning introduced by previous commit.
Dave Wysochanski [Fri, 24 Jul 2009 15:15:26 +0000 (15:15 +0000)]
Eliminate compile warning introduced by previous commit.

15 years agoUpdate lvm_vg_extend() to obtain VG_ORPHAN.
Dave Wysochanski [Fri, 24 Jul 2009 15:12:50 +0000 (15:12 +0000)]
Update lvm_vg_extend() to obtain VG_ORPHAN.

vg_extend() no longer obtains VG_OPHAN so we must do so in liblvm function.
We still have the race in liblvm but we will address this problem later.

15 years agoRevert previous patch that moved VG_ORPHAN lock inside vg_extend.
Dave Wysochanski [Fri, 24 Jul 2009 15:01:43 +0000 (15:01 +0000)]
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 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>
15 years agoAdd tests for lvm_vg_name_list, lvm_vg_id_list and lvm_scan_vgs.
Dave Wysochanski [Fri, 24 Jul 2009 12:51:32 +0000 (12:51 +0000)]
Add tests for lvm_vg_name_list, lvm_vg_id_list and lvm_scan_vgs.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoAdd lvm_scan_vgs liblvm fn to scan the system for LVM metadata.
Dave Wysochanski [Fri, 24 Jul 2009 12:48:21 +0000 (12:48 +0000)]
Add lvm_scan_vgs liblvm fn to scan the system for LVM metadata.

The lvm_list_vg_{names|ids} functions do not do a scan so we provide
a liblvm function that does a scan.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoAdd lvm_list_vg_names and lvm_list_vg_ids liblvm functions.
Dave Wysochanski [Fri, 24 Jul 2009 12:47:15 +0000 (12:47 +0000)]
Add lvm_list_vg_names and lvm_list_vg_ids liblvm functions.

These functions provide the capability of enumerating all vgnames and
vgids in the system.  They do not do a scan of the system.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoRemove redundant validate_name in vgreduce.
Dave Wysochanski [Fri, 24 Jul 2009 11:13:36 +0000 (11:13 +0000)]
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>

15 years agoUpdate test/api/test.c to not segfault if null lists of pvs/lvs returned.
Dave Wysochanski [Fri, 24 Jul 2009 04:15:30 +0000 (04:15 +0000)]
Update test/api/test.c to not segfault if null lists of pvs/lvs returned.

Author: Dave Wysochanski <dwysocha@redhat.com>

15 years agoUpdate WHATS_NEW for liblvm commits
Dave Wysochanski [Thu, 23 Jul 2009 23:55:01 +0000 (23:55 +0000)]
Update WHATS_NEW for liblvm commits

15 years agoUpdate test/api/test.c for simple tests involving pv/vg/lv name/uuid attributes.
Dave Wysochanski [Thu, 23 Jul 2009 23:40:50 +0000 (23:40 +0000)]
Update test/api/test.c for simple tests involving pv/vg/lv name/uuid attributes.

Tests the following APIs:
- lvm_{pv|vg|lv}_get_{name|uuid}()
- lvm_{lvs|pvs}_in_vg()

Example:
lvm> vg_open VolGroup00
Success opening vg VolGroup00
lvm> vg_list_lvs VolGroup00
LVs in VG VolGroup00:
VolGroup00/LogVol00 (bFO4EU-UaDu-iuMm-N6BA-xcZc-nm3u-J5K5lu)
VolGroup00/LogVol01 (BHGsPK-PwzY-kye0-MEWa-a67z-BiYE-03ZjwM)
lvm> vg_list_pvs VolGroup00
PVs in VG VolGroup00:
/dev/sda2 (Be91pt-CqT0-4YJE-nGI6-Oisz-hy0N-l9CHgn)

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Acked-by: Thomas Woerner <twoerner@redhat.com>
15 years agoAdd lvm_{pv|vg|lv}_get_{uuid|name}.
Dave Wysochanski [Thu, 23 Jul 2009 23:40:05 +0000 (23:40 +0000)]
Add lvm_{pv|vg|lv}_get_{uuid|name}.

Caller must free the memory of the uuid / name returned.
This may not be the best memory management policy since it may lead to
memory leaks if the caller has code like this:
if (!lvm_vg_get_name(vg))

Maybe we don't care - if we do we can use pools tied to handles later
or some other scheme.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Acked-by: Thomas Woerner <twoerner@redhat.com>
15 years agoAdd lvm_vg_list_{pvs|lvs} - return lists of pv/lv handles for a vg.
Dave Wysochanski [Thu, 23 Jul 2009 23:39:02 +0000 (23:39 +0000)]
Add lvm_vg_list_{pvs|lvs} - return lists of pv/lv handles for a vg.

- Use vgmem pool to allocate a list of lvm_*_list structs
- Allocate a new list each call (list may have changed since last call)
- Add to liblvm's exported symbols

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Acked-by: Thomas Woerner <twoerner@redhat.com>
15 years agoAdd list structure definitions for liblvm objects.
Dave Wysochanski [Thu, 23 Jul 2009 23:37:24 +0000 (23:37 +0000)]
Add list structure definitions for liblvm objects.

- pv_t, vg_t, lv_t
- include libdevmapper.h: needed for struct dm_list

These list structures will be needed in later APIs to return a list of
handles to one object, given another object.  For example, lvm_vg_list_lvs()
will return a list of LV handles (lv_t's) given a VG handle (vg_t).  We
need a structure to do this so we define the LV structure, as well as the
other structures at this point.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
15 years agoRemove lvseg_t and pvseg_t typedefs from liblvm/lvm.h.
Dave Wysochanski [Thu, 23 Jul 2009 23:36:20 +0000 (23:36 +0000)]
Remove lvseg_t and pvseg_t typedefs from liblvm/lvm.h.

We do not need lvseg and pvseg for now.  If we need we will add back
later.

15 years agocheck in the correct pkgconfig file
Alasdair Kergon [Thu, 23 Jul 2009 01:41:53 +0000 (01:41 +0000)]
check in the correct pkgconfig file

15 years agoUpdate lvm_vg_create to use NULL / non-NULL return for the time being.
Dave Wysochanski [Thu, 23 Jul 2009 01:20:22 +0000 (01:20 +0000)]
Update lvm_vg_create to use NULL / non-NULL return for the time being.

Some of the error interface is still TBD.  Rather than exporting a lot
of codes, etc, just use a simple pass / fail.  The allows our unit test
to not segfault if trying to create a VG that already exists.

15 years agoAdd a couple lvm_vg_open() calls to vgtest.c.
Dave Wysochanski [Wed, 22 Jul 2009 22:25:30 +0000 (22:25 +0000)]
Add a couple lvm_vg_open() calls to vgtest.c.

15 years agoAdd lvm_vg_open() to open an existing VG for reading or writing.
Dave Wysochanski [Wed, 22 Jul 2009 22:24:16 +0000 (22:24 +0000)]
Add lvm_vg_open() to open an existing VG for reading or writing.

lvm_vg_open() calls internal vg_read() function which is the entry point
for reading an existing VG.  In addition to the mode, we include a 'flags'
parameter for future extensions.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
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>
This page took 0.073773 seconds and 5 git commands to generate.