1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

lvmcache: change duplicate VG name warnings to verbose

When two different VGs with the same name exist,
they are both stored in lvmcache using the vginfo->next
list.  Previously, the code would print warnings (sometimes)
when adding VGs to this list.  Now the duplicate VG names
are handled by higher level code, so this list no longer
needs to print warnings about duplicate VG names being found.
This commit is contained in:
David Teigland 2015-11-30 15:28:22 -06:00
parent 88cef47b18
commit 3bcdf5d14b

53
lib/cache/lvmcache.c vendored
View File

@ -1259,6 +1259,15 @@ static int _insert_vginfo(struct lvmcache_vginfo *new_vginfo, const char *vgid,
return_0; return_0;
/* /*
* vginfo is kept for each VG with the same name.
* They are saved with the vginfo->next list.
* These checks just decide the ordering of
* that list.
*
* FIXME: it should no longer matter what order
* the vginfo's are kept in, so we can probably
* remove these comparisons and reordering entirely.
*
* If Primary not exported, new exported => keep * If Primary not exported, new exported => keep
* Else Primary exported, new not exported => change * Else Primary exported, new not exported => change
* Else Primary has hostname for this machine => keep * Else Primary has hostname for this machine => keep
@ -1268,38 +1277,42 @@ static int _insert_vginfo(struct lvmcache_vginfo *new_vginfo, const char *vgid,
*/ */
if (!(primary_vginfo->status & EXPORTED_VG) && if (!(primary_vginfo->status & EXPORTED_VG) &&
(vgstatus & EXPORTED_VG)) (vgstatus & EXPORTED_VG))
log_warn("WARNING: Duplicate VG name %s: " log_verbose("Cache: Duplicate VG name %s: "
"Existing %s takes precedence over " "Existing %s takes precedence over "
"exported %s", new_vginfo->vgname, "exported %s", new_vginfo->vgname,
uuid_primary, uuid_new); uuid_primary, uuid_new);
else if ((primary_vginfo->status & EXPORTED_VG) && else if ((primary_vginfo->status & EXPORTED_VG) &&
!(vgstatus & EXPORTED_VG)) { !(vgstatus & EXPORTED_VG)) {
log_warn("WARNING: Duplicate VG name %s: " log_verbose("Cache: Duplicate VG name %s: "
"%s takes precedence over exported %s", "%s takes precedence over exported %s",
new_vginfo->vgname, uuid_new, new_vginfo->vgname, uuid_new,
uuid_primary); uuid_primary);
use_new = 1; use_new = 1;
} else if (primary_vginfo->creation_host && } else if (primary_vginfo->creation_host &&
!strcmp(primary_vginfo->creation_host, !strcmp(primary_vginfo->creation_host,
primary_vginfo->fmt->cmd->hostname)) primary_vginfo->fmt->cmd->hostname))
log_warn("WARNING: Duplicate VG name %s: " log_verbose("Cache: Duplicate VG name %s: "
"Existing %s (created here) takes precedence " "Existing %s (created here) takes precedence "
"over %s", new_vginfo->vgname, uuid_primary, "over %s", new_vginfo->vgname, uuid_primary,
uuid_new); uuid_new);
else if (!primary_vginfo->creation_host && creation_host) { else if (!primary_vginfo->creation_host && creation_host) {
log_warn("WARNING: Duplicate VG name %s: " log_verbose("Cache: Duplicate VG name %s: "
"%s (with creation_host) takes precedence over %s", "%s (with creation_host) takes precedence over %s",
new_vginfo->vgname, uuid_new, new_vginfo->vgname, uuid_new,
uuid_primary); uuid_primary);
use_new = 1; use_new = 1;
} else if (creation_host && } else if (creation_host &&
!strcmp(creation_host, !strcmp(creation_host,
primary_vginfo->fmt->cmd->hostname)) { primary_vginfo->fmt->cmd->hostname)) {
log_warn("WARNING: Duplicate VG name %s: " log_verbose("Cache: Duplicate VG name %s: "
"%s (created here) takes precedence over %s", "%s (created here) takes precedence over %s",
new_vginfo->vgname, uuid_new, new_vginfo->vgname, uuid_new,
uuid_primary); uuid_primary);
use_new = 1; use_new = 1;
} else {
log_verbose("Cache: Duplicate VG name %s: "
"Prefer existing %s vs new %s",
new_vginfo->vgname, uuid_primary, uuid_new);
} }
if (!use_new) { if (!use_new) {