1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-12-25 20:23:49 +03:00

Compare commits

..

46 Commits

Author SHA1 Message Date
Alasdair Kergon
b097aa787b pre-commit 2008-06-25 14:24:17 +00:00
Alasdair Kergon
723be0fe69 Align struct memblock in dbg_malloc for sparc. 2008-06-25 14:10:33 +00:00
Alasdair Kergon
f0597a03de Cope with missing field values. 2008-06-25 00:10:36 +00:00
Alasdair Kergon
65f0656f54 Add --rows to dmsetup. 2008-06-24 22:53:48 +00:00
Alasdair Kergon
507ece15a5 Add --rows to reports. 2008-06-24 22:48:53 +00:00
Alasdair Kergon
30be4d1613 Add --unquoted to reporting tools. 2008-06-24 21:21:04 +00:00
Alasdair Kergon
366e89bda0 dmsetup --unquoted 2008-06-24 20:16:47 +00:00
Dave Wysochanski
f159c3f768 Refactor pv_create() to take cmd_context - no functional change. 2008-06-24 20:10:32 +00:00
Dave Wysochanski
8506d1d567 Suppress invalid 'sb_offset' compiler warning (FC8) with uninitialized_var().
device/dev-md.c:61: warning: ‘sb_offset’ may be used uninitialized in this function
2008-06-23 19:26:21 +00:00
Dave Wysochanski
111829da46 Add uninitialized_var macro to suppress invalid compiler warnings.
One such warning is seen on fedora9 gcc compiler:
/metadata.c:1923: warning: 'results' may be used uninitialized in this function
2008-06-23 19:04:34 +00:00
Dave Wysochanski
605798073e Suppress 'sb_offset' compiler warning by using enum for md superblock versions.
The warning is bogus and is only seen on certain versions of gcc.
However using the enum does seem to clarify the intent of the code - only
3 possible md minor superblock versions.

