master - dmeventd: log all commands with CMD: prefix
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=11a084cf42e79f...
Commit: 11a084cf42e79f130e4389bac57688cfd6657fc1
Parent: d60794c3a3948f5ec5d4c529569ba66d9a635e55
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 13 11:19:59 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 13 14:40:46 2015 +0200
dmeventd: log all commands with CMD: prefix
For easier grep of all processed command - add CMD: prefix to them.
Use >>> for entring command processing
and <<< when command is processed.
---
daemons/dmeventd/dmeventd.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 37cf8e9..844b2a6 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1574,7 +1574,7 @@ static void _process_request(struct dm_event_fifos *fifos)
return;
cmd = msg.cmd;
- DEBUGLOG("%s (0x%x) processing...", decode_cmd(cmd), cmd);
+ DEBUGLOG(">>> CMD:%s (0x%x) processing...", decode_cmd(cmd), cmd);
die = (msg.cmd == DM_EVENT_CMD_DIE) ? 1 : 0;
@@ -1587,7 +1587,7 @@ static void _process_request(struct dm_event_fifos *fifos)
dm_free(msg.data);
- DEBUGLOG("%s (0x%x) completed (=%d).", decode_cmd(cmd), cmd, msg.cmd);
+ DEBUGLOG("<<< CMD:%s (0x%x) completed (=%d).", decode_cmd(cmd), cmd, msg.cmd);
if (die) {
if (unlink(DMEVENTD_PIDFILE))
7 years, 5 months
master - dmeventd: fix loging report
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d60794c3a3948f...
Commit: d60794c3a3948f5ec5d4c529569ba66d9a635e55
Parent: 1b1c01a27b359f8e91c3c9e08684c435d8fd51c2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 9 22:16:33 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 13 14:40:46 2015 +0200
dmeventd: fix loging report
msg.cmd holds return value from processing after _do_process_request,
so save it before call.
---
daemons/dmeventd/dmeventd.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index ffc941f..37cf8e9 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1564,6 +1564,7 @@ static void _process_request(struct dm_event_fifos *fifos)
{
int die;
struct dm_event_daemon_message msg = { 0 };
+ int cmd;
/*
* Read the request from the client (client_read, client_write
@@ -1572,7 +1573,8 @@ static void _process_request(struct dm_event_fifos *fifos)
if (!_client_read(fifos, &msg))
return;
- DEBUGLOG("%s (0x%x) processing...", decode_cmd(msg.cmd), msg.cmd);
+ cmd = msg.cmd;
+ DEBUGLOG("%s (0x%x) processing...", decode_cmd(cmd), cmd);
die = (msg.cmd == DM_EVENT_CMD_DIE) ? 1 : 0;
@@ -1585,7 +1587,7 @@ static void _process_request(struct dm_event_fifos *fifos)
dm_free(msg.data);
- DEBUGLOG("%s (0x%x) completed.", decode_cmd(msg.cmd), msg.cmd);
+ DEBUGLOG("%s (0x%x) completed (=%d).", decode_cmd(cmd), cmd, msg.cmd);
if (die) {
if (unlink(DMEVENTD_PIDFILE))
7 years, 5 months
master - log: no file for external logging
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1b1c01a27b359f...
Commit: 1b1c01a27b359f8e91c3c9e08684c435d8fd51c2
Parent: 72d700b064fb64f6bb7e20c23dbb2ce8b6d8feb7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 13 09:44:33 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 13 14:40:44 2015 +0200
log: no file for external logging
When external logging is set do not bother creating log file,
as it's not going to be used.
---
WHATS_NEW | 1 +
lib/log/log.c | 4 ++++
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index c089228..7507b9c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.133 -
======================================
+ Avoid creation of log file when logging function is set.
Do not change logging in lvm2 library when it's already set.
Check for enough space in thin-pool in command before creating new thin.
Make libblkid detect all copies of the same signature if use_blkid_wiping=1.
diff --git a/lib/log/log.c b/lib/log/log.c
index bd11363..7f31361 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -74,6 +74,10 @@ void init_log_file(const char *log_file, int append)
int i = 0;
_log_file_path[0] = '\0';
+
+ if (_lvm2_log_fn)
+ return; /* No log file, when log function is set */
+
if ((env = getenv("LVM_LOG_FILE_EPOCH"))) {
while (isalpha(env[i]) && i < 32) /* Up to 32 alphas */
i++;
7 years, 5 months
master - toolcontext: do not change already set dm_log
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=72d700b064fb64...
Commit: 72d700b064fb64f6bb7e20c23dbb2ce8b6d8feb7
Parent: 86b04ebd193c9db09ee5f03a2de4997aa2ab52c3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 9 21:38:50 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 13 14:39:37 2015 +0200
toolcontext: do not change already set dm_log
If the dm_log is already set to non-default logger,
avoid to change it.
---
WHATS_NEW | 1 +
lib/commands/toolcontext.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 348c099..c089228 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.133 -
======================================
+ Do not change logging in lvm2 library when it's already set.
Check for enough space in thin-pool in command before creating new thin.
Make libblkid detect all copies of the same signature if use_blkid_wiping=1.
Fix vgimportclone with -n to not add number unnecessarily to base VG name.
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index c8d96ca..c150991 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -362,7 +362,8 @@ static void _init_logging(struct cmd_context *cmd)
/* Tell device-mapper about our logging */
#ifdef DEVMAPPER_SUPPORT
- dm_log_with_errno_init(print_log);
+ if (!dm_log_is_non_default())
+ dm_log_with_errno_init(print_log);
#endif
reset_log_duplicated();
reset_lvm_errno(1);
7 years, 5 months
master - thin: enhance logging
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=86b04ebd193c9d...
Commit: 86b04ebd193c9db09ee5f03a2de4997aa2ab52c3
Parent: 7e1c08bb6a90acdbf56e362ee017bd48de13a535
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 9 21:35:05 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 13 14:38:52 2015 +0200
thin: enhance logging
Add debug message with more details about threshold overflow.
---
lib/metadata/thin_manip.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 24c68a8..37bf4cb 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -224,15 +224,27 @@ int pool_below_threshold(const struct lv_segment *pool_seg)
if (!lv_thin_pool_percent(pool_seg->lv, 0, &percent))
return_0;
- if (percent >= threshold)
+ if (percent >= threshold) {
+ log_debug("Threshold configured for free data space in "
+ "thin pool %s has been reached (%.2f%% >= %.2f%%).",
+ display_lvname(pool_seg->lv),
+ dm_percent_to_float(percent),
+ dm_percent_to_float(threshold));
return 0;
+ }
/* Metadata */
if (!lv_thin_pool_percent(pool_seg->lv, 1, &percent))
return_0;
- if (percent >= threshold)
+ if (percent >= threshold) {
+ log_debug("Threshold configured for free metadata space in "
+ "thin pool %s has been reached (%.2f%% > %.2f%%).",
+ display_lvname(pool_seg->lv),
+ dm_percent_to_float(percent),
+ dm_percent_to_float(threshold));
return 0;
+ }
return 1;
}
7 years, 5 months
master - dmeventd: correct ret code for fail
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7e1c08bb6a90ac...
Commit: 7e1c08bb6a90acdbf56e362ee017bd48de13a535
Parent: c7b4359ff41634096770d464d362d43d2e82bbda
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 13 09:49:59 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 13 14:38:49 2015 +0200
dmeventd: correct ret code for fail
As _do_register_device() calls register_device() function that returns
1 success & 0 fail - ret = -ENOMEM for fail case instead of 0.
---
WHATS_NEW_DM | 1 +
daemons/dmeventd/dmeventd.c | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index e760875..a1c121a 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.110 -
======================================
+ Return -ENOMEM when device registration fails instead of 0 (=success).
Enforce writethrough mode for cleaner policy.
Add support for recognition and deactivation of MD devices to blkdeactivate.
Move target status functions out of libdm-deptree.
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 1ff5bf9..ffc941f 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1070,8 +1070,10 @@ static int _register_for_event(struct message_data *message_data)
if (!(thread = _lookup_thread_status(message_data))) {
_unlock_mutex();
- if (!(ret = _do_register_device(thread_new)))
- goto out;
+ if (!_do_register_device(thread_new)) {
+ ret = -ENOMEM;
+ goto_out;
+ }
thread = thread_new;
thread_new = NULL;
7 years, 5 months
master - thin: check for overflown pool earlier
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c7b4359ff41634...
Commit: c7b4359ff41634096770d464d362d43d2e82bbda
Parent: 5695c6aca63b2312e76f8b3fbbea95601269f8c8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 7 15:10:03 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 13 14:37:07 2015 +0200
thin: check for overflown pool earlier
Check for pool early before we actually start to modify metadata.
This requires locally active thin-pool.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 18 ++++++++++++------
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f683456..348c099 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.133 -
======================================
+ Check for enough space in thin-pool in command before creating new thin.
Make libblkid detect all copies of the same signature if use_blkid_wiping=1.
Fix vgimportclone with -n to not add number unnecessarily to base VG name.
Cleanup vgimportclone script and remove dependency on awk, grep, cut and tr.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 3e870d5..8a0bbcd 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7087,12 +7087,18 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
}
- if (seg_is_thin_volume(lp) &&
- lv_is_new_thin_pool(pool_lv)) {
- thin_pool_was_active = lv_is_active(pool_lv);
- if (!check_new_thin_pool(pool_lv))
- return_NULL;
- /* New pool is now inactive */
+ if (seg_is_thin_volume(lp)) {
+ if (lv_is_new_thin_pool(pool_lv)) {
+ thin_pool_was_active = lv_is_active(pool_lv);
+ if (!check_new_thin_pool(pool_lv))
+ return_NULL;
+ /* New pool is now inactive */
+ } else if (!pool_below_threshold(first_seg(pool_lv))) {
+ log_error("Cannot create new thin volume, free space in "
+ "thin pool %s reached threshold.",
+ display_lvname(pool_lv));
+ return NULL;
+ }
}
if (seg_is_cache(lp) &&
7 years, 5 months
master - libdm: enforce writethrough mode for cleaner
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5695c6aca63b23...
Commit: 5695c6aca63b2312e76f8b3fbbea95601269f8c8
Parent: 5ac81657e5d312b72d746bc7cf22a4e6bb5b1609
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 13 14:06:15 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 13 14:35:48 2015 +0200
libdm: enforce writethrough mode for cleaner
With "cleaner" policy always use 'writethrough' mode.
---
WHATS_NEW_DM | 1 +
libdm/libdm-deptree.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index e89ead0..e760875 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.110 -
======================================
+ Enforce writethrough mode for cleaner policy.
Add support for recognition and deactivation of MD devices to blkdeactivate.
Move target status functions out of libdm-deptree.
Correct use of max_write_behind parameter when generating raid target line.
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index ef283e9..afdce8d 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -3302,7 +3302,8 @@ int dm_tree_node_add_cache_target(struct dm_tree_node *node,
return_0;
seg->data_block_size = data_block_size;
- seg->flags = feature_flags;
+ /* Enforce WriteThough mode for cleaner policy */
+ seg->flags = (strcmp(policy_name, "cleaner") == 0) ? DM_CACHE_FEATURE_WRITETHROUGH : feature_flags;
seg->policy_name = policy_name;
/* FIXME: better validation missing */
7 years, 5 months
master - wiping: make libblkid detect all copies of the same signature if use_blkid_wiping=1
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5ac81657e5d312...
Commit: 5ac81657e5d312b72d746bc7cf22a4e6bb5b1609
Parent: 5bd63df237bc3426d1ebd41b103430063846b3ab
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Oct 13 12:18:04 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Oct 13 12:22:09 2015 +0200
wiping: make libblkid detect all copies of the same signature if use_blkid_wiping=1
Some signatures are spread around the disk in several copies, mainly for
backup. Make libblkid to detect these extra copies - there was missing
"blkid_probe_step_back" fn call after successful wipe of previous signature
copy.
An example with FAT table which has copies:
$ mkfs.vfat /dev/sda1
Before this patch:
$ pvcreate /dev/sda1
WARNING: vfat signature detected on /dev/sda1 at offset 54. Wipe it? [y/n]: y
Wiping vfat signature on /dev/sda1.
Physical volume "/dev/sda1" successfully created
With this patch applied:
$ pvcreate /dev/sda1
WARNING: vfat signature detected on /dev/sda1 at offset 54. Wipe it? [y/n]: y
Wiping vfat signature on /dev/sda1.
WARNING: vfat signature detected on /dev/sda1 at offset 0. Wipe it? [y/n]: y
Wiping vfat signature on /dev/sda1.
WARNING: vfat signature detected on /dev/sda1 at offset 510. Wipe it? [y/n]: y
Wiping vfat signature on /dev/sda1.
Physical volume "/dev/sda1" successfully created
---
WHATS_NEW | 1 +
lib/device/dev-type.c | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 5fa6e7f..f683456 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.133 -
======================================
+ Make libblkid detect all copies of the same signature if use_blkid_wiping=1.
Fix vgimportclone with -n to not add number unnecessarily to base VG name.
Cleanup vgimportclone script and remove dependency on awk, grep, cut and tr.
Add vg_missing_pv_count report field to report number of missing PVs in a VG.
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index 25f11d1..1d03024 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -651,8 +651,13 @@ static int _wipe_known_signatures_with_blkid(struct device *dev, const char *nam
BLKID_SUBLKS_BADCSUM);
while (!blkid_do_probe(probe)) {
- if ((r_wipe = _blkid_wipe(probe, dev, name, types_to_exclude, types_no_prompt, yes, force)) == 1)
+ if ((r_wipe = _blkid_wipe(probe, dev, name, types_to_exclude, types_no_prompt, yes, force)) == 1) {
(*wiped)++;
+ if (blkid_probe_step_back(probe)) {
+ log_error("Failed to step back blkid probe to check just wiped signature.");
+ goto out;
+ }
+ }
/* do not count excluded types */
if (r_wipe != 2)
found++;
7 years, 5 months
master - tests: test vgimportclone and -n option
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5bd63df237bc34...
Commit: 5bd63df237bc3426d1ebd41b103430063846b3ab
Parent: 75420282e17e44d5c7b56126a5c7fd170f0ef417
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Oct 12 12:54:35 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Oct 12 12:55:39 2015 +0200
tests: test vgimportclone and -n option
---
test/shell/vgimportclone.sh | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/test/shell/vgimportclone.sh b/test/shell/vgimportclone.sh
index 0b1af38..53c8b00 100644
--- a/test/shell/vgimportclone.sh
+++ b/test/shell/vgimportclone.sh
@@ -71,3 +71,28 @@ lvchange -ay $vg1/$lv1 $vg2/$lv1
vgchange -an $vg1 $vg2
vgremove -ff $vg1 $vg2
+
+# Verify that if we provide the -n|--basevgname,
+# the number suffix is not added unnecessarily.
+vgcreate --metadatasize 128k A${vg1}B "$dev1"
+
+# vg1B is not the same as Avg1B - we don't need number suffix
+dd if="$dev1" of="$dev2" bs=256K count=1
+aux notify_lvmetad "$dev2"
+vgimportclone -n ${vg1}B "$dev2"
+check pv_field "$dev2" vg_name ${vg1}B
+
+# Avg1 is not the same as Avg1B - we don't need number suffix
+dd if="$dev1" of="$dev2" bs=256K count=1
+aux notify_lvmetad "$dev2"
+vgimportclone -n A${vg1} "$dev2"
+check pv_field "$dev2" vg_name A${vg1}
+
+# Avg1B is the same as Avg1B - we need to add the number suffix
+dd if="$dev1" of="$dev2" bs=256K count=1
+aux notify_lvmetad "$dev2"
+vgimportclone -n A${vg1}B "$dev2"
+aux vgs
+check pv_field "$dev2" vg_name A${vg1}B1
+
+vgremove -ff A${vg1}B A${vg1}B1
7 years, 5 months