Adjust the logging messages and levels, and remove a unnecessary and
confusing message.

Suggested-by: Martin Wilck <[email protected]>
Signed-off-by: Benjamin Marzinski <[email protected]>
---
 libmpathpersist/mpath_persist_int.c | 16 +++++++++-------
 libmpathpersist/mpath_updatepr.c    |  9 +++++----
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/libmpathpersist/mpath_persist_int.c 
b/libmpathpersist/mpath_persist_int.c
index 14de06b3..8b8a7812 100644
--- a/libmpathpersist/mpath_persist_int.c
+++ b/libmpathpersist/mpath_persist_int.c
@@ -211,7 +211,7 @@ mpath_prout_common(struct multipath *mpp, int rq_servact, 
int rq_scope,
        vector_foreach_slot (mpp->pg, pgp, j) {
                vector_foreach_slot (pgp->paths, pp, i) {
                        if (!((pp->state == PATH_UP) || (pp->state == 
PATH_GHOST))) {
-                               condlog(1, "%s: %s path not up. Skip",
+                               condlog(3, "%s: %s path not up. Skip",
                                        mpp->wwid, pp->dev);
                                if (failed_paths)
                                        *failed_paths = true;
@@ -244,6 +244,8 @@ mpath_prout_common(struct multipath *mpp, int rq_servact, 
int rq_scope,
                        if (ret == MPATH_PR_RESERV_CONFLICT &&
                            (pp->dmstate == PSTATE_FAILED ||
                             rq_servact == MPATH_PROUT_RES_SA)) {
+                               condlog(4, "%s: ignoring path %s with conflict",
+                                       mpp->wwid, pp->dev);
                                conflict = true;
                                continue;
                        }
@@ -330,6 +332,8 @@ void preempt_missing_path(struct multipath *mpp, uint8_t 
*key, uint8_t *sa_key,
         * node. libmpathpersist has never worked if multiple nodes share
         * the same reservation key for a device
         */
+       condlog(3, "%s: preempting missing path while changing key",
+               mpp->wwid);
        rq_type = resp.prin_descriptor.prin_readresv.scope_type & 
MPATH_PR_TYPE_MASK;
        rq_scope = (resp.prin_descriptor.prin_readresv.scope_type &
                    MPATH_PR_SCOPE_MASK) >>
@@ -446,7 +450,7 @@ static int mpath_prout_reg(struct multipath *mpp,int 
rq_servact, int rq_scope,
        vector_foreach_slot (mpp->pg, pgp, j){
                vector_foreach_slot (pgp->paths, pp, i){
                        if (!((pp->state == PATH_UP) || (pp->state == 
PATH_GHOST))){
-                               condlog (1, "%s: %s path not up. Skip.", 
mpp->wwid, pp->dev);
+                               condlog (3, "%s: %s path not up. Skip.", 
mpp->wwid, pp->dev);
                                continue;
                        }
                        if (all_tg_pt && pp->sg_id.host_no != -1) {
@@ -736,7 +740,7 @@ mpath_prout_rel(struct multipath *mpp, int rq_servact, int 
rq_scope,
        vector_foreach_slot (mpp->pg, pgp, j){
                vector_foreach_slot (pgp->paths, pp, i){
                        if (!((pp->state == PATH_UP) || (pp->state == 
PATH_GHOST))){
-                               condlog (1, "%s: %s path not up.", mpp->wwid, 
pp->dev);
+                               condlog (3, "%s: %s path not up.", mpp->wwid, 
pp->dev);
                                continue;
                        }
 
@@ -780,17 +784,15 @@ mpath_prout_rel(struct multipath *mpp, int rq_servact, 
int rq_scope,
        }
 
        if (!check_holding_reservation(mpp, (uint8_t *)&mpp->reservation_key,
-                                      &res_type)) {
-               condlog(2, "%s: Releasing key not holding reservation.", 
mpp->wwid);
+                                      &res_type))
                return MPATH_PR_SUCCESS;
-       }
        if (res_type != rq_type) {
                condlog(2, "%s: --prout_type %u doesn't match reservation %u",
                        mpp->wwid, rq_type, res_type);
                return MPATH_PR_RESERV_CONFLICT;
        }
 
-       condlog (2, "%s: Path holding reservation is not available.", 
mpp->wwid);
+       condlog (3, "%s: Path holding reservation is not available.", 
mpp->wwid);
        /*
         * Cannot free the reservation because the path that is holding it
         * is not usable. Workaround this by:
diff --git a/libmpathpersist/mpath_updatepr.c b/libmpathpersist/mpath_updatepr.c
index dd8dd48e..d189c184 100644
--- a/libmpathpersist/mpath_updatepr.c
+++ b/libmpathpersist/mpath_updatepr.c
@@ -38,14 +38,14 @@ static char *do_pr(char *alias, char *str)
                return NULL;
        }
 
-       condlog (2, "%s: pr message=%s", alias, str);
+       condlog (4, "%s: pr message=%s", alias, str);
        if (send_packet(fd, str) != 0) {
                condlog(2, "%s: message=%s send error=%d", alias, str, errno);
                mpath_disconnect(fd);
                return NULL;
        }
        if (recv_packet(fd, &reply, timeout) < 0)
-               condlog(2, "%s: message=%s recv error=%d", alias, str, errno);
+               condlog(0, "%s: message=%s recv error=%d", alias, str, errno);
 
        mpath_disconnect(fd);
        return reply;
@@ -64,11 +64,12 @@ static int do_update_pr(char *alias, char *cmd, char *key)
 
        reply = do_pr(alias, str);
        if (reply) {
-               condlog (2, "%s: message=%s reply=%s", alias, str, reply);
-               if (reply && strncmp(reply,"ok", 2) == 0)
+               if (strncmp(reply, "ok", 2) == 0)
                        ret = 0;
                else
                        ret = -1;
+               condlog(ret ? 0 : 4, "%s: message=%s reply=%s", alias, str,
+                       reply);
        }
 
        free(reply);
-- 
2.50.1


Reply via email to