Related compiler warning:
device/dev-md.c:53: warning: 'sb_offset' may be used uninitialized in this function
2008-06-23 14:54:50 +00:00
Jim Meyering
8320f2b094 lvm2_run: don't return uninitialized for _memlock_inc or _memlock_dec
* tools/lvmcmdlib.c: Initialize "ret".  Also avoid useless string
comparison.
2008-06-23 09:27:45 +00:00
Jim Meyering
df0d8d809b configure: regenerate 2008-06-23 09:25:57 +00:00
Jim Meyering
062886df64 avoid link failure when configuring without --enable-cmdlib
* configure.in (LVM2CMD_LIB): Define if --enable-cmdlib.
* dmeventd/mirror/Makefile.in (CLDFLAGS): Use $(LVM2CMD_LIB) rather
than hard-coding -llvm2cmd.
* dmeventd/snapshot/Makefile.in (CLDFLAGS): Likewise.
2008-06-23 09:25:08 +00:00
Jim Meyering
148ea3aaa8 avoid link failure when configuring without --enable-readline
* configure.in: Define READLINE_SUPPORT not when processing
--enable-readline or --disable-readline, but rather only after
determining that readline support is desired and the readline
library is available/usable.
2008-06-23 09:23:48 +00:00
Christine Caulfield
ab5f66c13a Make clvmd return immediately if other nodes are down in an openais cluster. 2008-06-20 12:46:21 +00:00
Christine Caulfield
e65ffb8e68 Make clvmd return immediately if other nodes are down in a gulm cluster.
bz#447799
2008-06-20 10:58:28 +00:00
Zdeněk Kabeláč
949c1ab517 Improve/Fix read ahead 'auto' calculation for stripe_size
Fix lvchange output for -r auto setting if auto is already set
Add testcase for read ahead
2008-06-18 11:32:14 +00:00
Jim Meyering
946d8ee046 avoid compiler warning about cast in OFFSET_OF macro
* dmsetup/dmsetup.c (OFFSET_OF): Use an equivalent definition
that does not cast a pointer value to a narrower type.
2008-06-18 10:19:25 +00:00
Dave Wysochanski
c54a8a2e10 Fix identifier 'error_message_produced' used ambiguously.
Related compiler warning:
log/log.c:242: warning: declaration of 'error_message_produced' shadows a global declaration
../include/log.h:98: warning: shadowed declaration is here
2008-06-17 14:14:00 +00:00
Dave Wysochanski
31177e4f85 Trivial fix to lvcreate man page for --mirrorlog option. 2008-06-16 14:16:02 +00:00
Jim Meyering
750f81b4b5 Begin syncing configure.in for merge/unification with device-mapper. 2008-06-13 14:37:18 +00:00
Jim Meyering
987ff02a45 Don't deref uninitialized log_lv upon failed mirror addition.
* mirror.c (add_mirror_images): Ensure that log_lv is initialized.
2008-06-13 12:15:55 +00:00
Christine Caulfield
f5adaf813c Don't call openlog for every invocation of debuglog.
Patch from Masatake YAMATO
2008-06-13 07:44:14 +00:00
Alasdair Kergon
78ff7dc7f0 Add --force to lvextend and lvresize. 2008-06-12 13:24:02 +00:00
Milan Broz
d1fced3324 Fix vgchange to not activate mirror leg and log volumes directly. 2008-06-12 11:49:46 +00:00
Jim Meyering
e7df9c289b Makefile.in: correct distclean rule
* Makefile.in (SUBDIRS): Remove long-unused test/* names.
(SUBDIRS) [distclean]: Append "test".
Discovered with Zdeněk Kabeláč.
2008-06-12 09:48:45 +00:00
Jim Meyering
a78d7231a9 break (rather than return) so we have only one point of return
* tools/toollib.c (process_each_segment_in_lv): Upon sigint_caught,
break rather than returning ret_max.  No semantic change.
2008-06-11 15:02:52 +00:00
Zdeněk Kabeláč
ba7ae0002e copy vgid only when volume group is present in import_pool_pv 2008-06-11 13:14:41 +00:00
Alasdair Kergon
a090f7b839 post-release 2008-06-11 12:14:41 +00:00
Alasdair Kergon
34ed15a987 pre-release 2008-06-11 12:08:19 +00:00
Alasdair Kergon
cacec4c910 Fix tracking of validity of PVs with no mdas in lvmcache. 2008-06-11 11:02:05 +00:00
Dave Wysochanski
3e47d4e65b Fix return values for reporting commands when run with no PVs, LVs, or VGs.
The new error checking code caught some commands that were returning '0' as
an exit status for success.  This is incorrect and resulted in a benign error
message displayed (see below).  As of today, all commands should return a
value defined in lib/commands/errors.h (1-5).  This results in an exit code of
0 on success, or > 0 on failure (as stated in the lvm.8 man page).

Before change:
1. Make sure no PVs are on the system
2. Run 'pvs'
  Command failed with status code 0.

After change:
<no output>
2008-06-10 20:07:04 +00:00
Dave Wysochanski
8b42fa150b Add ommitted unlock_vg() call when sigint_caught() during vg processing.
Specific test case:
1. pvcreate /dev/loop1; vgcreate vg1 /dev/loop1; lvcreate -L 64M -n lv1 vg1
2. vgremove vg1 (will prompt user)
3. CTRL-C
Code will exit with:
Do you really want to remove volume group "vg2" containing 2 logical volumes? [y/n]:
  Volume group "vg2" not removed
  Command failed with status code 5.
  Internal error: Volume Group vg2 was not unlocked
  Device '/dev/loop1' has been left open.

After change:
Do you really want to remove volume group "vg2" containing 2 logical volumes? [y/n]:
  Volume group "vg2" not removed
  Command failed with status code 5.
2008-06-10 15:25:38 +00:00
Zdeněk Kabeláč
60e660b9c7 Fix wrong free_count on imported volume group from pool device
Fix segfault when calling pvcreate on the pool device
2008-06-10 14:55:14 +00:00
Alasdair Kergon
fe74f013e3 Fix inverted no_flush debug message. (mpatocka) 2008-06-10 11:19:19 +00:00
Alasdair Kergon
24c0c70f90 Fix segfault after _free_vginfo by remembering to remove vginfo from list. 2008-06-09 16:22:33 +00:00
Dave Wysochanski
757f91ca89 Add simple test case to repro pvs segfault with duplicate vgnames. 2008-06-09 15:31:58 +00:00
Alasdair Kergon
5c34f7847e bring list.h into line with lvm2 2008-06-08 14:53:51 +00:00
Alasdair Kergon
de456f014e Tweak detection of invalid fid after changes to PVs in VG in _vg_read. 2008-06-08 14:18:44 +00:00
Alasdair Kergon
d29565066d Revert assuming precommitted metadata is live when activating (unnecessary). 2008-06-08 11:33:15 +00:00
Alasdair Kergon
4d52c9233b . 2008-06-06 20:45:41 +00:00
Alasdair Kergon
6da1ca0cb9 rename some config vars 2008-06-06 20:44:35 +00:00
Alasdair Kergon
2f02f1518a Bring configure.in into line with the lvm2 version. 2008-06-06 20:33:13 +00:00
Alasdair Kergon
e8863707de Drop cached metadata for disappearing VG in vgmerge. 2008-06-06 19:32:35 +00:00
Alasdair Kergon
6a336dfc69 post-release 2008-06-06 19:28:35 +00:00
52 changed files with 2115 additions and 1516 deletions

View File

@@ -1,6 +1,6 @@
#
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
# Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
# Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -36,8 +36,8 @@ ifeq ($(MAKECMDGOALS),distclean)
lib/locking \
lib/mirror \
lib/snapshot \
po \
test/mm test/device test/format1 test/regex test/filters
test \
po
DISTCLEAN_TARGETS += lib/misc/configure.h
endif

View File

@@ -1 +1 @@
2.02.37-cvs (2008-06-06)
2.02.39-cvs (2008-06-11)

View File

@@ -1,3 +1,38 @@
Version 2.02.39 -
================================
Add --unquoted and --rows to reporting tools.
Add and use uninitialized_var() macro to suppress invalid compiler warnings.
Introduce enum for md minor sb version to suppress compiler warning.
Avoid undefined return value after _memlock manipulation in lvm2_run.
Avoid link failure if configured without --enable-cmdlib or --enable-readline.
Make clvmd return at once if other nodes down in a gulm or openais cluster.
Fix and improve readahead 'auto' calculation for stripe_size.
Fix lvchange output for -r auto setting if auto is already set.
Add test case for readahead.
Fix ambiguous use of identifier error_message_produced.
Begin syncing configure.in for merge/unification with device-mapper.
Fix add_mirror_images not to dereference uninitialized log_lv upon failure.
Don't call openlog for every debug line output by clvmd.
Add --force to lvextend and lvresize.
Fix vgchange to not activate mirror leg and log volumes directly.
Fix test directory clean up in make distclean.
Version 2.02.38 - 11th June 2008
================================
Fix tracking of validity of PVs with no mdas in lvmcache.
Fix return values for reporting commands when run with no PVs, LVs, or VGs.
Add omitted unlock_vg() call when sigint_caught() during vg processing.
Fix free_count when reading pool metadata.
Fix segfault when using pvcreate on a device containing pool metadata.
Fix segfault after _free_vginfo by remembering to remove vginfo from list.
Tweak detection of invalid fid after changes to PVs in VG in _vg_read.
Revert assuming precommitted metadata is live when activating (unnecessary).
Drop cached metadata for disappearing VG in vgmerge.
In script-processing mode, stop if any command fails.
Warn if command exits with non-zero status code without a prior log_error.
Check lv_count in vg_validate.
Add --nameprefixes to reporting tools for field name prefix output format.
Version 2.02.37 - 6th June 2008
===============================
Make clvmd-cman use a hash rather than an array for node updown info.

View File

@@ -1,3 +1,12 @@
Version 1.02.27 - 25th June 2008
================================
Align struct memblock in dbg_malloc for sparc.
Add --unquoted and --rows to dmsetup.
Avoid compiler warning about cast in dmsetup.c's OFFSET_OF macro.
Fix inverted no_flush debug message.
Remove --enable-jobs from configure. (Set at runtime instead.)
Bring configure.in and list.h into line with the lvm2 versions.
Version 1.02.26 - 6th June 2008
===============================
Initialise params buffer to empty string in _emit_segment.

2609
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,6 @@
##
###############################################################################
## Copyright (C) 2000-2004 Sistina Software, Inc. All rights reserved.
## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
##
## This file is part of LVM2.
## Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
##
## This copyrighted material is made available to anyone wishing to use,
## modify, copy, or redistribute it subject to the terms and conditions
@@ -18,9 +16,7 @@ AC_PREREQ(2.57)
dnl -- Process this file with autoconf to produce a configure script.
AC_INIT
AC_CONFIG_SRCDIR([lib/device/dev-cache.h])
################################################################################
AC_CONFIG_HEADERS(lib/misc/configure.h)
AC_CONFIG_HEADERS([lib/misc/configure.h])
################################################################################
dnl -- Setup the directory where autoconf has auxilary files
@@ -32,41 +28,45 @@ AC_CANONICAL_TARGET([])
case "$host_os" in
linux*)
CFLAGS="$CFLAGS"
COPTIMISE_FLAG="-O2"
CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym"
CLDWHOLEARCHIVE="-Wl,-whole-archive"
CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive"
LDDEPS="$LDDEPS .export.sym"
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
LIB_SUFFIX="so"
LIB_SUFFIX=so
DEVMAPPER=yes
ODIRECT=yes
DM_IOCTLS=yes
SELINUX=yes
REALTIME=yes
CLUSTER=internal
FSADM=no ;;
FSADM=no
;;
darwin*)
CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
COPTIMISE_FLAG="-O2"
CLDFLAGS="$CLDFLAGS"
CLDWHOLEARCHIVE="-all_load"
CLDNOWHOLEARCHIVE=
LDDEPS="$LDDEPS"
LDFLAGS="$LDFLAGS"
LIB_SUFFIX="dylib"
LIB_SUFFIX=dylib
DEVMAPPER=yes
ODIRECT=no
DM_IOCTLS=no
SELINUX=no
REALTIME=no
CLUSTER=none
FSADM=no ;;
FSADM=no
;;
esac
################################################################################
dnl -- Checks for programs.
AC_PROG_AWK
AC_PROG_CC
dnl probably no longer needed in 2008, but...
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
@@ -75,14 +75,15 @@ AC_PATH_PROG(CFLOW_CMD, cflow)
AC_PATH_PROG(CSCOPE_CMD, cscope)
################################################################################
dnl -- Checks for header files.
dnl -- Check for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_HEADERS(fcntl.h limits.h locale.h stddef.h syslog.h sys/file.h sys/ioctl.h sys/param.h sys/time.h,,AC_MSG_ERROR(bailing out))
AC_CHECK_HEADERS(assert.h ctype.h libgen.h signal.h stdio.h sys/mman.h sys/resource.h sys/stat.h sys/types.h sys/utsname.h sys/wait.h time.h,,AC_MSG_ERROR(bailing out))
AC_CHECK_HEADERS([locale.h stddef.h syslog.h sys/file.h sys/time.h assert.h \
libgen.h signal.h sys/mman.h sys/resource.h sys/utsname.h sys/wait.h time.h], ,
[AC_MSG_ERROR(bailing out)])
case "$host_os" in
linux*)
@@ -91,12 +92,19 @@ case "$host_os" in
AC_CHECK_HEADERS(machine/endian.h sys/disk.h,,AC_MSG_ERROR(bailing out)) ;;
esac
AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h getopt.h inttypes.h limits.h \
stdarg.h stdio.h stdlib.h string.h sys/ioctl.h sys/param.h sys/stat.h \
sys/types.h unistd.h], , [AC_MSG_ERROR(bailing out)])
AC_CHECK_HEADERS(termios.h sys/statvfs.h)
################################################################################
dnl -- Checks for typedefs, structures, and compiler characteristics.
dnl -- Check for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_CHECK_MEMBERS([struct stat.st_rdev])
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_TYPE_MODE_T
AC_CHECK_MEMBERS([struct stat.st_rdev])
@@ -104,7 +112,9 @@ AC_STRUCT_TM
################################################################################
dnl -- Check for functions
AC_CHECK_FUNCS(gethostname getpagesize memset munmap setlocale strcasecmp strchr strdup strncasecmp strerror strrchr strstr strtol strtoul,,AC_MSG_ERROR(bailing out))
AC_CHECK_FUNCS([gethostname getpagesize memset mkdir rmdir munmap setlocale \
strcasecmp strchr strdup strncasecmp strerror strrchr strstr strtol strtoul \
uname], , [AC_MSG_ERROR(bailing out)])
AC_FUNC_ALLOCA
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_FORK
@@ -114,22 +124,19 @@ AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_STAT
AC_FUNC_STRTOD
AC_FUNC_VPRINTF
################################################################################
dnl -- Prefix is /usr by default, the exec_prefix default is setup later
AC_PREFIX_DEFAULT(/usr)
################################################################################
dnl -- Parallel make jobs?
AC_ARG_ENABLE(jobs, [ --enable-jobs=NUM Number of jobs to run simultaneously], JOBS=-j$enableval, JOBS=-j2)
################################################################################
dnl -- Setup the ownership of the files
AC_MSG_CHECKING(file owner)
OWNER="root"
AC_ARG_WITH(user,
[ --with-user=USER Set the owner of installed files ],
[ --with-user=USER Set the owner of installed files [[USER=root]] ],
[ OWNER="$withval" ])
AC_MSG_RESULT($OWNER)
@@ -142,7 +149,7 @@ dnl -- Setup the group ownership of the files
AC_MSG_CHECKING(group owner)
GROUP="root"
AC_ARG_WITH(group,
[ --with-group=GROUP Set the group owner of installed files ],
[ --with-group=GROUP Set the group owner of installed files [[GROUP=root]] ],
[ GROUP="$withval" ])
AC_MSG_RESULT($GROUP)
@@ -260,31 +267,14 @@ if test x$MIRRORS = xinternal; then
AC_DEFINE([MIRRORED_INTERNAL], 1, [Define to 1 to include built-in support for mirrors.])
fi
################################################################################
dnl -- Enables staticly-linked tools
AC_MSG_CHECKING(whether to use static linking)
AC_ARG_ENABLE(static_link, [ --enable-static_link Use this to link the tools to their libraries
statically. Default is dynamic linking], STATIC_LINK=$enableval, STATIC_LINK=no)
AC_MSG_RESULT($STATIC_LINK)
################################################################################
dnl -- Enable readline
AC_MSG_CHECKING(whether to enable readline)
AC_ARG_ENABLE(readline, [ --enable-readline Enable readline support],
READLINE=$enableval, READLINE=no)
AC_ARG_ENABLE([readline],
[ --enable-readline Enable readline support],
[READLINE=$enableval], [READLINE=no])
AC_MSG_RESULT($READLINE)
if test x$READLINE = xyes; then
AC_DEFINE([READLINE_SUPPORT], 1, [Define to 1 to include the LVM readline shell.])
fi
################################################################################
dnl -- Disable selinux
AC_MSG_CHECKING(whether to enable selinux support)
AC_ARG_ENABLE(selinux, [ --disable-selinux Disable selinux support],
SELINUX=$enableval)
AC_MSG_RESULT($SELINUX)
################################################################################
dnl -- Disable realtime clock support
AC_MSG_CHECKING(whether to enable realtime support)
@@ -314,7 +304,7 @@ fi
dnl -- Enable debugging
AC_MSG_CHECKING(whether to enable debugging)
AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging],
DEBUG=$enableval, DEBUG=no)
DEBUG=$enableval, DEBUG=no)
AC_MSG_RESULT($DEBUG)
dnl -- Normally turn off optimisation for debug builds
@@ -328,7 +318,7 @@ fi
dnl -- Override optimisation
AC_MSG_CHECKING(for C optimisation flag)
AC_ARG_WITH(optimisation,
[ --with-optimisation=OPT C optimisation flag [OPT=-O2] ],
[ --with-optimisation=OPT C optimisation flag [[OPT=-O2]] ],
[ COPTIMISE_FLAG="$withval" ])
AC_MSG_RESULT($COPTIMISE_FLAG)
@@ -360,6 +350,10 @@ AC_MSG_CHECKING(whether to compile liblvm2cmd.so)
AC_ARG_ENABLE(cmdlib, [ --enable-cmdlib Build shared command library],
CMDLIB=$enableval, CMDLIB=no)
AC_MSG_RESULT($CMDLIB)
AC_SUBST([LVM2CMD_LIB])
test $CMDLIB=yes \
&& LVM2CMD_LIB=-llvm2cmd \
|| LVM2CMD_LIB=
################################################################################
dnl -- Enable fsadm
@@ -386,18 +380,11 @@ if test x$DMEVENTD = xyes; then
AC_DEFINE([DMEVENTD], 1, [Define to 1 to enable the device-mapper event daemon.])
fi
################################################################################
dnl -- Mess with default exec_prefix
dnl -- Clear default exec_prefix - install into /sbin rather than /usr/sbin
if [[ "x$exec_prefix" = xNONE -a "x$prefix" = xNONE ]];
then exec_prefix="";
fi;
################################################################################
dnl -- Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(mkdir rmdir uname,,AC_MSG_ERROR(bailing out))
################################################################################
dnl -- Check for termcap (Shamelessly copied from parted 1.4.17)
if test x$READLINE = xyes; then
@@ -436,12 +423,30 @@ Features cannot be 'shared' when building statically
)
fi
################################################################################
dnl -- Enables statically-linked tools
AC_MSG_CHECKING(whether to use static linking)
AC_ARG_ENABLE(static_link,
[ --enable-static_link Use this to link the tools to their libraries
statically. Default is dynamic linking],
STATIC_LINK=$enableval, STATIC_LINK=no)
AC_MSG_RESULT($STATIC_LINK)
################################################################################
dnl -- Disable selinux
AC_MSG_CHECKING(whether to enable selinux support)
AC_ARG_ENABLE(selinux, [ --disable-selinux Disable selinux support],
SELINUX=$enableval)
AC_MSG_RESULT($SELINUX)
################################################################################
dnl -- Check for selinux
if test x$SELINUX = xyes; then
AC_CHECK_LIB(sepol, sepol_check_context, HAVE_SEPOL=yes, HAVE_SEPOL=no)
if test x$HAVE_SEPOL = xyes; then
AC_DEFINE([HAVE_SEPOL], 1,
[Define to 1 if sepol_check_context is available.])
LIBS="-lsepol $LIBS"
fi
@@ -454,7 +459,7 @@ if test x$SELINUX = xyes; then
AC_MSG_WARN(Disabling selinux)
fi
# With --enable-static_link and selinux enabled, linking lvm.static
# With --enable-static_link and selinux enabled, linking
# fails on at least Debian unstable due to unsatisfied references
# to pthread_mutex_lock and _unlock. See if we need -lpthread.
if test "$STATIC_LINK-$HAVE_SELINUX" = yes-yes; then
@@ -482,7 +487,7 @@ fi
################################################################################
dnl -- Check for getopt
AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 to if getopt_long is available.]))
AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 if getopt_long is available.]))
################################################################################
dnl -- Check for readline (Shamelessly copied from parted 1.4.17)
@@ -497,7 +502,11 @@ Note: if you are using precompiled packages you will also need the development
package as well (which may be called readline-devel or something similar).
)
)
AC_CHECK_FUNC(rl_completion_matches, AC_DEFINE([HAVE_RL_COMPLETION_MATCHES], 1, [Define to 1 if rl_completion_matches() is available.]))
AC_CHECK_FUNC([rl_completion_matches],
AC_DEFINE([HAVE_RL_COMPLETION_MATCHES], 1,
[Define to 1 if rl_completion_matches() is available.]))
AC_DEFINE([READLINE_SUPPORT], 1,
[Define to 1 to include the LVM readline shell.])
fi
################################################################################
@@ -517,25 +526,25 @@ if test x$INTL = xyes; then
fi;
AC_ARG_WITH(localedir,
[ --with-localedir=DIR Translation files in DIR [PREFIX/share/locale]],
[ LOCALEDIR="$withval" ],
[ LOCALEDIR='${prefix}/share/locale' ])
[ --with-localedir=DIR Translation files in DIR [[PREFIX/share/locale]] ],
[ LOCALEDIR="$withval" ],
[ LOCALEDIR='${prefix}/share/locale' ])
fi
################################################################################
AC_ARG_WITH(confdir,
[ --with-confdir=DIR Configuration files in DIR [/etc]],
[ CONFDIR="$withval" ],
[ CONFDIR='/etc' ])
[ CONFDIR="$withval" ],
[ CONFDIR='/etc' ])
AC_ARG_WITH(staticdir,
[ --with-staticdir=DIR Static binary in DIR [EXEC_PREFIX/sbin]],
[ STATICDIR="$withval" ],
[ STATICDIR='${exec_prefix}/sbin' ])
[ STATICDIR="$withval" ],
[ STATICDIR='${exec_prefix}/sbin' ])
AC_ARG_WITH(dmdir,
[ --with-dmdir=DIR Build against device-mapper source tree in DIR],
[ DMDIR="$withval" CPPFLAGS="$CPPFLAGS -I$DMDIR/include"],
[ DMDIR="$withval" CPPFLAGS="$CPPFLAGS -I$DMDIR/include"],
[ DMDIR= ])
# Convert a relative dir name to absolute.
@@ -585,51 +594,56 @@ if test x$MODPROBE_CMD != x; then
fi
################################################################################
if test "-f VERSION"; then
LVM_VERSION="\"`cat VERSION`\""
else
LVM_VERSION="Unknown"
fi
LVM_VERSION="\"`cat VERSION 2>/dev/null || echo Unknown`\""
################################################################################
AC_SUBST(JOBS)
AC_SUBST(STATIC_LINK)
AC_SUBST(LVM1)
AC_SUBST(POOL)
AC_SUBST(SNAPSHOTS)
AC_SUBST(MIRRORS)
AC_SUBST(OWNER)
AC_SUBST(GROUP)
AC_SUBST(BUILD_DMEVENTD)
AC_SUBST(CFLAGS)
AC_SUBST(COPTIMISE_FLAG)
AC_SUBST(CFLOW_CMD)
AC_SUBST(CLDFLAGS)
AC_SUBST(CLDWHOLEARCHIVE)
AC_SUBST(CLDNOWHOLEARCHIVE)
AC_SUBST(LDDEPS)
AC_SUBST(LDFLAGS)
AC_SUBST(LIB_SUFFIX)
AC_SUBST(LIBS)
AC_SUBST(LVM_VERSION)
AC_SUBST(LVM1_FALLBACK)
AC_SUBST(CLDWHOLEARCHIVE)
AC_SUBST(CLUSTER)
AC_SUBST(CLVMD)
AC_SUBST(CMDLIB)
AC_SUBST(COPTIMISE_FLAG)
AC_SUBST(CSCOPE_CMD)
AC_SUBST(DEBUG)
AC_SUBST(DEVMAPPER)
AC_SUBST(HAVE_LIBDL)
AC_SUBST(HAVE_SELINUX)
AC_SUBST(HAVE_REALTIME)
AC_SUBST(CMDLIB)
AC_SUBST(MSGFMT)
AC_SUBST(LOCALEDIR)
AC_SUBST(CONFDIR)
AC_SUBST(STATICDIR)
AC_SUBST(DMDIR)
AC_SUBST(INTL_PACKAGE)
AC_SUBST(INTL)
AC_SUBST(CLVMD)
AC_SUBST(CLUSTER)
AC_SUBST(FSADM)
# FIXME: rename to LVM_USE_DMEVENTD
AC_SUBST(DMEVENTD)
AC_SUBST(CFLOW_CMD)
AC_SUBST(CSCOPE_CMD)
AC_SUBST(DM_COMPAT)
AC_SUBST(DM_DEVICE_GID)
AC_SUBST(DM_DEVICE_MODE)
AC_SUBST(DM_DEVICE_UID)
AC_SUBST(DM_IOCTLS)
AC_SUBST(DM_LIB_VERSION)
AC_SUBST(FSADM)
AC_SUBST(GROUP)
AC_SUBST(HAVE_LIBDL)
AC_SUBST(HAVE_REALTIME)
AC_SUBST(HAVE_SELINUX)
AC_SUBST(INTL)
AC_SUBST(INTL_PACKAGE)
AC_SUBST(JOBS)
AC_SUBST(LDDEPS)
AC_SUBST(LIBS)
AC_SUBST(LIB_SUFFIX)
AC_SUBST(LOCALEDIR)
AC_SUBST(LVM1)
AC_SUBST(LVM1_FALLBACK)
# FIXME: rename to LVM_CONF_DIR
AC_SUBST(CONFDIR)
AC_SUBST(LVM_VERSION)
AC_SUBST(MIRRORS)
AC_SUBST(MSGFMT)
AC_SUBST(OWNER)
AC_SUBST(PKGCONFIG)
AC_SUBST(POOL)
AC_SUBST(SNAPSHOTS)
AC_SUBST(STATICDIR)
AC_SUBST(STATIC_LINK)
AC_SUBST([LIB_PTHREAD])
################################################################################
@@ -638,22 +652,22 @@ dnl -- keep utility scripts running properly
AC_CONFIG_FILES([
Makefile
make.tmpl
include/Makefile
lib/Makefile
man/Makefile
po/Makefile
dmeventd/Makefile
daemons/Makefile
daemons/clvmd/Makefile
dmeventd/Makefile
dmeventd/mirror/Makefile
dmeventd/snapshot/Makefile
doc/Makefile
include/Makefile
lib/Makefile
lib/format1/Makefile
lib/format_pool/Makefile
lib/locking/Makefile
lib/mirror/Makefile
lib/snapshot/Makefile
test/Makefile
man/Makefile
po/Makefile
scripts/Makefile
tools/Makefile
tools/version.h

View File

@@ -665,6 +665,7 @@ static int _cluster_do_node_callback(struct local_client *master_client,
{
struct dm_hash_node *hn;
struct node_info *ninfo;
int somedown = 0;
dm_hash_iterate(hn, node_hash)
{
@@ -686,12 +687,14 @@ static int _cluster_do_node_callback(struct local_client *master_client,
client = dm_hash_lookup_binary(sock_hash, csid, GULM_MAX_CSID_LEN);
}
DEBUGLOG("down_callback2. node %s, state = %d\n", ninfo->name, ninfo->state);
if (ninfo->state != NODE_DOWN)
callback(master_client, csid, ninfo->state == NODE_CLVMD);
if (ninfo->state != NODE_CLVMD)
somedown = -1;
}
return 0;
return somedown;
}
/* Convert gulm error codes to unix errno numbers */

