summaryrefslogtreecommitdiff
path: root/mgmtd/mgmt_be_adapter.c
diff options
context:
space:
mode:
authorYash Ranjan <ranjany@vmware.com>2021-10-28 00:07:11 -0700
committerChristian Hopps <chopps@labn.net>2023-03-21 22:08:32 -0400
commit74335ceb2753cc73afe2854b20640018431acc19 (patch)
tree0ff2afc2aacd7078131086fd6051321725b5cd94 /mgmtd/mgmt_be_adapter.c
parent7d65b7b7f441ddb2e730d4274023c0d3d2907c6b (diff)
mgmtd: Add MGMT Transaction Framework
This commit introduces the MGMT Transaction framework that takes management requests from one (or more) frontend client sessions, translates them into transactions and drives them to completion in co-oridination with one (or more) backend client daemons involved in the request. This commit includes the following functionalities in the changeset: 1. Introduces the actual Transaction module. Commands added related to transaction are: a. show mgmt transaction all 2. Adds support for commit rollback feature which stores upto the 10 commit buffers. Each commit has a commit-id which can be used to rollback to the exact configuration state. Commands supported for this feature are: a. show mgmt commit-history b. mgmt rollback commit-id COMMIT_ID 3. Add hidden commands to enable record various performance metrics: a. mgmt performance-measurement b. mgmt reset-statistic Co-authored-by: Pushpasis Sarkar <pushpasis@gmail.com> Co-authored-by: Abhinay Ramesh <rabhinay@vmware.com> Co-authored-by: Ujwal P <ujwalp@vmware.com> Signed-off-by: Yash Ranjan <ranjany@vmware.com>
Diffstat (limited to 'mgmtd/mgmt_be_adapter.c')
-rw-r--r--mgmtd/mgmt_be_adapter.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/mgmtd/mgmt_be_adapter.c b/mgmtd/mgmt_be_adapter.c
index f5385d218e..b47ed3afe1 100644
--- a/mgmtd/mgmt_be_adapter.c
+++ b/mgmtd/mgmt_be_adapter.c
@@ -332,9 +332,9 @@ static void mgmt_be_adapter_disconnect(struct mgmt_be_client_adapter *adapter)
}
/*
- * TODO: Notify about client disconnect for appropriate cleanup
- * mgmt_txn_notify_be_adapter_conn(adapter, false);
+ * Notify about client disconnect for appropriate cleanup
*/
+ mgmt_txn_notify_be_adapter_conn(adapter, false);
if (adapter->id < MGMTD_BE_CLIENT_ID_MAX) {
mgmt_be_adapters_by_id[adapter->id] = NULL;
@@ -402,12 +402,12 @@ mgmt_be_adapter_handle_msg(struct mgmt_be_client_adapter *adapter,
adapter->name,
be_msg->txn_reply->success ? "success" : "failure");
/*
- * TODO: Forward the TXN_REPLY to txn module.
- * mgmt_txn_notify_be_txn_reply(
- * be_msg->txn_reply->txn_id,
- * be_msg->txn_reply->create,
- * be_msg->txn_reply->success, adapter);
+ * Forward the TXN_REPLY to txn module.
*/
+ mgmt_txn_notify_be_txn_reply(
+ be_msg->txn_reply->txn_id,
+ be_msg->txn_reply->create,
+ be_msg->txn_reply->success, adapter);
break;
case MGMTD__BE_MESSAGE__MESSAGE_CFG_DATA_REPLY:
MGMTD_BE_ADAPTER_DBG(
@@ -419,13 +419,13 @@ mgmt_be_adapter_handle_msg(struct mgmt_be_client_adapter *adapter,
? be_msg->cfg_data_reply->error_if_any
: "None");
/*
- * TODO: Forward the CGFData-create reply to txn module.
- * mgmt_txn_notify_be_cfgdata_reply(
- * be_msg->cfg_data_reply->txn_id,
- * be_msg->cfg_data_reply->batch_id,
- * be_msg->cfg_data_reply->success,
- * be_msg->cfg_data_reply->error_if_any, adapter);
+ * Forward the CGFData-create reply to txn module.
*/
+ mgmt_txn_notify_be_cfgdata_reply(
+ be_msg->cfg_data_reply->txn_id,
+ be_msg->cfg_data_reply->batch_id,
+ be_msg->cfg_data_reply->success,
+ be_msg->cfg_data_reply->error_if_any, adapter);
break;
case MGMTD__BE_MESSAGE__MESSAGE_CFG_APPLY_REPLY:
MGMTD_BE_ADAPTER_DBG(
@@ -445,14 +445,15 @@ mgmt_be_adapter_handle_msg(struct mgmt_be_client_adapter *adapter,
be_msg->cfg_apply_reply->error_if_any
? be_msg->cfg_apply_reply->error_if_any
: "None");
- /* TODO: Forward the CGFData-apply reply to txn module.
- * mgmt_txn_notify_be_cfg_apply_reply(
- * be_msg->cfg_apply_reply->txn_id,
- * be_msg->cfg_apply_reply->success,
- * (uint64_t *)be_msg->cfg_apply_reply->batch_ids,
- * be_msg->cfg_apply_reply->n_batch_ids,
- * be_msg->cfg_apply_reply->error_if_any, adapter);
+ /*
+ * Forward the CGFData-apply reply to txn module.
*/
+ mgmt_txn_notify_be_cfg_apply_reply(
+ be_msg->cfg_apply_reply->txn_id,
+ be_msg->cfg_apply_reply->success,
+ (uint64_t *)be_msg->cfg_apply_reply->batch_ids,
+ be_msg->cfg_apply_reply->n_batch_ids,
+ be_msg->cfg_apply_reply->error_if_any, adapter);
break;
case MGMTD__BE_MESSAGE__MESSAGE_GET_REPLY:
case MGMTD__BE_MESSAGE__MESSAGE_CFG_CMD_REPLY:
@@ -899,27 +900,26 @@ static void mgmt_be_adapter_conn_init(struct thread *thread)
assert(adapter && adapter->conn_fd >= 0);
/*
- * TODO: Check first if the current session can run a CONFIG
+ * Check first if the current session can run a CONFIG
* transaction or not. Reschedule if a CONFIG transaction
* from another session is already in progress.
+ */
if (mgmt_config_txn_in_progress() != MGMTD_SESSION_ID_NONE) {
mgmt_be_adapter_register_event(adapter, MGMTD_BE_CONN_INIT);
- return 0;
+ return;
}
- */
- /*
- * TODO: Notify TXN module to create a CONFIG transaction and
- * download the CONFIGs identified for this new client.
- * If the TXN module fails to initiate the CONFIG transaction
- * disconnect from the client forcing a reconnect later.
- * That should also take care of destroying the adapter.
- *
+ /*
+ * Notify TXN module to create a CONFIG transaction and
+ * download the CONFIGs identified for this new client.
+ * If the TXN module fails to initiate the CONFIG transaction
+ * disconnect from the client forcing a reconnect later.
+ * That should also take care of destroying the adapter.
+ */
if (mgmt_txn_notify_be_adapter_conn(adapter, true) != 0) {
mgmt_be_adapter_disconnect(adapter);
adapter = NULL;
}
- */
}
static void