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

142 Commits

Author SHA1 Message Date
Zdenek Kabelac
077a6755ff Replace free_vg with release_vg
Move the free_vg() to  vg.c  and replace free_vg  with release_vg
and make the _free_vg internal.

Patch is needed for sharing VG in vginfo cache so the release_vg function name
is a better fit here.
2011-08-10 20:25:29 +00:00
Peter Rajnoha
53dd32f41d Add proper udev library context initialization and finalization to liblvm.
This was missing in liblvm and it caused all udev-related operations to
not take effect when using liblvm, e.g. obtaining the list of devices from udev
db instead of scanning the whole /dev which also recreated the .cache as a side
effect. This was also the case with udisks-lvm-pv-export prober which is run
from within udev rules whenever the CHANGE event is fired.
2011-06-15 13:29:48 +00:00
Alasdair Kergon
453cdee51c Permit --available with lvcreate so non-snapshot LVs need not be activated. 2011-06-01 19:21:03 +00:00
Petr Rockai
eee66d2a80 When glibc needs buffers for line buffering of input and output buffers, it
allocates these buffers in such way it adds memory page for each such buffer
and size of unlock memory check will mismatch by 1 or 2 pages.

This happens when we print or read lines without '\n' so these buffers are
used. To avoid this extra allocation, use setvbuf to set these bufffers ahead.

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
Reviewed-by: Milan Broz <mbroz@redhat.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2011-05-07 13:50:11 +00:00
Peter Rajnoha
2c67b829a5 Finalize PV format instances properly in lvm_vg_write fn.
lvm_vg_write fn reinitializes the vg->removed_pvs list. We have to finalize
all PV format instances attached to PVs found in the original list.
2011-04-01 13:44:51 +00:00
Zdenek Kabelac
aec2115410 Const fixing
Fixing some const warnings - with API change in:

