master - dmeventd: provide message context
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a9ee86ccf2425c...
Commit: a9ee86ccf2425cbe3f038039c8038db1e1784086
Parent: 4e26024add915a1970eb7f43298b24b180e7e061
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 26 12:13:34 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 3 17:49:07 2016 +0100
dmeventd: provide message context
Show device name with printed message.
Also use different level for printing error message and
standard informational message.
---
daemons/dmeventd/plugins/mirror/dmeventd_mirror.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c b/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
index a7ed4dd..3d3a6de 100644
--- a/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
+++ b/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
@@ -99,20 +99,21 @@ static int _get_mirror_event(struct dso_state *state, char *params)
return r;
}
-static int _remove_failed_devices(const char *cmd_lvscan, const char *cmd_lvconvert)
+static int _remove_failed_devices(const char *cmd_lvscan, const char *cmd_lvconvert,
+ const char *device)
{
- int r;
-
if (!dmeventd_lvm2_run_with_lock(cmd_lvscan))
- log_warn("WARNING: Re-scan of mirrored device failed.");
+ log_warn("WARNING: Re-scan of mirrored device %s failed.", device);
/* if repair goes OK, report success even if lvscan has failed */
- r = dmeventd_lvm2_run_with_lock(cmd_lvconvert);
+ if (!dmeventd_lvm2_run_with_lock(cmd_lvconvert)) {
+ log_error("Repair of mirrored device %s failed.", device);
+ return 0;
+ }
- log_info("Repair of mirrored device %s.",
- (r) ? "finished successfully" : "failed");
+ log_info("Repair of mirrored device %s finished successfully.", device);
- return r;
+ return 1;
}
void process_event(struct dm_task *dmt,
@@ -151,7 +152,8 @@ void process_event(struct dm_task *dmt,
case ME_FAILURE:
log_error("Device failure in %s.", device);
if (!_remove_failed_devices(state->cmd_lvscan,
- state->cmd_lvconvert))
+ state->cmd_lvconvert,
+ device))
/* FIXME Why are all the error return codes unused? Get rid of them? */
log_error("Failed to remove faulty devices in %s.",
device);
7 years, 5 months
master - cleanup: use WARNING prefix for log_warn
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4e26024add915a...
Commit: 4e26024add915a1970eb7f43298b24b180e7e061
Parent: 0d95082aa97b92d120daf1858acd91abe788d2cb
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 26 14:42:13 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 3 17:49:07 2016 +0100
cleanup: use WARNING prefix for log_warn
Use capital WARNING prefix for log_warn() messages.
---
libdm/libdm-stats.c | 8 ++++----
tools/dmsetup.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 73d7ae8..55e2a42 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -3881,7 +3881,7 @@ merge:
continue;
if (_extents_overlap(ext, next)) {
- log_warn("Warning: region IDs " FMTu64 " and "
+ log_warn("WARNING: region IDs " FMTu64 " and "
FMTu64 " overlap. Some events will be "
"counted twice.", ext->id, next->id);
/* merge larger extent into smaller */
@@ -4002,8 +4002,8 @@ int dm_stats_create_group(struct dm_stats *dms, const char *members,
}
if (precise && (precise != count))
- log_warn("Grouping regions with different clock resolution: "
- "precision may be lost");
+ log_warn("WARNING: Grouping regions with different clock resolution: "
+ "precision may be lost.");
if (!_stats_group_check_overlap(dms, regions, count))
log_very_verbose("Creating group with overlapping regions.");
@@ -4048,7 +4048,7 @@ int dm_stats_delete_group(struct dm_stats *dms, uint64_t group_id,
if (dm_bit(regions, i)) {
dm_bit_clear(regions, i);
if (remove_regions && !dm_stats_delete_region(dms, i))
- log_warn("Failed to delete region "
+ log_warn("WARNING: Failed to delete region "
FMTu64 " on %s.", i, dms->name);
}
}
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 42f0b05..4b525e2 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -1611,7 +1611,7 @@ static int _udevcomplete_all(CMD_ARGS)
}
if (!_switches[YES_ARG]) {
- log_warn("This operation will destroy all semaphores %s%.0d%swith keys "
+ log_warn("WARNING: This operation will destroy all semaphores %s%.0d%swith keys "
"that have a prefix %" PRIu16 " (0x%" PRIx16 ").",
age ? "older than " : "", age, age ? " minutes " : "",
DM_COOKIE_MAGIC, DM_COOKIE_MAGIC);
7 years, 5 months
master - cleanup: remove goto
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0d95082aa97b92...
Commit: 0d95082aa97b92d120daf1858acd91abe788d2cb
Parent: 9cbe4c1af935bd4e76fbcc8a8736c6337bfc638b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 26 11:26:02 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 3 17:49:07 2016 +0100
cleanup: remove goto
Move goto path into 'if()' branch.
---
daemons/dmeventd/plugins/mirror/dmeventd_mirror.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c b/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
index 7653413..a7ed4dd 100644
--- a/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
+++ b/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
@@ -73,8 +73,10 @@ static int _get_mirror_event(struct dso_state *state, char *params)
unsigned i;
struct dm_status_mirror *ms;
- if (!dm_get_status_mirror(state->mem, params, &ms))
- goto_out;
+ if (!dm_get_status_mirror(state->mem, params, &ms)) {
+ log_error("Unable to parse mirror status string.");
+ return ME_IGNORE;
+ }
/* Check for bad mirror devices */
for (i = 0; i < ms->dev_count; ++i)
@@ -95,11 +97,6 @@ static int _get_mirror_event(struct dso_state *state, char *params)
dm_pool_free(state->mem, ms);
return r;
-
-out:
- log_error("Unable to parse mirror status string.");
-
- return ME_IGNORE;
}
static int _remove_failed_devices(const char *cmd_lvscan, const char *cmd_lvconvert)
7 years, 5 months
master - log_info to log_very_verbose
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9cbe4c1af935bd...
Commit: 9cbe4c1af935bd4e76fbcc8a8736c6337bfc638b
Parent: cc19cc07f7a1aa4a45f6044a7eb4686f6d5dcf69
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Nov 1 11:02:01 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 3 17:49:07 2016 +0100
log_info to log_very_verbose
Translate log_info() into log_very_verbose() which is macro
supposed to be used by our code.
log_info() is internal macro with eventually some 'symbolic' meaning
in syslogging daemons.
---
daemons/dmeventd/plugins/thin/dmeventd_thin.c | 2 +-
lib/activate/activate.c | 2 +-
lib/label/label.c | 24 ++++++++++++------------
libdm/libdm-stats.c | 4 ++--
4 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/daemons/dmeventd/plugins/thin/dmeventd_thin.c b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
index d5a3a59..0c26baf 100644
--- a/daemons/dmeventd/plugins/thin/dmeventd_thin.c
+++ b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
@@ -301,7 +301,7 @@ out:
static int _use_policy(struct dm_task *dmt, struct dso_state *state)
{
#if THIN_DEBUG
- log_info("dmeventd executes: %s.", state->cmd_str);
+ log_debug("dmeventd executes: %s.", state->cmd_str);
#endif
if (!dmeventd_lvm2_run_with_lock(state->cmd_str)) {
log_error("Failed to extend thin pool %s.",
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 571f2b2..8fc45b7 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1708,7 +1708,7 @@ int target_register_events(struct cmd_context *cmd, const char *dso, const struc
if (!r)
return_0;
- log_info("%s %s for events", set ? "Monitored" : "Unmonitored", uuid);
+ log_very_verbose("%s %s for events", set ? "Monitored" : "Unmonitored", uuid);
return 1;
}
diff --git a/lib/label/label.c b/lib/label/label.c
index b52cb42..c5f4884 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -140,18 +140,18 @@ static struct labeller *_find_labeller(struct device *dev, char *buf,
sector + scan_sector);
}
if (xlate64(lh->sector_xl) != sector + scan_sector) {
- log_info("%s: Label for sector %" PRIu64
- " found at sector %" PRIu64
- " - ignoring", dev_name(dev),
- (uint64_t)xlate64(lh->sector_xl),
- sector + scan_sector);
+ log_very_verbose("%s: Label for sector %" PRIu64
+ " found at sector %" PRIu64
+ " - ignoring", dev_name(dev),
+ (uint64_t)xlate64(lh->sector_xl),
+ sector + scan_sector);
continue;
}
if (calc_crc(INITIAL_CRC, (uint8_t *)&lh->offset_xl, LABEL_SIZE -
((uint8_t *) &lh->offset_xl - (uint8_t *) lh)) !=
xlate32(lh->crc_xl)) {
- log_info("Label checksum incorrect on %s - "
- "ignoring", dev_name(dev));
+ log_very_verbose("Label checksum incorrect on %s - "
+ "ignoring", dev_name(dev));
continue;
}
if (found)
@@ -243,8 +243,8 @@ int label_remove(struct device *dev)
}
if (wipe) {
- log_info("%s: Wiping label at sector %" PRIu64,
- dev_name(dev), sector);
+ log_very_verbose("%s: Wiping label at sector %" PRIu64,
+ dev_name(dev), sector);
if (!dev_write(dev, sector << SECTOR_SHIFT, LABEL_SIZE,
buf)) {
log_error("Failed to remove label from %s at "
@@ -333,9 +333,9 @@ int label_write(struct device *dev, struct label *label)
if (!dev_open(dev))
return_0;
- log_info("%s: Writing label to sector %" PRIu64 " with stored offset %"
- PRIu32 ".", dev_name(dev), label->sector,
- xlate32(lh->offset_xl));
+ log_very_verbose("%s: Writing label to sector %" PRIu64 " with stored offset %"
+ PRIu32 ".", dev_name(dev), label->sector,
+ xlate32(lh->offset_xl));
if (!dev_write(dev, label->sector << SECTOR_SHIFT, LABEL_SIZE, buf)) {
log_debug_devs("Failed to write label to %s", dev_name(dev));
r = 0;
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 3cddae4..73d7ae8 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4006,7 +4006,7 @@ int dm_stats_create_group(struct dm_stats *dms, const char *members,
"precision may be lost");
if (!_stats_group_check_overlap(dms, regions, count))
- log_info("Creating group with overlapping regions");
+ log_very_verbose("Creating group with overlapping regions.");
if (!_stats_create_group(dms, regions, alias, group_id))
goto bad;
@@ -4142,7 +4142,7 @@ static int _stats_group_file_regions(struct dm_stats *dms, uint64_t *region_ids,
* returned by FIEMAP imply a kernel bug or a corrupt fs.
*/
if (!_stats_group_check_overlap(dms, regions, count))
- log_info("Creating group with overlapping regions.");
+ log_very_verbose("Creating group with overlapping regions.");
if (!_stats_create_group(dms, regions, alias, &group_id))
goto bad;
7 years, 5 months
master - log_info to log_warn
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cc19cc07f7a1aa...
Commit: cc19cc07f7a1aa4a45f6044a7eb4686f6d5dcf69
Parent: e3775173b41f0cd4dfaeab84a235e167d9603618
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 31 18:00:53 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 3 17:49:07 2016 +0100
log_info to log_warn
Switch to log_warn level when we are reporting these message.
---
daemons/dmeventd/plugins/mirror/dmeventd_mirror.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c b/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
index ee10874..7653413 100644
--- a/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
+++ b/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
@@ -107,7 +107,7 @@ static int _remove_failed_devices(const char *cmd_lvscan, const char *cmd_lvconv
int r;
if (!dmeventd_lvm2_run_with_lock(cmd_lvscan))
- log_info("Re-scan of mirrored device failed.");
+ log_warn("WARNING: Re-scan of mirrored device failed.");
/* if repair goes OK, report success even if lvscan has failed */
r = dmeventd_lvm2_run_with_lock(cmd_lvconvert);
@@ -168,7 +168,7 @@ void process_event(struct dm_task *dmt,
break;
default:
/* FIXME Provide value then! */
- log_info("Unknown event received.");
+ log_warn("WARNING: %s received unknown event.", device);
}
} while (next);
}
7 years, 5 months
master - cleanup: log_info to log_error
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e3775173b41f0c...
Commit: e3775173b41f0cd4dfaeab84a235e167d9603618
Parent: ee13f265f043b47a1b023321fb9e8470fb5703c1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 31 18:03:06 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 3 17:49:07 2016 +0100
cleanup: log_info to log_error
Switch to more appropriate logging level.
---
WHATS_NEW | 1 +
WHATS_NEW_DM | 1 +
daemons/dmeventd/plugins/raid/dmeventd_raid.c | 2 +-
lib/filters/filter-regex.c | 4 ++--
lib/filters/filter-sysfs.c | 2 +-
5 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 311f3b6..a5e6d45 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.167 -
======================================
+ Use log_error in regex and sysfs filter to describe reason of failure.
Fix blkdeactivate to deactivate dev stack if dev on top already unmounted.
Prevent non-synced raid1 repair unless --force
Prevent raid4 creation/conversion on non-supporting kernels
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index a4dd6eb..17c370c 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.136 -
======================================
+ Log failure of raid device with log_error level.
Use dm_log_with_errno and translate runtime to dm_log only when needed.
Make log messages from dm and lvm library differnt from dmeventd.
Notice and Info messages are again logged from dmeventd and its plugins.
diff --git a/daemons/dmeventd/plugins/raid/dmeventd_raid.c b/daemons/dmeventd/plugins/raid/dmeventd_raid.c
index ee18793..9df5f1d 100644
--- a/daemons/dmeventd/plugins/raid/dmeventd_raid.c
+++ b/daemons/dmeventd/plugins/raid/dmeventd_raid.c
@@ -76,7 +76,7 @@ static int _process_raid_event(struct dso_state *state, char *params, const char
/* if repair goes OK, report success even if lvscan has failed */
if (!dmeventd_lvm2_run_with_lock(state->cmd_lvconvert)) {
- log_info("Repair of RAID device %s failed.", device);
+ log_error("Repair of RAID device %s failed.", device);
r = 0;
}
} else {
diff --git a/lib/filters/filter-regex.c b/lib/filters/filter-regex.c
index b8d229b..f7cc072 100644
--- a/lib/filters/filter-regex.c
+++ b/lib/filters/filter-regex.c
@@ -40,7 +40,7 @@ static int _extract_pattern(struct dm_pool *mem, const char *pat,
break;
default:
- log_info("pattern must begin with 'a' or 'r'");
+ log_error("Pattern must begin with 'a' or 'r'.");
return 0;
}
pat++;
@@ -77,7 +77,7 @@ static int _extract_pattern(struct dm_pool *mem, const char *pat,
*/
ptr = r + strlen(r) - 1;
if (*ptr != sep) {
- log_info("invalid separator at end of regex");
+ log_error("Invalid separator at end of regex.");
return 0;
}
*ptr = '\0';
diff --git a/lib/filters/filter-sysfs.c b/lib/filters/filter-sysfs.c
index 6f566bc..6dacd5d 100644
--- a/lib/filters/filter-sysfs.c
+++ b/lib/filters/filter-sysfs.c
@@ -168,7 +168,7 @@ static int _parse_dev(const char *file, FILE *fp, dev_t *result)
}
if (sscanf(buffer, "%u:%u", &major, &minor) != 2) {
- log_info("sysfs device file not correct format");
+ log_error("Incorrect format for sysfs device file: %s.", file);
return 0;
}
7 years, 5 months
master - libdm: use dm_log_with_errno always
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ee13f265f043b4...
Commit: ee13f265f043b47a1b023321fb9e8470fb5703c1
Parent: 221d8ff2a420a4104826907de9d71100dc208834
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 3 17:15:07 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 3 17:49:07 2016 +0100
libdm: use dm_log_with_errno always
Instead of compiling 2 log call for 2 different logging functions,
and runtime decide which version to use - use only 'newer' function
and when user sets his own OLD dm_log logging translate it runtime
for old arg list set.
The positive part is - we get shorter generated library,
on the negative part this translation means, we always have evaluate
all args and print the message into local on stack buffer, before
we can pass this buffer to the users' logging function with proper
expected parameters (and such function may later decide to discard
logging based on message level so whole printing was unnecessary).
---
WHATS_NEW_DM | 1 +
libdm/libdm-common.c | 62 ++++++++++++++++++++++++++++++++++++++++------
libdm/misc/dm-logging.h | 10 +------
3 files changed, 57 insertions(+), 16 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index d2d44ac..a4dd6eb 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.136 -
======================================
+ Use dm_log_with_errno and translate runtime to dm_log only when needed.
Make log messages from dm and lvm library differnt from dmeventd.
Notice and Info messages are again logged from dmeventd and its plugins.
Dmeventd now also respects DM_ABORT_ON_INTERNAL_ERRORS as libdm based tool.
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index 17f55ab..476f018 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -161,14 +161,59 @@ static void _default_log(int level, const char *file,
dm_log_fn dm_log = _default_log;
dm_log_with_errno_fn dm_log_with_errno = _default_log_with_errno;
+/*
+ * Wrapper function to reformat new messages to and
+ * old style logging which had not used errno parameter
+ *
+ * As we cannot simply pass '...' to old function we
+ * need to process arg list locally and just pass '%s' + buffer
+ */
+__attribute__((format(printf, 5, 6)))
+static void _log_to_default_log(int level,
+ const char *file, int line, int dm_errno_or_class,
+ const char *f, ...)
+{
+ va_list ap;
+ char buf[2 * PATH_MAX + 256]; /* big enough for most messages */
+
+ va_start(ap, f);
+ vsnprintf(buf, sizeof(buf), f, ap);
+ va_end(ap);
+
+ dm_log(level, file, line, "%s", buf);
+}
+
+/*
+ * Wrapper function take 'old' style message without errno
+ * and log it via new logging function with errno arg
+ *
+ * This minor case may happen if new libdm is used with old
+ * recompiled tool that would decided to use new logging,
+ * but still would like to use old binary plugins.
+ */
+__attribute__((format(printf, 4, 5)))
+static void _log_to_default_log_with_errno(int level,
+ const char *file, int line, const char *f, ...)
+{
+ va_list ap;
+ char buf[2 * PATH_MAX + 256]; /* big enough for most messages */
+
+ va_start(ap, f);
+ vsnprintf(buf, sizeof(buf), f, ap);
+ va_end(ap);
+
+ dm_log_with_errno(level, file, line, 0, "%s", buf);
+}
+
void dm_log_init(dm_log_fn fn)
{
- if (fn)
+ if (fn) {
dm_log = fn;
- else
+ dm_log_with_errno = _log_to_default_log;
+ } else {
dm_log = _default_log;
-
- dm_log_with_errno = _default_log_with_errno;
+ dm_log_with_errno = _default_log_with_errno;
+ }
}
int dm_log_is_non_default(void)
@@ -178,12 +223,13 @@ int dm_log_is_non_default(void)
void dm_log_with_errno_init(dm_log_with_errno_fn fn)
{
- if (fn)
+ if (fn) {
+ dm_log = _log_to_default_log_with_errno;
dm_log_with_errno = fn;
- else
+ } else {
+ dm_log = _default_log;
dm_log_with_errno = _default_log_with_errno;
-
- dm_log = _default_log;
+ }
}
void dm_log_init_verbose(int level)
diff --git a/libdm/misc/dm-logging.h b/libdm/misc/dm-logging.h
index 4088bfe..083664d 100644
--- a/libdm/misc/dm-logging.h
+++ b/libdm/misc/dm-logging.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2016 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -18,16 +18,10 @@
#include "libdevmapper.h"
-extern dm_log_fn dm_log;
extern dm_log_with_errno_fn dm_log_with_errno;
#define LOG_MESG(l, f, ln, e, x...) \
- do { \
- if (dm_log_is_non_default()) \
- dm_log(l, f, ln, ## x); \
- else \
- dm_log_with_errno(l, f, ln, e, ## x); \
- } while (0)
+ dm_log_with_errno(l, f, ln, e, ## x)
#define LOG_LINE(l, x...) LOG_MESG(l, __FILE__, __LINE__, 0, ## x)
#define LOG_LINE_WITH_ERRNO(l, e, x...) LOG_MESG(l, __FILE__, __LINE__, e, ## x)
7 years, 5 months
master - tests: check that pvscan cannot activate exported VG
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=221d8ff2a420a4...
Commit: 221d8ff2a420a4104826907de9d71100dc208834
Parent: 28b210f4fa10ef5e9baf4e28a891460eb65eb602
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Nov 3 11:43:08 2016 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Nov 3 11:43:37 2016 -0500
tests: check that pvscan cannot activate exported VG
---
test/shell/lvmetad-pvscan-cache.sh | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvmetad-pvscan-cache.sh b/test/shell/lvmetad-pvscan-cache.sh
index 501eec5..8b1e8c2 100644
--- a/test/shell/lvmetad-pvscan-cache.sh
+++ b/test/shell/lvmetad-pvscan-cache.sh
@@ -24,6 +24,28 @@ pvscan --cache
vgs | grep $vg1
+# Check that an LV cannot be activated by lvchange while VG is exported
+lvcreate -n $lv1 -l 4 -a n $vg1
+check lv_exists $vg1
+vgexport $vg1
+fail lvs $vg1
+fail lvchange -ay $vg1/$lv1
+vgimport $vg1
+check lv_exists $vg1
+check lv_field $vg/$lv1 lv_active ""
+
+# Check that an LV cannot be activated by pvscan while VG is exported
+vgexport $vg1
+pvscan --cache -aay "$dev1"
+pvscan --cache -aay "$dev2"
+vgimport $vg1
+check lv_exists $vg1
+check lv_field $vg1/$lv1 lv_active ""
+pvscan --cache -aay "$dev1"
+pvscan --cache -aay "$dev2"
+check lv_field $vg1/$lv1 lv_active "active"
+lvchange -an $vg1/$lv1
+
# When MDA is ignored on PV, do not read any VG
# metadata from such PV as it may contain old
# metadata which hasn't been updated for some
7 years, 5 months
master - cleanup: add 'static' for local struct
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=28b210f4fa10ef...
Commit: 28b210f4fa10ef5e9baf4e28a891460eb65eb602
Parent: 1db4b81d5a1e7c85ab5928c9f6a62ec9565885df
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Nov 2 14:26:41 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 3 12:43:09 2016 +0100
cleanup: add 'static' for local struct
---
lib/log/log.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/log/log.c b/lib/log/log.c
index 2207c7e..f9d5649 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -67,7 +67,7 @@ struct log_stream_item {
char *buffer;
};
-struct log_stream {
+static struct log_stream {
struct log_stream_item out;
struct log_stream_item err;
struct log_stream_item report;
7 years, 5 months
master - cleanup: drop unused attribute
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1db4b81d5a1e7c...
Commit: 1db4b81d5a1e7c85ab5928c9f6a62ec9565885df
Parent: 4b4d19e3aa1da061fed35edb979e1ca2a29fb7ed
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Nov 2 10:55:19 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 3 12:43:09 2016 +0100
cleanup: drop unused attribute
In this function we pass args through so make the function
header look the same as with _default_log().
---
libdm/libdm-common.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index 5deb555..17f55ab 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -137,8 +137,7 @@ static void _default_log_line(int level,
__attribute__((format(printf, 5, 6)))
static void _default_log_with_errno(int level,
- const char *file __attribute__((unused)),
- int line __attribute__((unused)), int dm_errno_or_class,
+ const char *file, int line, int dm_errno_or_class,
const char *f, ...)
{
va_list ap;
7 years, 5 months