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 /glfs-operations.c | |
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 'glfs-operations.c')
-rw-r--r-- | glfs-operations.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/glfs-operations.c b/glfs-operations.c index 3a6bd32..fecc315 100644 --- a/glfs-operations.c +++ b/glfs-operations.c @@ -18,7 +18,7 @@ int -glusterBlockCreateEntry(glusterBlockDefPtr blk) +glusterBlockCreateEntry(blockCreateCli *blk, char *gbid) { struct glfs *glfs; struct glfs_fd *fd; @@ -30,7 +30,7 @@ glusterBlockCreateEntry(glusterBlockDefPtr blk) return -1; } - ret = glfs_set_volfile_server(glfs, "tcp", blk->host, 24007); + ret = glfs_set_volfile_server(glfs, "tcp", blk->volfileserver, 24007); if (ret) { ERROR("%s", "glfs_set_volfile_server: failed"); goto out; @@ -48,7 +48,7 @@ glusterBlockCreateEntry(glusterBlockDefPtr blk) goto out; } - fd = glfs_creat(glfs, blk->filename, + fd = glfs_creat(glfs, gbid, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); if (!fd) { @@ -74,7 +74,7 @@ glusterBlockCreateEntry(glusterBlockDefPtr blk) int -glusterBlockDeleteEntry(glusterBlockDefPtr blk) +glusterBlockDeleteEntry(blockCreateCli *blk, char *gbid) { struct glfs *glfs; int ret = 0; @@ -85,7 +85,7 @@ glusterBlockDeleteEntry(glusterBlockDefPtr blk) return -1; } - ret = glfs_set_volfile_server(glfs, "tcp", blk->host, 24007); + ret = glfs_set_volfile_server(glfs, "tcp", blk->volfileserver, 24007); if (ret) { ERROR("%s", "glfs_set_volfile_server: failed"); goto out; @@ -103,7 +103,7 @@ glusterBlockDeleteEntry(glusterBlockDefPtr blk) goto out; } - ret = glfs_unlink(glfs, blk->filename); + ret = glfs_unlink(glfs, gbid); if (ret) { ERROR("%s", "glfs_unlink: failed"); goto out; |