diff options
author | David Teigland <teigland@redhat.com> | 2015-11-17 09:33:50 -0600 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2015-11-17 10:35:42 -0600 |
commit | 4d37db123d4ea2735c538bf9ad8a57be051ac9c3 (patch) | |
tree | 48635528f08ecc0b0d803c71ffd0cd241804c4aa | |
parent | 485d2ca9454ab4725605ab9a33928164aef1bfc8 (diff) | |
download | lvm2-4d37db123d4ea2735c538bf9ad8a57be051ac9c3.tar.gz |
lvmetad: improve error message for VGs with same name
-rw-r--r-- | lib/cache/lvmetad.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c index f8393dfbe..8b5bcfb09 100644 --- a/lib/cache/lvmetad.c +++ b/lib/cache/lvmetad.c @@ -316,6 +316,15 @@ static int _lvmetad_handle_reply(daemon_reply reply, const char *action, const c return 1; } + /* Multiple VGs with the same name were found. */ + if (found && !strcmp(daemon_reply_str(reply, "response", ""), "multiple")) { + log_very_verbose("Request to %s %s%sin lvmetad found multiple matching objects.", + action, object, *object ? " " : ""); + if (found) + *found = 2; + return 1; + } + log_error("Request to %s %s%sin lvmetad gave response %s. Reason: %s", action, object, *object ? " " : "", daemon_reply_str(reply, "response", "<missing>"), @@ -527,6 +536,12 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna if (_lvmetad_handle_reply(reply, "lookup VG", diag_name, &found) && found) { + if ((found == 2) && vgname) { + log_error("Multiple VGs found with the same name: %s.", vgname); + log_error("See the --select option with VG UUID (vg_uuid)."); + goto out; + } + if (!(top = dm_config_find_node(reply.cft->root, "metadata"))) { log_error(INTERNAL_ERROR "metadata config node not found."); goto out; |