From 683b6ba3f17a9bbf876c66f5d4b7a9d573d8853f Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Fri, 20 Jan 2017 12:13:37 +0530 Subject: 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 --- rpc/block_xdr.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'rpc/block_xdr.c') diff --git a/rpc/block_xdr.c b/rpc/block_xdr.c index cd8400e..91775fa 100644 --- a/rpc/block_xdr.c +++ b/rpc/block_xdr.c @@ -6,11 +6,54 @@ #include "block.h" bool_t -xdr_blockTrans (XDR *xdrs, blockTrans *objp) +xdr_blockCreate (XDR *xdrs, blockCreate *objp) +{ + if (!xdr_vector (xdrs, (char *)objp->volume, 255, + sizeof (char), (xdrproc_t) xdr_char)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->volfileserver, 255, + sizeof (char), (xdrproc_t) xdr_char)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->gbid, 127, + sizeof (char), (xdrproc_t) xdr_char)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->size)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->block_name, 255, + sizeof (char), (xdrproc_t) xdr_char)) + return FALSE; + return TRUE; +} + +bool_t +xdr_blockCreateCli (XDR *xdrs, blockCreateCli *objp) +{ + if (!xdr_vector (xdrs, (char *)objp->volume, 255, + sizeof (char), (xdrproc_t) xdr_char)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->volfileserver, 255, + sizeof (char), (xdrproc_t) xdr_char)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->size)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->block_name, 255, + sizeof (char), (xdrproc_t) xdr_char)) + return FALSE; + if (!xdr_string (xdrs, &objp->block_hosts, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_blockResponse (XDR *xdrs, blockResponse *objp) { if (!xdr_int (xdrs, &objp->exit)) return FALSE; if (!xdr_string (xdrs, &objp->out, ~0)) return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->offset)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, (u_int *) &objp->xdata.xdata_len, ~0)) + return FALSE; return TRUE; } -- cgit