diff options
Diffstat (limited to 'lib/mgmt_fe_client.c')
| -rw-r--r-- | lib/mgmt_fe_client.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/lib/mgmt_fe_client.c b/lib/mgmt_fe_client.c index 35a6d7d909..be7263f21b 100644 --- a/lib/mgmt_fe_client.c +++ b/lib/mgmt_fe_client.c @@ -50,6 +50,22 @@ struct mgmt_fe_client { struct debug mgmt_dbg_fe_client = {0, "Management frontend client operations"}; +static inline const char *dsid2name(Mgmtd__DatastoreId id) +{ + switch ((int)id) { + case MGMTD_DS_NONE: + return "none"; + case MGMTD_DS_RUNNING: + return "running"; + case MGMTD_DS_CANDIDATE: + return "candidate"; + case MGMTD_DS_OPERATIONAL: + return "operational"; + default: + return "unknown-datastore-id"; + } +} + static struct mgmt_fe_client_session * mgmt_fe_find_session_by_client_id(struct mgmt_fe_client *client, uint64_t client_id) @@ -124,18 +140,15 @@ static int mgmt_fe_send_session_req(struct mgmt_fe_client *client, { Mgmtd__FeMessage fe_msg; Mgmtd__FeSessionReq sess_req; - bool scok; mgmtd__fe_session_req__init(&sess_req); sess_req.create = create; if (create) { sess_req.id_case = MGMTD__FE_SESSION_REQ__ID_CLIENT_CONN_ID; sess_req.client_conn_id = session->client_id; - scok = true; } else { sess_req.id_case = MGMTD__FE_SESSION_REQ__ID_SESSION_ID; sess_req.session_id = session->session_id; - scok = false; } mgmtd__fe_message__init(&fe_msg); @@ -146,7 +159,7 @@ static int mgmt_fe_send_session_req(struct mgmt_fe_client *client, "Sending SESSION_REQ %s message for client-id %" PRIu64, create ? "create" : "destroy", session->client_id); - return mgmt_fe_client_send_msg(client, &fe_msg, scok); + return mgmt_fe_client_send_msg(client, &fe_msg, true); } int mgmt_fe_send_lockds_req(struct mgmt_fe_client *client, uint64_t session_id, @@ -168,8 +181,9 @@ int mgmt_fe_send_lockds_req(struct mgmt_fe_client *client, uint64_t session_id, fe_msg.lockds_req = &lockds_req; MGMTD_FE_CLIENT_DBG( - "Sending %sLOCK_REQ message for Ds:%d session-id %" PRIu64, - lock ? "" : "UN", ds_id, session_id); + "Sending LOCKDS_REQ (%sLOCK) message for DS:%s session-id %" PRIu64, + lock ? "" : "UN", dsid2name(ds_id), session_id); + return mgmt_fe_client_send_msg(client, &fe_msg, false); } @@ -197,9 +211,9 @@ int mgmt_fe_send_setcfg_req(struct mgmt_fe_client *client, uint64_t session_id, fe_msg.setcfg_req = &setcfg_req; MGMTD_FE_CLIENT_DBG( - "Sending SET_CONFIG_REQ message for Ds:%d session-id %" PRIu64 + "Sending SET_CONFIG_REQ message for DS:%s session-id %" PRIu64 " (#xpaths:%d)", - ds_id, session_id, num_data_reqs); + dsid2name(ds_id), session_id, num_data_reqs); return mgmt_fe_client_send_msg(client, &fe_msg, false); } @@ -227,8 +241,8 @@ int mgmt_fe_send_commitcfg_req(struct mgmt_fe_client *client, fe_msg.commcfg_req = &commitcfg_req; MGMTD_FE_CLIENT_DBG( - "Sending COMMIT_CONFIG_REQ message for Src-Ds:%d, Dst-Ds:%d session-id %" PRIu64, - src_ds_id, dest_ds_id, session_id); + "Sending COMMIT_CONFIG_REQ message for Src-DS:%s, Dst-DS:%s session-id %" PRIu64, + dsid2name(src_ds_id), dsid2name(dest_ds_id), session_id); return mgmt_fe_client_send_msg(client, &fe_msg, false); } @@ -254,9 +268,9 @@ int mgmt_fe_send_getcfg_req(struct mgmt_fe_client *client, uint64_t session_id, fe_msg.getcfg_req = &getcfg_req; MGMTD_FE_CLIENT_DBG( - "Sending GET_CONFIG_REQ message for Ds:%d session-id %" PRIu64 + "Sending GET_CONFIG_REQ message for DS:%s session-id %" PRIu64 " (#xpaths:%d)", - ds_id, session_id, num_data_reqs); + dsid2name(ds_id), session_id, num_data_reqs); return mgmt_fe_client_send_msg(client, &fe_msg, false); } @@ -282,9 +296,9 @@ int mgmt_fe_send_getdata_req(struct mgmt_fe_client *client, uint64_t session_id, fe_msg.getdata_req = &getdata_req; MGMTD_FE_CLIENT_DBG( - "Sending GET_CONFIG_REQ message for Ds:%d session-id %" PRIu64 + "Sending GET_CONFIG_REQ message for DS:%s session-id %" PRIu64 " (#xpaths:%d)", - ds_id, session_id, num_data_reqs); + dsid2name(ds_id), session_id, num_data_reqs); return mgmt_fe_client_send_msg(client, &fe_msg, false); } |
