master - thin: swap if branch
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=969c87fa5b6685...
Commit: 969c87fa5b66859567a2d6de2b6700ee795d8e59
Parent: f88f5a1ca3b0c77a2c353460ff35d802bbb05a34
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 4 11:25:41 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jul 4 13:33:41 2013 +0200
thin: swap if branch
Move shorter if branch in front.
Use buffer for _tmeta and _tdata names so too long name
of LV is earlier detected.
---
tools/lvconvert.c | 42 +++++++++++++++++++++---------------------
1 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index c2041c0..fff0188 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1991,13 +1991,12 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
{
int r = 0;
const char *old_name;
- int len = strlen(pool_lv->name) + 16; /* _tmeta, _tdata */
struct lv_segment *seg;
struct logical_volume *data_lv = pool_lv;
struct logical_volume *metadata_lv;
struct logical_volume *pool_metadata_lv;
struct logical_volume *external_lv = NULL;
- char metadata_name[len], data_name[len];
+ char metadata_name[NAME_LEN], data_name[NAME_LEN];
if (!lv_is_visible(pool_lv)) {
log_error("Can't convert internal LV %s/%s.",
@@ -2035,11 +2034,28 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
pool_lv->name) < 0) ||
(dm_snprintf(data_name, sizeof(data_name), "%s_tdata",
pool_lv->name) < 0)) {
- log_error("Failed to create lv names.");
+ log_error("Failed to create internal lv names, "
+ "thin pool name is too long.");
return 0;
}
- if (lp->pool_metadata_lv_name) {
+ if (!lp->pool_metadata_lv_name) {
+ if (!update_pool_params(cmd, lp->target_attr, lp->passed_args,
+ pool_lv->le_count, pool_lv->vg->extent_size,
+ &lp->chunk_size, &lp->discards,
+ &lp->poolmetadata_size))
+ return_0;
+
+ if (!get_stripe_params(cmd, &lp->stripes, &lp->stripe_size))
+ return_0;
+
+ if (!(metadata_lv = alloc_pool_metadata(pool_lv, metadata_name,
+ lp->read_ahead, lp->stripes,
+ lp->stripe_size,
+ lp->poolmetadata_size,
+ lp->alloc, lp->pvh)))
+ return_0;
+ } else {
if (!(metadata_lv = find_lv(pool_lv->vg, lp->pool_metadata_lv_name))) {
log_error("Unknown metadata LV %s.", lp->pool_metadata_lv_name);
return 0;
@@ -2135,22 +2151,6 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
&lp->chunk_size, &lp->discards,
&lp->poolmetadata_size))
return_0;
- } else {
- if (!update_pool_params(cmd, lp->target_attr, lp->passed_args,
- pool_lv->le_count, pool_lv->vg->extent_size,
- &lp->chunk_size, &lp->discards,
- &lp->poolmetadata_size))
- return_0;
-
- if (!get_stripe_params(cmd, &lp->stripes, &lp->stripe_size))
- return_0;
-
- if (!(metadata_lv = alloc_pool_metadata(pool_lv, metadata_name,
- lp->read_ahead, lp->stripes,
- lp->stripe_size,
- lp->poolmetadata_size,
- lp->alloc, lp->pvh)))
- return_0;
}
if (!deactivate_lv(cmd, metadata_lv)) {
@@ -2203,7 +2203,7 @@ mda_write:
/* Rename deactivated metadata LV to have _tmeta suffix */
/* Implicit checks if metadata_lv is visible */
- if (strcmp(metadata_lv->name, metadata_name) &&
+ if (!lp->pool_metadata_lv_name &&
!lv_rename_update(cmd, metadata_lv, metadata_name, 0))
return_0;
10 years, 10 months
master - thin: move alloc_pool_metadata
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f88f5a1ca3b0c7...
Commit: f88f5a1ca3b0c77a2c353460ff35d802bbb05a34
Parent: f88497079778b00fe5ed9a43d890af64d272c325
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 4 11:04:05 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jul 4 13:33:41 2013 +0200
thin: move alloc_pool_metadata
Move function from /tool to /lib to thin_manip.c
Since lvm2api will need to move many things into /lib anyway.
---
lib/metadata/metadata-exported.h | 5 ++++
lib/metadata/thin_manip.c | 40 ++++++++++++++++++++++++++++++++++
tools/lvconvert.c | 9 ++++---
tools/toollib.c | 44 --------------------------------------
tools/toollib.h | 5 ----
5 files changed, 50 insertions(+), 53 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 7b7ac3c..ee3ae66 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -657,6 +657,11 @@ int update_pool_params(struct cmd_context *cmd, unsigned attr, int passed_args,
uint64_t *pool_metadata_size);
int get_pool_discards(const char *str, thin_discards_t *discards);
const char *get_pool_discards_name(thin_discards_t discards);
+struct logical_volume *alloc_pool_metadata(struct logical_volume *pool_lv,
+ const char *name, uint32_t read_ahead,
+ uint32_t stripes, uint32_t stripe_size,
+ uint64_t size, alloc_policy_t alloc,
+ struct dm_list *pvh);
/*
* Activation options
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 4ff647a..f40fd74 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -681,3 +681,43 @@ const char *get_pool_discards_name(thin_discards_t discards)
return "unknown";
}
+
+struct logical_volume *alloc_pool_metadata(struct logical_volume *pool_lv,
+ const char *name, uint32_t read_ahead,
+ uint32_t stripes, uint32_t stripe_size,
+ uint64_t size, alloc_policy_t alloc,
+ struct dm_list *pvh)
+{
+ struct logical_volume *metadata_lv;
+ /* FIXME: Make lvm2api usable */
+ struct lvcreate_params lvc = {
+ .activate = CHANGE_ALY,
+ .alloc = alloc,
+ .lv_name = name,
+ .major = -1,
+ .minor = -1,
+ .permission = LVM_READ | LVM_WRITE,
+ .pvh = pvh,
+ .read_ahead = read_ahead,
+ .stripe_size = stripe_size,
+ .stripes = stripes,
+ .vg_name = pool_lv->vg->name,
+ .zero = 1,
+ };
+
+ dm_list_init(&lvc.tags);
+
+ if (!(lvc.extents = extents_from_size(pool_lv->vg->cmd, size,
+ pool_lv->vg->extent_size)))
+ return_0;
+
+ if (!(lvc.segtype = get_segtype_from_string(pool_lv->vg->cmd, "striped")))
+ return_0;
+
+ /* FIXME: allocate properly space for metadata_lv */
+
+ if (!(metadata_lv = lv_create_single(pool_lv->vg, &lvc)))
+ return_0;
+
+ return metadata_lv;
+}
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index ccc8420..c2041c0 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2145,10 +2145,11 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
if (!get_stripe_params(cmd, &lp->stripes, &lp->stripe_size))
return_0;
- if (!(metadata_lv = alloc_pool_metadata(pool_lv, lp->alloc, metadata_name,
- lp->pvh, lp->read_ahead,
- lp->stripes, lp->stripe_size,
- lp->poolmetadata_size)))
+ if (!(metadata_lv = alloc_pool_metadata(pool_lv, metadata_name,
+ lp->read_ahead, lp->stripes,
+ lp->stripe_size,
+ lp->poolmetadata_size,
+ lp->alloc, lp->pvh)))
return_0;
}
diff --git a/tools/toollib.c b/tools/toollib.c
index 1a6fbee..5db537f 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1601,50 +1601,6 @@ int get_pool_params(struct cmd_context *cmd,
return 1;
}
-struct logical_volume *alloc_pool_metadata(struct logical_volume *pool_lv,
- alloc_policy_t alloc,
- const char *name,
- struct dm_list *pvh,
- uint32_t read_ahead,
- uint32_t stripes,
- uint32_t stripe_size,
- uint64_t size)
-{
- struct logical_volume *metadata_lv;
- struct lvcreate_params lvc;
-
- /* FIXME: Make lvm2api usable */
- memset(&lvc, 0, sizeof(lvc));
-
- if (!(lvc.extents = extents_from_size(pool_lv->vg->cmd, size,
- pool_lv->vg->extent_size)))
- return_0;
-
- if (!(lvc.segtype = get_segtype_from_string(pool_lv->vg->cmd, "striped")))
- return_0;
-
- dm_list_init(&lvc.tags);
-
- /* FIXME: allocate properly space for metadata_lv */
- lvc.activate = CHANGE_ALY;
- lvc.alloc = alloc;
- lvc.lv_name = name;
- lvc.major = -1;
- lvc.minor = -1;
- lvc.permission = LVM_READ | LVM_WRITE;
- lvc.pvh = pvh;
- lvc.read_ahead = read_ahead;
- lvc.stripe_size = stripe_size;
- lvc.stripes = stripes;
- lvc.vg_name = pool_lv->vg->name;
- lvc.zero = 1;
-
- if (!(metadata_lv = lv_create_single(pool_lv->vg, &lvc)))
- return_0;
-
- return metadata_lv;
-}
-
/*
* Generic stripe parameter checks.
*/
diff --git a/tools/toollib.h b/tools/toollib.h
index 32884db..cfcb934 100644
--- a/tools/toollib.h
+++ b/tools/toollib.h
@@ -122,11 +122,6 @@ int get_pool_params(struct cmd_context *cmd,
uint64_t *pool_metadata_size,
int *zero);
-struct logical_volume *alloc_pool_metadata(struct logical_volume *pool_lv,
- alloc_policy_t alloc, const char *name,
- struct dm_list *pvh, uint32_t read_ahead,
- uint32_t stripes, uint32_t stripe_size,
- uint64_t size);
int get_stripe_params(struct cmd_context *cmd, uint32_t *stripes,
uint32_t *stripe_size);
10 years, 10 months
master - configure: revert /etc changes
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f88497079778b0...
Commit: f88497079778b00fe5ed9a43d890af64d272c325
Parent: 2c4f81634f2c53a0ca7a589dbba054ca0c2a4e75
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 4 11:52:25 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jul 4 13:33:41 2013 +0200
configure: revert /etc changes
The idea of using 'eprefix' unfortunatelly fails on /usr moved distros.
But there is also default --sysconfdir which is normaly set to /etc.
If unset it's PREFIX/etc.
For now revert.
FIXME: replace lvm vars with standard ones everyone is using.
---
configure | 6 +++---
configure.in | 8 +++++---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/configure b/configure
index fbe92a5..12272d1 100755
--- a/configure
+++ b/configure
@@ -1639,7 +1639,7 @@ Optional Packages:
--with-dmeventd-path=PATH
dmeventd path [[EPREFIX/sbin/dmeventd]]
--with-default-system-dir=DIR
- default LVM system directory [[EPREFIX/etc/lvm]]
+ default LVM system directory [[/etc/lvm]]
--with-default-profile-subdir=SUBDIR
default configuration profile subdir [[profile]]
--with-default-archive-subdir=SUBDIR
@@ -10066,7 +10066,7 @@ fi
if test "${with_confdir+set}" = set; then :
withval=$with_confdir; CONFDIR=$withval
else
- CONFDIR='${exec_prefix}/etc'
+ CONFDIR='/etc'
fi
@@ -10549,7 +10549,7 @@ fi
if test "${with_default_system_dir+set}" = set; then :
withval=$with_default_system_dir; DEFAULT_SYS_DIR=$withval
else
- DEFAULT_SYS_DIR="$lvm_exec_prefix/etc/lvm"
+ DEFAULT_SYS_DIR="/etc/lvm"
fi
diff --git a/configure.in b/configure.in
index fa31b18..97ddc1d 100644
--- a/configure.in
+++ b/configure.in
@@ -1276,10 +1276,11 @@ if test x$INTL = xyes; then
fi
################################################################################
+dnl -- FIXME: need to switch to regular option here --sysconfdir
AC_ARG_WITH(confdir,
AC_HELP_STRING([--with-confdir=DIR],
[configuration files in DIR [[/etc]]]),
- CONFDIR=$withval, CONFDIR='${exec_prefix}/etc')
+ CONFDIR=$withval, CONFDIR='/etc')
AC_ARG_WITH(staticdir,
AC_HELP_STRING([--with-staticdir=DIR],
@@ -1414,10 +1415,11 @@ fi
################################################################################
dnl -- various defaults
+dnl -- FIXME: need to switch to regular option here --sysconfdir
AC_ARG_WITH(default-system-dir,
AC_HELP_STRING([--with-default-system-dir=DIR],
- [default LVM system directory [[EPREFIX/etc/lvm]]]),
- DEFAULT_SYS_DIR=$withval, DEFAULT_SYS_DIR="$lvm_exec_prefix/etc/lvm")
+ [default LVM system directory [[/etc/lvm]]]),
+ DEFAULT_SYS_DIR=$withval, DEFAULT_SYS_DIR="/etc/lvm")
AC_DEFINE_UNQUOTED(DEFAULT_SYS_DIR, ["$DEFAULT_SYS_DIR"],
[Path to LVM system directory.])
10 years, 10 months
master - man: refine doc for config profiles
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2c4f81634f2c53...
Commit: 2c4f81634f2c53a0ca7a589dbba054ca0c2a4e75
Parent: 0a5b68e87bb901480eb95c98b7811dbb64a54c67
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jul 4 12:09:21 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jul 4 12:09:21 2013 +0200
man: refine doc for config profiles
---
man/lvm.8.in | 17 ++++++++++-------
man/lvm.conf.5.in | 16 ++++++++++------
2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/man/lvm.8.in b/man/lvm.8.in
index 129c9fd..61fd74a 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -266,13 +266,16 @@ In addition to that, when creating a Volume Group or a Logical Volume,
it causes the ProfileName to be stored in metadata for each Volume Group
or Logical Volume. If the profile is stored in metadata, it is automatically
applied next time the Volume Group or the Logical Volume is processed and the
-use of --profile is not necessary when running LVM commands further. If different
-profiles are defined for the Volume Group and its Logical Volumes, the profile
-defined for the Logical Volumes are used during command processing. The profile can
-be changed or detached using the \fBvgchange\fP(8) and \fBlvchange\fP(8) command
-and their \fB\-\-profile ProfileName\fP and \fB--detachprofile\fP options.
-See also \fBlvm.conf\fP(5) for more information about configuration profiles
-and the way they fit with other LVM configuration methods.
+use of --profile is not necessary when running LVM commands further. See also
+\fBlvm.conf\fP(5) for more information about \fBprofile config\fP and the
+way it fits with other LVM configuration methods.
+.TP
+.IR \fB\-\-config \ ConfigurationString
+Uses the ConfigurationString as direct string representation of the configuration
+to override the existing configuration. The ConfigurationString is of exactly
+the same format as used in any LVM configuration file. See \fBlvm.conf\fP(5)
+for more information about \fBdirect config override on command line\fP and the
+way it fits with other LVM configuration methods.
.SH ENVIRONMENT VARIABLES
.TP
.B HOME
diff --git a/man/lvm.conf.5.in b/man/lvm.conf.5.in
index 8043f80..2786df2 100644
--- a/man/lvm.conf.5.in
+++ b/man/lvm.conf.5.in
@@ -29,7 +29,7 @@ with different values if needed. For this purpose, there's the \fBdefault.profil
which contains all settings that are customizable by profiles
and users are encouraged to copy this profile, then to change the values
as needed and to remove the settings that are not customized by the new profile.
-The profiles are stored in #DEFAULT_PROFILE_DIR# by default.
+The profiles are stored in #DEFAULT_PROFILE_DIR# directory by default.
This location can be changed using the \fBconfig/profile_dir\fP setting.
Each profile configuration is stored in \fBProfileName.profile\fP file
in the profile directory. When referencing the profile, the \fB.profile\fP
@@ -39,13 +39,17 @@ The profile to use can be defined for each LVM command using the \fB\-\-profile
command line option. When using a profile while creating Volume
Groups or Logical Volumes, the ProfileName is stored in Volume Group
metadata. When using such volumes later on, the profile is automatically
-loaded and used. If Volume Group and any of its Logical Volumes has different
+loaded and applied. If Volume Group and any of its Logical Volumes have different
profiles defined, the profile defined for the Logical Volume is used. Profiles
attached to Volume Groups or Logical Volumes can be changed or detached
-by using \fBvgchange\fP(8) and \fBlvchange\fP(8) with \fB\-\-profile ProfileName\fP
-or \fB\-\-detachprofile\fP options. The \fBvgs\fP and \fBlvs\fP reporting commands
-provide \fB-o vg_profile\fP and \fB-o lv_profile\fP output options
-to show the profile attached to a Volume Group or a Logical Volume.
+using the \fBvgchange\fP(8) and \fBlvchange\fP(8) commands with \fB\-\-profile ProfileName\fP
+or \fB\-\-detachprofile\fP options. For any other LVM command, the \fB\-\-profile ProfileName\fP
+option causes the profile to be applied only temporarily during the command
+execution for any existing Volume Group or Logical Volume.
+
+The \fBvgs\fP and \fBlvs\fP reporting commands provide \fB-o vg_profile\fP and
+\fB-o lv_profile\fP output options to show the profile currently attached to a
+Volume Group or a Logical Volume.
.TP
.B direct config override on command line
10 years, 10 months
master - man: document profile config and related options
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0a5b68e87bb901...
Commit: 0a5b68e87bb901480eb95c98b7811dbb64a54c67
Parent: 21cd275b37cafa7605451aeeef3f1f7fae98447a
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jul 3 16:45:27 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jul 3 16:49:26 2013 +0200
man: document profile config and related options
Document following items:
configuration cascade (man lvm.conf)
--profile ProfileName (man lvm)
--detachprofile (man vgchange/lvchange)
-o vg_profile/lv_profile (man vgs/lvs)
Also document --config a bit so we can see where it fits in the
configuration cascade - will be documented more in following commit...
---
WHATS_NEW | 1 +
man/Makefile.in | 2 +-
man/lvchange.8.in | 8 +++++++
man/lvm.8.in | 14 ++++++++++++
man/lvm.conf.5.in | 61 +++++++++++++++++++++++++++++++++++++++++++++++++---
man/lvs.8.in | 1 +
man/vgchange.8.in | 8 +++++++
man/vgs.8.in | 6 ++--
8 files changed, 93 insertions(+), 8 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index adecd63..b174cb3 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Add man page entries for profile configuration and related options.
Improve error loging when user tries to interrupt commands.
Rename _swap_lv to _swap_lv_identifiers and move to allow an additional user.
Rename snapshot segment returning methods from find_*_cow to find_*_snapshot.
diff --git a/man/Makefile.in b/man/Makefile.in
index 8be34c3..8c2ff13 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -85,7 +85,7 @@ $(MAN5) $(MAN8) $(MAN8DM) $(MAN8CLUSTER): Makefile
%: %.in
@case "$@" in \
*/*) ;; \
- *) echo "Creating $@" ; $(SED) -e "s+#VERSION#+$(LVM_VERSION)+;s+#DEFAULT_SYS_DIR#+$(DEFAULT_SYS_DIR)+;s+#DEFAULT_ARCHIVE_DIR#+$(DEFAULT_ARCHIVE_DIR)+;s+#DEFAULT_BACKUP_DIR#+$(DEFAULT_BACKUP_DIR)+;s+#DEFAULT_CACHE_DIR#+$(DEFAULT_CACHE_DIR)+;s+#DEFAULT_LOCK_DIR#+$(DEFAULT_LOCK_DIR)+;s+#CLVMD_PATH#+@CLVMD_PATH@+;s+#LVM_PATH#+@LVM_PATH@+;s+#DEFAULT_RUN_DIR#+@DEFAULT_RUN_DIR@+;" $< > $@ ;; \
+ *) echo "Creating $@" ; $(SED) -e "s+#VERSION#+$(LVM_VERSION)+;s+#DEFAULT_SYS_DIR#+$(DEFAULT_SYS_DIR)+;s+#DEFAULT_ARCHIVE_DIR#+$(DEFAULT_ARCHIVE_DIR)+;s+#DEFAULT_BACKUP_DIR#+$(DEFAULT_BACKUP_DIR)+;s+#DEFAULT_PROFILE_DIR#+$(DEFAULT_PROFILE_DIR)+;s+#DEFAULT_CACHE_DIR#+$(DEFAULT_CACHE_DIR)+;s+#DEFAULT_LOCK_DIR#+$(DEFAULT_LOCK_DIR)+;s+#CLVMD_PATH#+@CLVMD_PATH@+;s+#LVM_PATH#+@LVM_PATH@+;s+#DEFAULT_RUN_DIR#+@DEFAULT_RUN_DIR@+;" $< > $@ ;; \
esac
install_man5: $(MAN5)
diff --git a/man/lvchange.8.in b/man/lvchange.8.in
index d5041f3..44426ef 100644
--- a/man/lvchange.8.in
+++ b/man/lvchange.8.in
@@ -16,6 +16,9 @@ lvchange \- change attributes of a logical volume
.RB [ \-d | \-\-debug ]
.RB [ \-\-deltag
.IR Tag ]
+.RB [ \-\-profile
+.IR ProfileName ]
+.RB [ \-\-detachprofile ]
.RB [ \-\-discards
.RI { ignore | nopassdown | passdown }]
.RB [ \-\-resync ]
@@ -81,6 +84,11 @@ logical volumes. It's only possible to change a non-contiguous
logical volume's allocation policy to contiguous, if all of the
allocated physical extents are already contiguous.
.TP
+.BR \-\-detachprofile
+Detach any configuration profiles attached to given Logical Volumes.
+See also \fBlvm\fP(8) and \fBlvm.conf\fP(5) for more
+information about configuration profiles.
+.TP
.BR \-\-discards " {" \fIignore | \fInopassdown | \fIpassdown }
Set this to \fIignore\fP to ignore any discards received by a
thin pool Logical Volume. Set to \fInopassdown\fP to process such
diff --git a/man/lvm.8.in b/man/lvm.8.in
index 37a60e4..129c9fd 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -259,6 +259,20 @@ If there are sufficient free Physical Extents to satisfy
an allocation request but \fInormal\fP doesn't use them,
\fIanywhere\fP will - even if that reduces performance by
placing two stripes on the same Physical Volume.
+.TP
+.IR \fB\-\-profile \ ProfileName
+Selects the configuration profile to use when processing an LVM command.
+In addition to that, when creating a Volume Group or a Logical Volume,
+it causes the ProfileName to be stored in metadata for each Volume Group
+or Logical Volume. If the profile is stored in metadata, it is automatically
+applied next time the Volume Group or the Logical Volume is processed and the
+use of --profile is not necessary when running LVM commands further. If different
+profiles are defined for the Volume Group and its Logical Volumes, the profile
+defined for the Logical Volumes are used during command processing. The profile can
+be changed or detached using the \fBvgchange\fP(8) and \fBlvchange\fP(8) command
+and their \fB\-\-profile ProfileName\fP and \fB--detachprofile\fP options.
+See also \fBlvm.conf\fP(5) for more information about configuration profiles
+and the way they fit with other LVM configuration methods.
.SH ENVIRONMENT VARIABLES
.TP
.B HOME
diff --git a/man/lvm.conf.5.in b/man/lvm.conf.5.in
index f47cc17..8043f80 100644
--- a/man/lvm.conf.5.in
+++ b/man/lvm.conf.5.in
@@ -4,13 +4,65 @@ lvm.conf \- Configuration file for LVM2
.SH SYNOPSIS
.B #DEFAULT_SYS_DIR#/lvm.conf
.SH DESCRIPTION
-lvm.conf is loaded during the initialisation phase of
+\fBlvm.conf\fP is loaded during the initialisation phase of
\fBlvm\fP(8). This file can in turn lead to other files
being loaded - settings read in later override earlier
settings. File timestamps are checked between commands and if
any have changed, all the files are reloaded.
+
+The settings defined in lvm.conf can be overridden by any
+of these extended configuration methods:
+.TP
+.B tag config
+.br
+See \fBtags\fP configuration setting description below.
+
+.TP
+.B profile config
+.br
+A profile is a set of selected customizable configuration settings
+that are aimed to achieve a certain characteristics in various
+environments or uses. Normally, the name of the profile should
+reflect that environment or use. LVM itself provides a few predefined
+configuration profiles. Users are allowed to add more profiles
+with different values if needed. For this purpose, there's the \fBdefault.profile\fP
+which contains all settings that are customizable by profiles
+and users are encouraged to copy this profile, then to change the values
+as needed and to remove the settings that are not customized by the new profile.
+The profiles are stored in #DEFAULT_PROFILE_DIR# by default.
+This location can be changed using the \fBconfig/profile_dir\fP setting.
+Each profile configuration is stored in \fBProfileName.profile\fP file
+in the profile directory. When referencing the profile, the \fB.profile\fP
+suffix is left out.
+
+The profile to use can be defined for each LVM command using the \fB\-\-profile ProfileName\fP
+command line option. When using a profile while creating Volume
+Groups or Logical Volumes, the ProfileName is stored in Volume Group
+metadata. When using such volumes later on, the profile is automatically
+loaded and used. If Volume Group and any of its Logical Volumes has different
+profiles defined, the profile defined for the Logical Volume is used. Profiles
+attached to Volume Groups or Logical Volumes can be changed or detached
+by using \fBvgchange\fP(8) and \fBlvchange\fP(8) with \fB\-\-profile ProfileName\fP
+or \fB\-\-detachprofile\fP options. The \fBvgs\fP and \fBlvs\fP reporting commands
+provide \fB-o vg_profile\fP and \fB-o lv_profile\fP output options
+to show the profile attached to a Volume Group or a Logical Volume.
+
+.TP
+.B direct config override on command line
+The \fB\-\-config ConfigurationString\fP command line option takes the
+ConfigurationString as direct string representation of the configuration
+to override the existing configuration. The ConfigurationString is of
+exactly the same format as used in any LVM configuration file.
+
.LP
-Use \fBlvm dumpconfig\fP to check what settings are in use.
+When several configuration methods are used at the same time
+and when LVM looks for the value of a particular setting, it traverses
+this cascade from left to right:
+\fBdirect config override on command line\fP -> \fBprofile config\fP -> \fBtag config\fP -> \fBlvm.conf\fP.
+No part of this cascade is compulsory. If there's no setting value found at
+the end of the cascade, a default value is used for that setting.
+Use \fBlvm dumpconfig\fP to check what settings are in use and what
+the default values are.
.SH SYNTAX
.LP
This section describes the configuration file syntax.
@@ -389,8 +441,9 @@ otherwise it doesn't.
After lvm.conf has been processed, LVM2 works through each host
tag that has been defined in turn, and if there is a configuration
file called lvm_\fB<host_tag>\fP.conf it attempts to load it.
-Any settings read in override settings found in earlier files.
-Any additional host tags defined get appended to the search list,
+The activation/volume_list, devices/filter and devices/types settings are merged
+(these all are lists), otherwise any settings read in override settings found in
+earlier files. Any additional host tags defined get appended to the search list,
so in turn they can lead to further configuration files being processed.
Use \fBlvm dumpconfig\fP to check the result of config
file processing.
diff --git a/man/lvs.8.in b/man/lvs.8.in
index 1626e17..013740f 100644
--- a/man/lvs.8.in
+++ b/man/lvs.8.in
@@ -90,6 +90,7 @@ lv_major,
lv_minor,
lv_name,
lv_path,
+lv_profile,
lv_read_ahead,
lv_size,
lv_tags,
diff --git a/man/vgchange.8.in b/man/vgchange.8.in
index bc4ef32..ab76ed0 100644
--- a/man/vgchange.8.in
+++ b/man/vgchange.8.in
@@ -22,6 +22,9 @@ vgchange \- change attributes of a volume group
.RB [ \-d | \-\-debug ]
.RB [ \-\-deltag
.IR Tag ]
+.RB [ \-\-profile
+.IR ProfileName ]
+.RB [ \-\-detachprofile ]
.RB [ \-h | \-\-help ]
.RB [ \-\-ignorelockingfailure ]
.RB [ \-\-ignoremonitoring ]
@@ -89,6 +92,11 @@ If the cluster infrastructure is unavailable on a particular node at a
particular time, you may still be able to use Volume Groups that
are not marked as clustered.
.TP
+.BR \-\-detachprofile
+Detach any configuration profiles attached to given Volume Groups.
+See also \fBlvm\fP(8) and \fBlvm.conf\fP(5) for more
+information about configuration profiles.
+.TP
.BR \-u ", " \-\-uuid
Generate new random UUID for specified Volume Groups.
.TP
diff --git a/man/vgs.8.in b/man/vgs.8.in
index e555898..381e3a9 100644
--- a/man/vgs.8.in
+++ b/man/vgs.8.in
@@ -60,9 +60,9 @@ Use \fB\-o vg_all\fP to select all volume group columns.
Use \fB\-o help\fP to view the full list of columns available.
.IP
Column names include: vg_fmt, vg_uuid, vg_name, vg_attr, vg_size, vg_free,
-vg_sysid, vg_extent_size, vg_extent_count, vg_free_count, max_lv, max_pv,
-pv_count, lv_count, snap_count, vg_seqno, vg_tags, vg_mda_count, vg_mda_free,
-and vg_mda_size, vg_mda_used_count.
+vg_sysid, vg_extent_size, vg_extent_count, vg_free_count, vg_profile, max_lv,
+max_pv, pv_count, lv_count, snap_count, vg_seqno, vg_tags, vg_mda_count,
+vg_mda_free, and vg_mda_size, vg_mda_used_count.
.IP
Any "vg_" prefixes are optional. Columns mentioned in either \fBpvs\fP(8)
or \fBlvs\fP(8) can also be chosen, but columns cannot be taken from both
10 years, 10 months
master - configure: more tweaks
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=21cd275b37cafa...
Commit: 21cd275b37cafa7605451aeeef3f1f7fae98447a
Parent: 6f335ffa35552ed9d002d8a6884c707b2942750c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jul 3 16:32:23 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 3 16:33:29 2013 +0200
configure: more tweaks
We have to use lvm_exec_prefix for proper values.
DEFAULT vars needs to be already evaluated.
---
conf/example.conf.in | 2 +-
configure | 4 ++--
configure.in | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 3bc8c3c..cb4d3e5 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -25,7 +25,7 @@ config {
abort_on_errors = 0
# Directory where LVM looks for configuration profiles.
- profile_dir = "@DEFAULT_SYS_DIR@/@DEFAULT_PROFILE_SUBDIR"
+ profile_dir = "@DEFAULT_SYS_DIR@/@DEFAULT_PROFILE_SUBDIR@"
}
# This section allows you to configure which block devices should
diff --git a/configure b/configure
index aae8165..fbe92a5 100755
--- a/configure
+++ b/configure
@@ -1639,7 +1639,7 @@ Optional Packages:
--with-dmeventd-path=PATH
dmeventd path [[EPREFIX/sbin/dmeventd]]
--with-default-system-dir=DIR
- default LVM system directory [[/etc/lvm]]
+ default LVM system directory [[EPREFIX/etc/lvm]]
--with-default-profile-subdir=SUBDIR
default configuration profile subdir [[profile]]
--with-default-archive-subdir=SUBDIR
@@ -10549,7 +10549,7 @@ fi
if test "${with_default_system_dir+set}" = set; then :
withval=$with_default_system_dir; DEFAULT_SYS_DIR=$withval
else
- DEFAULT_SYS_DIR='${exec_prefix}/etc/lvm'
+ DEFAULT_SYS_DIR="$lvm_exec_prefix/etc/lvm"
fi
diff --git a/configure.in b/configure.in
index 1d62fee..fa31b18 100644
--- a/configure.in
+++ b/configure.in
@@ -1417,7 +1417,7 @@ dnl -- various defaults
AC_ARG_WITH(default-system-dir,
AC_HELP_STRING([--with-default-system-dir=DIR],
[default LVM system directory [[EPREFIX/etc/lvm]]]),
- DEFAULT_SYS_DIR=$withval, DEFAULT_SYS_DIR='${exec_prefix}/etc/lvm')
+ DEFAULT_SYS_DIR=$withval, DEFAULT_SYS_DIR="$lvm_exec_prefix/etc/lvm")
AC_DEFINE_UNQUOTED(DEFAULT_SYS_DIR, ["$DEFAULT_SYS_DIR"],
[Path to LVM system directory.])
10 years, 10 months
master - sigint: improve logic on for sigint reaction
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6f335ffa35552e...
Commit: 6f335ffa35552ed9d002d8a6884c707b2942750c
Parent: ffa11ed35688243a4546d4a35a97fc0339916651
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 1 16:30:12 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 3 14:46:42 2013 +0200
sigint: improve logic on for sigint reaction
Fix and improve handling on sigint.
Always check for signal presence *before* calling of command,
so it will not call the command when break was hit.
If the command has been finished succesfully there is
no problem to mark the command ok and not report interrupt at all.
Fix cuple related stack; reports and assignments.
---
WHATS_NEW | 1 +
lib/cache/lvmetad.c | 8 ++-
lib/locking/locking.c | 3 +
lib/metadata/lv_manip.c | 2 +-
tools/lvchange.c | 4 +-
tools/pvcreate.c | 6 +-
tools/pvscan.c | 18 +++++--
tools/toollib.c | 126 ++++++++++++++++++++++++-----------------------
8 files changed, 91 insertions(+), 77 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f1f9a82..adecd63 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Improve error loging when user tries to interrupt commands.
Rename _swap_lv to _swap_lv_identifiers and move to allow an additional user.
Rename snapshot segment returning methods from find_*_cow to find_*_snapshot.
liblvm/python API: Additions: PV create/removal/resize/listing
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index a107047..f43283f 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -955,11 +955,13 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, activation_handler handler)
init_silent(1);
while ((dev = dev_iter_get(iter))) {
- if (!lvmetad_pvscan_single(cmd, dev, handler))
+ if (sigint_caught()) {
r = 0;
-
- if (sigint_caught())
+ stack;
break;
+ }
+ if (!lvmetad_pvscan_single(cmd, dev, handler))
+ r = 0;
}
init_silent(was_silent);
diff --git a/lib/locking/locking.c b/lib/locking/locking.c
index cdd6ac4..34e8bd9 100644
--- a/lib/locking/locking.c
+++ b/lib/locking/locking.c
@@ -54,6 +54,9 @@ static void _catch_sigint(int unused __attribute__((unused)))
}
int sigint_caught(void) {
+ if (_sigint_caught)
+ log_error("Interrupted...");
+
return _sigint_caught;
}
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 4c3beb0..b7914dd 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -3252,7 +3252,7 @@ static int _request_confirmation(struct cmd_context *cmd,
return 0;
}
if (sigint_caught())
- return 0;
+ return_0;
}
return 1;
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 4b88a51..f7ce7fd 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -347,7 +347,7 @@ static int lvchange_resync(struct cmd_context *cmd, struct logical_volume *lv)
}
if (sigint_caught())
- return 0;
+ return_0;
active = 1;
}
@@ -643,7 +643,7 @@ static int lvchange_persistent(struct cmd_context *cmd,
}
if (sigint_caught())
- return 0;
+ return_0;
log_verbose("Ensuring %s is inactive.", lv->name);
if (!deactivate_lv(cmd, lv)) {
diff --git a/tools/pvcreate.c b/tools/pvcreate.c
index d2de4d9..b18e400 100644
--- a/tools/pvcreate.c
+++ b/tools/pvcreate.c
@@ -108,14 +108,14 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv)
}
for (i = 0; i < argc; i++) {
+ if (sigint_caught())
+ return_ECMD_FAILED;
+
dm_unescape_colons_and_at_signs(argv[i], NULL, NULL);
if (ECMD_PROCESSED != pvcreate_locked(cmd, argv[i], &pp)) {
ret = ECMD_FAILED;
}
-
- if (sigint_caught())
- return ret;
}
return ret;
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 665e416..63dc524 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -193,13 +193,16 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv)
ret = ECMD_FAILED;
continue;
}
-
- if (!lvmetad_pvscan_single(cmd, dev, handler)) {
+ if (sigint_caught()) {
ret = ECMD_FAILED;
+ stack;
break;
}
- if (sigint_caught())
+ if (!lvmetad_pvscan_single(cmd, dev, handler)) {
+ ret = ECMD_FAILED;
+ stack;
break;
+ }
}
if (!devno_args)
@@ -232,14 +235,17 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv)
dm_free(buf);
continue;
}
-
+ if (sigint_caught()) {
+ ret = ECMD_FAILED;
+ stack;
+ break;
+ }
if (!lvmetad_pvscan_single(cmd, dev, handler)) {
ret = ECMD_FAILED;
+ stack;
break;
}
- if (sigint_caught())
- break;
}
out:
diff --git a/tools/toollib.c b/tools/toollib.c
index 6e23e17..1a6fbee 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -161,6 +161,9 @@ int process_each_lv_in_vg(struct cmd_context *cmd,
if (!process_lv)
continue;
+ if (sigint_caught())
+ return_ECMD_FAILED;
+
lvl->lv->vg->cmd_missing_vgs = 0;
ret = process_single_lv(cmd, lvl->lv, handle);
if (ret != ECMD_PROCESSED && failed_lvnames) {
@@ -175,10 +178,6 @@ int process_each_lv_in_vg(struct cmd_context *cmd,
}
if (ret > ret_max)
ret_max = ret;
- if (sigint_caught()) {
- stack;
- return ret_max;
- }
}
if (lvargs_supplied && lvargs_matched != dm_list_size(arg_lvnames)) {
@@ -357,7 +356,10 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
}
}
- while (!sigint_caught()) {
+ for (;;) {
+ if (sigint_caught())
+ return_ECMD_FAILED;
+
ret = process_each_lv_in_vg(cmd, cvl_vg->vg, &lvnames,
tags_arg, &failed_lvnames,
handle, process_single_lv);
@@ -384,11 +386,6 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
ret_max = ret;
free_cmd_vgs(&cmd_vgs);
- /* FIXME: logic for breaking command is not consistent */
- if (sigint_caught()) {
- stack;
- return ECMD_FAILED;
- }
}
return ret_max;
@@ -438,11 +435,14 @@ int process_each_segment_in_pv(struct cmd_context *cmd,
ret_max = ret;
} else
dm_list_iterate_items(pvseg, &pv->segments) {
+ if (sigint_caught()) {
+ ret_max = ECMD_FAILED;
+ stack;
+ break;
+ }
ret = process_single_pvseg(cmd, vg, pvseg, handle);
if (ret > ret_max)
ret_max = ret;
- if (sigint_caught())
- break;
}
if (vg_name)
@@ -463,12 +463,11 @@ int process_each_segment_in_lv(struct cmd_context *cmd,
int ret;
dm_list_iterate_items(seg, &lv->segments) {
+ if (sigint_caught())
+ return_ECMD_FAILED;
ret = process_single_seg(cmd, seg, handle);
if (ret > ret_max)
ret_max = ret;
- /* FIXME: logic for breaking command is not consistent */
- if (sigint_caught())
- return ECMD_FAILED;
}
return ret_max;
@@ -491,9 +490,9 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name,
return_0;
for (;;) {
- /* FIXME: consistent handling of command break */
if (sigint_caught()) {
ret = ECMD_FAILED;
+ stack;
break;
}
if (!cmd_vg_read(cmd, &cmd_vgs))
@@ -502,6 +501,7 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name,
(!((flags & READ_ALLOW_INCONSISTENT) &&
(vg_read_error(cvl_vg->vg) == FAILED_INCONSISTENT)))) {
ret = ECMD_FAILED;
+ stack;
break;
}
@@ -592,6 +592,8 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
return ret_max;
}
dm_list_iterate_items(sl, vgids) {
+ if (sigint_caught())
+ return_ECMD_FAILED;
vgid = sl->str;
if (!(vgid) || !(vg_name = lvmcache_vgname_from_vgid(cmd->mem, vgid)))
continue;
@@ -599,11 +601,11 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
&arg_vgnames,
flags, handle,
ret_max, process_single_vg);
- if (sigint_caught())
- return ret_max;
}
} else {
dm_list_iterate_items(sl, vgnames) {
+ if (sigint_caught())
+ return_ECMD_FAILED;
vg_name = sl->str;
if (is_orphan_vg(vg_name))
continue; /* FIXME Unnecessary? */
@@ -611,8 +613,6 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
&arg_vgnames,
flags, handle,
ret_max, process_single_vg);
- if (sigint_caught())
- return ret_max;
}
}
@@ -628,14 +628,14 @@ int process_each_pv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
struct pv_list *pvl;
dm_list_iterate_items(pvl, &vg->pvs) {
+ if (sigint_caught())
+ return_ECMD_FAILED;
if (tags && !dm_list_empty(tags) &&
!str_list_match_list(tags, &pvl->pv->tags, NULL)) {
continue;
}
if ((ret = process_single_pv(cmd, vg, pvl->pv, handle)) > ret_max)
ret_max = ret;
- if (sigint_caught())
- return ret_max;
}
return ret_max;
@@ -650,12 +650,10 @@ static int _process_all_devs(struct cmd_context *cmd, void *handle,
struct device *dev;
int ret_max = ECMD_PROCESSED;
- int ret = 0;
+ int ret;
- if (!scan_vgs_for_pvs(cmd, 1)) {
- stack;
- return ECMD_FAILED;
- }
+ if (!scan_vgs_for_pvs(cmd, 1))
+ return_ECMD_FAILED;
if (!(iter = dev_iter_create(cmd->filter, 1))) {
log_error("dev_iter creation failed");
@@ -663,6 +661,12 @@ static int _process_all_devs(struct cmd_context *cmd, void *handle,
}
while ((dev = dev_iter_get(iter))) {
+ if (sigint_caught()) {
+ ret_max = ECMD_FAILED;
+ stack;
+ break;
+ }
+
if (!(pv = pv_read(cmd, dev_name(dev), 0, 0))) {
memset(&pv_dummy, 0, sizeof(pv_dummy));
dm_list_init(&pv_dummy.tags);
@@ -670,14 +674,12 @@ static int _process_all_devs(struct cmd_context *cmd, void *handle,
pv_dummy.dev = dev;
pv = &pv_dummy;
}
- ret = process_single_pv(cmd, NULL, pv, handle);
-
- free_pv_fid(pv);
+ ret = process_single_pv(cmd, NULL, pv, handle);
if (ret > ret_max)
ret_max = ret;
- if (sigint_caught())
- break;
+
+ free_pv_fid(pv);
}
dev_iter_destroy(iter);
@@ -718,6 +720,10 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
if (argc) {
log_verbose("Using physical volume(s) on command line");
for (; opt < argc; opt++) {
+ if (sigint_caught()) {
+ ret_max = ECMD_FAILED;
+ goto_out;
+ }
dm_unescape_colons_and_at_signs(argv[opt], NULL, &at_sign);
if (at_sign && (at_sign == argv[opt])) {
tagname = at_sign + 1;
@@ -786,22 +792,22 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
}
ret = process_single_pv(cmd, vg, pv, handle);
-
+ if (ret > ret_max)
+ ret_max = ret;
/*
* Free PV only if we called pv_read before,
* otherwise the PV structure is part of the VG.
*/
if (!vg)
free_pv_fid(pv);
-
- if (ret > ret_max)
- ret_max = ret;
- if (sigint_caught())
- goto out;
}
if (!dm_list_empty(&tags) && (vgnames = get_vgnames(cmd, 1)) &&
!dm_list_empty(vgnames)) {
dm_list_iterate_items(sll, vgnames) {
+ if (sigint_caught()) {
+ ret_max = ECMD_FAILED;
+ goto_out;
+ }
vg = vg_read(cmd, sll->str, NULL, flags);
if (vg_read_error(vg)) {
ret_max = ECMD_FAILED;
@@ -813,31 +819,20 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
ret = process_each_pv_in_vg(cmd, vg, &tags,
handle,
process_single_pv);
-
- unlock_and_release_vg(cmd, vg, sll->str);
-
if (ret > ret_max)
ret_max = ret;
- if (sigint_caught())
- goto out;
+
+ unlock_and_release_vg(cmd, vg, sll->str);
}
}
} else {
if (vg) {
log_verbose("Using all physical volume(s) in "
"volume group");
- ret = process_each_pv_in_vg(cmd, vg, NULL, handle,
- process_single_pv);
- if (ret > ret_max)
- ret_max = ret;
- if (sigint_caught())
- goto out;
+ ret_max = process_each_pv_in_vg(cmd, vg, NULL, handle,
+ process_single_pv);
} else if (arg_count(cmd, all_ARG)) {
- ret = _process_all_devs(cmd, handle, process_single_pv);
- if (ret > ret_max)
- ret_max = ret;
- if (sigint_caught())
- goto out;
+ ret_max = _process_all_devs(cmd, handle, process_single_pv);
} else {
log_verbose("Scanning for physical volume names");
@@ -846,13 +841,16 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
goto bad;
dm_list_iterate_items(pvl, pvslist) {
+ if (sigint_caught()) {
+ ret_max = ECMD_FAILED;
+ goto_out;
+ }
ret = process_single_pv(cmd, NULL, pvl->pv,
handle);
- free_pv_fid(pvl->pv);
if (ret > ret_max)
ret_max = ret;
- if (sigint_caught())
- goto out;
+
+ free_pv_fid(pvl->pv);
}
}
}
@@ -1351,12 +1349,16 @@ int vg_refresh_visible(struct cmd_context *cmd, struct volume_group *vg)
sigint_allow();
dm_list_iterate_items(lvl, &vg->lvs) {
- if (sigint_caught())
- return_0;
+ if (sigint_caught()) {
+ r = 0;
+ stack;
+ break;
+ }
- if (lv_is_visible(lvl->lv))
- if (!lv_refresh(cmd, lvl->lv))
- r = 0;
+ if (lv_is_visible(lvl->lv) && !lv_refresh(cmd, lvl->lv)) {
+ r = 0;
+ stack;
+ }
}
sigint_restore();
10 years, 10 months
master - configure: fix install location of profile dir
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ffa11ed3568824...
Commit: ffa11ed35688243a4546d4a35a97fc0339916651
Parent: eeb164b50f9e5e5ce39f7851fced7c29e1fc0202
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jul 3 13:07:39 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 3 14:44:51 2013 +0200
configure: fix install location of profile dir
Seems like we have a bit overcomplicated set of options
for deducing individual install dirs.
This patch fixes installation issues with DESTDIR,
but the whole set of configure options should be simplified.
---
conf/Makefile.in | 4 ++--
configure | 4 ++--
configure.in | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/conf/Makefile.in b/conf/Makefile.in
index c148ac2..f9947b1 100644
--- a/conf/Makefile.in
+++ b/conf/Makefile.in
@@ -30,8 +30,8 @@ install_conf: $(CONFSRC)
fi
install_profiles: $(PROFILES)
- $(INSTALL) -d $(DEFAULT_PROFILE_DIR)
- $(INSTALL_DATA) $(PROFILES) $(DEFAULT_PROFILE_DIR)/
+ $(INSTALL_DIR) $(DESTDIR)$(DEFAULT_PROFILE_DIR)
+ $(INSTALL_DATA) $(PROFILES) $(DESTDIR)$(DEFAULT_PROFILE_DIR)/
install_lvm2: install_conf install_profiles
diff --git a/configure b/configure
index 212bd80..aae8165 100755
--- a/configure
+++ b/configure
@@ -10066,7 +10066,7 @@ fi
if test "${with_confdir+set}" = set; then :
withval=$with_confdir; CONFDIR=$withval
else
- CONFDIR="/etc"
+ CONFDIR='${exec_prefix}/etc'
fi
@@ -10549,7 +10549,7 @@ fi
if test "${with_default_system_dir+set}" = set; then :
withval=$with_default_system_dir; DEFAULT_SYS_DIR=$withval
else
- DEFAULT_SYS_DIR="/etc/lvm"
+ DEFAULT_SYS_DIR='${exec_prefix}/etc/lvm'
fi
diff --git a/configure.in b/configure.in
index 6d417e3..1d62fee 100644
--- a/configure.in
+++ b/configure.in
@@ -1279,7 +1279,7 @@ fi
AC_ARG_WITH(confdir,
AC_HELP_STRING([--with-confdir=DIR],
[configuration files in DIR [[/etc]]]),
- CONFDIR=$withval, CONFDIR="/etc")
+ CONFDIR=$withval, CONFDIR='${exec_prefix}/etc')
AC_ARG_WITH(staticdir,
AC_HELP_STRING([--with-staticdir=DIR],
@@ -1416,8 +1416,8 @@ fi
dnl -- various defaults
AC_ARG_WITH(default-system-dir,
AC_HELP_STRING([--with-default-system-dir=DIR],
- [default LVM system directory [[/etc/lvm]]]),
- DEFAULT_SYS_DIR=$withval, DEFAULT_SYS_DIR="/etc/lvm")
+ [default LVM system directory [[EPREFIX/etc/lvm]]]),
+ DEFAULT_SYS_DIR=$withval, DEFAULT_SYS_DIR='${exec_prefix}/etc/lvm')
AC_DEFINE_UNQUOTED(DEFAULT_SYS_DIR, ["$DEFAULT_SYS_DIR"],
[Path to LVM system directory.])
10 years, 10 months
master - lvconvert: use proper error path
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=eeb164b50f9e5e...
Commit: eeb164b50f9e5e5ce39f7851fced7c29e1fc0202
Parent: fe09d84668487f2a6b64edccced1ed049cc9ac18
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jul 2 23:59:52 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 3 14:44:51 2013 +0200
lvconvert: use proper error path
VG needs to be released in this error path
---
tools/lvconvert.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 4d2a432..ccc8420 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2413,7 +2413,7 @@ static int lvconvert_single(struct cmd_context *cmd, struct lvconvert_params *lp
&lp->passed_args, &lp->chunk_size,
&lp->discards, &lp->poolmetadata_size,
&lp->zero))
- goto_out;
+ goto_bad;
/*
* lp->pvh holds the list of PVs available for allocation or removal
10 years, 10 months
master - lvconvert: Rename _swap_lv to _swap_lv_identifiers and move to allow an additional user
by Mike Snitzer
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fe09d84668487f...
Commit: fe09d84668487f2a6b64edccced1ed049cc9ac18
Parent: f9e0adcce56055f625ab8c77c7d66e4db61fe23a
Author: Mike Snitzer <snitzer(a)redhat.com>
AuthorDate: Tue Jul 2 17:02:25 2013 -0400
Committer: Mike Snitzer <snitzer(a)redhat.com>
CommitterDate: Tue Jul 2 17:02:25 2013 -0400
lvconvert: Rename _swap_lv to _swap_lv_identifiers and move to allow an additional user
---
WHATS_NEW | 1 +
tools/lvconvert.c | 42 +++++++++++++++++++++---------------------
2 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 60b2fac..f1f9a82 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Rename _swap_lv to _swap_lv_identifiers and move to allow an additional user.
Rename snapshot segment returning methods from find_*_cow to find_*_snapshot.
liblvm/python API: Additions: PV create/removal/resize/listing
liblvm/python API: Additions: LV attr/origin/Thin pool/Thin LV creation
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 4ac7e54..4d2a432 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -650,6 +650,25 @@ static progress_t _poll_merge_progress(struct cmd_context *cmd,
return PROGRESS_UNFINISHED;
}
+/* Swap lvid and LV names */
+static int _swap_lv_identifiers(struct cmd_context *cmd,
+ struct logical_volume *a, struct logical_volume *b)
+{
+ union lvid lvid;
+ const char *name;
+
+ lvid = a->lvid;
+ a->lvid = b->lvid;
+ b->lvid = lvid;
+
+ name = a->name;
+ a->name = b->name;
+ if (!lv_rename_update(cmd, b, name, 0))
+ return_0;
+
+ return 1;
+}
+
static struct poll_functions _lvconvert_mirror_fns = {
.get_copy_vg = _get_lvconvert_vg,
.get_copy_lv = _get_lvconvert_lv,
@@ -1869,25 +1888,6 @@ out:
return r;
}
-/* Swap lvid and LV names */
-static int _swap_lv(struct cmd_context *cmd,
- struct logical_volume *a, struct logical_volume *b)
-{
- union lvid lvid;
- const char *name;
-
- lvid = a->lvid;
- a->lvid = b->lvid;
- b->lvid = lvid;
-
- name = a->name;
- a->name = b->name;
- if (!lv_rename_update(cmd, b, name, 0))
- return_0;
-
- return 1;
-}
-
static int _lvconvert_thinpool_external(struct cmd_context *cmd,
struct logical_volume *pool_lv,
struct logical_volume *external_lv,
@@ -1932,7 +1932,7 @@ static int _lvconvert_thinpool_external(struct cmd_context *cmd,
* which could be easily removed by the user after i.e. power-off
*/
- if (!_swap_lv(cmd, torigin_lv, external_lv)) {
+ if (!_swap_lv_identifiers(cmd, torigin_lv, external_lv)) {
stack;
goto revert_new_lv;
}
@@ -1956,7 +1956,7 @@ static int _lvconvert_thinpool_external(struct cmd_context *cmd,
return 1;
deactivate_and_revert_new_lv:
- if (!_swap_lv(cmd, torigin_lv, external_lv))
+ if (!_swap_lv_identifiers(cmd, torigin_lv, external_lv))
stack;
if (!deactivate_lv(cmd, torigin_lv)) {
10 years, 10 months