master - raid: man regenerated
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=81b3b71dae7775c93ad...
Commit: 81b3b71dae7775c93adebdea60308e11057a4ee8
Parent: c0c202e60600b2d7460ce0e7825f2ec89956c68f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jan 8 13:06:03 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jan 8 13:13:57 2019 +0100
raid: man regenerated
---
man/lvs.8_pregen | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/man/lvs.8_pregen b/man/lvs.8_pregen
index 377afc2..9659b70 100644
--- a/man/lvs.8_pregen
+++ b/man/lvs.8_pregen
@@ -569,8 +569,8 @@ Inconsistencies are detected by initiating a "check" on a RAID logical volume.
(The scrubbing operations, "check" and "repair", can be performed on a RAID
logical volume via the 'lvchange' command.) (w)ritemostly signifies the
devices in a RAID 1 logical volume that have been marked write-mostly.
-Re(s)haping shows a Raid Logical Volume is undergoing a reshape (ie. striped
- addition/removal, stripe size or RAID algorithm change).
+Re(s)haping signifies a RAID Logical Volume is either undergoing a stripe
+addition/removal, a stripe size or RAID algorithm change.
(R)emove after reshape signifies freed striped raid images to be removed.
.IP
Related to Thin pool Logical Volumes: (F)ailed, out of (D)ata space,
5 years, 3 months
master - mirror: regenerate config
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c0c202e60600b2d7460...
Commit: c0c202e60600b2d7460ce0e7825f2ec89956c68f
Parent: 54a569be4068d7e08ad7d6d2f6e0ee64dad0797e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jan 8 13:05:06 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jan 8 13:13:57 2019 +0100
mirror: regenerate config
Drop extra line in source file - since this line is auto-generated
and would appear twice in resuling .in file with 'make generate'.
---
conf/example.conf.in | 5 ++---
lib/config/config_settings.h | 1 -
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 39584b3..dfe8006 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -911,13 +911,12 @@ global {
# Configuration option global/support_mirrored_mirror_log.
# Enable mirrored 'mirror' log type for testing.
- #
+ #
# This type is deprecated to create or convert to but can
# be enabled to test that activation of existing mirrored
# logs and conversion to disk/core works.
- #
+ #
# Not supported for regular operation!
- #
support_mirrored_mirror_log = 0
# Configuration option global/raid10_segtype_default.
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 248d204..f1d2826 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -969,7 +969,6 @@ cfg(global_mirror_segtype_default_CFG, "mirror_segtype_default", global_CFG_SECT
"#\n")
cfg(global_support_mirrored_mirror_log_CFG, "support_mirrored_mirror_log", global_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(2, 3, 2), NULL, 0, NULL,
- "Configuration option global/support_mirrored_mirror_log.\n"
"Enable mirrored 'mirror' log type for testing.\n"
"#\n"
"This type is deprecated to create or convert to but can\n"
5 years, 3 months
master - vdo: regenerate config
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=54a569be4068d7e08ad...
Commit: 54a569be4068d7e08ad7d6d2f6e0ee64dad0797e
Parent: 61e378c4e72096be64cb5ee0a26cf976ad3a75e9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jan 8 13:04:42 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jan 8 13:13:57 2019 +0100
vdo: regenerate config
---
conf/example.conf.in | 51 +++++++++++++++++++++++-------------------
lib/config/config_settings.h | 6 ++--
2 files changed, 31 insertions(+), 26 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 85465f5..39584b3 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -497,10 +497,19 @@ allocation {
# This configuration option has an automatic default value.
# vdo_use_deduplication = 1
- # Configuration option allocation/vdo_emulate_512_sectors.
- # Specifies that the VDO volume is to emulate a 512 byte block device.
+ # Configuration option allocation/vdo_use_metadata_hints.
+ # Enables or disables whether VDO volume should tag its latency-critical
+ # writes with the REQ_SYNC flag. Some device mapper targets such as dm-raid5
+ # process writes with this flag at a higher priority.
+ # Default is enabled.
# This configuration option has an automatic default value.
- # vdo_emulate_512_sectors = 0
+ # vdo_use_metadata_hints = 1
+
+ # Configuration option allocation/vdo_minimum_io_size.
+ # The minimum IO size for VDO volume to accept, in bytes.
+ # Valid values are 512 or 4096. The recommended and default value is 4096.
+ # This configuration option has an automatic default value.
+ # vdo_minimum_io_size = 4096
# Configuration option allocation/vdo_block_map_cache_size_mb.
# Specifies the amount of memory in MiB allocated for caching block map
@@ -511,10 +520,10 @@ allocation {
# vdo_block_map_cache_size_mb = 128
# Configuration option allocation/vdo_block_map_period.
- # Tunes the quantity of block map updates that can accumulate
- # before cache pages are flushed to disk. The value must be
- # at least 1 and less then 16380.
- # A lower value means shorter recovery time but lower performance.
+ # The speed with which the block map cache writes out modified block map pages.
+ # A smaller era length is likely to reduce the amount time spent rebuilding,
+ # at the cost of increased block map writes during normal operation.
+ # The maximum and recommended value is 16380; the minimum value is 1.
# This configuration option has an automatic default value.
# vdo_block_map_period = 16380
@@ -534,22 +543,6 @@ allocation {
# This configuration option has an automatic default value.
# vdo_index_memory_size_mb = 256
- # Configuration option allocation/vdo_use_read_cache.
- # Enables or disables the read cache within the VDO volume.
- # The cache should be enabled if write workloads are expected
- # to have high levels of deduplication, or for read intensive
- # workloads of highly compressible data.
- # This configuration option has an automatic default value.
- # vdo_use_read_cache = 0
-
- # Configuration option allocation/vdo_read_cache_size_mb.
- # Specifies the extra VDO volume read cache size in MiB.
- # This space is in addition to a system-defined minimum.
- # The value must be less then 16TiB and 1.12 MiB of memory
- # will be used per MiB of read cache specified, per bio thread.
- # This configuration option has an automatic default value.
- # vdo_read_cache_size_mb = 0
-
# Configuration option allocation/vdo_slab_size_mb.
# Specifies the size in MiB of the increment by which a VDO is grown.
# Using a smaller size constrains the total maximum physical size
@@ -625,6 +618,18 @@ allocation {
# Data which has not been flushed is not guaranteed to persist in this mode.
# This configuration option has an automatic default value.
# vdo_write_policy = "auto"
+
+ # Configuration option allocation/vdo_max_discard.
+ # Specified te maximum size of discard bio accepted, in 4096 byte blocks.
+ # I/O requests to a VDO volume are normally split into 4096-byte blocks,
+ # and processed up to 2048 at a time. However, discard requests to a VDO volume
+ # can be automatically split to a larger size, up to <max discard> 4096-byte blocks
+ # in a single bio, and are limited to 1500 at a time.
+ # Increasing this value may provide better overall performance, at the cost of
+ # increased latency for the individual discard requests.
+ # The default and minimum is 1. The maximum is UINT_MAX / 4096.
+ # This configuration option has an automatic default value.
+ # vdo_max_discard = 1
}
# Configuration section log.
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index eedb7cd..248d204 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -660,12 +660,12 @@ cfg(allocation_vdo_use_sparse_index_CFG, "vdo_use_sparse_index", allocation_CFG_
// vdo format
cfg(allocation_vdo_index_memory_size_mb_CFG, "vdo_index_memory_size_mb", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_INDEX_MEMORY_SIZE_MB, VDO_1ST_VSN, NULL, 0, NULL,
"Specifies the amount of index memory in MiB for VDO volume.\n"
- "The value must be at least 256MiB and at most 1TiB.")
+ "The value must be at least 256MiB and at most 1TiB.\n")
cfg(allocation_vdo_slab_size_mb_CFG, "vdo_slab_size_mb", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_SLAB_SIZE_MB, VDO_1ST_VSN, NULL, 0, NULL,
"Specifies the size in MiB of the increment by which a VDO is grown.\n"
"Using a smaller size constrains the total maximum physical size\n"
- "that can be accommodated. Must be a power of two between 128MiB and 32GiB.")
+ "that can be accommodated. Must be a power of two between 128MiB and 32GiB.\n")
cfg(allocation_vdo_ack_threads_CFG, "vdo_ack_threads", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_ACK_THREADS, VDO_1ST_VSN, NULL, 0, NULL,
"Specifies the number of threads to use for acknowledging\n"
@@ -692,7 +692,7 @@ cfg(allocation_vdo_hash_zone_threads_CFG, "vdo_hash_zone_threads", allocation_CF
"processing based on the hash value computed from the block data.\n"
"The value must be at in range [0..100].\n"
"vdo_hash_zone_threads, vdo_logical_threads and vdo_physical_threads must be\n"
- "either all zero or all non-zero.")
+ "either all zero or all non-zero.\n")
cfg(allocation_vdo_logical_threads_CFG, "vdo_logical_threads", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_LOGICAL_THREADS, VDO_1ST_VSN, NULL, 0, NULL,
"Specifies the number of threads across which to subdivide parts of the VDO\n"
5 years, 3 months
master - config: drop extra spaces
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=61e378c4e72096be64c...
Commit: 61e378c4e72096be64cb5ee0a26cf976ad3a75e9
Parent: fdd612b8242281ac599c220726155202c71549a8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jan 7 17:39:55 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jan 8 13:13:57 2019 +0100
config: drop extra spaces
---
lib/config/config_settings.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 21ea3b6..eedb7cd 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -668,7 +668,7 @@ cfg(allocation_vdo_slab_size_mb_CFG, "vdo_slab_size_mb", allocation_CFG_SECTION,
"that can be accommodated. Must be a power of two between 128MiB and 32GiB.")
cfg(allocation_vdo_ack_threads_CFG, "vdo_ack_threads", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_ACK_THREADS, VDO_1ST_VSN, NULL, 0, NULL,
- "Specifies the number of threads to use for acknowledging\n"
+ "Specifies the number of threads to use for acknowledging\n"
"completion of requested VDO I/O operations.\n"
"The value must be at in range [0..100].\n")
5 years, 3 months
master - generators: avoid contacting syslog with generators
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fdd612b8242281ac599...
Commit: fdd612b8242281ac599c220726155202c71549a8
Parent: 6298eaeca50e32cdff3adefdb57b09c3250547a2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jan 7 15:48:39 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jan 8 13:13:54 2019 +0100
generators: avoid contacting syslog with generators
The systemd generators are executed very early during the switch
from initramfs to system partition and the syslog is not yet fully
operational - it may cause blocking, if some debug logging is enabled
at the same time in /etc/lvm/lvm.conf log{} section.
To avoid timeouting and killing this generator - rather enhance lvm
code to suppress any syslog communication when LVM_SUPPRESS_SYSLOG
envvar is set.
Use of this envvar is needed since the parsing of i.e. cmdline options
that could eventually override lvm.conf setting happens in this case
way too late and number of lines could have been already streamed to
syslog.
---
WHATS_NEW | 1 +
lib/log/log.c | 3 +++
man/lvm.8_main | 3 +++
scripts/generator-internals.c | 3 +++
4 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6fdde83..822d045 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.02 -
===================================
+ Introduce LVM_SUPPRESS_SYSLOG to suppress syslog usage by generator.
Fix generator quering lvmconfig unpresent config option.
Fix memleak on bcache error path code.
Fix missing unlock on lvm2 dmeventd plugin error path initialization.
diff --git a/lib/log/log.c b/lib/log/log.c
index fd056b1..f6aaa04 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -324,6 +324,9 @@ void init_log_while_suspended(int log_while_suspended)
void init_syslog(int facility)
{
+ if (getenv("LVM_SUPPRESS_SYSLOG"))
+ return;
+
openlog("lvm", LOG_PID, facility);
_syslog = 1;
}
diff --git a/man/lvm.8_main b/man/lvm.8_main
index b9abf58..3e67b1b 100644
--- a/man/lvm.8_main
+++ b/man/lvm.8_main
@@ -435,6 +435,9 @@ Defaults to "\fI#DEFAULT_SYS_DIR#\fP".
.B LVM_SUPPRESS_FD_WARNINGS
Suppress warnings about unexpected file descriptors passed into LVM.
.TP
+.B LVM_SUPPRESS_SYSLOG
+Suppress contacting syslog.
+.TP
.B LVM_VG_NAME
The Volume Group name that is assumed for
any reference to a Logical Volume that doesn't specify a path.
diff --git a/scripts/generator-internals.c b/scripts/generator-internals.c
index 8392065..733e818 100644
--- a/scripts/generator-internals.c
+++ b/scripts/generator-internals.c
@@ -72,6 +72,9 @@ static bool _open_child(struct child_process *child, const char *cmd, const char
(void) close(pipe_fd[1]);
}
+ /* Suppressing any use of syslog */
+ (void) setenv("LVM_SUPPRESS_SYSLOG", "1", 1);
+
if (execv(cmd, (char *const *) argv) < 0)
_error("execv failed: %s\n", strerror(errno));
// Shouldn't get here unless exec failed.
5 years, 3 months
master - scripts: lvm2-activation-generator fix lvmconfig call
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6298eaeca50e32cdff3...
Commit: 6298eaeca50e32cdff3adefdb57b09c3250547a2
Parent: bc40391b7de93334c815565240848d5297f7a6c8
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Jan 4 11:11:13 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jan 8 13:11:46 2019 +0100
scripts: lvm2-activation-generator fix lvmconfig call
Fix a scenario where global/event_activation setting is not found. In
this case we need to take default value just like lvm tools do when
executed. So use "lvmconfig --type full".
Also, if we fail to execute lvmconfig for whatever reason, fallback to
generating the activation units as failsafe action.
Reported by: Bastian Blank <waldi debian org>
---
WHATS_NEW | 1 +
scripts/generator-internals.c | 3 ++-
.../lvm2_activation_generator_systemd_red_hat.c | 15 ++++++++++-----
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 3fe1f3e..6fdde83 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.02 -
===================================
+ Fix generator quering lvmconfig unpresent config option.
Fix memleak on bcache error path code.
Fix missing unlock on lvm2 dmeventd plugin error path initialization.
Improve Makefile dependency tracking.
diff --git a/scripts/generator-internals.c b/scripts/generator-internals.c
index 0929b78..8392065 100644
--- a/scripts/generator-internals.c
+++ b/scripts/generator-internals.c
@@ -186,7 +186,8 @@ static bool _parse_line(const char *line, struct config *cfg)
static bool _get_config(struct config *cfg, const char *lvmconfig_path)
{
static const char *_argv[] = {
- "lvmconfig", LVM_CONF_EVENT_ACTIVATION, LVM_CONF_USE_LVMPOLLD, NULL
+ "lvmconfig", "--type", "full",
+ LVM_CONF_EVENT_ACTIVATION, LVM_CONF_USE_LVMPOLLD, NULL
};
bool r = true;
diff --git a/scripts/lvm2_activation_generator_systemd_red_hat.c b/scripts/lvm2_activation_generator_systemd_red_hat.c
index a3a3e88..f906f08 100644
--- a/scripts/lvm2_activation_generator_systemd_red_hat.c
+++ b/scripts/lvm2_activation_generator_systemd_red_hat.c
@@ -194,12 +194,17 @@ static bool _run(int argc, const char **argv)
if (!_parse_command_line(&gen, argc, argv))
return false;
- if (!_get_config(&gen.cfg, LVMCONFIG_PATH))
- return false;
+ if (_get_config(&gen.cfg, LVMCONFIG_PATH)) {
+ if (gen.cfg.event_activation)
+ // If event_activation=1, pvscan --cache -aay does activation.
+ return true;
+ }
- if (gen.cfg.event_activation)
- // If event_activation=1, pvscan --cache -aay does activation.
- return true;
+ /*
+ * Create the activation units if:
+ * - _get_config succeeded and event_activation=0
+ * - _get_config failed, then this is a failsafe fallback
+ */
/* mark lvm2-activation.*.service as world-accessible */
old_mask = umask(0022);
5 years, 3 months
master - writecache: use wipe_lv to warn about specific signatures
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bc40391b7de93334c81...
Commit: bc40391b7de93334c815565240848d5297f7a6c8
Parent: 938b6b8253c7aadb8947c574cc5f480ed2c1b696
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Jan 3 10:37:26 2019 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jan 3 10:47:35 2019 -0600
writecache: use wipe_lv to warn about specific signatures
When initializing an LV to hold the writecache, use wipe_lv()
which looks for specific signatures on the LV.
Wiping signatures is not necessary, but printing a warning
that names a specific signature (in addition to the existing
generic warning/confirmation) may help if a user accidentally
specifies the wrong LV which contains something important.
---
tools/lvconvert.c | 39 +++++++++------------------------------
1 files changed, 9 insertions(+), 30 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 2c6384e..8ea7b65 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5230,44 +5230,23 @@ static int _lvconvert_detach_writecache(struct cmd_context *cmd,
static int _writecache_zero(struct cmd_context *cmd, struct logical_volume *lv)
{
- struct device *dev;
- char name[PATH_MAX];
- int ret = 0;
+ struct wipe_params wp;
+ int ret;
if (!activate_lv(cmd, lv)) {
- log_error("Failed to activate LV %s for zeroing.", lv->name);
+ log_error("Failed to activate LV %s for zeroing.", display_lvname(lv));
return 0;
}
- sync_local_dev_names(cmd);
-
- if (dm_snprintf(name, sizeof(name), "%s%s/%s",
- cmd->dev_dir, lv->vg->name, lv->name) < 0) {
- log_error("Name too long - device not cleared (%s)", lv->name);
- goto out;
- }
+ wp.do_wipe_signatures = 1; /* optional, to print warning if clobbering something */
+ wp.do_zero = 1; /* required for dm-writecache to work */
+ wp.zero_sectors = 1;
+ wp.zero_value = 0;
- if (!(dev = dev_cache_get(cmd, name, NULL))) {
- log_error("%s: not found: device not zeroed", name);
- goto out;
- }
+ ret = wipe_lv(lv, wp);
- if (!label_scan_open(dev)) {
- log_error("Failed to open %s/%s for zeroing.", lv->vg->name, lv->name);
- goto out;
- }
-
- if (!dev_write_zeros(dev, UINT64_C(0), (size_t) 1 << SECTOR_SHIFT))
- goto_out;
-
- log_debug("Zeroed the first sector of %s", lv->name);
-
- label_scan_invalidate(dev);
-
- ret = 1;
-out:
if (!deactivate_lv(cmd, lv)) {
- log_error("Failed to deactivate LV %s for zeroing.", lv->name);
+ log_error("Failed to deactivate LV %s for zeroing.", display_lvname(lv));
ret = 0;
}
5 years, 3 months
master - writecache: prompt before using an LV to hold cache
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=938b6b8253c7aadb894...
Commit: 938b6b8253c7aadb8947c574cc5f480ed2c1b696
Parent: 89c61f2018c843a7dabc617ba152b99656ee9849
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jan 2 11:44:03 2019 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jan 2 11:44:03 2019 -0600
writecache: prompt before using an LV to hold cache
---
test/shell/writecache.sh | 4 ++--
tools/lvconvert.c | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/test/shell/writecache.sh b/test/shell/writecache.sh
index ce77cfe..42c864a 100644
--- a/test/shell/writecache.sh
+++ b/test/shell/writecache.sh
@@ -48,7 +48,7 @@ cp pattern1 $mount_dir/pattern1
umount $mount_dir
lvchange -an $vg/$lv1
-lvconvert --type writecache --cachepool $lv2 $vg/$lv1
+lvconvert --yes --type writecache --cachepool $lv2 $vg/$lv1
check lv_field $vg/$lv1 segtype writecache
@@ -90,7 +90,7 @@ lvchange -an $vg/$lv2
# test2: create fs on LV after writecache is attached
-lvconvert --type writecache --cachepool $lv2 $vg/$lv1
+lvconvert --yes --type writecache --cachepool $lv2 $vg/$lv1
check lv_field $vg/$lv1 segtype writecache
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 3ba7f5b..2c6384e 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5498,6 +5498,12 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
return 0;
}
+ if (!arg_is_set(cmd, yes_ARG) &&
+ yes_no_prompt("Erase all existing data on %s? [y/n]: ", display_lvname(lv_fast)) == 'n') {
+ log_error("Conversion aborted.");
+ return 0;
+ }
+
/* Ensure the two LVs are not active elsewhere. */
if (!lockd_lv(cmd, lv, "ex", 0))
goto_bad;
5 years, 3 months
master - Revert "lvconvert: use standard wiping code"
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=89c61f2018c843a7dab...
Commit: 89c61f2018c843a7dabc617ba152b99656ee9849
Parent: ee9d623d387c8789fc40e957af7b47d287a57368
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jan 2 11:21:45 2019 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jan 2 11:21:45 2019 -0600
Revert "lvconvert: use standard wiping code"
This reverts commit fb85d5d02478a34ab6648bdbdf09a931176dee71.
Adding a confirmation prompt in the following commit so the
wiping confirmation won't be needed.
---
tools/lvconvert.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 47 insertions(+), 1 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 7139be3..3ba7f5b 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5228,6 +5228,52 @@ static int _lvconvert_detach_writecache(struct cmd_context *cmd,
return 1;
}
+static int _writecache_zero(struct cmd_context *cmd, struct logical_volume *lv)
+{
+ struct device *dev;
+ char name[PATH_MAX];
+ int ret = 0;
+
+ if (!activate_lv(cmd, lv)) {
+ log_error("Failed to activate LV %s for zeroing.", lv->name);
+ return 0;
+ }
+
+ sync_local_dev_names(cmd);
+
+ if (dm_snprintf(name, sizeof(name), "%s%s/%s",
+ cmd->dev_dir, lv->vg->name, lv->name) < 0) {
+ log_error("Name too long - device not cleared (%s)", lv->name);
+ goto out;
+ }
+
+ if (!(dev = dev_cache_get(cmd, name, NULL))) {
+ log_error("%s: not found: device not zeroed", name);
+ goto out;
+ }
+
+ if (!label_scan_open(dev)) {
+ log_error("Failed to open %s/%s for zeroing.", lv->vg->name, lv->name);
+ goto out;
+ }
+
+ if (!dev_write_zeros(dev, UINT64_C(0), (size_t) 1 << SECTOR_SHIFT))
+ goto_out;
+
+ log_debug("Zeroed the first sector of %s", lv->name);
+
+ label_scan_invalidate(dev);
+
+ ret = 1;
+out:
+ if (!deactivate_lv(cmd, lv)) {
+ log_error("Failed to deactivate LV %s for zeroing.", lv->name);
+ ret = 0;
+ }
+
+ return ret;
+}
+
static int _get_one_writecache_setting(struct cmd_context *cmd, struct writecache_settings *settings,
char *key, char *val, uint32_t *block_size_sectors)
{
@@ -5470,7 +5516,7 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
* writecache block_size value matching the sector size of lv.
*/
- if (!activate_and_wipe_lv(lv_fast, 0)) {
+ if (!_writecache_zero(cmd, lv_fast)) {
log_error("LV %s could not be zeroed.", display_lvname(lv_fast));
return 0;
}
5 years, 3 months