master - lvmetad: improve error message for VGs with same name
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4d37db123d4ea2735c538bf9ad8a57be051ac9c3 Commit: 4d37db123d4ea2735c538bf9ad8a57be051ac9c3 Parent: 485d2ca9454ab4725605ab9a33928164aef1bfc8 Author: David Teigland <[email protected]> AuthorDate: Tue Nov 17 09:33:50 2015 -0600 Committer: David Teigland <[email protected]> CommitterDate: Tue Nov 17 10:35:42 2015 -0600
lvmetad: improve error message for VGs with same name
--- lib/cache/lvmetad.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)
lib/cache/lvmetad.c +15 -0
@@ -316,6 +316,15 @@ static int _lvmetad_handle_reply(daemon_reply reply, const char *action, const creturn 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 *vgnaif (_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;