ctdb-client: Drop client code to send CHECK_SRVIDS control
[samba.git] / ctdb / client / client_control_sync.c
index 2c71b36458ffe3c76f6c9f605ba60419a7273e73..fd31823885c2bd676ef30a6ba2868a1d9551b67f 100644 (file)
@@ -33,6 +33,7 @@
 #include "protocol/protocol_api.h"
 #include "client/client_private.h"
 #include "client/client.h"
+#include "client/client_sync.h"
 
 int ctdb_ctrl_process_exists(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                             struct ctdb_client_context *client,
@@ -183,7 +184,7 @@ int ctdb_ctrl_getvnnmap(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 int ctdb_ctrl_getdebug(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                       struct ctdb_client_context *client,
                       int destnode, struct timeval timeout,
-                      uint32_t *loglevel)
+                      int *loglevel)
 {
        struct ctdb_req_control request;
        struct ctdb_reply_control *reply;
@@ -212,7 +213,7 @@ int ctdb_ctrl_getdebug(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 int ctdb_ctrl_setdebug(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                       struct ctdb_client_context *client,
                       int destnode, struct timeval timeout,
-                      uint32_t loglevel)
+                      int loglevel)
 {
        struct ctdb_req_control request;
        struct ctdb_reply_control *reply;
@@ -414,14 +415,13 @@ int ctdb_ctrl_statistics_reset(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 int ctdb_ctrl_db_attach(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                        struct ctdb_client_context *client,
                        int destnode, struct timeval timeout,
-                       const char *db_name, uint32_t tdb_flags,
-                       uint32_t *db_id)
+                       const char *db_name, uint32_t *db_id)
 {
        struct ctdb_req_control request;
        struct ctdb_reply_control *reply;
        int ret;
 
-       ctdb_req_control_db_attach(&request, db_name, tdb_flags);
+       ctdb_req_control_db_attach(&request, db_name);
        ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
                                  &request, &reply);
        if (ret != 0) {
@@ -760,35 +760,6 @@ int ctdb_ctrl_freeze(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
        return 0;
 }
 
-int ctdb_ctrl_thaw(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                  struct ctdb_client_context *client,
-                  int destnode, struct timeval timeout,
-                  int priority)
-{
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       int ret;
-
-       ctdb_req_control_thaw(&request, priority);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control THAW failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_thaw(reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control THAW failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       return 0;
-}
-
 int ctdb_ctrl_get_pnn(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                      struct ctdb_client_context *client,
                      int destnode, struct timeval timeout,
@@ -1145,137 +1116,17 @@ int ctdb_ctrl_set_tcp_tickle_list(TALLOC_CTX *mem_ctx,
        return 0;
 }
 
-int ctdb_ctrl_register_server_id(TALLOC_CTX *mem_ctx,
-                                struct tevent_context *ev,
-                                struct ctdb_client_context *client,
-                                int destnode, struct timeval timeout,
-                                struct ctdb_client_id *cid)
-{
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       int ret;
-
-       ctdb_req_control_register_server_id(&request, cid);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control REGISTER_SERVER_ID failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_register_server_id(reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control REGISTER_SERVER_ID failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       return 0;
-}
-
-int ctdb_ctrl_unregister_server_id(TALLOC_CTX *mem_ctx,
-                                  struct tevent_context *ev,
-                                  struct ctdb_client_context *client,
-                                  int destnode, struct timeval timeout,
-                                  struct ctdb_client_id *cid)
-{
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       int ret;
-
-       ctdb_req_control_unregister_server_id(&request, cid);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control UNREGISTER_SERVER_ID failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_unregister_server_id(reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control UNREGISTER_SERVER_ID failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       return 0;
-}
-
-int ctdb_ctrl_check_server_id(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                             struct ctdb_client_context *client,
-                             int destnode, struct timeval timeout,
-                             struct ctdb_client_id *cid)
-{
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       int ret;
-
-       ctdb_req_control_check_server_id(&request, cid);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control CHECK_SERVER_ID failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_check_server_id(reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control CHECK_SERVER_ID failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       return 0;
-}
-
-int ctdb_ctrl_get_server_id_list(TALLOC_CTX *mem_ctx,
-                                struct tevent_context *ev,
-                                struct ctdb_client_context *client,
-                                int destnode, struct timeval timeout,
-                                struct ctdb_client_id_map **cid_map)
-{
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       int ret;
-
-       ctdb_req_control_get_server_id_list(&request);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control GET_SERVER_ID_LIST failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_get_server_id_list(reply, mem_ctx, cid_map);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control GET_SERVER_ID_LIST failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       return 0;
-}
-
 int ctdb_ctrl_db_attach_persistent(TALLOC_CTX *mem_ctx,
                                   struct tevent_context *ev,
                                   struct ctdb_client_context *client,
                                   int destnode, struct timeval timeout,
-                                  const char *db_name, int tdb_flags,
-                                  uint32_t *db_id)
+                                  const char *db_name, uint32_t *db_id)
 {
        struct ctdb_req_control request;
        struct ctdb_reply_control *reply;
        int ret;
 
-       ctdb_req_control_db_attach_persistent(&request, db_name, tdb_flags);
+       ctdb_req_control_db_attach_persistent(&request, db_name);
        ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
                                  &request, &reply);
        if (ret != 0) {
@@ -1325,66 +1176,6 @@ int ctdb_ctrl_send_gratuitous_arp(TALLOC_CTX *mem_ctx,
        return 0;
 }
 
-int ctdb_ctrl_transaction_start(TALLOC_CTX *mem_ctx,
-                               struct tevent_context *ev,
-                               struct ctdb_client_context *client,
-                               int destnode, struct timeval timeout,
-                               uint32_t tid)
-{
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       int ret;
-
-       ctdb_req_control_transaction_start(&request, tid);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control TRANSACTION_START failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_transaction_start(reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control TRANSACTION_START failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       return 0;
-}
-
-int ctdb_ctrl_transaction_commit(TALLOC_CTX *mem_ctx,
-                                struct tevent_context *ev,
-                                struct ctdb_client_context *client,
-                                int destnode, struct timeval timeout,
-                                uint32_t tid)
-{
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       int ret;
-
-       ctdb_req_control_transaction_commit(&request, tid);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control TRANSACTION_COMMIT failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_transaction_commit(reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control TRANSACTION_COMMIT failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       return 0;
-}
-
 int ctdb_ctrl_wipe_database(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                            struct ctdb_client_context *client,
                            int destnode, struct timeval timeout,
@@ -1645,35 +1436,6 @@ int ctdb_ctrl_del_public_ip(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
        return 0;
 }
 
-int ctdb_ctrl_run_eventscripts(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                              struct ctdb_client_context *client,
-                              int destnode, struct timeval timeout,
-                              const char *event)
-{
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       int ret;
-
-       ctdb_req_control_run_eventscripts(&request, event);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control RUN_EVENTSCRIPTS failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_run_eventscripts(reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control RUN_EVENTSCRIPTS failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       return 0;
-}
-
 int ctdb_ctrl_get_capabilities(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                               struct ctdb_client_context *client,
                               int destnode, struct timeval timeout,
@@ -1764,13 +1526,14 @@ int ctdb_ctrl_takeover_ip(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 int ctdb_ctrl_get_public_ips(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                             struct ctdb_client_context *client,
                             int destnode, struct timeval timeout,
+                            bool available_only,
                             struct ctdb_public_ip_list **pubip_list)
 {
        struct ctdb_req_control request;
        struct ctdb_reply_control *reply;
        int ret;
 
-       ctdb_req_control_get_public_ips(&request);
+       ctdb_req_control_get_public_ips(&request, available_only);
        ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
                                  &request, &reply);
        if (ret != 0) {
@@ -1819,37 +1582,6 @@ int ctdb_ctrl_get_nodemap(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
        return 0;
 }
 
-int ctdb_ctrl_get_event_script_status(TALLOC_CTX *mem_ctx,
-                                     struct tevent_context *ev,
-                                     struct ctdb_client_context *client,
-                                     int destnode, struct timeval timeout,
-                                     enum ctdb_event event,
-                                     struct ctdb_script_list **slist)
-{
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       int ret;
-
-       ctdb_req_control_get_event_script_status(&request, event);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control GET_EVENT_SCRIPT_STATUS failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_get_event_script_status(reply, mem_ctx, slist);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control GET_EVENT_SCRIPT_STATUS failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       return 0;
-}
-
 int ctdb_ctrl_traverse_kill(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                            struct ctdb_client_context *client,
                            int destnode, struct timeval timeout,
@@ -1908,35 +1640,6 @@ int ctdb_ctrl_get_reclock_file(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
        return 0;
 }
 
-int ctdb_ctrl_set_reclock_file(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                              struct ctdb_client_context *client,
-                              int destnode, struct timeval timeout,
-                              const char *reclock_file)
-{
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       int ret;
-
-       ctdb_req_control_set_reclock_file(&request, reclock_file);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control SET_RECLOCK_FILE failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_set_reclock_file(reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control SET_RECLOCK_FILE failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       return 0;
-}
-
 int ctdb_ctrl_stop_node(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                        struct ctdb_client_context *client,
                        int destnode, struct timeval timeout)
@@ -2051,64 +1754,6 @@ int ctdb_ctrl_set_recmasterrole(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
        return 0;
 }
 
-int ctdb_ctrl_enable_script(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                           struct ctdb_client_context *client,
-                           int destnode, struct timeval timeout,
-                           const char *script)
-{
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       int ret;
-
-       ctdb_req_control_enable_script(&request, script);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control ENABLE_SCRIPT failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_enable_script(reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control ENABLE_SCRIPT failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       return 0;
-}
-
-int ctdb_ctrl_disable_script(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                            struct ctdb_client_context *client,
-                            int destnode, struct timeval timeout,
-                            const char *script)
-{
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       int ret;
-
-       ctdb_req_control_disable_script(&request, script);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control DISABLE_SCRIPT failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_disable_script(reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control DISABLE_SCRIPT failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       return 0;
-}
-
 int ctdb_ctrl_set_ban_state(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                            struct ctdb_client_context *client,
                            int destnode, struct timeval timeout,
@@ -2167,97 +1812,6 @@ int ctdb_ctrl_get_ban_state(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
        return 0;
 }
 
-int ctdb_ctrl_set_db_priority(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                             struct ctdb_client_context *client,
-                             int destnode, struct timeval timeout,
-                             uint32_t db_id, int priority)
-{
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       struct ctdb_db_priority db_prio;
-       int ret;
-
-       db_prio.db_id = db_id;
-       db_prio.priority = priority;
-
-       ctdb_req_control_set_db_priority(&request, &db_prio);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control SET_DB_PRIORITY failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_set_db_priority(reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control SET_DB_PRIORITY failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       return 0;
-}
-
-int ctdb_ctrl_get_db_priority(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                             struct ctdb_client_context *client,
-                             int destnode, struct timeval timeout,
-                             uint32_t db_id, uint32_t *priority)
-{
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       int ret;
-
-       ctdb_req_control_get_db_priority(&request, db_id);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control GET_DB_PRIORITY failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_get_db_priority(reply, priority);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control GET_DB_PRIORITY failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       return 0;
-}
-
-int ctdb_ctrl_transaction_cancel(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                                struct ctdb_client_context *client,
-                                int destnode, struct timeval timeout,
-                                uint32_t tid)
-{
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       int ret;
-
-       ctdb_req_control_transaction_cancel(&request, tid);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control TRANSACTION_CANCEL failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_transaction_cancel(reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control TRANSACTION_CANCEL failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       return 0;
-}
-
 int ctdb_ctrl_register_notify(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                              struct ctdb_client_context *client,
                              int destnode, struct timeval timeout,
@@ -2640,48 +2194,6 @@ int ctdb_ctrl_set_db_readonly(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
        return 0;
 }
 
-int ctdb_ctrl_check_srvids(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                          struct ctdb_client_context *client,
-                          int destnode, struct timeval timeout,
-                          uint64_t *srvid, int count, uint8_t **result)
-{
-       struct ctdb_uint64_array srvid_list;
-       struct ctdb_uint8_array *u8_array;
-       struct ctdb_req_control request;
-       struct ctdb_reply_control *reply;
-       int ret;
-
-       srvid_list.num = count;
-       srvid_list.val = srvid;
-
-       ctdb_req_control_check_srvids(&request, &srvid_list);
-       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-                                 &request, &reply);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control CHECK_SRVIDS failed to node %u, ret=%d\n",
-                      destnode, ret));
-               return ret;
-       }
-
-       ret = ctdb_reply_control_check_srvids(reply, &request, &u8_array);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,
-                     ("Control CHECK_SRVIDS failed, ret=%d\n", ret));
-               return ret;
-       }
-
-       if (u8_array->num != count) {
-               DEBUG(DEBUG_ERR,
-                     ("Control CHECK_SRVIDS returned invalid data %d != %d\n",
-                      u8_array->num, count));
-               return ret;
-       }
-
-       *result = talloc_steal(mem_ctx, u8_array->val);
-       return 0;
-}
-
 int ctdb_ctrl_traverse_start_ext(TALLOC_CTX *mem_ctx,
                                 struct tevent_context *ev,
                                 struct ctdb_client_context *client,
@@ -3102,7 +2614,7 @@ int ctdb_ctrl_db_push_start(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                                  &request, &reply);
        if (ret != 0) {
                DEBUG(DEBUG_ERR,
-                     ("Control DB_PUSH failed to node %u, ret=%d\n",
+                     ("Control DB_PUSH_START failed to node %u, ret=%d\n",
                       destnode, ret));
                return ret;
        }
@@ -3110,7 +2622,7 @@ int ctdb_ctrl_db_push_start(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
        ret = ctdb_reply_control_db_push_start(reply);
        if (ret != 0) {
                DEBUG(DEBUG_ERR,
-                     ("Control DB_PUSH failed, ret=%d\n", ret));
+                     ("Control DB_PUSH_START failed, ret=%d\n", ret));
                return ret;
        }
 
@@ -3131,7 +2643,7 @@ int ctdb_ctrl_db_push_confirm(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                                  &request, &reply);
        if (ret != 0) {
                DEBUG(DEBUG_ERR,
-                     ("Control DB_PUSH failed to node %u, ret=%d\n",
+                     ("Control DB_PUSH_CONFIRM failed to node %u, ret=%d\n",
                       destnode, ret));
                return ret;
        }
@@ -3139,7 +2651,66 @@ int ctdb_ctrl_db_push_confirm(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
        ret = ctdb_reply_control_db_push_confirm(reply, num_records);
        if (ret != 0) {
                DEBUG(DEBUG_ERR,
-                     ("Control DB_PUSH failed, ret=%d\n", ret));
+                     ("Control DB_PUSH_CONFIRM failed, ret=%d\n", ret));
+               return ret;
+       }
+
+       return 0;
+}
+
+int ctdb_ctrl_db_open_flags(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+                           struct ctdb_client_context *client,
+                           int destnode, struct timeval timeout,
+                           uint32_t db_id, int *tdb_flags)
+{
+       struct ctdb_req_control request;
+       struct ctdb_reply_control *reply;
+       int ret;
+
+       ctdb_req_control_db_open_flags(&request, db_id);
+       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
+                                 &request, &reply);
+       if (ret != 0) {
+               DEBUG(DEBUG_ERR,
+                     ("Control DB_OPEN_FLAGS failed to node %u, ret=%d\n",
+                      destnode, ret));
+               return ret;
+       }
+
+       ret = ctdb_reply_control_db_open_flags(reply, tdb_flags);
+       if (ret != 0) {
+               DEBUG(DEBUG_ERR,
+                     ("Control DB_OPEN_FLAGS failed, ret=%d\n", ret));
+               return ret;
+       }
+
+       return 0;
+}
+
+int ctdb_ctrl_db_attach_replicated(TALLOC_CTX *mem_ctx,
+                                  struct tevent_context *ev,
+                                  struct ctdb_client_context *client,
+                                  int destnode, struct timeval timeout,
+                                  const char *db_name, uint32_t *db_id)
+{
+       struct ctdb_req_control request;
+       struct ctdb_reply_control *reply;
+       int ret;
+
+       ctdb_req_control_db_attach_replicated(&request, db_name);
+       ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
+                                 &request, &reply);
+       if (ret != 0) {
+               DEBUG(DEBUG_ERR,
+                     ("Control DB_ATTACH_REPLICATED failed to node %u,"
+                      " ret=%d\n", destnode, ret));
+               return ret;
+       }
+
+       ret = ctdb_reply_control_db_attach_replicated(reply, db_id);
+       if (ret != 0) {
+               DEBUG(DEBUG_ERR,
+                     ("Control DB_ATTACH_REPLICATED failed, ret=%d\n", ret));
                return ret;
        }