summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd.h
diff options
context:
space:
mode:
authorshishir gowda <sgowda@redhat.com>2013-10-10 13:45:31 +0530
committershishir gowda <sgowda@redhat.com>2013-11-15 12:30:00 +0530
commit82c14c1d4a1b26b52d9b0fb6f68db6abafa04fe0 (patch)
treefd59ea4095aeed672732f97f3f65c025c21fd82d /xlators/mgmt/glusterd/src/glusterd.h
parente87c5979ae1859dbe7c2fd17d94a6e9f51f4073a (diff)
mgmt/glusterd: Introduce snapshot infrastructure
API's for creating, adding, finding, removing snapshots and consistency groups are provided. Change-Id: Ic28da69a075b062aefdf14754c68259ca58bd427 Signed-off-by: shishir gowda <sgowda@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd.h')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index ad63682e5..11e0c6d39 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -155,6 +155,7 @@ typedef struct {
gf_boolean_t restart_done;
rpcsvc_t *uds_rpc; /* RPCSVC for the unix domain socket */
uint32_t base_port;
+ struct list_head snap_cg;
} glusterd_conf_t;
@@ -267,11 +268,13 @@ struct glusterd_replace_brick_ {
typedef struct glusterd_replace_brick_ glusterd_replace_brick_t;
struct glusterd_volinfo_ {
+ gf_lock_t lock;
char volname[GLUSTERD_MAX_VOLUME_NAME];
int type;
int brick_count;
struct list_head vol_list;
struct list_head bricks;
+ struct list_head snaps;
glusterd_volume_status status;
int sub_count; /* backward compatibility */
int stripe_count;
@@ -314,6 +317,41 @@ struct glusterd_volinfo_ {
int client_op_version;
};
+typedef enum gd_snap_status_ {
+ GD_SNAP_STATUS_NONE,
+ GD_SNAP_STATUS_INIT,
+ GD_SNAP_STATUS_IN_USE,
+ GD_SNAP_STATUS_DECOMMISSION,
+ GD_SNAP_STATUS_RESTORED,
+} gd_snap_status_t;
+
+struct glusterd_snap_ {
+ gf_lock_t lock;
+ glusterd_volinfo_t *snap_volume;
+ struct list_head snap_list;
+ char snap_name[256];
+ uuid_t snap_id;
+ uuid_t cg_id;
+ char *description;
+ time_t time_stamp;
+ gd_snap_status_t snap_status;
+};
+
+typedef struct glusterd_snap_ glusterd_snap_t;
+
+struct glusterd_snap_cg_ {
+ gf_lock_t lock;
+ uuid_t cg_id;
+ char cg_name[256];
+ char *description;
+ gd_snap_status_t cg_status;
+ int64_t volume_count;
+ struct list_head cg_list;
+ glusterd_volinfo_t volumes[0];
+};
+
+typedef struct glusterd_snap_cg_ glusterd_snap_cg_t;
+
typedef enum gd_node_type_ {
GD_NODE_NONE,
GD_NODE_BRICK,
@@ -492,6 +530,14 @@ int
glusterd_op_unlock_send_resp (rpcsvc_request_t *req, int32_t status);
int
+glusterd_op_volume_lock_send_resp (rpcsvc_request_t *req,
+ uuid_t *txn_id, int32_t status);
+
+int
+glusterd_op_volume_unlock_send_resp (rpcsvc_request_t *req,
+ uuid_t *txn_id, int32_t status);
+
+int
glusterd_op_stage_send_resp (rpcsvc_request_t *req,
int32_t op, int32_t status,
char *op_errstr, dict_t *rsp_dict);
@@ -764,4 +810,47 @@ int32_t glusterd_op_begin_synctask (rpcsvc_request_t *req, glusterd_op_t op,
void *dict);
int32_t
glusterd_defrag_event_notify_handle (dict_t *dict);
+
+int32_t
+glusterd_txn_opinfo_init ();
+
+void
+glusterd_txn_opinfo_fini ();
+
+/* snapshot */
+glusterd_snap_t*
+glusterd_new_snap_object();
+
+glusterd_snap_cg_t*
+glusterd_new_snap_cg_object(int64_t volume_count);
+
+int32_t
+glusterd_add_snap (glusterd_volinfo_t *volinfo, glusterd_snap_t *snap);
+
+glusterd_snap_t*
+glusterd_remove_snap_by_id (glusterd_volinfo_t *volinfo, uuid_t snap_id);
+
+glusterd_snap_t*
+glusterd_remove_snap_by_name (glusterd_volinfo_t *volinfo, char *snap_name);
+
+glusterd_snap_t*
+glusterd_find_snap_by_name (glusterd_volinfo_t *volinfo, char *snap_name);
+
+glusterd_snap_t*
+glusterd_find_snap_by_id (glusterd_volinfo_t *volinfo, uuid_t snap_id);
+
+int32_t
+glusterd_add_snap_cg (glusterd_conf_t *conf, glusterd_snap_cg_t *cg);
+
+glusterd_snap_cg_t*
+glusterd_remove_snap_cg_by_name (glusterd_conf_t *conf, char *cg_name);
+
+glusterd_snap_cg_t*
+glusterd_remove_snap_cg_by_id (glusterd_conf_t *conf, uuid_t cg_id);
+
+glusterd_snap_cg_t*
+glusterd_find_snap_cg_by_id (glusterd_conf_t *conf, uuid_t cg_id);
+
+glusterd_snap_cg_t*
+glusterd_find_snap_cg_by_name (glusterd_conf_t *conf, char *cg_name);
#endif