int vg_extend(struct volume_group *vg, int pv_count, const char *const *pv_names,

Change is needed - as lvm2api expects const behaviour here.
So vg_extend() is doing local strdup for unescaping.

skip_dev_dir return const char* from const char* vg_name.

Rest of the patch is cleanup of related warnings.

Also using dm_report_filed_string() API change to simplify
casting in _string_disp and _lvname_disp.
2011-02-18 14:47:28 +00:00
Zdenek Kabelac
401a40d941 Do not check for open_count when not needed.
Disable open_count checking in lv_info it it's not used.

Fix previous commit (comment out unsable code for now).
2011-02-03 01:24:46 +00:00
Zdenek Kabelac
12fbaae042 Add default error path for get_property
Set invalid property value for error path when NULL handler is passed.
Fixes use of uninitialized prop structure as we return 'v' by value.
---
2011-01-10 13:07:58 +00:00
Zdenek Kabelac
66781f5d5a Fix wrong cast to char*
As cmd->cmd_line is already const char pointer it's not needed to cast already
const char pointer to char pointer.
2010-12-20 13:28:04 +00:00
Petr Rockai
8961b1d503 Add getters for copy_percent and snap_percent to the lvm2app API. 2010-12-14 23:20:58 +00:00
Alasdair Kergon
2b82bd79f5 Rename vg_release to free_vg. 2010-12-08 20:50:48 +00:00
Petr Rockai
5219fe3ca8 This patch adds helpers to allow users to lookup a lv or pv handle by
uuid (given a vg_t of course).

Signed-off-by: Dave Wysochanski <wysochanski@pobox.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2010-11-25 14:34:51 +00:00
Petr Rockai
14b0c96bc7 This patch adds helpers to allow users to lookup a lv or pv handle by
name (given a vg_t of course).

Signed-off-by: Dave Wysochanski <wysochanski@pobox.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2010-11-25 14:33:44 +00:00
Petr Rockai
55429cde3c Add lvm2app function to query pvseg properties.
Signed-off-by: Dave Wysochanski <wysochanski@pobox.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2010-11-17 20:12:39 +00:00
Petr Rockai
b2b27cd7f4 Add a new type and function to lvm2app to enumerate pvsegs.
Signed-off-by: Dave Wysochanski <wysochanski@pobox.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2010-11-17 20:10:42 +00:00
Petr Rockai
5de70620ef Add lvm2app function to query lvseg properties.
Signed-off-by: Dave Wysochanski <wysochanski@pobox.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2010-11-17 20:09:42 +00:00
Petr Rockai
ecc511167a Add a new type and function to lvm2app to enumerate lvsegs.
Signed-off-by: Dave Wysochanski <wysochanski@pobox.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2010-11-17 20:07:01 +00:00
Petr Rockai
eeaf3ba70a Implement lvm_vg_set_property() by calling internal 'set' property function.
Signed-off-by: Dave Wysochanski <wysochanski@pobox.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2010-11-17 19:16:05 +00:00
Alasdair Kergon
f8452d8cfd Support repetition of --addtag and --deltag arguments.
Add infrastructure for specific cmdline arguments to be repeated in groups.
Split the_args cmdline arguments and values into arg_props and arg_values.
2010-11-11 17:29:05 +00:00
Dave Wysochanski
dd68ee88ea Add lvm_lv_get_property() generic function to obtain value of any lv propert
Add a generic LV property function to lvm2app, similar to VG function.
Return lvm_property_value and require caller to check 'is_valid' flag
and lvm_errno() for API error.
2010-10-25 14:09:08 +00:00
Dave Wysochanski
4e92d7c9ae Add lvm_pv_get_property() generic function to obtain value of any pv property.
Add a generic PV property function to lvm2app, similar to VG function.
Return lvm_property_value and require caller to check 'is_valid' flag
before using the value.  If 'is_valid' is not set, then lvm_errno()
should be used to obtain the specific error.
2010-10-25 14:08:55 +00:00
Dave Wysochanski
3c1febe0a8 Add lvm_vg_get_property() generic vg property function.
Add a generic VG property function to lvm2app.  Call the internal library
vg_get_property() function.  Strings are dup'd internally.
Rework lvm_vg_get_property to return lvm_property_value and require caller
to check 'is_valid' flag.  If !is_valid, the caller can check lvm_errno()
for the specific error.

Create a 'get_property' function, local to lvm2app, that factors out
most of the common code that copies the components of lvm_property_type
into lvm_property_value.  This allows for a 1-line function for each
of the generic property functions exported by lvm2app.
2010-10-25 14:08:43 +00:00
Dave Wysochanski
254d672dcc Add pv_uuid_dup, vg_uuid_dup, and lv_uuid_dup, and call id_format_and_copy.
Add supporting functions for pv_uuid, vg_uuid, and lv_uuid.
Call new function id_format_and_copy.  Use 'const' where appropriate.
Add "_dup" suffix to indicate memory is being allocated.
Call {pv|vg|lv}_uuid_dup from lvm2app uuid functions.
2010-09-30 14:07:47 +00:00
Alasdair Kergon
2d6fcbf67d Allow internal suspend and resume of origin without its snapshots. 2010-08-17 16:25:32 +00:00
Zdenek Kabelac
56081fe97b Clean generated files .exported_symbols_generated, example.conf for distclean. 2010-08-03 13:00:45 +00:00
Alasdair Kergon
2d696f9efc Use #include <> not "" in lvm2app.h which gets installed on the system. 2010-08-02 12:23:01 +00:00
Dave Wysochanski
8e3da446f4 More comment updates in lvm2app.h. 2010-07-12 18:29:31 +00:00
Dave Wysochanski
da42be4d8d Update comments about memory handling in lvm2app.h. 2010-07-12 18:12:23 +00:00
Dave Wysochanski
d01a6a2c5c Remove unnecessary list of includes in liblvm files.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-07-09 16:57:34 +00:00
Alasdair Kergon
08f1ddea6c Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
Dave Wysochanski
40b4d1c3ae Refactor vg_remove_check to place pv removal into separate function. 2010-06-30 18:03:52 +00:00
Alasdair Kergon
8b2055719d Generate liblvm2app and libdevmapper exported symbols from header files.
Detection is simply by prefix - dm_ or lvm_ - and any additional symbols needed
but not detected this way are placed in .exported_symbols.
2010-06-25 18:17:38 +00:00
Alasdair Kergon
9bce3d3bcf actually, let's keep these in same order as in header 2010-06-25 12:21:47 +00:00
Alasdair Kergon
4de36d0072 Update liblvm2app exported symbols.
Add Makefile target to generate current list of lvm2app.h functions.
2010-06-25 12:19:52 +00:00
Milan Broz
c9c7d25c35 Remove C++ private keyword from headers.
Add extern C definition for libdevmapper, lvm2app and lvm2cmd.
2010-06-16 13:01:25 +00:00
Dave Wysochanski
8f4a9e6a3e Fix warnings with conversion of uuid.
More cleanup of uuid casting / structures is needed but for now just
cast like the rest of the code.
2010-05-19 12:12:47 +00:00
Dave Wysochanski
0d23926e4e Add lvm2app interfaces to lookup a vgname from a pvid and pvname.
lvm2app forces applications to start with a volume group name,
open the volume group, then operate on individual pvs.  In some
cases the application may want to start with a device name rather
than the volume group name.  Today, if an application wants to
do this, it must iterate through all the volume groups to find
the volume group that the specific device is attached to.
These new interfaces allow the application to avoid such overhead.
Bump the lvm2app version number to 3.
2010-05-19 11:53:12 +00:00
Zdenek Kabelac
fff111fe22 Add pkgconfigdir for placement of .pc files
Use easily overideable make install pkgconfigdir variable.
2010-05-11 08:57:02 +00:00
Zdenek Kabelac
75e69cd1b2 Switch to use Requires.private for devmapper.pc and lvm2app.pc
Use Requires.private: instead of Libs.private:
Use UDEV_PC and SELINUX_PC for Require.private:

It looks like usage of Requires.private is prefered from Libs.private.
However pkg-config documentation is really poor here. But here is
short outcome:

There is a difference in Libs.private: and Requires.private: where
we specify libselinux instead of  -lselinux -lsepol.

We leave resolving of query like 'pkg-config --libs --static devmapper'
on taking proper selinux and udev libs to their .pc files instead of
hardcoding them into our .pc file which is might give incorrect answer.
- i.e. dependency of libselinux package might change and we may return
wrong list of linked libraries.

http://bugs.freedesktop.org/show_bug.cgi?id=4738
http://err.no/personal/blog/tech/2008-03-25-18-07_pkg-config,_sonames_and_Requires.private
2010-05-11 08:54:11 +00:00
Peter Rajnoha
d50c6d4bf5 Add new --sysinit option for vgchange and lvchange.
A shortcut for --ignorelockingfailure, --ignoremonitoring, --poll n options
and LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES environment variable used all at
once in initialisation scripts (e.g. rc.sysinit or initrd).
2010-05-06 11:15:55 +00:00
Dave Wysochanski
298ec21e29 Use vg->vgmem to allocate vg/lv/pv string properties instead of dm_malloc/fr
Everywhere else in the API the caller can rely on lvm2app taking care of
memory allocation and free, so make the 'name' and 'uuid' properties of a
vg/lv/pv use the vg handle to allocate memory.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-04-19 15:22:24 +00:00
Zdenek Kabelac
23b059e7b7 INSTALL rules updates
Patch is inspired by Debian's extra patch.

- removes OWNER & GROUP make vars they are parts of INSTALL command.
- adds INSTALL_PROGRAM for executable, uses $(INSTALL)
- adds INSTALL_DATA for non-executable data, uses ($INSTALL)
- adds INSTALL_WDATA for writable non-executable data, uses ($INSTALL)
- adds configure option --enable-write_install - to support
  installatin of writable files used by distribution
- replaces usage of ifeq @LIB_SUFFIX@ with $(LIB_SUFFIX)
- installs .a files from static builds without executable flag
- installs .a files to $(usrlibdir) instead of $(libdir)
- installs all static binaries to $(staticdir)
- create .so links for devel package in $(usrlibdir) instead of
  $(libdir)
- makes .so and .so.LIB_VERSION files within builddir
- removes VERSIONED_SHLIB and created versioned LIB_SHARED automagicaly
- install LIB_SHARED via install_lib_shared target
- install plugins via install_lib_shared_plugin target
- prints whole 'install' command during installation instead of less
  informative "Installing  $(something) $(somewhere)"
- install multiple man pages with one INSTALL command
- use DISTCLEAN_TARGETS instead of creating multiple distclean targets
2010-04-09 21:42:48 +00:00
Zdenek Kabelac
c737d34804 Use vpath instead of VPATH.
Usage of VPATH makes troubles when used within $(builddir).
Not only source files are being found through VPATH,
but targets as well. (make --debug=v)

Thus if user builds the code in $(srcdir) and also in some $(builddir)
he gets mangled results as some generated files (i.e. .export.sym)
are 'reused' from $(srcdir) instead of $(builddir).

This patch switches to use vpath were we could explicitly name
suffixes that should be looked via vpath - we must take care,
we do not generate files with these suffixes:
.c, .in, .po, .exported_symbols
2010-04-09 21:34:25 +00:00
Alasdair Kergon
b8175c33da Use INTERNAL_ERROR definition consistently in internal error messages. 2010-03-25 18:22:04 +00:00
Mike Snitzer
a6bc975a24 Improve activation monitoring option processing
. Add "monitoring" option to "activation" section of lvm.conf
. Have clvmd consult the lvm.conf "activation/monitoring" too.
. Introduce toollib.c:get_activation_monitoring_mode().
. Error out when both --monitor and --ignoremonitoring are provided.
. Add --monitor and --ignoremonitoring support to lvcreate.  Update
  lvcreate man page accordingly.
. Clarify that '--monitor' controls the start and stop of monitoring in
  the {vg,lv}change man pages.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
2010-03-23 22:30:18 +00:00
Milan Broz
917c57e77b Disable long living process flag in lvm2app.
This option should be configurable, but for now
do not set it at all.

(lvm2app is used in udisks probers and there
cac cause several nasty races when trying to update
lvmcache during rescan.)
2010-03-17 14:45:28 +00:00
Alasdair Kergon
38220f9fe9 Remove unnecessary full_scan parameter from get_vgids and get_vgnames calls. 2010-03-16 16:57:03 +00:00
Zdenek Kabelac
f0f0b802d1 Introduce LVMINTERNAL_LIBS
Keep dependency libraries for liblvm-internal in one place.
2010-03-04 11:12:39 +00:00
Zdenek Kabelac
814aebc4e9 Use $(top_builddir) for inclusion of make.tmpl in Makefiles. 2010-03-04 09:51:37 +00:00
Dave Wysochanski
322633e1f5 Add Doxygen file for lvm2app to generate documentation from lvm2app.h.
A simple Doxygen file for lvm2app documentation.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-02-24 18:16:54 +00:00