summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-07-30 17:50:22 +0200
committerVijay Bellur <vijay@gluster.com>2011-09-12 06:23:11 -0700
commit37ac355cbbd36497f914905615bffb3e35805f0a (patch)
treea3a2b14739d9955e797927b5327b617738a00a3d /rpc
parent78170472e6c7f0bce95ab035cc4ed86ec662e80d (diff)
glusterd / cli: mount-broker service
Mountbroker is configured in glusterd volfile through a DSL which is restriced enough to be able to appear in the role of the value of a volfile knob. Basically the DSL describes set-theorical requirements against the option set which is sent by the cli (in the hope of getting a mount with these options). If the requirements meet and the volume id and the uid who is to "own" the mount can be unambigously deduced from the given request, glusterd does the mount with the given parameters. The use case of geo-replication is sugared by means of volume options which then generate a complete mount-broker option set. Demo: - add the following option to your glusterd volfile: option mountbroker-root /tmp/mbr option mountbroker.fool EQL(volfile-id=pop*|user-map-root=*|volfile-server=localhost)&MEET(user-map-root=john|user-map-root=jane) - before starting glusterd, create /tmp/mbr owned by root with mode 0755 - with cli, do $ gluster system:: mount fool volfile-id=pop33 user-map-root=jane volfile-server=localhost - on succesful completion (volume pop33 exists and is started, jane is a valid username), the mount path will be echoed to you - you can get rid of the mount by $ gluster system:: umount <mount-path> Change-Id: I629cf64add0a45500d05becc3316f67cdb5b42ff BUG: 3482 Reviewed-on: http://review.gluster.com/128 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-lib/src/protocol-common.h2
-rw-r--r--rpc/xdr/src/cli1-xdr.c42
-rw-r--r--rpc/xdr/src/cli1-xdr.h36
-rw-r--r--rpc/xdr/src/cli1-xdr.x21
4 files changed, 101 insertions, 0 deletions
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h
index 216429e79..3c4c8fc44 100644
--- a/rpc/rpc-lib/src/protocol-common.h
+++ b/rpc/rpc-lib/src/protocol-common.h
@@ -203,6 +203,8 @@ enum gluster_cli_procnum {
GLUSTER_CLI_GETWD,
GLUSTER_CLI_LOG_LEVEL,
GLUSTER_CLI_STATUS_VOLUME,
+ GLUSTER_CLI_MOUNT,
+ GLUSTER_CLI_UMOUNT,
GLUSTER_CLI_MAXVALUE,
};
diff --git a/rpc/xdr/src/cli1-xdr.c b/rpc/xdr/src/cli1-xdr.c
index d7d541eb0..250efc935 100644
--- a/rpc/xdr/src/cli1-xdr.c
+++ b/rpc/xdr/src/cli1-xdr.c
@@ -992,3 +992,45 @@ xdr_gf1_cli_status_volume_rsp (XDR *xdrs, gf1_cli_status_volume_rsp *objp)
return FALSE;
return TRUE;
}
+
+bool_t
+xdr_gf1_cli_mount_req (XDR *xdrs, gf1_cli_mount_req *objp)
+{
+ if (!xdr_string (xdrs, &objp->label, ~0))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_gf1_cli_mount_rsp (XDR *xdrs, gf1_cli_mount_rsp *objp)
+{
+ if (!xdr_int (xdrs, &objp->op_ret))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->op_errno))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->path, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_gf1_cli_umount_req (XDR *xdrs, gf1_cli_umount_req *objp)
+{
+ if (!xdr_int (xdrs, &objp->lazy))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->path, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_gf1_cli_umount_rsp (XDR *xdrs, gf1_cli_umount_rsp *objp)
+{
+ if (!xdr_int (xdrs, &objp->op_ret))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->op_errno))
+ return FALSE;
+ return TRUE;
+}
diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h
index 085b9f285..0d606e79f 100644
--- a/rpc/xdr/src/cli1-xdr.h
+++ b/rpc/xdr/src/cli1-xdr.h
@@ -561,6 +561,34 @@ struct gf1_cli_status_volume_rsp {
};
typedef struct gf1_cli_status_volume_rsp gf1_cli_status_volume_rsp;
+struct gf1_cli_mount_req {
+ char *label;
+ struct {
+ u_int dict_len;
+ char *dict_val;
+ } dict;
+};
+typedef struct gf1_cli_mount_req gf1_cli_mount_req;
+
+struct gf1_cli_mount_rsp {
+ int op_ret;
+ int op_errno;
+ char *path;
+};
+typedef struct gf1_cli_mount_rsp gf1_cli_mount_rsp;
+
+struct gf1_cli_umount_req {
+ int lazy;
+ char *path;
+};
+typedef struct gf1_cli_umount_req gf1_cli_umount_req;
+
+struct gf1_cli_umount_rsp {
+ int op_ret;
+ int op_errno;
+};
+typedef struct gf1_cli_umount_rsp gf1_cli_umount_rsp;
+
/* the xdr functions */
#if defined(__STDC__) || defined(__cplusplus)
@@ -628,6 +656,10 @@ extern bool_t xdr_gf1_cli_log_level_req (XDR *, gf1_cli_log_level_req*);
extern bool_t xdr_gf1_cli_log_level_rsp (XDR *, gf1_cli_log_level_rsp*);
extern bool_t xdr_gf1_cli_status_volume_req (XDR *, gf1_cli_status_volume_req*);
extern bool_t xdr_gf1_cli_status_volume_rsp (XDR *, gf1_cli_status_volume_rsp*);
+extern bool_t xdr_gf1_cli_mount_req (XDR *, gf1_cli_mount_req*);
+extern bool_t xdr_gf1_cli_mount_rsp (XDR *, gf1_cli_mount_rsp*);
+extern bool_t xdr_gf1_cli_umount_req (XDR *, gf1_cli_umount_req*);
+extern bool_t xdr_gf1_cli_umount_rsp (XDR *, gf1_cli_umount_rsp*);
#else /* K&R C */
extern bool_t xdr_gf_cli_defrag_type ();
@@ -694,6 +726,10 @@ extern bool_t xdr_gf1_cli_log_level_req ();
extern bool_t xdr_gf1_cli_log_level_rsp ();
extern bool_t xdr_gf1_cli_status_volume_req ();
extern bool_t xdr_gf1_cli_status_volume_rsp ();
+extern bool_t xdr_gf1_cli_mount_req ();
+extern bool_t xdr_gf1_cli_mount_rsp ();
+extern bool_t xdr_gf1_cli_umount_req ();
+extern bool_t xdr_gf1_cli_umount_rsp ();
#endif /* K&R C */
diff --git a/rpc/xdr/src/cli1-xdr.x b/rpc/xdr/src/cli1-xdr.x
index 70d221cbb..9fc9f02d2 100644
--- a/rpc/xdr/src/cli1-xdr.x
+++ b/rpc/xdr/src/cli1-xdr.x
@@ -411,3 +411,24 @@ struct gf1_cli_status_volume_rsp {
string op_errstr<>;
opaque dict<>;
};
+
+struct gf1_cli_mount_req {
+ string label<>;
+ opaque dict<>;
+};
+
+struct gf1_cli_mount_rsp {
+ int op_ret;
+ int op_errno;
+ string path<>;
+};
+
+struct gf1_cli_umount_req {
+ int lazy;
+ string path<>;
+};
+
+struct gf1_cli_mount_rsp {
+ int op_ret;
+ int op_errno;
+};