Merge pull request #6945 from qlyoung/nb-more-messages

More gRPC logging + errmsg for no changes
This commit is contained in:
Renato Westphal 2020-08-19 20:14:05 -03:00 committed by GitHub
commit 0d206e9d85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -680,8 +680,12 @@ int nb_candidate_commit_prepare(struct nb_context *context,
RB_INIT(nb_config_cbs, &changes); RB_INIT(nb_config_cbs, &changes);
nb_config_diff(running_config, candidate, &changes); nb_config_diff(running_config, candidate, &changes);
if (RB_EMPTY(nb_config_cbs, &changes)) if (RB_EMPTY(nb_config_cbs, &changes)) {
snprintf(
errmsg, errmsg_len,
"No changes to apply were found during preparation phase");
return NB_ERR_NO_CHANGES; return NB_ERR_NO_CHANGES;
}
if (nb_candidate_validate_code(context, candidate, &changes, errmsg, if (nb_candidate_validate_code(context, candidate, &changes, errmsg,
errmsg_len) errmsg_len)

View File

@ -677,11 +677,13 @@ class NorthboundImpl
switch (phase) { switch (phase) {
case frr::CommitRequest::VALIDATE: case frr::CommitRequest::VALIDATE:
zlog_debug("`-> Performing VALIDATE");
ret = nb_candidate_validate( ret = nb_candidate_validate(
&context, candidate->config, errmsg, &context, candidate->config, errmsg,
sizeof(errmsg)); sizeof(errmsg));
break; break;
case frr::CommitRequest::PREPARE: case frr::CommitRequest::PREPARE:
zlog_debug("`-> Performing PREPARE");
ret = nb_candidate_commit_prepare( ret = nb_candidate_commit_prepare(
&context, candidate->config, &context, candidate->config,
comment.c_str(), comment.c_str(),
@ -689,17 +691,20 @@ class NorthboundImpl
sizeof(errmsg)); sizeof(errmsg));
break; break;
case frr::CommitRequest::ABORT: case frr::CommitRequest::ABORT:
zlog_debug("`-> Performing ABORT");
nb_candidate_commit_abort( nb_candidate_commit_abort(
candidate->transaction, errmsg, candidate->transaction, errmsg,
sizeof(errmsg)); sizeof(errmsg));
break; break;
case frr::CommitRequest::APPLY: case frr::CommitRequest::APPLY:
zlog_debug("`-> Performing ABORT");
nb_candidate_commit_apply( nb_candidate_commit_apply(
candidate->transaction, true, candidate->transaction, true,
&transaction_id, errmsg, &transaction_id, errmsg,
sizeof(errmsg)); sizeof(errmsg));
break; break;
case frr::CommitRequest::ALL: case frr::CommitRequest::ALL:
zlog_debug("`-> Performing ALL");
ret = nb_candidate_commit( ret = nb_candidate_commit(
&context, candidate->config, true, &context, candidate->config, true,
comment.c_str(), &transaction_id, comment.c_str(), &transaction_id,
@ -737,6 +742,12 @@ class NorthboundImpl
grpc::StatusCode::INTERNAL, errmsg); grpc::StatusCode::INTERNAL, errmsg);
break; break;
} }
if (nb_dbg_client_grpc)
zlog_debug("`-> Result: %s (message: '%s')",
nb_err_name((enum nb_error)ret),
errmsg);
if (ret == NB_OK) { if (ret == NB_OK) {
// Response: uint32 transaction_id = 1; // Response: uint32 transaction_id = 1;
if (transaction_id) if (transaction_id)