View File

@@ -452,6 +452,7 @@ static int _cluster_do_node_callback(struct local_client *master_client,
{
struct dm_hash_node *hn;
struct node_info *ninfo;
int somedown = 0;
dm_hash_iterate(hn, node_hash)
{
@@ -465,8 +466,10 @@ static int _cluster_do_node_callback(struct local_client *master_client,
if (ninfo->state != NODE_DOWN)
callback(master_client, csid, ninfo->state == NODE_CLVMD);
if (ninfo->state != NODE_CLVMD)
somedown = -1;
}
return 0;
return somedown;
}
/* Real locking */

View File

@@ -182,8 +182,10 @@ void debuglog(const char *fmt, ...)
va_end(ap);
}
if (debug == DEBUG_SYSLOG) {
if (!syslog_init)
if (!syslog_init) {
openlog("clvmd", LOG_PID, LOG_DAEMON);
syslog_init = 1;
}
va_start(ap,fmt);
vsyslog(LOG_DEBUG, fmt, ap);

View File

@@ -1,6 +1,6 @@
#
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
# Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
# Copyright (C) 2004-2005, 2008 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -17,7 +17,7 @@ top_srcdir = @top_srcdir@
VPATH = @srcdir@
INCLUDES += -I${top_srcdir}/tools
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper -llvm2cmd
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper $(LVM2CMD_LIB)
SOURCES = dmeventd_mirror.c
@@ -33,4 +33,3 @@ install: libdevmapper-event-lvm2mirror.$(LIB_SUFFIX)
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
$(libdir)/$<.$(LIB_VERSION)
$(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$<

View File

@@ -17,7 +17,7 @@ top_srcdir = @top_srcdir@
VPATH = @srcdir@
INCLUDES += -I${top_srcdir}/tools
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper -llvm2cmd
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper $(LVM2CMD_LIB)
SOURCES = dmeventd_snapshot.c
@@ -33,4 +33,3 @@ install: libdevmapper-event-lvm2snapshot.$(LIB_SUFFIX)
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
$(libdir)/$<.$(LIB_VERSION)
$(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$<

View File

@@ -1,6 +1,6 @@
#
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
# Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
# Copyright (C) 2004-2005, 2008 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -17,7 +17,7 @@ top_srcdir = @top_srcdir@
VPATH = @srcdir@
INCLUDES += -I${top_srcdir}/tools
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper -llvm2cmd
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper $(LVM2CMD_LIB)
SOURCES = dmeventd_mirror.c
@@ -33,4 +33,3 @@ install: libdevmapper-event-lvm2mirror.$(LIB_SUFFIX)
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
$(libdir)/$<.$(LIB_VERSION)
$(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$<

View File

@@ -17,7 +17,7 @@ top_srcdir = @top_srcdir@
VPATH = @srcdir@
INCLUDES += -I${top_srcdir}/tools
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper -llvm2cmd
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper $(LVM2CMD_LIB)
SOURCES = dmeventd_snapshot.c
@@ -33,4 +33,3 @@ install: libdevmapper-event-lvm2snapshot.$(LIB_SUFFIX)
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
$(libdir)/$<.$(LIB_VERSION)
$(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$<

View File

@@ -993,11 +993,7 @@ int lv_activation_filter(struct cmd_context *cmd, const char *lvid_s,
if (!activation())
goto activate;
/*
* If we're activating and precommitted metadata is still cached,
* we assume it matches the new live metadata.
*/
if (!(lv = lv_from_lvid(cmd, lvid_s, 1)))
if (!(lv = lv_from_lvid(cmd, lvid_s, 0)))
return 0;
if (!_passes_activation_filter(cmd, lv)) {
@@ -1022,11 +1018,7 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
if (!activation())
return 1;
/*
* If we're activating and precommitted metadata is still cached,
* we assume it matches the new live metadata.
*/
if (!(lv = lv_from_lvid(cmd, lvid_s, 1)))
if (!(lv = lv_from_lvid(cmd, lvid_s, 0)))
return 0;
if (filter && !_passes_activation_filter(cmd, lv)) {

View File

@@ -928,8 +928,8 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
break;
if (lv_is_cow(lv) && !layer)
break;
if (max_stripe_size < seg->stripe_size)
max_stripe_size = seg->stripe_size;
if (max_stripe_size < seg->stripe_size * seg->area_count)
max_stripe_size = seg->stripe_size * seg->area_count;
}
if (read_ahead == DM_READ_AHEAD_AUTO) {

21
lib/cache/lvmcache.c vendored
View File

@@ -631,11 +631,14 @@ struct device *device_from_pvid(struct cmd_context *cmd, struct id *pvid)
static int _free_vginfo(struct lvmcache_vginfo *vginfo)
{
struct lvmcache_vginfo *primary_vginfo, *vginfo2;
int r = 1;
_free_cached_vgmetadata(vginfo);
if (vginfo_from_vgname(vginfo->vgname, NULL) == vginfo) {
vginfo2 = primary_vginfo = vginfo_from_vgname(vginfo->vgname, NULL);
if (vginfo == primary_vginfo) {
dm_hash_remove(_vgname_hash, vginfo->vgname);
if (vginfo->next && !dm_hash_insert(_vgname_hash, vginfo->vgname,
vginfo->next)) {
@@ -643,7 +646,12 @@ static int _free_vginfo(struct lvmcache_vginfo *vginfo)
vginfo->vgname);
r = 0;
}
}
} else do
if (vginfo2->next == vginfo) {
vginfo2->next = vginfo->next;
break;
}
while ((vginfo2 = primary_vginfo->next));
if (vginfo->vgname)
dm_free(vginfo->vgname);
@@ -1007,6 +1015,15 @@ int lvmcache_update_vgname_and_id(struct lvmcache_info *info,
vgid = vgname;
}
/* If PV without mdas is already in a real VG, don't make it orphan */
if (is_orphan_vg(vgname) && info->vginfo && !list_size(&info->mdas) &&
!is_orphan_vg(info->vginfo->vgname) && memlock())
return 1;
/* If moving PV from orphan to real VG, always mark it valid */
if (!is_orphan_vg(vgname))
info->status &= ~CACHE_INVALID;
if (!_lvmcache_update_vgname(info, vgname, vgid, vgstatus,
creation_host, info->fmt) ||
!_lvmcache_update_vgid(info, info->vginfo, vgid) ||

View File

@@ -101,8 +101,10 @@
#define DEFAULT_REP_ALIGNED 1
#define DEFAULT_REP_BUFFERED 1
#define DEFAULT_REP_COLUMNS_AS_ROWS 0
#define DEFAULT_REP_HEADINGS 1
#define DEFAULT_REP_PREFIXES 0
#define DEFAULT_REP_QUOTED 1
#define DEFAULT_REP_SEPARATOR " "
#define DEFAULT_LVS_COLS "lv_name,vg_name,lv_attr,lv_size,origin,snap_percent,move_pv,mirror_log,copy_percent,convert_lv"

View File

@@ -48,18 +48,26 @@ static int _dev_has_md_magic(struct device *dev, uint64_t sb_offset)
* 1: At start of device
* 2: 4K from start of device.
*/
static uint64_t _v1_sb_offset(uint64_t size, unsigned minor_version)
typedef enum {
MD_MINOR_VERSION_MIN,
MD_MINOR_V0 = MD_MINOR_VERSION_MIN,
MD_MINOR_V1,
MD_MINOR_V2,
MD_MINOR_VERSION_MAX = MD_MINOR_V2
} md_minor_version_t;
static uint64_t _v1_sb_offset(uint64_t size, md_minor_version_t minor_version)
{
uint64_t sb_offset;
uint64_t uninitialized_var(sb_offset);
switch(minor_version) {
case 0:
case MD_MINOR_V0:
sb_offset = (size - 8 * 2) & ~(4 * 2 - 1ULL);
break;
case 1:
case MD_MINOR_V1:
sb_offset = 0;
break;
case 2:
case MD_MINOR_V2:
sb_offset = 4 * 2;
break;
}
@@ -74,7 +82,7 @@ static uint64_t _v1_sb_offset(uint64_t size, unsigned minor_version)
int dev_is_md(struct device *dev, uint64_t *sb)
{
int ret = 1;
unsigned minor = 0;
md_minor_version_t minor;
uint64_t size, sb_offset;
if (!dev_get_size(dev, &size)) {
@@ -96,12 +104,13 @@ int dev_is_md(struct device *dev, uint64_t *sb)
if (_dev_has_md_magic(dev, sb_offset))
goto out;
minor = MD_MINOR_VERSION_MIN;
/* Version 1, try v1.0 -> v1.2 */
do {
sb_offset = _v1_sb_offset(size, minor);
if (_dev_has_md_magic(dev, sb_offset))
goto out;
} while (++minor <= 2);
} while (++minor <= MD_MINOR_VERSION_MAX);
ret = 0;

View File

@@ -36,6 +36,7 @@ int import_pool_vg(struct volume_group *vg, struct dm_pool *mem, struct list *pl
vg->extent_count +=
((pl->pd.pl_blocks) / POOL_PE_SIZE);
vg->free_count = vg->extent_count;
vg->pv_count++;
if (vg->name)
@@ -45,7 +46,6 @@ int import_pool_vg(struct volume_group *vg, struct dm_pool *mem, struct list *pl
get_pool_vg_uuid(&vg->id, &pl->pd);
vg->extent_size = POOL_PE_SIZE;
vg->status |= LVM_READ | LVM_WRITE | CLUSTERED | SHARED;
vg->free_count = vg->extent_count;
vg->max_lv = 1;
vg->max_pv = POOL_MAX_DEVICES;
vg->alloc = ALLOC_NORMAL;
@@ -165,7 +165,8 @@ int import_pool_pv(const struct format_type *fmt, struct dm_pool *mem,
log_error("Unable to duplicate vg_name string");
return 0;
}
memcpy(&pv->vgid, &vg->id, sizeof(vg->id));
if (vg != NULL)
memcpy(&pv->vgid, &vg->id, sizeof(vg->id));
pv->status = 0;
pv->size = pd->pl_blocks;
pv->pe_size = POOL_PE_SIZE;

View File

@@ -51,6 +51,7 @@ static int _already_logging = 0;
static int _mirror_in_sync = 0;
static int _dmeventd_monitor = DEFAULT_DMEVENTD_MONITOR;
static int _ignore_suspended_devices = 0;
static int _error_message_produced = 0;
static lvm2_log_fn_t _lvm2_log_fn = NULL;
@@ -238,6 +239,16 @@ void init_indent(int indent)
_indent = indent;
}
void init_error_message_produced(int value)
{
_error_message_produced = value;
}
int error_message_produced(void)
{
return _error_message_produced;
}
int test_mode()
{
return _test;
@@ -322,6 +333,9 @@ void print_log(int level, const char *file, int line, const char *format, ...)
if (_log_suppress == 2)
return;
if (level <= _LOG_ERR)
_error_message_produced = 1;
trformat = _(format);
if (_lvm2_log_fn) {

View File

@@ -79,6 +79,7 @@ void init_security_level(int level);
void init_mirror_in_sync(int in_sync);
void init_dmeventd_monitor(int reg);
void init_ignore_suspended_devices(int ignore);
void init_error_message_produced(int error_message_produced);
void set_cmd_name(const char *cmd_name);
@@ -94,6 +95,7 @@ int lockingfailed(void);
int security_level(void);
int mirror_in_sync(void);
int ignore_suspended_devices(void);
int error_message_produced(void);
#define DMEVENTD_MONITOR_IGNORE -1
int dmeventd_monitor_mode(void);

View File

@@ -347,7 +347,7 @@ vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name,
/* pe_start and pe_end relate to any existing data so that new metadata
* areas can avoid overlap */
pv_t *pv_create(const struct format_type *fmt,
pv_t *pv_create(const struct cmd_context *cmd,
struct device *dev,
struct id *id,
uint64_t size,

View File

@@ -747,7 +747,7 @@ int vg_split_mdas(struct cmd_context *cmd __attribute((unused)),
* Note:
* FIXME - liblvm todo - tidy up arguments for external use (fmt, mdas, etc)
*/
pv_t *pv_create(const struct format_type *fmt,
pv_t *pv_create(const struct cmd_context *cmd,
struct device *dev,
struct id *id, uint64_t size,
uint64_t pe_start,
@@ -756,7 +756,7 @@ pv_t *pv_create(const struct format_type *fmt,
int pvmetadatacopies,
uint64_t pvmetadatasize, struct list *mdas)
{
return _pv_create(fmt, dev, id, size, pe_start,
return _pv_create(cmd->fmt, dev, id, size, pe_start,
existing_extent_count,
existing_extent_size,
pvmetadatacopies,
@@ -1213,10 +1213,11 @@ int vg_validate(struct volume_group *vg)
if ((lv_count = (uint32_t) list_size(&vg->lvs)) !=
vg->lv_count + 2 * vg->snapshot_count) {
log_debug("Internal error: #internal LVs (%u) != #LVs (%"
log_error("Internal error: #internal LVs (%u) != #LVs (%"
PRIu32 ") + 2 * #snapshots (%" PRIu32 ") in VG %s",
list_size(&vg->lvs), vg->lv_count,
vg->snapshot_count, vg->name);
r = 0;
}
list_iterate_items(lvl, &vg->lvs) {
@@ -1530,16 +1531,16 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
if (use_precommitted && !(fmt->features & FMT_PRECOMMIT))
use_precommitted = 0;
/* Store pvids for later so we can check if any are missing */
if (!(pvids = lvmcache_get_pvids(cmd, vgname, vgid)))
return_NULL;
/* create format instance with appropriate metadata area */
if (!(fid = fmt->ops->create_instance(fmt, vgname, vgid, NULL))) {
log_error("Failed to create format instance");
return NULL;
}
/* Store pvids for later so we can check if any are missing */
if (!(pvids = lvmcache_get_pvids(cmd, vgname, vgid)))
return_NULL;
/* Ensure contents of all metadata areas match - else do recovery */
list_iterate_items(mda, &fid->metadata_areas) {
if ((use_precommitted &&
@@ -1919,7 +1920,7 @@ struct list *get_vgids(struct cmd_context *cmd, int full_scan)
static int _get_pvs(struct cmd_context *cmd, struct list **pvslist)
{
struct str_list *strl;
struct list *results;
struct list * uninitialized_var(results);
const char *vgname, *vgid;
struct list *pvh, *tmp;
struct list *vgids;

View File

@@ -1,6 +1,6 @@
/*
* Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
* Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -1344,7 +1344,8 @@ int add_mirror_images(struct cmd_context *cmd, struct logical_volume *lv,
struct alloc_handle *ah;
const struct segment_type *segtype;
struct list *parallel_areas;
struct logical_volume **img_lvs, *log_lv;
struct logical_volume **img_lvs;
struct logical_volume *log_lv = NULL;
if (stripes > 1) {
log_error("stripes > 1 is not supported");
@@ -1416,8 +1417,8 @@ int add_mirror_images(struct cmd_context *cmd, struct logical_volume *lv,
return 1;
out_remove_log:
if (!lv_remove(log_lv) || !vg_write(log_lv->vg) ||
(backup(log_lv->vg), !vg_commit(log_lv->vg)))
if (log_lv && (!lv_remove(log_lv) || !vg_write(log_lv->vg) ||
(backup(log_lv->vg), !vg_commit(log_lv->vg))))
log_error("Manual intervention may be required to remove "
"abandoned log LV before retrying.");

View File

@@ -36,8 +36,7 @@
/* Define to 1 if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
/* Define to 1 if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
/* Define to 1 if you have the <dlfcn.h> header file. */
@@ -49,6 +48,9 @@
/* Define to 1 if you have the `dup2' function. */
#undef HAVE_DUP2
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
@@ -61,7 +63,7 @@
/* Define to 1 if you have the `getmntent' function. */
#undef HAVE_GETMNTENT
/* Define to 1 to if getopt_long is available. */
/* Define to 1 if getopt_long is available. */
#undef HAVE_GETOPTLONG
/* Define to 1 if you have the <getopt.h> header file. */
@@ -171,6 +173,9 @@
/* Define to 1 if you have the <selinux/selinux.h> header file. */
#undef HAVE_SELINUX_SELINUX_H
/* Define to 1 if sepol_check_context is available. */
#undef HAVE_SEPOL
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
@@ -184,6 +189,9 @@
zero-length file name argument. */
#undef HAVE_STAT_EMPTY_STRING_BUG
/* Define to 1 if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
@@ -270,6 +278,9 @@
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/statvfs.h> header file. */
#undef HAVE_SYS_STATVFS_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
@@ -291,6 +302,9 @@
/* Define to 1 if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H
/* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H

View File

@@ -25,4 +25,6 @@
(void) (&_a == &_b); \
_a > _b ? _a : _b; })
#define uninitialized_var(x) x = x
#endif

View File

@@ -1077,7 +1077,8 @@ static struct dm_report_field_type _fields[] = {
void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
report_type_t *report_type, const char *separator,
int aligned, int buffered, int headings, int field_prefixes)
int aligned, int buffered, int headings, int field_prefixes,
int quoted, int columns_as_rows)
{
uint32_t report_flags = 0;
void *rh;
@@ -1091,9 +1092,21 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
if (headings)
report_flags |= DM_REPORT_OUTPUT_HEADINGS;
if (field_prefixes)
report_flags |= DM_REPORT_OUTPUT_FIELD_NAME_PREFIX;
if (!quoted)
report_flags |= DM_REPORT_OUTPUT_FIELD_UNQUOTED;
if (columns_as_rows)
report_flags |= DM_REPORT_OUTPUT_COLUMNS_AS_ROWS;
rh = dm_report_init(report_type, _report_types, _fields, format,
separator, report_flags, keys, cmd);
if (field_prefixes)
dm_report_set_output_field_name_prefix(rh, "lvm2_");
return rh;
}

View File

@@ -28,7 +28,8 @@ typedef int (*field_report_fn) (struct report_handle * dh, struct field * field,
void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
report_type_t *report_type, const char *separator,
int aligned, int buffered, int headings, int field_prefixes);
int aligned, int buffered, int headings, int field_prefixes,
int quoted, int columns_as_rows);
void report_free(void *handle);
int report_object(void *handle, struct volume_group *vg,
struct logical_volume *lv, struct physical_volume *pv,

View File

@@ -43,8 +43,8 @@ else
endif
VERSIONED_SHLIB = libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION)
DEFS += -DDEVICE_UID=@DEVICE_UID@ -DDEVICE_GID=@DEVICE_GID@ \
-DDEVICE_MODE=@DEVICE_MODE@
DEFS += -DDM_DEVICE_UID=@DM_DEVICE_UID@ -DDM_DEVICE_GID=@DM_DEVICE_GID@ \
-DDM_DEVICE_MODE=@DM_DEVICE_MODE@
include ../make.tmpl

View File

@@ -740,6 +740,8 @@ struct dm_report_field_type {
#define DM_REPORT_OUTPUT_BUFFERED 0x00000002
#define DM_REPORT_OUTPUT_HEADINGS 0x00000004
#define DM_REPORT_OUTPUT_FIELD_NAME_PREFIX 0x00000008
#define DM_REPORT_OUTPUT_FIELD_UNQUOTED 0x00000010
#define DM_REPORT_OUTPUT_COLUMNS_AS_ROWS 0x00000020
struct dm_report *dm_report_init(uint32_t *report_types,
const struct dm_report_object_type *types,

View File

@@ -120,9 +120,9 @@ struct dm_task *dm_task_create(int type)
dmt->type = type;
dmt->minor = -1;
dmt->major = -1;
dmt->uid = DEVICE_UID;
dmt->gid = DEVICE_GID;
dmt->mode = DEVICE_MODE;
dmt->uid = DM_DEVICE_UID;
dmt->gid = DM_DEVICE_GID;
dmt->mode = DM_DEVICE_MODE;
dmt->no_open_count = 0;
dmt->read_ahead = DM_READ_AHEAD_AUTO;
dmt->read_ahead_flags = 0;

View File

@@ -937,7 +937,7 @@ static int _suspend_node(const char *name, uint32_t major, uint32_t minor,
log_verbose("Suspending %s (%" PRIu32 ":%" PRIu32 ")%s%s",
name, major, minor,
skip_lockfs ? "" : " with filesystem sync",
no_flush ? "" : " without device flush");
no_flush ? "" : " with device flush");
if (!(dmt = dm_task_create(DM_DEVICE_SUSPEND))) {
log_error("Suspend dm_task creation failed for %s", name);

View File

@@ -513,6 +513,14 @@ struct dm_report *dm_report_init(uint32_t *report_types,
rh->flags |= output_flags & DM_REPORT_OUTPUT_MASK;
/* With columns_as_rows we must buffer and not align. */
if (output_flags & DM_REPORT_OUTPUT_COLUMNS_AS_ROWS) {
if (!(output_flags & DM_REPORT_OUTPUT_BUFFERED))
rh->flags |= DM_REPORT_OUTPUT_BUFFERED;
if (output_flags & DM_REPORT_OUTPUT_ALIGNED)
rh->flags &= ~DM_REPORT_OUTPUT_ALIGNED;
}
if (output_flags & DM_REPORT_OUTPUT_BUFFERED)
rh->flags |= RH_SORT_REQUIRED;
@@ -793,23 +801,152 @@ static int _sort_rows(struct dm_report *rh)
/*
* Produce report output
*/
int dm_report_output(struct dm_report *rh)
static int _output_field(struct dm_report *rh, struct dm_report_field *field)
{
char *field_id;
int32_t width;
uint32_t align;
const char *repstr;
char buf[4096];
if (rh->flags & DM_REPORT_OUTPUT_FIELD_NAME_PREFIX) {
if (!(field_id = strdup(rh->fields[field->props->field_num].id))) {
log_error("dm_report: Failed to copy field name");
return 0;
}
if (!dm_pool_grow_object(rh->mem, rh->output_field_name_prefix, 0)) {
log_error("dm_report: Unable to extend output line");
return 0;
}
if (!dm_pool_grow_object(rh->mem, _toupperstr(field_id), 0)) {
log_error("dm_report: Unable to extend output line");
return 0;
}
free(field_id);
if (!dm_pool_grow_object(rh->mem, "=", 1)) {
log_error("dm_report: Unable to extend output line");
return 0;
}
if (!(rh->flags & DM_REPORT_OUTPUT_FIELD_UNQUOTED) &&
!dm_pool_grow_object(rh->mem, "\'", 1)) {
log_error("dm_report: Unable to extend output line");
return 0;
}
}
repstr = field->report_string;
width = field->props->width;
if (!(rh->flags & DM_REPORT_OUTPUT_ALIGNED)) {
if (!dm_pool_grow_object(rh->mem, repstr, 0)) {
log_error("dm_report: Unable to extend output line");
return 0;
}
} else {
if (!(align = field->props->flags & DM_REPORT_FIELD_ALIGN_MASK))
align = (field->props->flags & DM_REPORT_FIELD_TYPE_NUMBER) ?
DM_REPORT_FIELD_ALIGN_RIGHT : DM_REPORT_FIELD_ALIGN_LEFT;
if (align & DM_REPORT_FIELD_ALIGN_LEFT) {
if (dm_snprintf(buf, sizeof(buf), "%-*.*s",
width, width, repstr) < 0) {
log_error("dm_report: left-aligned snprintf() failed");
return 0;
}
if (!dm_pool_grow_object(rh->mem, buf, width)) {
log_error("dm_report: Unable to extend output line");
return 0;
}
} else if (align & DM_REPORT_FIELD_ALIGN_RIGHT) {
if (dm_snprintf(buf, sizeof(buf), "%*.*s",
width, width, repstr) < 0) {
log_error("dm_report: right-aligned snprintf() failed");
return 0;
}
if (!dm_pool_grow_object(rh->mem, buf, width)) {
log_error("dm_report: Unable to extend output line");
return 0;
}
}
}
if ((rh->flags & DM_REPORT_OUTPUT_FIELD_NAME_PREFIX) &&
!(rh->flags & DM_REPORT_OUTPUT_FIELD_UNQUOTED))
if (!dm_pool_grow_object(rh->mem, "\'", 1)) {
log_error("dm_report: Unable to extend output line");
return 0;
}
return 1;
}
static int _output_as_rows(struct dm_report *rh)
{
struct field_properties *fp;
struct dm_report_field *field;
struct row *row;
if (!dm_pool_begin_object(rh->mem, 512)) {
log_error("dm_report: Unable to allocate output line");
return 0;
}
list_iterate_items(fp, &rh->field_props) {
if (fp->flags & FLD_HIDDEN) {
list_iterate_items(row, &rh->rows) {
field = list_item(list_first(&row->fields), struct dm_report_field);
list_del(&field->list);
}
continue;
}
if ((rh->flags & DM_REPORT_OUTPUT_HEADINGS)) {
if (!dm_pool_grow_object(rh->mem, rh->fields[fp->field_num].heading, 0)) {
log_error("dm_report: Failed to extend row for field name");
goto bad;
}
if (!dm_pool_grow_object(rh->mem, rh->separator, 0)) {
log_error("dm_report: Failed to extend row with separator");
goto bad;
}
}
list_iterate_items(row, &rh->rows) {
if ((field = list_item(list_first(&row->fields), struct dm_report_field))) {
if (!_output_field(rh, field))
goto bad;
list_del(&field->list);
}
if (!list_end(&rh->rows, &row->list))
if (!dm_pool_grow_object(rh->mem, rh->separator, 0)) {
log_error("dm_report: Unable to extend output line");
goto bad;
}
}
if (!dm_pool_grow_object(rh->mem, "\0", 1)) {
log_error("dm_report: Failed to terminate row");
goto bad;
}
log_print("%s", (char *) dm_pool_end_object(rh->mem));
}
return 1;
bad:
dm_pool_abandon_object(rh->mem);
return 0;
}
static int _output_as_columns(struct dm_report *rh)
{
struct list *fh, *rowh, *ftmp, *rtmp;
struct row *row = NULL;
struct dm_report_field *field;
const char *repstr;
char *field_id;
char buf[4096];
int32_t width;
uint32_t align;
if (list_empty(&rh->rows))
return 1;
/* Sort rows */
if ((rh->flags & RH_SORT_REQUIRED))
_sort_rows(rh);
/* If headings not printed yet, calculate field widths and print them */
if (!(rh->flags & RH_HEADINGS_PRINTED))
@@ -827,75 +964,15 @@ int dm_report_output(struct dm_report *rh)
if (field->props->flags & FLD_HIDDEN)
continue;
if (rh->flags & DM_REPORT_OUTPUT_FIELD_NAME_PREFIX) {
if (!(field_id = strdup(rh->fields[field->props->field_num].id))) {
log_error("dm_report: Failed to copy field name");
goto bad;
}
if (!_output_field(rh, field))
goto bad;
if (!dm_pool_grow_object(rh->mem, rh->output_field_name_prefix, 0)) {
log_error("dm_report: Unable to extend output line");
goto bad;
}
if (!dm_pool_grow_object(rh->mem, _toupperstr(field_id), 0)) {
log_error("dm_report: Unable to extend output line");
goto bad;
}
free(field_id);
if (!dm_pool_grow_object(rh->mem, "=\'", 2)) {
log_error("dm_report: Unable to extend output line");
goto bad;
}
}
repstr = field->report_string;
width = field->props->width;
if (!(rh->flags & DM_REPORT_OUTPUT_ALIGNED)) {
if (!dm_pool_grow_object(rh->mem, repstr, 0)) {
log_error("dm_report: Unable to extend output line");
goto bad;
}
} else {
if (!(align = field->props->flags & DM_REPORT_FIELD_ALIGN_MASK))
align = (field->props->flags & DM_REPORT_FIELD_TYPE_NUMBER) ?
DM_REPORT_FIELD_ALIGN_RIGHT : DM_REPORT_FIELD_ALIGN_LEFT;
if (align & DM_REPORT_FIELD_ALIGN_LEFT) {
if (dm_snprintf(buf, sizeof(buf), "%-*.*s",
width, width, repstr) < 0) {
log_error("dm_report: left-aligned snprintf() failed");
goto bad;
}
if (!dm_pool_grow_object(rh->mem, buf, width)) {
log_error("dm_report: Unable to extend output line");
goto bad;
}
} else if (align & DM_REPORT_FIELD_ALIGN_RIGHT) {
if (dm_snprintf(buf, sizeof(buf), "%*.*s",
width, width, repstr) < 0) {
log_error("dm_report: right-aligned snprintf() failed");
goto bad;
}
if (!dm_pool_grow_object(rh->mem, buf, width)) {
log_error("dm_report: Unable to extend output line");
goto bad;
}
}
}
if (rh->flags & DM_REPORT_OUTPUT_FIELD_NAME_PREFIX)
if (!dm_pool_grow_object(rh->mem, "\'", 1)) {
log_error("dm_report: Unable to extend output line");
goto bad;
}
if (!list_end(&row->fields, fh))
if (!dm_pool_grow_object(rh->mem, rh->separator, 0)) {
log_error("dm_report: Unable to extend output line");
goto bad;
}
list_del(&field->list);
}
if (!dm_pool_grow_object(rh->mem, "\0", 1)) {
@@ -915,3 +992,17 @@ int dm_report_output(struct dm_report *rh)
dm_pool_abandon_object(rh->mem);
return 0;
}
int dm_report_output(struct dm_report *rh)
{
if (list_empty(&rh->rows))
return 1;
if ((rh->flags & RH_SORT_REQUIRED))
_sort_rows(rh);
if ((rh->flags & DM_REPORT_OUTPUT_COLUMNS_AS_ROWS))
return _output_as_rows(rh);
else
return _output_as_columns(rh);
}

View File

@@ -40,7 +40,7 @@ struct memblock {
const char *file; /* File that allocated */
int line; /* Line that allocated */
void *magic; /* Address of this block */
};
} __attribute__((aligned(8)));
static struct {
unsigned block_serialno;/* Non-decreasing serialno of block */

View File

@@ -1,7 +1,7 @@
# @configure_input@
#
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
# Copyright (C) 2004 Red Hat, Inc. All rights reserved.
# Copyright (C) 2004, 2008 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#

View File

@@ -11,7 +11,7 @@ lvcreate \- create a logical volume in an existing volume group
{\-l/\-\-extents LogicalExtentsNumber[%{VG|PVS|FREE}] |
\-L/\-\-size LogicalVolumeSize[kKmMgGtT]}
[\-M/\-\-persistent y/n] [\-\-minor minor]
[\-m/\-\-mirrors Mirrors [\-\-nosync] [\-\-mirrorlog {disk|log}] [\-\-corelog]
[\-m/\-\-mirrors Mirrors [\-\-nosync] [\-\-mirrorlog {disk|core}] [\-\-corelog]
[\-R/\-\-regionsize MirrorLogRegionSize]]
[\-n/\-\-name LogicalVolumeName]
[\-p/\-\-permission r/rw] [\-r/\-\-readahead ReadAheadSectors|auto|none]

61
test/t-lvmcache-exercise.sh Executable file
View File

@@ -0,0 +1,61 @@
#!/bin/sh
# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
test_description='Test lvmcache operation'
privileges_required_=1
. ./test-lib.sh
cleanup_()
{
test -n "$d1" && losetup -d "$d1"
test -n "$d2" && losetup -d "$d2"
test -n "$d3" && losetup -d "$d3"
test -n "$d4" && losetup -d "$d4"
test -n "$d5" && losetup -d "$d5"
rm -f "$f1" "$f2" "$f3" "$f4" "$f5"
}
# FIXME: paramaterize lvm1 vs lvm2 metadata; most of these tests should run
# fine with lvm1 metadata as well; for now, just add disks 5 and 6 as lvm1
# metadata
test_expect_success \
'set up temp files, loopback devices, PVs, vgnames' \
'f1=$(pwd)/1 && d1=$(loop_setup_ "$f1") &&
f2=$(pwd)/2 && d2=$(loop_setup_ "$f2") &&
f3=$(pwd)/3 && d3=$(loop_setup_ "$f3") &&
f4=$(pwd)/4 && d4=$(loop_setup_ "$f4") &&
f5=$(pwd)/5 && d5=$(loop_setup_ "$f5") &&
vg1=$(this_test_)-test-vg1-$$ &&
vg2=$(this_test_)-test-vg2-$$ &&
lv1=$(this_test_)-test-lv1-$$ &&
lv2=$(this_test_)-test-lv2-$$ &&
lv3=$(this_test_)-test-lv3-$$ &&
pvcreate $d1 $d2 $d3 $d4 $d5'
#
# Duplicate vg name should cause warnings (but not segfault!)
#
test_expect_success \
"Duplicate vg name might cause warnings but should succeed" \
'vgcreate $vg1 $d1 &&
vgcreate $vg2 $d3 &&
losetup -d $d1 &&
vgcreate $vg1 $d2 &&
losetup $d1 $f1 &&
pvs &&
pvs'
test_done
# Local Variables:
# indent-tabs-mode: nil
# End:

68
test/t-read-ahead.sh Executable file
View File

@@ -0,0 +1,68 @@
#!/bin/sh
# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# tests basic functionality of read-ahead and ra regressions
#
test_description='Test read-ahead functionality'
privileges_required_=1
. ./test-lib.sh
cleanup_()
{
test -n "$d1" && losetup -d "$d1"
test -n "$d2" && losetup -d "$d2"
test -n "$d3" && losetup -d "$d3"
test -n "$d4" && losetup -d "$d4"
test -n "$d5" && losetup -d "$d5"
rm -f "$f1" "$f2" "$f3" "$f4" "$f5"
}
get_lvs_()
{
case $(lvs --units s --nosuffix --noheadings -o $1_read_ahead "$vg"/"$lv") in
*$2) true ;;
*) false ;;
esac
}
test_expect_success "set up temp files, loopback devices" \
'f1=$(pwd)/1 && d1=$(loop_setup_ "$f1") &&
f2=$(pwd)/2 && d2=$(loop_setup_ "$f2") &&
f3=$(pwd)/3 && d3=$(loop_setup_ "$f3") &&
f4=$(pwd)/4 && d4=$(loop_setup_ "$f4") &&
f5=$(pwd)/5 && d5=$(loop_setup_ "$f5") &&
vg=$(this_test_)-test-vg-$$ &&
lv=$(this_test_)-test-lv-$$'
test_expect_success "test various read ahead settings" \
'pvcreate "$d1" &&
pvcreate "$d2" &&
pvcreate "$d3" &&
pvcreate "$d4" &&
pvcreate "$d5" &&
vgcreate -c n "$vg" "$d1" "$d2" "$d3" "$d4" "$d5" &&
lvcreate -n "$lv" -l 100%FREE -i5 -I256 "$vg" &&
lvdisplay "$vg"/"$lv" &&
lvchange -r auto "$vg"/"$lv" || true | grep auto &&
get_lvs_ lv auto &&
get_lvs_ lv_kernel 5120 &&
lvchange -r 400 "$vg/$lv" &&
get_lvs_ lv 400 &&
vgremove -f "$vg"'
test_done
# Local Variables:
# indent-tabs-mode: nil
# End:

View File

@@ -53,7 +53,9 @@ arg(monitor_ARG, '\0', "monitor", yes_no_arg, 0)
arg(config_ARG, '\0', "config", string_arg, 0)
arg(trustcache_ARG, '\0', "trustcache", NULL, 0)
arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", NULL, 0)
arg(prefixes_ARG, '\0', "prefixes", NULL, 0)
arg(nameprefixes_ARG, '\0', "nameprefixes", NULL, 0)
arg(unquoted_ARG, '\0', "unquoted", NULL, 0)
arg(rows_ARG, '\0', "rows", NULL, 0)
/* Allow some variations */
arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0)

View File

@@ -217,6 +217,7 @@ xx(lvextend,
"\t[-A|--autobackup y|n]\n"
"\t[--alloc AllocationPolicy]\n"
"\t[-d|--debug]\n"
"\t[-f|--force]\n"
"\t[-h|--help]\n"
"\t[-i|--stripes Stripes [-I|--stripesize StripeSize]]\n"
"\t{-l|--extents [+]LogicalExtentsNumber[%{VG|PVS|FREE}] |\n"
@@ -230,9 +231,9 @@ xx(lvextend,
"\t[--version]" "\n"
"\tLogicalVolume[Path] [ PhysicalVolumePath... ]\n",
alloc_ARG, autobackup_ARG, extents_ARG, mirrors_ARG, nofsck_ARG,
resizefs_ARG, size_ARG, stripes_ARG, stripesize_ARG, test_ARG,
type_ARG)
alloc_ARG, autobackup_ARG, extents_ARG, force_ARG, mirrors_ARG,
nofsck_ARG, resizefs_ARG, size_ARG, stripes_ARG, stripesize_ARG,
test_ARG, type_ARG)
xx(lvmchange,
"With the device mapper, this is obsolete and does nothing.",
@@ -339,6 +340,7 @@ xx(lvresize,
"\t[-A|--autobackup y|n]\n"
"\t[--alloc AllocationPolicy]\n"
"\t[-d|--debug]\n"
"\t[-f|--force]\n"
"\t[-h|--help]\n"
"\t[-i|--stripes Stripes [-I|--stripesize StripeSize]]\n"
"\t{-l|--extents [+|-]LogicalExtentsNumber[%{VG|LV|PVS|FREE}] |\n"
@@ -351,8 +353,9 @@ xx(lvresize,
"\t[--version]" "\n"
"\tLogicalVolume[Path] [ PhysicalVolumePath... ]\n",
alloc_ARG, autobackup_ARG, extents_ARG, nofsck_ARG, resizefs_ARG,
size_ARG, stripes_ARG, stripesize_ARG, test_ARG, type_ARG)
alloc_ARG, autobackup_ARG, extents_ARG, force_ARG, nofsck_ARG,
resizefs_ARG, size_ARG, stripes_ARG, stripesize_ARG, test_ARG,
type_ARG)
xx(lvs,
"Display information about logical volumes",
@@ -363,24 +366,27 @@ xx(lvs,
"\t[-d|--debug]\n"
"\t[-h|--help]\n"
"\t[--ignorelockingfailure]\n"
"\t[--nameprefixes]\n"
"\t[--noheadings]\n"
"\t[--nosuffix]\n"
"\t[-o|--options [+]Field[,Field]]\n"
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
"\t[-P|--partial] " "\n"
"\t[--rows]\n"
"\t[--segments]\n"
"\t[--separator Separator]\n"
"\t[--trustcache]\n"
"\t[--unbuffered]\n"
"\t[--units hsbkmgtHKMGT]\n"
"\t[--unquoted]\n"
"\t[-v|--verbose]\n"
"\t[--version]" "\n"
"\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n",
aligned_ARG, all_ARG, ignorelockingfailure_ARG, noheadings_ARG,
nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
segments_ARG, separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG,
units_ARG)
aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG,
noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
rows_ARG, segments_ARG, separator_ARG, sort_ARG, trustcache_ARG,
unbuffered_ARG, units_ARG, unquoted_ARG)
xx(lvscan,
"List all logical volumes in all volume groups",
@@ -570,25 +576,28 @@ xx(pvs,
"\t[-a|--all]\n"
"\t[-d|--debug]" "\n"
"\t[-h|-?|--help] " "\n"
"\t[--noheadings]\n"
"\t[--ignorelockingfailure]\n"
"\t[--nameprefixes]\n"
"\t[--noheadings]\n"
"\t[--nosuffix]\n"
"\t[-o|--options [+]Field[,Field]]\n"
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
"\t[-P|--partial] " "\n"
"\t[--rows]\n"
"\t[--segments]\n"
"\t[--separator Separator]\n"
"\t[--trustcache]\n"
"\t[--unbuffered]\n"
"\t[--units hsbkmgtHKMGT]\n"
"\t[--unquoted]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
"\t[PhysicalVolume [PhysicalVolume...]]\n",
aligned_ARG, all_ARG, ignorelockingfailure_ARG, noheadings_ARG,
nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
segments_ARG, separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG,
units_ARG)
aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG,
noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
rows_ARG, segments_ARG, separator_ARG, sort_ARG, trustcache_ARG,
unbuffered_ARG, units_ARG, unquoted_ARG)
xx(pvscan,
"List all physical volumes",
@@ -887,22 +896,26 @@ xx(vgs,
"\t[-d|--debug]\n"
"\t[-h|--help]\n"
"\t[--ignorelockingfailure]\n"
"\t[--nameprefixes]\n"
"\t[--noheadings]\n"
"\t[--nosuffix]\n"
"\t[-o|--options [+]Field[,Field]]\n"
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
"\t[-P|--partial] " "\n"
"\t[--rows]\n"
"\t[--separator Separator]\n"
"\t[--trustcache]\n"
"\t[--unbuffered]\n"
"\t[--units hsbkmgtHKMGT]\n"
"\t[--unquoted]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
"\t[VolumeGroupName [VolumeGroupName...]]\n",
aligned_ARG, all_ARG, ignorelockingfailure_ARG, noheadings_ARG,
nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG)
aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG,
noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
rows_ARG, separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG,
unquoted_ARG)
xx(vgscan,
"Search for all volume groups",

View File

@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
* Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
* Copyright (C) 2005-2007 NEC Corporation
*
* This file is part of the device-mapper userspace tools.
@@ -122,6 +122,7 @@ enum {
NOTABLE_ARG,
OPTIONS_ARG,
READAHEAD_ARG,
ROWS_ARG,
SEPARATOR_ARG,
SHOWKEYS_ARG,
SORT_ARG,
@@ -130,6 +131,7 @@ enum {
TREE_ARG,
UID_ARG,
UNBUFFERED_ARG,
UNQUOTED_ARG,
UUID_ARG,
VERBOSE_ARG,
VERSION_ARG,
@@ -1927,7 +1929,7 @@ static const struct dm_report_object_type _report_types[] = {
};
/* Column definitions */
#define OFFSET_OF(strct, field) ((unsigned int) &((struct strct *)NULL)->field)
#define OFFSET_OF(strct, field) (((char*)&((struct strct*)0)->field) - (char*)0)
#define STR (DM_REPORT_FIELD_TYPE_STRING)
#define NUM (DM_REPORT_FIELD_TYPE_NUMBER)
#define FIELD_O(type, strct, sorttype, head, field, width, func, id, desc) {DR_ ## type, sorttype, OFFSET_OF(strct, field), width, id, head, &_ ## func ## _disp, desc},
@@ -1976,6 +1978,7 @@ static int _report_init(struct command *c)
const char *keys = "";
const char *separator = " ";
int aligned = 1, headings = 1, buffered = 1, field_prefixes = 0;
int quoted = 1, columns_as_rows = 0;
uint32_t flags = 0;
size_t len = 0;
int r = 0;
@@ -1990,6 +1993,12 @@ static int _report_init(struct command *c)
if (_switches[UNBUFFERED_ARG])
buffered = 0;
if (_switches[ROWS_ARG])
columns_as_rows = 1;
if (_switches[UNQUOTED_ARG])
quoted = 0;
if (_switches[NAMEPREFIXES_ARG]) {
aligned = 0;
field_prefixes = 1;
@@ -2040,6 +2049,12 @@ static int _report_init(struct command *c)
if (field_prefixes)
flags |= DM_REPORT_OUTPUT_FIELD_NAME_PREFIX;
if (!quoted)
flags |= DM_REPORT_OUTPUT_FIELD_UNQUOTED;
if (columns_as_rows)
flags |= DM_REPORT_OUTPUT_COLUMNS_AS_ROWS;
if (!(_report = dm_report_init(&_report_type,
_report_types, _report_fields,
options, separator, flags, keys, NULL)))
@@ -2483,6 +2498,7 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir)
{"notable", 0, &ind, NOTABLE_ARG},
{"options", 1, &ind, OPTIONS_ARG},
{"readahead", 1, &ind, READAHEAD_ARG},
{"rows", 0, &ind, ROWS_ARG},
{"separator", 1, &ind, SEPARATOR_ARG},
{"showkeys", 0, &ind, SHOWKEYS_ARG},
{"sort", 1, &ind, SORT_ARG},
@@ -2492,6 +2508,7 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir)
{"uid", 1, &ind, UID_ARG},
{"uuid", 1, &ind, UUID_ARG},
{"unbuffered", 0, &ind, UNBUFFERED_ARG},
{"unquoted", 0, &ind, UNQUOTED_ARG},
{"verbose", 1, &ind, VERBOSE_ARG},
{"version", 0, &ind, VERSION_ARG},
{0, 0, 0, 0}
@@ -2638,6 +2655,8 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir)
}
}
}
if ((ind == ROWS_ARG))
_switches[ROWS_ARG]++;
if ((ind == SHOWKEYS_ARG))
_switches[SHOWKEYS_ARG]++;
if ((ind == TABLE_ARG)) {
@@ -2646,8 +2665,8 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir)
}
if ((ind == TREE_ARG))
_switches[TREE_ARG]++;
if ((ind == UNBUFFERED_ARG))
_switches[UNBUFFERED_ARG]++;
if ((ind == UNQUOTED_ARG))
_switches[UNQUOTED_ARG]++;
if ((ind == VERSION_ARG))
_switches[VERSION_ARG]++;
}

View File

@@ -387,8 +387,11 @@ static int lvchange_readahead(struct cmd_context *cmd,
}
if (lv->read_ahead == read_ahead) {
log_error("Read ahead is already %u for \"%s\"",
read_ahead, lv->name);
if (read_ahead == DM_READ_AHEAD_AUTO)
log_error("Read ahead is already auto for \"%s\"", lv->name);
else
log_error("Read ahead is already %u for \"%s\"",
read_ahead, lv->name);
return 0;
}

View File

@@ -236,6 +236,10 @@ int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline)
log_error("No such command '%s'. Try 'help'.",
argv[0]);
if ((ret != ECMD_PROCESSED) && !error_message_produced()) {
log_debug("Internal error: Failed command did not use log_error");
log_error("Command failed with status code %d.", ret);
}
_write_history();
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
* Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -79,9 +79,10 @@ int lvm2_run(void *handle, const char *cmdline)
}
/* FIXME Temporary - move to libdevmapper */
ret = ECMD_PROCESSED;
if (!strcmp(cmdline, "_memlock_inc"))
memlock_inc();
if (!strcmp(cmdline, "_memlock_dec"))
else if (!strcmp(cmdline, "_memlock_dec"))
memlock_dec();
else
ret = lvm_run_command(cmd, argc, argv);

View File

@@ -875,6 +875,8 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
int ret = 0;
int locking_type;
init_error_message_produced(0);
/* each command should start out with sigint flag cleared */
sigint_clear();
@@ -1096,7 +1098,14 @@ static int _run_script(struct cmd_context *cmd, int argc, char **argv)
continue;
if (!strcmp(argv[0], "quit") || !strcmp(argv[0], "exit"))
break;
lvm_run_command(cmd, argc, argv);
ret = lvm_run_command(cmd, argc, argv);
if (ret != ECMD_PROCESSED) {
if (!error_message_produced()) {
log_debug("Internal error: Failed command did not use log_error");
log_error("Command failed with status code %d.", ret);
}
break;
}
}
if (fclose(script))
@@ -1218,6 +1227,11 @@ int lvm2_main(int argc, char **argv, unsigned is_static)
if (ret == ENO_SUCH_CMD)
log_error("No such command. Try 'help'.");
if ((ret != ECMD_PROCESSED) && !error_message_produced()) {
log_debug("Internal error: Failed command did not use log_error");
log_error("Command failed with status code %d.", ret);
}
out:
lvm_fin(cmd);
if (ret == ECMD_PROCESSED)

View File

@@ -225,7 +225,7 @@ static int pvcreate_single(struct cmd_context *cmd, const char *pv_name,
}
list_init(&mdas);
if (!(pv = pv_create(cmd->fmt, dev, idp, size, pe_start,
if (!(pv = pv_create(cmd, dev, idp, size, pe_start,
extent_count, extent_size,
pvmetadatacopies, pvmetadatasize, &mdas))) {
log_error("Failed to setup physical volume \"%s\"", pv_name);

View File

@@ -158,7 +158,8 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
char *str;
const char *keys = NULL, *options = NULL, *separator;
int r = ECMD_PROCESSED;
int aligned, buffered, headings, field_prefixes;
int aligned, buffered, headings, field_prefixes, quoted;
int columns_as_rows;
unsigned args_are_pvs;
aligned = find_config_tree_int(cmd, "report/aligned",
@@ -171,6 +172,10 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
DEFAULT_REP_SEPARATOR);
field_prefixes = find_config_tree_int(cmd, "report/prefixes",
DEFAULT_REP_PREFIXES);
quoted = find_config_tree_int(cmd, "report/quoted",
DEFAULT_REP_QUOTED);
columns_as_rows = find_config_tree_int(cmd, "report/columns_as_rows",
DEFAULT_REP_COLUMNS_AS_ROWS);
args_are_pvs = (report_type == PVS || report_type == PVSEGS) ? 1 : 0;
@@ -272,14 +277,19 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
buffered = 0;
if (arg_count(cmd, noheadings_ARG))
headings = 0;
if (arg_count(cmd, prefixes_ARG)) {
if (arg_count(cmd, nameprefixes_ARG)) {
aligned = 0;
field_prefixes = 1;
}
if (arg_count(cmd, unquoted_ARG))
quoted = 0;
if (arg_count(cmd, rows_ARG))
columns_as_rows = 1;
if (!(report_handle = report_init(cmd, options, keys, &report_type,
separator, aligned, buffered,
headings, field_prefixes))) {
headings, field_prefixes, quoted,
columns_as_rows))) {
stack;
return ECMD_FAILED;
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
* Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -145,7 +145,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd,
void *handle,
process_single_lv_fn_t process_single)
{
int ret_max = 0;
int ret_max = ECMD_PROCESSED;
int ret = 0;
unsigned process_all = 0;
unsigned process_lv = 0;
@@ -223,7 +223,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
void *handle))
{
int opt = 0;
int ret_max = 0;
int ret_max = ECMD_PROCESSED;
int ret = 0;
int consistent;
@@ -404,7 +404,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
if (ret > ret_max)
ret_max = ret;
if (sigint_caught())
return ret_max;
break;
}
return ret_max;
@@ -421,7 +421,7 @@ int process_each_segment_in_pv(struct cmd_context *cmd,
{
struct pv_segment *pvseg;
const char *vg_name = NULL;
int ret_max = 0;
int ret_max = ECMD_PROCESSED;
int ret;
if (!vg && !is_orphan(pv)) {
@@ -456,7 +456,7 @@ int process_each_segment_in_lv(struct cmd_context *cmd,
void *handle))
{
struct lv_segment *seg;
int ret_max = 0;
int ret_max = ECMD_PROCESSED;
int ret;
list_iterate_items(seg, &lv->segments) {
@@ -464,7 +464,7 @@ int process_each_segment_in_lv(struct cmd_context *cmd,
if (ret > ret_max)
ret_max = ret;
if (sigint_caught())
return ret_max;
break;
}
return ret_max;
@@ -514,9 +514,6 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name,
ret_max = ret;
}
if (sigint_caught())
return ret_max;
unlock_vg(cmd, vg_name);
return ret_max;
@@ -530,7 +527,7 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
int consistent, void *handle))
{
int opt = 0;
int ret_max = 0;
int ret_max = ECMD_PROCESSED;
struct str_list *sl;
struct list *vgnames, *vgids;
@@ -616,7 +613,7 @@ int process_each_pv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
const struct list *tags, void *handle,
process_single_pv_fn_t process_single)
{
int ret_max = 0;
int ret_max = ECMD_PROCESSED;
int ret = 0;
struct pv_list *pvl;
@@ -645,7 +642,7 @@ static int _process_all_devs(struct cmd_context *cmd, void *handle,
struct dev_iter *iter;
struct device *dev;
int ret_max = 0;
int ret_max = ECMD_PROCESSED;
int ret = 0;
if (!scan_vgs_for_pvs(cmd)) {
@@ -687,7 +684,7 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
void *handle))
{
int opt = 0;
int ret_max = 0;
int ret_max = ECMD_PROCESSED;
int ret = 0;
struct pv_list *pvl;

View File

@@ -66,10 +66,14 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd,
if ((lv->status & SNAPSHOT) || lv_is_cow(lv))
continue;
/* Can't deactive a pvmove or log LV */
/* Only request activation of mirror LV */
if ((lv->status & MIRROR_IMAGE) || (lv->status & MIRROR_LOG))
continue;
/* Can't deactivate a pvmove LV */
/* FIXME There needs to be a controlled way of doing this */
if (((activate == CHANGE_AN) || (activate == CHANGE_ALN)) &&
((lv->status & PVMOVE) || (lv->status & MIRROR_LOG)))
((lv->status & PVMOVE) ))
continue;
if (activate == CHANGE_AN) {

View File

@@ -112,7 +112,7 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name,
+ pe_start - 1;
list_init(&mdas);
if (!(pv = pv_create(cmd->fmt, pv_dev(existing_pv),
if (!(pv = pv_create(cmd, pv_dev(existing_pv),
&existing_pv->id, size,
pe_start, pv_pe_count(existing_pv),
pv_pe_size(existing_pv), pvmetadatacopies,

View File

@@ -113,5 +113,5 @@ int vgdisplay(struct cmd_context *cmd, int argc, char **argv)
}
************/
return 0;
return ECMD_PROCESSED;
}

View File

@@ -49,6 +49,8 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
if (!archive(vg_from) || !archive(vg_to))
goto_bad;
drop_cached_metadata(vg_from);
/* Merge volume groups */
while (!list_empty(&vg_from->pvs)) {
struct list *pvh = vg_from->pvs.n;