summaryrefslogtreecommitdiffstats
path: root/ctdb/client
diff options
context:
space:
mode:
authorRonnie Sahlberg <sahlberg@ronnie>2007-08-27 10:31:22 +1000
committerRonnie Sahlberg <sahlberg@ronnie>2007-08-27 10:31:22 +1000
commit7f02e16143a067b0ee40cdbc60006ccad6c3879a (patch)
tree5849208fac0363105963557fa51673cf87d662d4 /ctdb/client
parenta9c45b256230080ffd52dd7d65756f0444583b12 (diff)
downloadsamba-7f02e16143a067b0ee40cdbc60006ccad6c3879a.tar.gz
samba-7f02e16143a067b0ee40cdbc60006ccad6c3879a.tar.xz
samba-7f02e16143a067b0ee40cdbc60006ccad6c3879a.zip
add async versions of the freeze node control and freeze all nodes in
parallell (This used to be ctdb commit f34e89f54d9f4380e76eb1b5b2385a4d8500b505)
Diffstat (limited to 'ctdb/client')
-rw-r--r--ctdb/client/ctdb_client.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c
index 0aa0e9b97e..91351befd4 100644
--- a/ctdb/client/ctdb_client.c
+++ b/ctdb/client/ctdb_client.c
@@ -1807,18 +1807,27 @@ int ctdb_ctrl_getpid(struct ctdb_context *ctdb, struct timeval timeout, uint32_t
/*
- freeze a node
+ async freeze send control
*/
-int ctdb_ctrl_freeze(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode)
+struct ctdb_client_control_state *
+ctdb_ctrl_freeze_send(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, uint32_t destnode)
+{
+ return ctdb_control_send(ctdb, destnode, 0,
+ CTDB_CONTROL_FREEZE, 0, tdb_null,
+ mem_ctx, NULL, &timeout, NULL);
+}
+
+/*
+ async freeze recv control
+*/
+int ctdb_ctrl_freeze_recv(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state)
{
int ret;
int32_t res;
- ret = ctdb_control(ctdb, destnode, 0,
- CTDB_CONTROL_FREEZE, 0, tdb_null,
- NULL, NULL, &res, &timeout, NULL);
- if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control freeze failed\n"));
+ ret = ctdb_control_recv(ctdb, state, mem_ctx, NULL, &res, NULL);
+ if ( (ret != 0) || (res != 0) ){
+ DEBUG(0,(__location__ " ctdb_ctrl_freeze_recv failed\n"));
return -1;
}
@@ -1826,6 +1835,22 @@ int ctdb_ctrl_freeze(struct ctdb_context *ctdb, struct timeval timeout, uint32_t
}
/*
+ freeze a node
+ */
+int ctdb_ctrl_freeze(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode)
+{
+ TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
+ struct ctdb_client_control_state *state;
+ int ret;
+
+ state = ctdb_ctrl_freeze_send(ctdb, tmp_ctx, timeout, destnode);
+ ret = ctdb_ctrl_freeze_recv(ctdb, tmp_ctx, state);
+ talloc_free(tmp_ctx);
+
+ return ret;
+}
+
+/*
thaw a node
*/
int ctdb_ctrl_thaw(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode)