Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5b7e543cae5be52e…
Commit: 5b7e543cae5be52e1dcd79c7f6876acc89138cf1
Parent: 03c941a4caf411f21045670e205ccdd975be27c7
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Nov 27 12:54:48 2013 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Nov 27 15:48:06 2013 +0100
conf: add allocation/wipe_signatures_on_new_logical_volumes_when_zeroing
This setting controls whether signature wiping on newly created logical
volumes will follow the state of zeroing (-Z/--zero option).
---
WHATS_NEW | 1 +
conf/default.profile.in | 1 +
conf/example.conf.in | 9 +++++++++
lib/config/config_settings.h | 1 +
4 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 7718b6f..af489d6 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.105 -
=====================================
+ Add allocation/wipe_signatures_on_new_logical_volumes_when_zeroing to lvm.conf.
Do not fail the whole autoactivation if the VG refresh done before fails.
Do not connect to lvmetad on vg/lvchange --sysinit -aay and socket absent.
Use lv_check_not_in_use() when testing device in use before merging.
diff --git a/conf/default.profile.in b/conf/default.profile.in
index 29049ef..5a481de 100644
--- a/conf/default.profile.in
+++ b/conf/default.profile.in
@@ -9,6 +9,7 @@
# Refer to 'man lvm.conf' for further information about profiles and file layout.
allocation {
+ wipe_signatures_on_new_logical_volumes_when_zeroing = 1
thin_pool_chunk_size_policy = "generic"
thin_pool_chunk_size = 64
thin_pool_discards = "passdown"
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 03e1c45..0ac53ef 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -272,6 +272,15 @@ allocation {
# algorithm.
maximise_cling = 1
+ # Whether do wipe any signatures found on newly created Logical Volumes
+ # automatically in addition to zeroing of the first KB on the LV
+ # (-Z/--zero y option) when running the LVM command without specifying
+ # the -W/--wipesignatures option. If -W/--wipesignatures command line
+ # option is specified, it always takes precedence over this setting.
+ # Default is to wipe signatures when zeroing.
+ #
+ wipe_signatures_on_new_logical_volumes_when_zeroing = 1
+
# Set to 1 to guarantee that mirror logs will always be placed on
# different PVs from the mirror images. This was the default
# until version 2.02.85.
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 7fdf763..7a7e8e5 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -104,6 +104,7 @@ cfg(devices_issue_discards_CFG, "issue_discards", devices_CFG_SECTION, 0, CFG_TY
cfg_array(allocation_cling_tag_list_CFG, "cling_tag_list", allocation_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(2, 2, 77), NULL)
cfg(allocation_maximise_cling_CFG, "maximise_cling", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MAXIMISE_CLING, vsn(2, 2, 85), NULL)
+cfg(allocation_wipe_signatures_on_new_logical_volumes_when_zeroing_CFG, "wipe_signatures_on_new_logical_volumes_when_zeroing", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL)
cfg(allocation_mirror_logs_require_separate_pvs_CFG, "mirror_logs_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS, vsn(2, 2, 85), NULL)
cfg(allocation_thin_pool_metadata_require_separate_pvs_CFG, "thin_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 89), NULL)
cfg(allocation_thin_pool_zero_CFG, "thin_pool_zero", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_ZERO, vsn(2, 2, 99), NULL)
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d6e67b850365864b…
Commit: d6e67b850365864bba91619a40503ff0b0392e2c
Parent: 729b104413e11412866a549ef8a6702f56c4acd1
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Nov 27 08:33:02 2013 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Nov 27 08:33:02 2013 +0100
WHATS_NEW: commit 729b104
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 4148754..7718b6f 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.105 -
=====================================
+ Do not fail the whole autoactivation if the VG refresh done before fails.
Do not connect to lvmetad on vg/lvchange --sysinit -aay and socket absent.
Use lv_check_not_in_use() when testing device in use before merging.
Move test for target present from init_snapshot_merge() to lvconvert.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=729b104413e11412…
Commit: 729b104413e11412866a549ef8a6702f56c4acd1
Parent: 8d5cff5b9bb217942c009dca49d0bffb51e85004
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Nov 27 08:20:02 2013 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Nov 27 08:20:02 2013 +0100
activation: continue with autoactivation if refresh fails
If the refresh fails for any reason before autoactivation, let's not
make this a stopper for autoactivation itself - just log the error
message if it appears.
The reason is that in some rare situations, we can still hit the
problem with the suspend call to fail (as already described in
commit d8085edf65006a50608edb821b3d30947abaa838, also
https://bugzilla.redhat.com/show_bug.cgi?id=1027314) The refresh
itself is done for only one reason - to refresh any dm tables
for LVs for which the underlying PVs got unplugged/disconnected
and then plugged/connected back (see also
https://bugzilla.redhat.com/show_bug.cgi?id=954061 for more info).
In this case, the major:minor pair is changed and we need to
update dm tables for LVs accordingly.
Now if refresh fails, the error is still logged, but autoactivation
continues.
---
tools/pvscan.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/tools/pvscan.c b/tools/pvscan.c
index ce8c446..981a9c2 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -147,10 +147,8 @@ static int _auto_activation_handler(struct cmd_context *cmd,
usleep(REFRESH_BEFORE_AUTOACTIVATION_RETRY_USLEEP_DELAY);
}
- if (!refresh_done) {
+ if (!refresh_done)
log_error("%s: refresh before autoactivation failed.", vg->name);
- goto out;
- }
if (!vgchange_activate(vg->cmd, vg, activate)) {
log_error("%s: autoactivation failed.", vg->name);
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8d5cff5b9bb21794…
Commit: 8d5cff5b9bb217942c009dca49d0bffb51e85004
Parent: 47110f7e27ce2a4bf329e860cf6eb339d107fde7
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Nov 26 14:51:23 2013 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Nov 26 14:51:23 2013 +0100
lv/vgchange: do not try to connect to lvmetad if socket absent and --sysinit -aay used
If using lv/vgchange --sysinit -aay and lvmetad is enabled, we'd like to
avoid the direct activation and rely on autoactivation instead so
it fits system initialization scripts.
But if we're calling lv/vgchange --sysinit -aay too early when even
lvmetad service is not started yet, we just need to do the direct
activation instead without printing any error messages (while
trying to connect to lvmetad and not finding its socket).
This patch adds two helper functions - "lvmetad_socket_present" and
"lvmetad_used" which can be used to check for this condition properly
and avoid these lvmetad connections when the socket is not present
(and hence lvmetad is not yet running).
---
WHATS_NEW | 1 +
daemons/lvmetad/lvmetad-client.h | 4 +++-
daemons/lvmetad/lvmetad-core.c | 4 +++-
lib/cache/lvmetad.c | 16 ++++++++++++++++
lib/cache/lvmetad.h | 15 +++++++++++++++
tools/lvchange.c | 30 ++++++++++++++++++++++++++----
tools/vgchange.c | 30 ++++++++++++++++++++++++++----
7 files changed, 90 insertions(+), 10 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9b18ef0..4148754 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.105 -
=====================================
+ Do not connect to lvmetad on vg/lvchange --sysinit -aay and socket absent.
Use lv_check_not_in_use() when testing device in use before merging.
Move test for target present from init_snapshot_merge() to lvconvert.
Check for failure of lvmcache_add_mda() when writing pv.
diff --git a/daemons/lvmetad/lvmetad-client.h b/daemons/lvmetad/lvmetad-client.h
index fe8eedc..8d6ae0e 100644
--- a/daemons/lvmetad/lvmetad-client.h
+++ b/daemons/lvmetad/lvmetad-client.h
@@ -17,6 +17,8 @@
#include "daemon-client.h"
+#define LVMETAD_SOCKET DEFAULT_RUN_DIR "/lvmetad.socket"
+
struct volume_group;
/* Different types of replies we may get from lvmetad. */
@@ -64,7 +66,7 @@ static inline daemon_handle lvmetad_open(const char *socket)
{
daemon_info lvmetad_info = {
.path = "lvmetad",
- .socket = socket ?: DEFAULT_RUN_DIR "/lvmetad.socket",
+ .socket = socket ?: LVMETAD_SOCKET,
.protocol = "lvmetad",
.protocol_version = 1,
.autostart = 0
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index 03d89c9..87374e8 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -29,6 +29,8 @@
#include <math.h> /* fabs() */
#include <float.h> /* DBL_EPSILON */
+#define LVMETAD_SOCKET DEFAULT_RUN_DIR "/lvmetad.socket"
+
typedef struct {
log_state *log; /* convenience */
const char *log_config;
@@ -1209,7 +1211,7 @@ int main(int argc, char *argv[])
if (!s.socket_path) {
_socket_override = 0;
- s.socket_path = DEFAULT_RUN_DIR "/lvmetad.socket";
+ s.socket_path = LVMETAD_SOCKET;
}
ls.log_config = "";
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 5119ab1..1ead9f8 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -72,6 +72,22 @@ void lvmetad_connect_or_warn(void)
strerror(_lvmetad.error));
}
+int lvmetad_used(void)
+{
+ return _lvmetad_use;
+}
+
+int lvmetad_socket_present(void)
+{
+ const char *socket = _lvmetad_socket ?: LVMETAD_SOCKET;
+ int r;
+
+ if ((r = access(socket, F_OK)) && errno != ENOENT)
+ log_sys_error("lvmetad_socket_present", "");
+
+ return !r;
+}
+
int lvmetad_active(void)
{
if (!_lvmetad_use)
diff --git a/lib/cache/lvmetad.h b/lib/cache/lvmetad.h
index ff4cd0a..85b71c2 100644
--- a/lib/cache/lvmetad.h
+++ b/lib/cache/lvmetad.h
@@ -44,6 +44,19 @@ void lvmetad_set_active(int);
void lvmetad_set_socket(const char *);
/*
+ * Check whether lvmetad is used.
+ */
+int lvmetad_used(void);
+
+/*
+ * Check if lvmetad socket is present (either the one set by lvmetad_set_socket
+ * or the default one if not set). For example, this may be used before calling
+ * lvmetad_active() check that does connect to the socket - this would produce
+ * various connection errors if the socket is not present.
+ */
+int lvmetad_socket_present(void);
+
+/*
* Check whether lvmetad is active (where active means both that it is running
* and that we have a working connection with it).
*/
@@ -149,6 +162,8 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, activation_handler handler)
# define lvmetad_disconnect() do { } while (0)
# define lvmetad_set_active(a) do { } while (0)
# define lvmetad_set_socket(a) do { } while (0)
+# define lvmetad_used() (0)
+# define lvmetad_socket_present() (0)
# define lvmetad_active() (0)
# define lvmetad_connect_or_warn() do { } while (0)
# define lvmetad_set_token(a) do { } while (0)
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 1931c03..897ffb2 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -1235,11 +1235,33 @@ int lvchange(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
- if (arg_count(cmd, sysinit_ARG) && lvmetad_active() &&
+ /*
+ * If --sysinit -aay is used and at the same time lvmetad is used,
+ * we want to rely on autoactivation to take place. Also, we
+ * need to take special care here as lvmetad service does
+ * not neet to be running at this moment yet - it could be
+ * just too early during system initialization time.
+ */
+ if (arg_count(cmd, sysinit_ARG) && lvmetad_used() &&
arg_uint_value(cmd, activate_ARG, 0) == CHANGE_AAY) {
- log_warn("lvmetad is active while using --sysinit -a ay, "
- "skipping manual activation");
- return ECMD_PROCESSED;
+ if (!lvmetad_socket_present()) {
+ /*
+ * If lvmetad socket is not present yet,
+ * the service is just not started. It'll
+ * be started a bit later so we need to do
+ * the activation without lvmetad which means
+ * direct activation instead of autoactivation.
+ */
+ log_warn("lvmetad is not active yet, using direct activation during sysinit");
+ lvmetad_set_active(0);
+ } else if (lvmetad_active()) {
+ /*
+ * If lvmetad is active already, we want
+ * to make use of the autoactivation.
+ */
+ log_warn("lvmetad is active, skipping direct activation during sysinit");
+ return ECMD_PROCESSED;
+ }
}
return process_each_lv(cmd, argc, argv,
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 4087fab..b50b444 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -616,11 +616,33 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
- if (arg_count(cmd, sysinit_ARG) && lvmetad_active() &&
+ /*
+ * If --sysinit -aay is used and at the same time lvmetad is used,
+ * we want to rely on autoactivation to take place. Also, we
+ * need to take special care here as lvmetad service does
+ * not neet to be running at this moment yet - it could be
+ * just too early during system initialization time.
+ */
+ if (arg_count(cmd, sysinit_ARG) && lvmetad_used() &&
arg_uint_value(cmd, activate_ARG, 0) == CHANGE_AAY) {
- log_warn("lvmetad is active while using --sysinit -a ay, "
- "skipping manual activation");
- return ECMD_PROCESSED;
+ if (!lvmetad_socket_present()) {
+ /*
+ * If lvmetad socket is not present yet,
+ * the service is just not started. It'll
+ * be started a bit later so we need to do
+ * the activation without lvmetad which means
+ * direct activation instead of autoactivation.
+ */
+ log_warn("lvmetad is not active yet, using direct activation during sysinit");
+ lvmetad_set_active(0);
+ } else if (lvmetad_active()) {
+ /*
+ * If lvmetad is active already, we want
+ * to make use of the autoactivation.
+ */
+ log_warn("lvmetad is active, skipping direct activation during sysinit");
+ return ECMD_PROCESSED;
+ }
}
if (arg_count(cmd, clustered_ARG) && !argc && !arg_count(cmd, yes_ARG) &&