master - WHATS_NEW: [unknown] replaces 'unknown device'
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3d610fabbdb5f6...
Commit: 3d610fabbdb5f63e6e46661f7080f74852b118b0
Parent: 57cd94b9e3b74c65f34eb2c40096cbbac024e986
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Mar 1 11:16:35 2016 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Mar 1 11:16:35 2016 -0600
WHATS_NEW: [unknown] replaces 'unknown device'
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 3494455..7602fa4 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.145 -
=====================================
+ Display [unknown] instead of 'unknown device' in pvs output.
Fix error path when pvcreate allocation fails (2.02.144).
Display [unknown] instead of blank for unknown VG names in pvs output.
8 years, 1 month
master - pvs: replace 'unknown device' with [unknown]
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=57cd94b9e3b74c...
Commit: 57cd94b9e3b74c65f34eb2c40096cbbac024e986
Parent: afae3355f8e79b8fab8d5bc45f99caf0d8b2420c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Feb 29 13:38:31 2016 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Mar 1 11:12:03 2016 -0600
pvs: replace 'unknown device' with [unknown]
A config setting can restore the old string.
---
lib/commands/toolcontext.c | 3 +++
lib/config/config_settings.h | 4 ++++
lib/config/defaults.h | 1 +
lib/device/dev-cache.c | 2 +-
lib/misc/lvm-globals.c | 12 ++++++++++++
lib/misc/lvm-globals.h | 2 ++
6 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 1d7ca58..7f6eee4 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -675,6 +675,9 @@ static int _process_config(struct cmd_context *cmd)
if (!process_profilable_config(cmd))
return_0;
+ if (find_config_tree_bool(cmd, report_two_word_unknown_device_CFG, NULL))
+ init_unknown_device_name("unknown device");
+
init_detect_internal_vg_cache_corruption
(find_config_tree_bool(cmd, global_detect_internal_vg_cache_corruption_CFG, NULL));
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 1143c8b..95eb8ee 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -1682,6 +1682,10 @@ cfg(report_pvsegs_cols_verbose_CFG, "pvsegs_cols_verbose", report_CFG_SECTION, C
cfg(report_mark_hidden_devices_CFG, "mark_hidden_devices", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, 1, vsn(2, 2, 140), NULL, 0, NULL,
"Use brackets [] to mark hidden devices.\n")
+cfg(report_two_word_unknown_device_CFG, "two_word_unknown_device", report_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, 0, vsn(2, 2, 146), NULL, 0, NULL,
+ "Use the two words 'unknown device' in place of '[unknown]'.\n"
+ "This is displayed when the device for a PV is not known.\n")
+
cfg(dmeventd_mirror_library_CFG, "mirror_library", dmeventd_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DMEVENTD_MIRROR_LIB, vsn(1, 2, 3), NULL, 0, NULL,
"The library dmeventd uses when monitoring a mirror device.\n"
"libdevmapper-event-lvm2mirror.so attempts to recover from\n"
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 080c3ff..648a168 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -56,6 +56,7 @@
#define DEFAULT_USE_MLOCKALL 0
#define DEFAULT_METADATA_READ_ONLY 0
#define DEFAULT_LVDISPLAY_SHOWS_FULL_DEVICE_PATH 0
+#define DEFAULT_UNKNOWN_DEVICE_NAME "[unknown]"
#define DEFAULT_SANLOCK_LV_EXTEND_MB 256
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 6358109..47ae140 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -1108,5 +1108,5 @@ int dev_fd(struct device *dev)
const char *dev_name(const struct device *dev)
{
return (dev && dev->aliases.n) ? dm_list_item(dev->aliases.n, struct dm_str_list)->str :
- "unknown device";
+ unknown_device_name();
}
diff --git a/lib/misc/lvm-globals.c b/lib/misc/lvm-globals.c
index 020640e..b7af353 100644
--- a/lib/misc/lvm-globals.c
+++ b/lib/misc/lvm-globals.c
@@ -55,6 +55,7 @@ static int _dev_disable_after_error_count = DEFAULT_DISABLE_AFTER_ERROR_COUNT;
static uint64_t _pv_min_size = (DEFAULT_PV_MIN_SIZE_KB * 1024L >> SECTOR_SHIFT);
static int _detect_internal_vg_cache_corruption =
DEFAULT_DETECT_INTERNAL_VG_CACHE_CORRUPTION;
+static const char *_unknown_device_name = DEFAULT_UNKNOWN_DEVICE_NAME;
void init_verbose(int level)
{
@@ -379,3 +380,14 @@ int detect_internal_vg_cache_corruption(void)
{
return _detect_internal_vg_cache_corruption;
}
+
+const char *unknown_device_name(void)
+{
+ return _unknown_device_name;
+}
+
+void init_unknown_device_name(const char *name)
+{
+ _unknown_device_name = name;
+}
+
diff --git a/lib/misc/lvm-globals.h b/lib/misc/lvm-globals.h
index 387a4ae..77c01b4 100644
--- a/lib/misc/lvm-globals.h
+++ b/lib/misc/lvm-globals.h
@@ -52,6 +52,7 @@ void init_pv_min_size(uint64_t sectors);
void init_activation_checks(int checks);
void init_detect_internal_vg_cache_corruption(int detect);
void init_retry_deactivation(int retry);
+void init_unknown_device_name(const char *name);
void set_cmd_name(const char *cmd_name);
const char *get_cmd_name(void);
@@ -84,6 +85,7 @@ uint64_t pv_min_size(void);
int activation_checks(void);
int detect_internal_vg_cache_corruption(void);
int retry_deactivation(void);
+const char *unknown_device_name(void);
#define DMEVENTD_MONITOR_IGNORE -1
int dmeventd_monitor_mode(void);
8 years, 1 month
master - cleanup: missplaced .
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=afae3355f8e79b...
Commit: afae3355f8e79b8fab8d5bc45f99caf0d8b2420c
Parent: 058eb3739d6f0550f81fb9d6268feda698fdbb05
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 1 17:20:47 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Mar 1 17:20:47 2016 +0100
cleanup: missplaced .
Remove misplaced '.' after '?'
Drop extra 'stack;' after log_debug().
---
tools/toollib.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index 05d765d..dba5023 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -3958,7 +3958,7 @@ static int _pvremove_check_single(struct cmd_context *cmd,
*/
if (!dev_test_excl(pv->dev)) {
/* FIXME Detect whether device-mapper itself is still using it */
- log_error("Can't open %s exclusively. Mounted filesystem?.",
+ log_error("Can't open %s exclusively. Mounted filesystem?",
pv_dev_name(pv));
dm_list_move(&pp->arg_fail, &pd->list);
return 1;
@@ -4049,6 +4049,7 @@ static int _pvremove_check_single(struct cmd_context *cmd,
pd->dev = pv->dev;
dm_list_move(&pp->arg_process, &pd->list);
+
return 1;
}
@@ -4193,7 +4194,7 @@ int pvcreate_each_device(struct cmd_context *cmd,
*/
if (dm_list_empty(&pp->arg_process)) {
log_debug("No devices to process.");
- goto_bad;
+ goto bad;
}
/*
8 years, 1 month
master - makefile: handle dm-version-expected
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=058eb3739d6f05...
Commit: 058eb3739d6f0550f81fb9d6268feda698fdbb05
Parent: 3b93c110303de10464ad3e2a4b14175526765832
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 1 16:03:02 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Mar 1 16:03:02 2016 +0100
makefile: handle dm-version-expected
---
test/Makefile.in | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index 77190b3..f1fad14 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -209,7 +209,9 @@ install: .tests-stamp lib/paths-installed
cd lib && $(INSTALL_DATA) \
$(LIB_FLAVOURS) \
$(LIB_LVMLOCKD_CONF) \
- version-expected $(DATADIR)/lib
+ dm-version-expected \
+ version-expected \
+ $(DATADIR)/lib
@for i in cache-mq cache-smq thin-performance ; do \
echo "$(INSTALL_DATA) $(abs_top_srcdir)/conf/$$i.profile $(DATADIR)/lib"; \
$(INSTALL_DATA) $(abs_top_srcdir)/conf/$$i.profile $(DATADIR)/lib; done
@@ -327,7 +329,8 @@ endif
CLEAN_TARGETS += .lib-dir-stamp .tests-stamp $(LIB) $(addprefix lib/,\
$(CMDS) clvmd dmeventd dmsetup lvmetad lvmpolld \
- harness thin-performance.profile fsadm vgimportclone version-expected \
+ harness thin-performance.profile fsadm vgimportclone \
+ dm-version-expected version-expected \
paths-installed paths-installed-t paths-common paths-common-t)
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
8 years, 1 month
master - man: fix mising braces
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3b93c110303de1...
Commit: 3b93c110303de10464ad3e2a4b14175526765832
Parent: 872d5922e17692332df3ee3bebeb1dac0855887d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 1 13:40:32 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Mar 1 14:02:43 2016 +0100
man: fix mising braces
Fixing some reported issued found by:
http://catb.org/~esr/doclifter/bugs.html
Reported-by: Eric S. Raymond <esr at thyrsus.com>
---
man/lvmconfig.8.in | 37 +++++++++++++++++++++----------------
man/lvresize.8.in | 6 +++---
2 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/man/lvmconfig.8.in b/man/lvmconfig.8.in
index 0e9e7c5..9a3fcab 100644
--- a/man/lvmconfig.8.in
+++ b/man/lvmconfig.8.in
@@ -2,14 +2,18 @@
.SH "NAME"
lvmconfig, lvm dumpconfig, lvm config \(em Display LVM configuration
.SH SYNOPSIS
+.
+.ad l
.B lvmconfig
.RB [ \-f | \-\-file
.IR filename ]
.RB [ \-\-type
-.RI { current | default | diff | full | list | missing | new | profilable | profilable-command | profilable-metadata }
+.RB { current |\: default |\: diff |\: full | list |\: missing \c
+.RB |\: new |\: profilable |\: profilable-command \c
+.RB |\: profilable-metadata }]
.RB [ \-\-atversion
.IR version ]
-.RB [ \-\---sinceversion
+.RB [ \-\-sinceversion
.IR version ]
.RB [ \-\-ignoreadvanced ]
.RB [ \-\-ignoreunsupported ]
@@ -32,7 +36,8 @@ lvmconfig, lvm dumpconfig, lvm config \(em Display LVM configuration
.RB [ \-\-withspaces ]
.RB [ \-\-withversions ]
.RB [ ConfigurationNode... ]
-
+.ad b
+.
.SH DESCRIPTION
lvmconfig produces formatted output from the LVM configuration tree.
The command was added in release 2.02.119 and has an identical longer form
@@ -49,7 +54,7 @@ List configuration settings with summarizing comment. This is the same as using
\fBlvmconfig --type list --withsummary\fP.
.TP
-.IR \fB\-\-type " {" current | default | diff | full | missing | new | profilable | profilable-command | profilable-metadata }
+.BR \-\-type " {" current | default | diff | full | missing | new | profilable | profilable-command | profilable-metadata }
Select the type of configuration to display. The configuration settings
displayed have either default values or currently-used values assigned based on
the type selected. If no type is selected, \fB\-\-type current\fP is used
@@ -58,18 +63,18 @@ commented out, it means the setting does not have any concrete default
value defined. Output can be saved and used as a proper \fBlvm.conf\fP(5)
file.
.RS
-.IP current 3
+.IP \fBcurrent\fP 3
Display the current \fBlvm.conf\fP configuration merged with any \fBtag
config\fP if used. See also \fBlvm.conf\fP(5) for more info about LVM
configuration methods.
-.IP default 3
+.IP \fBdefault\fP 3
Display all possible configuration settings with default values assigned.
-.IP diff 3
+.IP \fBdiff\fP 3
Display all configuration settings for which the values used differ from defaults.
The value assigned for each configuration setting is the value currently used.
This is actually minimal LVM configuration which can be used without
a change to current configured behaviour.
-.IP full 3
+.IP \fBfull\fP 3
Display full configuration tree - a combination of current configuration tree
(\fB\-\-type current\fP) and tree of settings for which default values are
used (\fB\-\-type missing\fP). This is exactly the configuration tree that
@@ -78,26 +83,26 @@ the use of \fB\-\-mergedconfig\fP option. If comments are displayed
(see \fB\-\-withcomments\fP and \fB\-\-withsummary\fP options), then
for each setting found in existing configuration and for which defaults
are not used, there's an extra comment line printed to denote this.
-.IP list 3
+.IP \fBlist\fP 3
Display plain list of configuration settings.
-.IP missing 3
+.IP \fBmissing\fP 3
Display all configuration settings with default values assigned which are
missing in the configuration currently used and for which LVM automatically
fallbacks to using these default values.
-.IP new 3
+.IP \fBnew\fP 3
Display all new configuration settings introduced in current LVM version
or specific version as defined by \fB\-\-atversion\fP option.
-.IP profilable 3
+.IP \fBprofilable\fP 3
Display all profilable configuration settings with default values assigned.
See \fBlvm.conf\fP(5) for more info about \fBprofile config\fP method.
-.IP profilable-command 3
+.IP \fBprofilable-command\fP 3
Display all profilable configuration settings with default values assigned
that can be used in command profile. This is a subset of settings displayed
-by \fB\-\-type \-\-profilable\fP.
-.IP profilable-metadata 3
+by \fB\-\-type profilable\fP.
+.IP \fBprofilable-metadata\fP 3
Display all profilable configuration settings with default values assigned
that can be used in metadata profile. This is a subset of settings displayed
-by \fB\-\-type \-\-profilable\fP.
+by \fB\-\-type profilable\fP.
.RE
.TP
diff --git a/man/lvresize.8.in b/man/lvresize.8.in
index ed95a0d..a5bda53 100644
--- a/man/lvresize.8.in
+++ b/man/lvresize.8.in
@@ -9,12 +9,12 @@ lvresize \(em resize a logical volume
.IR ProfileName ]
.RB [ \-i | \-\-stripes " " \fIStripes
.RB [ \-I | \-\-stripesize " " \fIStripeSize ]]
-.RB {[ \-l | \-\-extents
+.RB { \-l | \-\-extents
.RI [ + | \- ] LogicalExtentsNumber [ % { VG | LV | PVS | FREE | ORIGIN "}] |"
-.RB [ \-L | \-\-size
+.BR \-L | \-\-size
.RI [ + | \- ] LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]}
.RB [ \-\-poolmetadatasize
-.RI [ + ] MetadataVolumeSize [ bBsSkKmMgG ]
+.RI [ + ] MetadataVolumeSize [ bBsSkKmMgG ]]
.RB [ \-f | \-\-force ]
.RB [ \-n | \-\-nofsck ]
.RB [ \-r | \-\-resizefs ]
8 years, 1 month
master - cleanup: indent and dots
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=872d5922e17692...
Commit: 872d5922e17692332df3ee3bebeb1dac0855887d
Parent: 36d0dcef38ec3ce89f3c13be272efc69f981b207
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 1 11:41:09 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Mar 1 14:02:43 2016 +0100
cleanup: indent and dots
---
tools/toollib.c | 107 ++++++++++++++++++++++++++-----------------------------
1 files changed, 51 insertions(+), 56 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index dbb6d40..05d765d 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -3689,7 +3689,6 @@ static struct pvcreate_device *_pvcreate_list_find_name(struct dm_list *devices,
* foreign/shared/clustered VG, that VG will not be processed by this function,
* and the arg will be reported as not found.
*/
-
static int _pvcreate_check_single(struct cmd_context *cmd,
struct volume_group *vg,
struct physical_volume *pv,
@@ -3732,7 +3731,7 @@ static int _pvcreate_check_single(struct cmd_context *cmd,
* Check if the uuid specified for the new PV is used by another PV.
*/
if (!found && pv->dev && pp->uuid_str && id_equal(&pv->id, &pp->pva.id)) {
- log_error("uuid %s already in use on \"%s\"", pp->uuid_str, pv_dev_name(pv));
+ log_error("UUID %s already in use on \"%s\".", pp->uuid_str, pv_dev_name(pv));
pp->check_failed = 1;
return 0;
}
@@ -3740,7 +3739,7 @@ static int _pvcreate_check_single(struct cmd_context *cmd,
if (!found)
return 1;
- log_debug("Checking device %s for pvcreate %.32s",
+ log_debug("Checking device %s for pvcreate %.32s.",
pv_dev_name(pv), pv->dev->pvid[0] ? pv->dev->pvid : "");
/*
@@ -3758,21 +3757,19 @@ static int _pvcreate_check_single(struct cmd_context *cmd,
* What kind of device is this: an orphan PV, an uninitialized/unused
* device, a PV used in a VG.
*/
-
if (vg && !is_orphan_vg(vg->name)) {
/* Device is a PV used in a VG. */
- log_debug("Found pvcreate arg %s: pv is used in %s", pd->name, vg->name);
+ log_debug("Found pvcreate arg %s: pv is used in %s.", pd->name, vg->name);
pd->is_vg_pv = 1;
pd->vg_name = dm_pool_strdup(cmd->mem, vg->name);
-
} else if (vg && is_orphan_vg(vg->name)) {
if (is_used_pv(pv)) {
/* Device is used in an unknown VG. */
- log_debug("Found pvcreate arg %s: pv is used in unknown VG", pd->name);
+ log_debug("Found pvcreate arg %s: PV is used in unknown VG.", pd->name);
pd->is_used_unknown_pv = 1;
} else {
/* Device is an orphan PV. */
- log_debug("Found pvcreate arg %s: pv is orphan in %s", pd->name, vg->name);
+ log_debug("Found pvcreate arg %s: PV is orphan in %s.", pd->name, vg->name);
pd->is_orphan_pv = 1;
}
@@ -3781,7 +3778,7 @@ static int _pvcreate_check_single(struct cmd_context *cmd,
else
pp->orphan_vg_name = FMT_TEXT_ORPHAN_VG_NAME;
} else {
- log_debug("Found pvcreate arg %s: device is not a pv", pd->name);
+ log_debug("Found pvcreate arg %s: device is not a PV.", pd->name);
/* Device is not a PV. */
pd->is_not_pv = 1;
}
@@ -3800,15 +3797,15 @@ static int _pvcreate_check_single(struct cmd_context *cmd,
* pvcreate is being run on this device, but the device is already
* a PV in a VG. A prompt or force option is required to use it.
*/
-
if (!(prompt = dm_pool_zalloc(cmd->mem, sizeof(*prompt)))) {
- log_error("prompt alloc failed");
+ log_error("prompt alloc failed.");
pp->check_failed = 1;
return 0;
}
prompt->dev = pd->dev;
prompt->type = PROMPT_PVCREATE_PV_IN_VG;
prompt->pv_name = dm_pool_strdup(cmd->mem, pd->name);
+
if (pd->is_used_unknown_pv)
prompt->vg_name_unknown = 1;
else
@@ -3817,6 +3814,7 @@ static int _pvcreate_check_single(struct cmd_context *cmd,
pd->dev = pv->dev;
dm_list_move(&pp->arg_process, &pd->list);
+
return 1;
}
@@ -3864,7 +3862,6 @@ static int _pv_confirm_single(struct cmd_context *cmd,
* What kind of device is this: an orphan PV, an uninitialized/unused
* device, a PV used in a VG.
*/
-
if (vg && !is_orphan_vg(vg->name)) {
/* Device is a PV used in a VG. */
@@ -3877,7 +3874,6 @@ static int _pv_confirm_single(struct cmd_context *cmd,
/* In check_single it was in a different VG. */
goto fail;
}
-
} else if (is_orphan(pv)) {
/* Device is an orphan PV. */
@@ -3895,10 +3891,8 @@ static int _pv_confirm_single(struct cmd_context *cmd,
/* In check_single it was different. */
goto fail;
}
-
} else {
/* Device is not a PV. */
-
if (pd->is_orphan_pv || pd->is_used_unknown_pv) {
/* In check_single it was an orphan PV. */
goto fail;
@@ -3912,11 +3906,13 @@ static int _pv_confirm_single(struct cmd_context *cmd,
/* Device is unchanged from check_single. */
dm_list_move(&pp->arg_process, &pd->list);
+
return 1;
fail:
log_error("Cannot use device %s: it changed during prompt.", pd->name);
dm_list_move(&pp->arg_fail, &pd->list);
+
return 1;
}
@@ -3954,7 +3950,7 @@ static int _pvremove_check_single(struct cmd_context *cmd,
if (!found)
return 1;
- log_debug("Checking device %s for pvremove %.32s",
+ log_debug("Checking device %s for pvremove %.32s.",
pv_dev_name(pv), pv->dev->pvid[0] ? pv->dev->pvid : "");
/*
@@ -3962,7 +3958,7 @@ static int _pvremove_check_single(struct cmd_context *cmd,
*/
if (!dev_test_excl(pv->dev)) {
/* FIXME Detect whether device-mapper itself is still using it */
- log_error("Can't open %s exclusively. Mounted filesystem?",
+ log_error("Can't open %s exclusively. Mounted filesystem?.",
pv_dev_name(pv));
dm_list_move(&pp->arg_fail, &pd->list);
return 1;
@@ -3990,18 +3986,18 @@ static int _pvremove_check_single(struct cmd_context *cmd,
if (vg && !is_orphan_vg(vg->name)) {
/* Device is a PV used in a VG. */
- log_debug("Found pvremove arg %s: pv is used in %s", pd->name, vg->name);
+ log_debug("Found pvremove arg %s: pv is used in %s.", pd->name, vg->name);
pd->is_vg_pv = 1;
pd->vg_name = dm_pool_strdup(cmd->mem, vg->name);
} else if (vg && is_orphan_vg(vg->name)) {
if (is_used_pv(pv)) {
/* Device is used in an unknown VG. */
- log_debug("Found pvremove arg %s: pv is used in unknown VG", pd->name);
+ log_debug("Found pvremove arg %s: pv is used in unknown VG.", pd->name);
pd->is_used_unknown_pv = 1;
} else {
/* Device is an orphan PV. */
- log_debug("Found pvremove arg %s: pv is orphan in %s", pd->name, vg->name);
+ log_debug("Found pvremove arg %s: pv is orphan in %s.", pd->name, vg->name);
pd->is_orphan_pv = 1;
}
@@ -4010,14 +4006,14 @@ static int _pvremove_check_single(struct cmd_context *cmd,
else
pp->orphan_vg_name = FMT_TEXT_ORPHAN_VG_NAME;
} else {
- log_debug("Found pvremove arg %s: device is not a pv", pd->name);
+ log_debug("Found pvremove arg %s: device is not a PV.", pd->name);
/* Device is not a PV. */
pd->is_not_pv = 1;
}
if (pd->is_not_pv) {
pd->dev = pv->dev;
- log_error("No PV found on device %s", pd->name);
+ log_error("No PV found on device %s.", pd->name);
dm_list_move(&pp->arg_fail, &pd->list);
return 1;
}
@@ -4038,7 +4034,7 @@ static int _pvremove_check_single(struct cmd_context *cmd,
*/
if (!(prompt = dm_pool_zalloc(cmd->mem, sizeof(*prompt)))) {
- log_error("prompt alloc failed");
+ log_error("prompt alloc failed.");
pp->check_failed = 1;
return 0;
}
@@ -4086,6 +4082,7 @@ int pvcreate_each_device(struct cmd_context *cmd,
struct pvcreate_prompt *prompt, *prompt2;
struct physical_volume *pv;
struct volume_group *orphan_vg;
+ struct lvmcache_info *info;
struct dm_list arg_sort;
struct pv_list *pvl;
struct pv_list *vgpvl;
@@ -4108,12 +4105,12 @@ int pvcreate_each_device(struct cmd_context *cmd,
pv_name = pp->pv_names[i];
if (!(pd = dm_pool_zalloc(cmd->mem, sizeof(*pd)))) {
- log_error("alloc failed");
+ log_error("alloc failed.");
return 0;
}
if (!(pd->name = dm_pool_strdup(cmd->mem, pv_name))) {
- log_error("strdup failed");
+ log_error("strdup failed.");
return 0;
}
@@ -4143,7 +4140,7 @@ int pvcreate_each_device(struct cmd_context *cmd,
* vgcreate/vgextend use the PVs created here to add to a VG.
*/
if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE, NULL)) {
- log_error("Can't get lock for orphan PVs");
+ log_error("Can't get lock for orphan PVs.");
return 0;
}
@@ -4273,11 +4270,10 @@ int pvcreate_each_device(struct cmd_context *cmd,
* Clear the cache here before locking orphans, since it won't be
* done by process_each_pv with orphans already locked.
*/
-
lvmcache_destroy(cmd, 1, 0);
if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE, NULL)) {
- log_error("Can't get lock for orphan PVs");
+ log_error("Can't get lock for orphan PVs.");
goto_out;
}
@@ -4293,7 +4289,6 @@ int pvcreate_each_device(struct cmd_context *cmd,
* arg_fail if it cannot be used. After the second loop, any devices
* remaining on arg_confirm were not found and are not used.
*/
-
dm_list_splice(&pp->arg_confirm, &pp->arg_process);
process_each_pv(cmd, 0, NULL, NULL, 1, 0, handle, _pv_confirm_single);
@@ -4334,7 +4329,7 @@ do_command:
* Wipe signatures on devices being created.
*/
dm_list_iterate_items_safe(pd, pd2, &pp->arg_create) {
- log_verbose("Wiping signatures on new PV %s", pd->name);
+ log_verbose("Wiping signatures on new PV %s.", pd->name);
if (!wipe_known_signatures(cmd, pd->dev, pd->name, TYPE_LVM1_MEMBER | TYPE_LVM2_MEMBER,
0, pp->yes, pp->force, &pd->wiped)) {
@@ -4354,10 +4349,10 @@ do_command:
* and not recreate a new PV on top of an existing PV.
*/
if (pp->preserve_existing && pp->orphan_vg_name) {
- log_debug("Using existing orphan PVs in %s", pp->orphan_vg_name);
+ log_debug("Using existing orphan PVs in %s.", pp->orphan_vg_name);
if (!(orphan_vg = vg_read_internal(cmd, pp->orphan_vg_name, NULL, 0, &consistent))) {
- log_error("Cannot read orphans VG %s", pp->orphan_vg_name);
+ log_error("Cannot read orphans VG %s.", pp->orphan_vg_name);
goto_bad;
}
@@ -4366,7 +4361,7 @@ do_command:
continue;
if (!(pvl = dm_pool_alloc(cmd->mem, sizeof(*pvl)))) {
- log_error("alloc pvl failed");
+ log_error("alloc pvl failed.");
dm_list_move(&pp->arg_fail, &pd->list);
continue;
}
@@ -4380,7 +4375,7 @@ do_command:
}
if (found) {
- log_debug("Using existing orphan PV %s", pv_dev_name(vgpvl->pv));
+ log_debug("Using existing orphan PV %s.", pv_dev_name(vgpvl->pv));
pvl->pv = vgpvl->pv;
dm_list_add(&pp->pvs, &pvl->list);
} else {
@@ -4404,59 +4399,60 @@ do_command:
break;
if (!(pvl = dm_pool_alloc(cmd->mem, sizeof(*pvl)))) {
- log_error("alloc pvl failed");
+ log_error("alloc pvl failed.");
dm_list_move(&pp->arg_fail, &pd->list);
continue;
}
pv_name = pd->name;
- log_debug("Creating a new PV on %s", pv_name);
+ log_debug("Creating a new PV on %s.", pv_name);
if (!(pv = pv_create(cmd, pd->dev, &pp->pva))) {
- log_error("Failed to setup physical volume \"%s\"", pv_name);
+ log_error("Failed to setup physical volume \"%s\".", pv_name);
dm_list_move(&pp->arg_fail, &pd->list);
continue;
}
log_verbose("Set up physical volume for \"%s\" with %" PRIu64
- " available sectors", pv_name, pv_size(pv));
+ " available sectors.", pv_name, pv_size(pv));
if (!label_remove(pv->dev)) {
- log_error("Failed to wipe existing label on %s", pv_name);
+ log_error("Failed to wipe existing label on %s.", pv_name);
dm_list_move(&pp->arg_fail, &pd->list);
continue;
}
if (pp->zero) {
- log_verbose("Zeroing start of device %s", pv_name);
+ log_verbose("Zeroing start of device %s.", pv_name);
if (!dev_open_quiet(pv->dev)) {
- log_error("%s not opened: device not zeroed", pv_name);
+ log_error("%s not opened: device not zeroed.", pv_name);
dm_list_move(&pp->arg_fail, &pd->list);
continue;
}
if (!dev_set(pv->dev, UINT64_C(0), (size_t) 2048, 0)) {
- log_error("%s not wiped: aborting", pv_name);
- if (!dev_close(pv->dev))
- stack;
+ log_error("%s not wiped: aborting.", pv_name);
+ if (!dev_close(pv->dev))
+ stack;
dm_list_move(&pp->arg_fail, &pd->list);
continue;
- }
- if (!dev_close(pv->dev))
- stack;
+ }
+ if (!dev_close(pv->dev))
+ stack;
}
- log_verbose("Writing physical volume data to disk \"%s\"", pv_name);
+ log_verbose("Writing physical volume data to disk \"%s\".", pv_name);
if (!pv_write(cmd, pv, 0)) {
- log_error("Failed to write physical volume \"%s\"", pv_name);
+ log_error("Failed to write physical volume \"%s\".", pv_name);
dm_list_move(&pp->arg_fail, &pd->list);
continue;
}
- log_print_unless_silent("Physical volume \"%s\" successfully created", pv_name);
+ log_print_unless_silent("Physical volume \"%s\" successfully created.",
+ pv_name);
pvl->pv = pv;
dm_list_add(&pp->pvs, &pvl->list);
@@ -4466,10 +4462,8 @@ do_command:
* Remove PVs from devices for pvremove.
*/
dm_list_iterate_items_safe(pd, pd2, &pp->arg_remove) {
- struct lvmcache_info *info;
-
if (!label_remove(pd->dev)) {
- log_error("Failed to wipe existing label(s) on %s", pd->name);
+ log_error("Failed to wipe existing label(s) on %s.", pd->name);
dm_list_move(&pp->arg_fail, &pd->list);
continue;
}
@@ -4479,17 +4473,18 @@ do_command:
lvmcache_del(info);
if (!lvmetad_pv_gone_by_dev(pd->dev, NULL)) {
- log_error("Failed to remove PV %s from lvmetad", pd->name);
+ log_error("Failed to remove PV %s from lvmetad.", pd->name);
dm_list_move(&pp->arg_fail, &pd->list);
continue;
}
- log_print_unless_silent("Labels on physical volume \"%s\" successfully wiped",
+ log_print_unless_silent("Labels on physical volume \"%s\" successfully wiped.",
pd->name);
}
dm_list_iterate_items(pd, &pp->arg_fail)
- log_debug("pv command failed for %s", pd->name);
+ log_debug("%s: command failed for %s.",
+ cmd->command->name, pd->name);
if (!dm_list_empty(&pp->arg_fail))
goto_bad;
8 years, 1 month
master - coverity: eliminate DEADCODE
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=36d0dcef38ec3c...
Commit: 36d0dcef38ec3ce89f3c13be272efc69f981b207
Parent: 8173c2ff9af805a1f8eb79fb4bd223622f79ad0d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 1 13:58:15 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Mar 1 14:02:43 2016 +0100
coverity: eliminate DEADCODE
Coverity notice this cannot be NULL: cur = &dms->regions[*cur_r]
so avoid NULL checking and simplify form.
---
libdm/libdm-stats.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 82d3fa5..1dce3eb 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -957,15 +957,13 @@ bad:
static void _stats_walk_next(const struct dm_stats *dms, int region,
uint64_t *cur_r, uint64_t *cur_a)
{
- struct dm_stats_region *cur = NULL;
+ struct dm_stats_region *cur;
int present;
if (!dms || !dms->regions)
return;
- if (!(cur = &dms->regions[*cur_r]))
- return;
-
+ cur = dms->regions + *cur_r;
present = _stats_region_present(cur);
if (region && present)
8 years, 1 month
master - coverity: missing error path
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8173c2ff9af805...
Commit: 8173c2ff9af805a1f8eb79fb4bd223622f79ad0d
Parent: b2d819eafac630cc683c5fdf02730a636dd9bff6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 1 11:40:53 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Mar 1 14:02:43 2016 +0100
coverity: missing error path
---
WHATS_NEW | 1 +
tools/toollib.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 507e028..3494455 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.145 -
=====================================
+ Fix error path when pvcreate allocation fails (2.02.144).
Display [unknown] instead of blank for unknown VG names in pvs output.
Version 2.02.144 - 26th February 2016
diff --git a/tools/toollib.c b/tools/toollib.c
index dd5ece3..dbb6d40 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -4406,6 +4406,7 @@ do_command:
if (!(pvl = dm_pool_alloc(cmd->mem, sizeof(*pvl)))) {
log_error("alloc pvl failed");
dm_list_move(&pp->arg_fail, &pd->list);
+ continue;
}
pv_name = pd->name;
8 years, 1 month