diff options
author | Csaba Henk <csaba@gluster.com> | 2011-07-30 17:50:22 +0200 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-09-12 06:23:11 -0700 |
commit | 37ac355cbbd36497f914905615bffb3e35805f0a (patch) | |
tree | a3a2b14739d9955e797927b5327b617738a00a3d /rpc/xdr | |
parent | 78170472e6c7f0bce95ab035cc4ed86ec662e80d (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/xdr')
-rw-r--r-- | rpc/xdr/src/cli1-xdr.c | 42 | ||||
-rw-r--r-- | rpc/xdr/src/cli1-xdr.h | 36 | ||||
-rw-r--r-- | rpc/xdr/src/cli1-xdr.x | 21 |
3 files changed, 99 insertions, 0 deletions
diff --git a/rpc/xdr/src/cli1-xdr.c b/rpc/xdr/src/cli1-xdr.c index d7d541eb07d..250efc93575 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 085b9f28565..0d606e79ff6 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 70d221cbb3b..9fc9f02d29d 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; +}; |