diff options
author | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-01-20 12:13:37 +0530 |
---|---|---|
committer | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-01-30 19:31:50 +0530 |
commit | 683b6ba3f17a9bbf876c66f5d4b7a9d573d8853f (patch) | |
tree | a2bf7cbcda416818d663613284b29e16b2b533c3 /rpc/block.h | |
parent | 4ef14866295c1328a11f9a06cfc3bc1db9b1e7b6 (diff) |
gluster-block: listen on unix and inet
from now We basically have 2 RPC connections,
1. Between gluster block CLI and local gluster-blockd
This connection is basically UNIX/local netid ,listening on
/var/run/gluster-blockd.socket file.
The CLI always Send/Receive the commands to/from the local
gluster-blockd via local rpc.
2. Between gluster-blockd's, i.e local (to cli) gluster-blockd and the
gluster-blockd's running on remote(blockhost)
This is the tcp connection. The rpc requests are listening on 24006
Also from now gluster-blockd is multi threaded (As of now 2 threads)
Lets consider the Create Request to understand what each thread solves
Thread1 (THE CLI THREAD)
* Listening on local RPC
* Generate the GBID (UUID) and create the entry with name GBID in the
given volume with a requested size.
* And Send the Configuration requests to remote hosts,
waits for the replies
(HINt: after this point Read Thread2 and come back)
* Return to CLI.
Thread 2 (THE SERVER THREAD)
* Listens on 24006
* On Receiving an event, read the structure.
* Executes the required "targetcli bla bla bla" command locally
* Fills the command exitcode and the output in the RPC reply structure
and send reply
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'rpc/block.h')
-rw-r--r-- | rpc/block.h | 64 |
1 files changed, 54 insertions, 10 deletions
diff --git a/rpc/block.h b/rpc/block.h index 54315b7..d939057 100644 --- a/rpc/block.h +++ b/rpc/block.h @@ -8,41 +8,85 @@ #include <rpc/rpc.h> +#define ADDRESS "/var/run/gluster-block.socket" #ifdef __cplusplus extern "C" { #endif -struct blockTrans { +struct blockCreate { + char volume[255]; + char volfileserver[255]; + char gbid[127]; + u_quad_t size; + char block_name[255]; +}; +typedef struct blockCreate blockCreate; + +struct blockCreateCli { + char volume[255]; + char volfileserver[255]; + u_quad_t size; + char block_name[255]; + char *block_hosts; +}; +typedef struct blockCreateCli blockCreateCli; + +struct blockResponse { int exit; char *out; + u_quad_t offset; + struct { + u_int xdata_len; + char *xdata_val; + } xdata; }; -typedef struct blockTrans blockTrans; +typedef struct blockResponse blockResponse; + +#define GLUSTER_BLOCK_CLI 212153113 +#define GLUSTER_BLOCK_CLI_VERS 1 + +#if defined(__STDC__) || defined(__cplusplus) +#define BLOCK_CREATE_CLI 1 +extern blockResponse * block_create_cli_1(blockCreateCli *, CLIENT *); +extern blockResponse * block_create_cli_1_svc(blockCreateCli *, struct svc_req *); +extern int gluster_block_cli_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +#define BLOCK_CREATE_CLI 1 +extern blockResponse * block_create_cli_1(); +extern blockResponse * block_create_cli_1_svc(); +extern int gluster_block_cli_1_freeresult (); +#endif /* K&R C */ #define GLUSTER_BLOCK 21215311 #define GLUSTER_BLOCK_VERS 1 #if defined(__STDC__) || defined(__cplusplus) -#define BLOCK_EXEC 1 -extern blockTrans * block_exec_1(char **, CLIENT *); -extern blockTrans * block_exec_1_svc(char **, struct svc_req *); +#define BLOCK_CREATE 1 +extern blockResponse * block_create_1(blockCreate *, CLIENT *); +extern blockResponse * block_create_1_svc(blockCreate *, struct svc_req *); extern int gluster_block_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); #else /* K&R C */ -#define BLOCK_EXEC 1 -extern blockTrans * block_exec_1(); -extern blockTrans * block_exec_1_svc(); +#define BLOCK_CREATE 1 +extern blockResponse * block_create_1(); +extern blockResponse * block_create_1_svc(); extern int gluster_block_1_freeresult (); #endif /* K&R C */ /* the xdr functions */ #if defined(__STDC__) || defined(__cplusplus) -extern bool_t xdr_blockTrans (XDR *, blockTrans*); +extern bool_t xdr_blockCreate (XDR *, blockCreate*); +extern bool_t xdr_blockCreateCli (XDR *, blockCreateCli*); +extern bool_t xdr_blockResponse (XDR *, blockResponse*); #else /* K&R C */ -extern bool_t xdr_blockTrans (); +extern bool_t xdr_blockCreate (); +extern bool_t xdr_blockCreateCli (); +extern bool_t xdr_blockResponse (); #endif /* K&R C */ |