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

3771 Commits

Author SHA1 Message Date
Dave Wysochanski
9c492aeecd Update WHATS_NEW for latest liblvm changes 2009-07-26 22:19:14 +00:00
Dave Wysochanski
7d55939138 Update test/api/test.c to display lvm_lv_is_active and lvm_lv_is_suspended.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 20:59:02 +00:00
Dave Wysochanski
0e5c15a1ba Update test/api/test.c to call lv_deactivate and lv_activate.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 20:58:38 +00:00
Dave Wysochanski
2642ef553a 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>
2009-07-26 20:58:11 +00:00
Dave Wysochanski
63b186b6f7 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>
2009-07-26 20:57:37 +00:00
Dave Wysochanski
bd1dcfbe96 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>
2009-07-26 20:29:56 +00:00
Dave Wysochanski
a57262a7ee Update a few liblvm calls with log_errno.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 20:29:28 +00:00
Dave Wysochanski
f864285b3a 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>
2009-07-26 20:28:59 +00:00
Dave Wysochanski
648fa396d9 A few more lvm.h updates that got missed.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 16:49:52 +00:00
Dave Wysochanski
2572832e0c Rename lvm_scan_vgs to lvm_scan.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 16:44:05 +00:00
Dave Wysochanski
93e025dcc4 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>
2009-07-26 16:35:57 +00:00
Dave Wysochanski
5ed9395077 Update lvm.h handle and handle list comments.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 16:11:58 +00:00
Dave Wysochanski
4e57aae3a7 Rename lvm_vg_get_free to lvm_vg_get_free_size.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 16:06:46 +00:00
Dave Wysochanski
1efda0fbb9 Rename lvm_list_vg_ids to lvm_list_vg_uuids.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 16:06:21 +00:00
Dave Wysochanski
0185663b88 Rename lvm_vg_get_free_count to lvm_vg_get_free_extent_count.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 16:05:49 +00:00
Dave Wysochanski
befeabb45a Update test/api/test.c to call lvm_lv_remove.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 14:37:15 +00:00
Dave Wysochanski
8bcb96836d 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>
2009-07-26 14:36:52 +00:00
Dave Wysochanski
90e0faf3db Update test/api/test.c - correct list_vg_names and list_vg_ids.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 13:08:00 +00:00
Dave Wysochanski
81bbb483f4 Update test/api/test.c for liblvm 'get' functions.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 13:07:41 +00:00
Dave Wysochanski
83f25cd121 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>
2009-07-26 13:06:59 +00:00
Dave Wysochanski
8b3755a679 Use vg_size in vg_set_extent_size.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 12:41:36 +00:00
Dave Wysochanski
483a7cb6d5 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>
2009-07-26 12:41:09 +00:00
Dave Wysochanski
8c38c9642c Rename vg_size to vgsize to avoid naming conflicts.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 12:40:27 +00:00
Dave Wysochanski
a66c95ce44 Update WHATS_NEW for recent checkins 2009-07-26 11:21:32 +00:00
Dave Wysochanski
599e07d2e0 Update test/api/test.c to call lvm_vg_create_lv_linear.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 02:35:47 +00:00
Dave Wysochanski
ce611945ad Update test/api/test.c to handle read/write open modes.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 02:35:19 +00:00
Dave Wysochanski
7a35a9f5d8 Add lvm_vg_create_lv_linear liblvm function.
Create a default linear logical volume from a volume group.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 02:34: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
c9b4604ba6 Remove use of void * from pvcreate_single.
We should use struct pvcreate_params to utilize compiler typechecking.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 02:02:22 +00:00
Dave Wysochanski
bae6bc62bd 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>
2009-07-26 01:54:40 +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
89777f9cec 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>
2009-07-26 01:53:57 +00:00
Dave Wysochanski
9d5a318ac6 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>
2009-07-26 01:53:30 +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
beeba64080 Remove unneeded pv_create wrapper function.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 01:52:19 +00:00
Alasdair Kergon
1cc59fa4ac Add global/wait_for_locks to lvm.conf so blocking on locks can be disabled. 2009-07-24 23:28:55 +00:00
Alasdair Kergon
2918b433a3 remove no-longer-needed NONBLOCK 2009-07-24 18:26:42 +00:00
Alasdair Kergon
c07d773e67 All LV locks are non-blocking so remove LCK_NONBLOCK from separate macros. 2009-07-24 18:15:06 +00:00
Dave Wysochanski
fce6fb489f Eliminate compile warning introduced by previous commit. 2009-07-24 15:15:26 +00:00
Dave Wysochanski
0b7cc76a9d 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.
2009-07-24 15:12:50 +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
ad534f790e Add tests for lvm_vg_name_list, lvm_vg_id_list and lvm_scan_vgs.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-24 12:51:32 +00:00
Dave Wysochanski
fe63e644d9 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>
2009-07-24 12:48:21 +00:00