diff options
| author | Chirag Shah <chirag@nvidia.com> | 2020-08-20 12:09:53 -0700 | 
|---|---|---|
| committer | Chirag Shah <chirag@nvidia.com> | 2020-08-20 14:12:04 -0700 | 
| commit | 390a886277ba3afc6b9371cc13587b9a30ce5bdb (patch) | |
| tree | 4894f96aac6079993493eb818a159bcebab91052 /lib/northbound.c | |
| parent | 6a7fb29c197718b7a8e43e64e641b59d0bb5a751 (diff) | |
*: record transaction based on control flag
In case of config rollback is enabled,
record northbound transaction based on a control flag.
The actual frr daemons would set the flag to true via
nb_init from frr_init.
This will allow test daemon to bypass recording
transacation to db.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Diffstat (limited to 'lib/northbound.c')
| -rw-r--r-- | lib/northbound.c | 8 | 
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/northbound.c b/lib/northbound.c index 29e843a84e..18500a8bd2 100644 --- a/lib/northbound.c +++ b/lib/northbound.c @@ -57,6 +57,8 @@ static struct {  	const void *owner_user;  } running_config_mgmt_lock; +/* Knob to record config transaction */ +static bool nb_db_enabled;  /*   * Global lock used to prevent multiple configuration transactions from   * happening concurrently. @@ -732,7 +734,7 @@ void nb_candidate_commit_apply(struct nb_transaction *transaction,  	nb_config_replace(running_config, transaction->config, true);  	/* Record transaction. */ -	if (save_transaction +	if (save_transaction && nb_db_enabled  	    && nb_db_transaction_save(transaction, transaction_id) != NB_OK)  		flog_warn(EC_LIB_NB_TRANSACTION_RECORD_FAILED,  			  "%s: failed to record transaction", __func__); @@ -2216,7 +2218,7 @@ static void nb_load_callbacks(const struct frr_yang_module_info *module)  void nb_init(struct thread_master *tm,  	     const struct frr_yang_module_info *const modules[], -	     size_t nmodules) +	     size_t nmodules, bool db_enabled)  {  	unsigned int errors = 0; @@ -2241,6 +2243,8 @@ void nb_init(struct thread_master *tm,  		exit(1);  	} +	nb_db_enabled = db_enabled; +  	/* Create an empty running configuration. */  	running_config = nb_config_new(NULL);  	running_config_entries = hash_create(running_config_entry_key_make,  | 
