mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 10:32:00 +00:00
mgmtd, lib: Cleanup zlog_err()
Cleanup all zlog_err() that were meant for debug only. Signed-off-by: Pushpasis Sarkar <pushpasis@gmail.com>
This commit is contained in:
parent
02619b5522
commit
048e1e7be8
109
lib/vty.c
109
lib/vty.c
@ -73,6 +73,13 @@ static bool mgmt_candidate_ds_wr_locked;
|
||||
static uint64_t mgmt_client_id_next;
|
||||
static uint64_t mgmt_last_req_id = UINT64_MAX;
|
||||
|
||||
static bool vty_debug;
|
||||
#define VTY_DBG(fmt, ...) \
|
||||
do { \
|
||||
if (vty_debug) \
|
||||
zlog_debug(fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
PREDECL_DLIST(vtyservs);
|
||||
|
||||
struct vty_serv {
|
||||
@ -3273,9 +3280,9 @@ void vty_init_vtysh(void)
|
||||
static void vty_mgmt_server_connected(uintptr_t lib_hndl, uintptr_t usr_data,
|
||||
bool connected)
|
||||
{
|
||||
zlog_err("%sGot %sconnected %s MGMTD Frontend Server",
|
||||
!connected ? "ERROR: " : "", !connected ? "dis: " : "",
|
||||
!connected ? "from" : "to");
|
||||
VTY_DBG("%sGot %sconnected %s MGMTD Frontend Server",
|
||||
!connected ? "ERROR: " : "", !connected ? "dis: " : "",
|
||||
!connected ? "from" : "to");
|
||||
|
||||
mgmt_fe_connected = connected;
|
||||
|
||||
@ -3295,15 +3302,13 @@ static void vty_mgmt_session_created(uintptr_t lib_hndl, uintptr_t usr_data,
|
||||
vty = (struct vty *)session_ctx;
|
||||
|
||||
if (!success) {
|
||||
zlog_err("%s session for client %llu failed!",
|
||||
create ? "Creating" : "Destroying",
|
||||
(unsigned long long)client_id);
|
||||
zlog_err("%s session for client %" PRIu64 " failed!",
|
||||
create ? "Creating" : "Destroying", client_id);
|
||||
return;
|
||||
}
|
||||
|
||||
zlog_err("%s session for client %llu successfully!",
|
||||
create ? "Created" : "Destroyed",
|
||||
(unsigned long long)client_id);
|
||||
VTY_DBG("%s session for client %" PRIu64 " successfully",
|
||||
create ? "Created" : "Destroyed", client_id);
|
||||
if (create)
|
||||
vty->mgmt_session_id = session_id;
|
||||
}
|
||||
@ -3320,13 +3325,13 @@ static void vty_mgmt_ds_lock_notified(uintptr_t lib_hndl, uintptr_t usr_data,
|
||||
vty = (struct vty *)session_ctx;
|
||||
|
||||
if (!success) {
|
||||
zlog_err("%socking for DS %u failed! Err: '%s'",
|
||||
zlog_err("%socking for DS %u failed, Err: '%s'",
|
||||
lock_ds ? "L" : "Unl", ds_id, errmsg_if_any);
|
||||
vty_out(vty, "ERROR: %socking for DS %u failed! Err: '%s'\n",
|
||||
vty_out(vty, "ERROR: %socking for DS %u failed, Err: '%s'\n",
|
||||
lock_ds ? "L" : "Unl", ds_id, errmsg_if_any);
|
||||
} else {
|
||||
zlog_err("%socked DS %u successfully!", lock_ds ? "L" : "Unl",
|
||||
ds_id);
|
||||
VTY_DBG("%socked DS %u successfully", lock_ds ? "L" : "Unl",
|
||||
ds_id);
|
||||
}
|
||||
|
||||
vty_mgmt_resume_response(vty, success);
|
||||
@ -3342,17 +3347,15 @@ static void vty_mgmt_set_config_result_notified(
|
||||
vty = (struct vty *)session_ctx;
|
||||
|
||||
if (!success) {
|
||||
zlog_err(
|
||||
"SET_CONFIG request for client 0x%llx failed! Error: '%s'",
|
||||
(unsigned long long)client_id,
|
||||
errmsg_if_any ? errmsg_if_any : "Unknown");
|
||||
vty_out(vty, "ERROR: SET_CONFIG request failed! Error: %s\n",
|
||||
zlog_err("SET_CONFIG request for client 0x%" PRIx64
|
||||
" failed, Error: '%s'",
|
||||
client_id, errmsg_if_any ? errmsg_if_any : "Unknown");
|
||||
vty_out(vty, "ERROR: SET_CONFIG request failed, Error: %s\n",
|
||||
errmsg_if_any ? errmsg_if_any : "Unknown");
|
||||
} else {
|
||||
zlog_err(
|
||||
"SET_CONFIG request for client 0x%llx req-id %llu was successfull!",
|
||||
(unsigned long long)client_id,
|
||||
(unsigned long long)req_id);
|
||||
VTY_DBG("SET_CONFIG request for client 0x%" PRIx64
|
||||
" req-id %" PRIu64 " was successfull",
|
||||
client_id, req_id);
|
||||
}
|
||||
|
||||
vty_mgmt_resume_response(vty, success);
|
||||
@ -3369,17 +3372,15 @@ static void vty_mgmt_commit_config_result_notified(
|
||||
vty = (struct vty *)session_ctx;
|
||||
|
||||
if (!success) {
|
||||
zlog_err(
|
||||
"COMMIT_CONFIG request for client 0x%llx failed! Error: '%s'",
|
||||
(unsigned long long)client_id,
|
||||
errmsg_if_any ? errmsg_if_any : "Unknown");
|
||||
vty_out(vty, "ERROR: COMMIT_CONFIG request failed! Error: %s\n",
|
||||
zlog_err("COMMIT_CONFIG request for client 0x%" PRIx64
|
||||
" failed, Error: '%s'",
|
||||
client_id, errmsg_if_any ? errmsg_if_any : "Unknown");
|
||||
vty_out(vty, "ERROR: COMMIT_CONFIG request failed, Error: %s\n",
|
||||
errmsg_if_any ? errmsg_if_any : "Unknown");
|
||||
} else {
|
||||
zlog_err(
|
||||
"COMMIT_CONFIG request for client 0x%llx req-id %llu was successfull!",
|
||||
(unsigned long long)client_id,
|
||||
(unsigned long long)req_id);
|
||||
VTY_DBG("COMMIT_CONFIG request for client 0x%" PRIx64
|
||||
" req-id %" PRIu64 " was successfull",
|
||||
client_id, req_id);
|
||||
if (errmsg_if_any)
|
||||
vty_out(vty, "MGMTD: %s\n", errmsg_if_any);
|
||||
}
|
||||
@ -3399,19 +3400,18 @@ static enum mgmt_result vty_mgmt_get_data_result_notified(
|
||||
vty = (struct vty *)session_ctx;
|
||||
|
||||
if (!success) {
|
||||
zlog_err(
|
||||
"GET_DATA request for client 0x%llx failed! Error: '%s'",
|
||||
(unsigned long long)client_id,
|
||||
errmsg_if_any ? errmsg_if_any : "Unknown");
|
||||
vty_out(vty, "ERROR: GET_DATA request failed! Error: %s\n",
|
||||
zlog_err("GET_DATA request for client 0x%" PRIx64
|
||||
" failed, Error: '%s'",
|
||||
client_id, errmsg_if_any ? errmsg_if_any : "Unknown");
|
||||
vty_out(vty, "ERROR: GET_DATA request failed, Error: %s\n",
|
||||
errmsg_if_any ? errmsg_if_any : "Unknown");
|
||||
vty_mgmt_resume_response(vty, success);
|
||||
return MGMTD_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
zlog_debug(
|
||||
"GET_DATA request for client 0x%llx req-id %llu was successfull!",
|
||||
(unsigned long long)client_id, (unsigned long long)req_id);
|
||||
VTY_DBG("GET_DATA request for client 0x%" PRIx64 " req-id %" PRIu64
|
||||
" was successfull!",
|
||||
client_id, req_id);
|
||||
|
||||
if (req_id != mgmt_last_req_id) {
|
||||
mgmt_last_req_id = req_id;
|
||||
@ -3469,10 +3469,10 @@ int vty_mgmt_send_lockds_req(struct vty *vty, Mgmtd__DatastoreId ds_id,
|
||||
vty->mgmt_req_id, ds_id, lock);
|
||||
if (ret != MGMTD_SUCCESS) {
|
||||
zlog_err(
|
||||
"Failed to send %sLOCK-DS-REQ to MGMTD for req-id %llu.",
|
||||
lock ? "" : "UN",
|
||||
(unsigned long long)vty->mgmt_req_id);
|
||||
vty_out(vty, "Failed to send %sLOCK-DS-REQ to MGMTD!",
|
||||
"Failed to send %sLOCK-DS-REQ to MGMTD for req-id %"
|
||||
PRIu64 ".",
|
||||
lock ? "" : "UN", vty->mgmt_req_id);
|
||||
vty_out(vty, "Failed to send %sLOCK-DS-REQ to MGMTD!\n",
|
||||
lock ? "" : "UN");
|
||||
return -1;
|
||||
}
|
||||
@ -3549,6 +3549,7 @@ int vty_mgmt_send_config_data(struct vty *vty)
|
||||
MGMTD_DS_RUNNING) != MGMTD_SUCCESS) {
|
||||
zlog_err("Failed to send %d Config Xpaths to MGMTD!!",
|
||||
(int)indx);
|
||||
vty_out(vty, "Failed to send SETCFG-REQ to MGMTD!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -3570,9 +3571,10 @@ int vty_mgmt_send_commit_config(struct vty *vty, bool validate_only, bool abort)
|
||||
abort);
|
||||
if (ret != MGMTD_SUCCESS) {
|
||||
zlog_err(
|
||||
"Failed to send COMMIT-REQ to MGMTD for req-id %llu.",
|
||||
(unsigned long long)vty->mgmt_req_id);
|
||||
vty_out(vty, "Failed to send COMMIT-REQ to MGMTD!");
|
||||
"Failed to send COMMIT-REQ to MGMTD for req-id %"
|
||||
PRIu64 ".",
|
||||
vty->mgmt_req_id);
|
||||
vty_out(vty, "Failed to send COMMIT-REQ to MGMTD!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -3608,9 +3610,11 @@ int vty_mgmt_send_get_config(struct vty *vty, Mgmtd__DatastoreId datastore,
|
||||
num_req);
|
||||
|
||||
if (ret != MGMTD_SUCCESS) {
|
||||
zlog_err("Failed to send GET-CONFIG to MGMTD for req-id %llu.",
|
||||
(unsigned long long)vty->mgmt_req_id);
|
||||
vty_out(vty, "Failed to send GET-CONFIG to MGMTD!");
|
||||
zlog_err(
|
||||
"Failed to send GET-CONFIG to MGMTD for req-id %" PRIu64
|
||||
".",
|
||||
vty->mgmt_req_id);
|
||||
vty_out(vty, "Failed to send GET-CONFIG to MGMTD!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -3643,9 +3647,10 @@ int vty_mgmt_send_get_data(struct vty *vty, Mgmtd__DatastoreId datastore,
|
||||
vty->mgmt_req_id, datastore, getreq, num_req);
|
||||
|
||||
if (ret != MGMTD_SUCCESS) {
|
||||
zlog_err("Failed to send GET-DATA to MGMTD for req-id %llu.",
|
||||
(unsigned long long)vty->mgmt_req_id);
|
||||
vty_out(vty, "Failed to send GET-DATA to MGMTD!");
|
||||
zlog_err("Failed to send GET-DATA to MGMTD for req-id %" PRIu64
|
||||
".",
|
||||
vty->mgmt_req_id);
|
||||
vty_out(vty, "Failed to send GET-DATA to MGMTD!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
#define MGMTD_DS_DBG(fmt, ...) \
|
||||
do { \
|
||||
if (mgmt_debug_ds) \
|
||||
zlog_err("%s: " fmt, __func__, ##__VA_ARGS__); \
|
||||
zlog_debug("%s: " fmt, __func__, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#define MGMTD_DS_ERR(fmt, ...) \
|
||||
zlog_err("%s: ERROR: " fmt, __func__, ##__VA_ARGS__)
|
||||
|
@ -20,10 +20,10 @@
|
||||
#define MGMTD_TXN_ERR(fmt, ...) \
|
||||
fprintf(stderr, "%s: ERROR, " fmt "\n", __func__, ##__VA_ARGS__)
|
||||
#else /* REDIRECT_DEBUG_TO_STDERR */
|
||||
#define MGMTD_TXN_DBG(fmt, ...) \
|
||||
#define MGMTD_TXN_DBG(fmt, ...) \
|
||||
do { \
|
||||
if (mgmt_debug_txn) \
|
||||
zlog_err("%s: " fmt, __func__, ##__VA_ARGS__); \
|
||||
if (mgmt_debug_txn) \
|
||||
zlog_debug("%s: " fmt, __func__, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#define MGMTD_TXN_ERR(fmt, ...) \
|
||||
zlog_err("%s: ERROR: " fmt, __func__, ##__VA_ARGS__)
|
||||
|
Loading…
Reference in New Issue
Block a user