From a3cb38e3edf005bef73da4c9cfd958474a14d50f Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 17 Apr 2014 15:54:34 -0700 Subject: build: MacOSX Porting fixes git@forge.gluster.org:~schafdog/glusterfs-core/osx-glusterfs Working functionality on MacOSX - GlusterD (management daemon) - GlusterCLI (management cli) - GlusterFS FUSE (using OSXFUSE) - GlusterNFS (without NLM - issues with rpc.statd) Change-Id: I20193d3f8904388e47344e523b3787dbeab044ac BUG: 1089172 Signed-off-by: Harshavardhana Signed-off-by: Dennis Schafroth Tested-by: Harshavardhana Tested-by: Dennis Schafroth Reviewed-on: http://review.gluster.org/7503 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/mgmt/glusterd/src/glusterd-utils.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.h') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index 23f8ad7f6..d2121778a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -8,7 +8,7 @@ cases as published by the Free Software Foundation. */ #ifndef _GLUSTERD_UTILS_H -#define _GLUSTERD_UTILS_H_ +#define _GLUSTERD_UTILS_H #ifndef _CONFIG_H #define _CONFIG_H @@ -684,14 +684,16 @@ glusterd_rpc_clnt_unref (glusterd_conf_t *conf, rpc_clnt_t *rpc); int32_t glusterd_compare_volume_name(struct list_head *, struct list_head *); -#ifdef GF_LINUX_HOST_OS + char* glusterd_get_brick_mount_details (glusterd_brickinfo_t *brickinfo); + struct mntent * glusterd_get_mnt_entry_info (char *mnt_pt, FILE *mtab); + int glusterd_get_brick_root (char *path, char **mount_point); -#endif //LINUX_HOST + int glusterd_compare_snap_time(struct list_head *, struct list_head *); -- cgit From 0af287791f0d50b5d2975cb2e2c902c797b05860 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Wed, 2 Apr 2014 05:39:22 +0000 Subject: glusterd/snapshot-handshake: Perform handshake of missed_snaps_list. In a handshake, create a union of the missed_snap_lists of the two peers. If an entry is present, its no op. If an entry is pendng, and the peer entry is done, mark own entry as done. If an entry is done, and the peer ertry is pending, its a no-op. If its a new entry, add it. Change-Id: Idbfa49cc34871631ba8c7c56d915666311024887 BUG: 1061685 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/7453 Tested-by: Gluster Build System Reviewed-by: Rajesh Joseph Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-utils.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.h') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index d2121778a..0f1c52372 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -719,4 +719,10 @@ glusterd_add_missed_snaps_to_dict (dict_t *rsp_dict, char *snap_uuid, glusterd_brickinfo_t *brickinfo, int32_t brick_number, int32_t op); +int32_t +glusterd_add_missed_snaps_to_export_dict (dict_t *vols); + +int32_t +glusterd_import_friend_missed_snap_list (dict_t *vols); + #endif -- cgit From d7b3e068290c41b13ecd664771814202d7d26881 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Mon, 7 Apr 2014 05:25:28 +0000 Subject: glusterd/snapshot: Adding snap_vol_id and snap_uuid to missed_snap_list Persisting missing snapshot info on disk as well as in memory in the following format: -------------NODE-UUID--------------:--------------SNAP-UUID-------------=---------SNAP-VOL-ID------------:BRICKNUM:-------BRICKPATH--------:OPERATION:STATUS 927cb5fe-63da-48f5-82f6-e6a09ddc81c4:8258b18f-d408-483d-8239-204039dc6397=a17b4fe42c5a45f7a916438643edaa13: 3 :/brick/brick-dirs/brick3: 1 : 1 927cb5fe-63da-48f5-82f6-e6a09ddc81c4:8258b18f-d408-483d-8239-204039dc6397=a17b4fe42c5a45f7a916438643edaa13: 3 :/brick/brick-dirs/brick3: 3 : 1 927cb5fe-63da-48f5-82f6-e6a09ddc81c4:8258b18f-d408-483d-8239-204039dc6397=83a3cc05453b46b2a7eda4c9a9208638: 3 :/brick/brick-dirs/brick3: 1 : 1 This data will be stored on disk at /var/lib/glusterd/snaps/missed_snaps_list In memory we maintain the data as a list of glusterd_missed_snap_info in conf, the key for this list are the first two fields, i.e NODE-UUID:SNAP-UUID. For every NODE-UUID:SNAP-UUID, there can be multiple operations missed on multiple bricks. So we maintain a list of glusterd_snap_op_t for every node of glusterd_missed_snap_info This list is maintained or updated during snapshot create, delete, and restore operations which are the only operations that if missed, are recorded in this list. During snapshot create, if a node is down, or a brick is down, we don't receive their mount point infos. snap_status of such bricks is marked as -1, and their brick details are added to this list. During snapshot delete, we check from originator node, if any other nodes, holding bricks of the said snap are down. Those are also added to the list. Also if the node is up, but the snapshot was pending for a snap brick, and its snap_status is -1, we add that to the list too. When a subsequent delete entry is processed for an already existing create entry, we just mark the create entries status as done (2), and don't add the delete entry to the list. During snapshot restore, we check from originator node, if any other nodes, holding bricks of the said snap are down. Those are also added to the list. Also if the node is up, but the snapshot was pending for a snap brick, and its snap_status is -1, we add that to the list too. Like delete when a subsequent restore entry is processed for an already existing create entry, we just mark the create entries status as done (2), and don't add the restore entry to the list. Change-Id: I54f63e28d3c40555d0f84528f38227103171f594 BUG: 1061685 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/7454 Tested-by: Gluster Build System Reviewed-by: Rajesh Joseph Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-utils.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.h') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index 0f1c52372..ec65357f9 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -715,7 +715,8 @@ int32_t glusterd_missed_snap_op_new (glusterd_snap_op_t **snap_op); int32_t -glusterd_add_missed_snaps_to_dict (dict_t *rsp_dict, char *snap_uuid, +glusterd_add_missed_snaps_to_dict (dict_t *rsp_dict, + glusterd_volinfo_t *snap_vol, glusterd_brickinfo_t *brickinfo, int32_t brick_number, int32_t op); -- cgit From 5d9172e0b3e14795db7aba321cfcac428a201399 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Mon, 7 Apr 2014 06:02:10 +0000 Subject: glusterd/snapshot: Perform missed snap deletes and restores. Replacing is_volume_restored(gf_boolean_t) with restored_from_snap(uuid_t) in glusterd_volinfo_ Also removed gd_restore_snap_volume from glusterd-volgen.c to glusterd-snapshot.c Change-Id: Ic615a1658cfaffa98d4590506ac82f20bf709ad6 BUG: 1089906 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/7455 Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi Reviewed-by: Rajesh Joseph Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-utils.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.h') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index ec65357f9..1a4490ab9 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -726,4 +726,9 @@ glusterd_add_missed_snaps_to_export_dict (dict_t *vols); int32_t glusterd_import_friend_missed_snap_list (dict_t *vols); +int32_t +gd_restore_snap_volume (dict_t *rsp_dict, + glusterd_volinfo_t *orig_vol, + glusterd_volinfo_t *snap_vol); + #endif -- cgit From b46d0ba04901ebca81d0f477e3e9ac6ba8607946 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Thu, 3 Apr 2014 03:36:28 +0000 Subject: glusterd/snapshot: Recreate the mount dirs and mount the lvm snapshots on node reboot. The lvm snapshots of the bricks are mounted at /var/run/gluster/snaps/ or /run/gluster/snaps. These paths being on a tempfs, on reboot are removed. So when glusterd starts, we need to recreate these paths, activate the respective logical volumes (lvm snapshots of the bricks), and mount these logical volumes at their respective paths. Change-Id: Ic5ef61e79a25d9830df717c592391965fe09db62 BUG: 1061685 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/7452 Tested-by: Gluster Build System Reviewed-by: Rajesh Joseph Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-utils.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.h') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index 1a4490ab9..76198428c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -731,4 +731,7 @@ gd_restore_snap_volume (dict_t *rsp_dict, glusterd_volinfo_t *orig_vol, glusterd_volinfo_t *snap_vol); +int32_t +glusterd_mount_lvm_snapshot (char *device_path, char *brick_mount_path); + #endif -- cgit From a7c8d514c0487019d218c327deb52f7d09645875 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Mon, 21 Apr 2014 03:32:00 +0000 Subject: glusterd: Rename the export dictionary as peer_data During a glusterd handshake, a dictionary is passed among the peers which contains, info of volumes, global opts, and now also info of snaps and list of missed snaps As it now contains more than just volume specific data, renaming the dict in the code-base from "vols" to "peer_data" Change-Id: Ib457172789ddd0d8978b08bceab0988c48e9eea7 BUG: 1061685 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/7524 Tested-by: Gluster Build System Reviewed-by: Rajesh Joseph Reviewed-by: Atin Mukherjee Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-utils.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.h') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index 76198428c..5d7c76b84 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -182,10 +182,11 @@ glusterd_volume_brickinfo_get_by_brick (char *brick, glusterd_brickinfo_t **brickinfo); int32_t -glusterd_build_volume_dict (dict_t **vols); +glusterd_add_volumes_to_export_dict (dict_t **peer_data); int32_t -glusterd_compare_friend_data (dict_t *vols, int32_t *status, char *hostname); +glusterd_compare_friend_data (dict_t *peer_data, int32_t *status, + char *hostname); int glusterd_compute_cksum (glusterd_volinfo_t *volinfo, @@ -251,7 +252,7 @@ int glusterd_remote_hostname_get (rpcsvc_request_t *req, char *remote_host, int len); int32_t -glusterd_import_friend_volumes (dict_t *vols); +glusterd_import_friend_volumes (dict_t *peer_data); void glusterd_set_volume_status (glusterd_volinfo_t *volinfo, glusterd_volume_status status); @@ -721,10 +722,10 @@ glusterd_add_missed_snaps_to_dict (dict_t *rsp_dict, int32_t brick_number, int32_t op); int32_t -glusterd_add_missed_snaps_to_export_dict (dict_t *vols); +glusterd_add_missed_snaps_to_export_dict (dict_t *peer_data); int32_t -glusterd_import_friend_missed_snap_list (dict_t *vols); +glusterd_import_friend_missed_snap_list (dict_t *peer_data); int32_t gd_restore_snap_volume (dict_t *rsp_dict, -- cgit From 54a5a42848870ee17b923c6c37d65fdfe4a5fec9 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Tue, 22 Apr 2014 00:52:57 +0000 Subject: glusterd/snapshot: Compare and update snapshots during peer handshake During a peer-handshake, after the volumes have synced, and the list of missed snapshots have synced, the node will perform the pending deletes and restores on this list. At this point, the current snapshot list in the node will be updated, and hence in case of conflicts arising during snapshot handshake, the peer hosting the bricks will be given precedence Likewise, if there will be a conflict, and both peers will be in the same state, i.e either both would be hosting bricks or both would not be hosting bricks, then a decision can't be taken and a peer-reject will happen. glusterd_compare_and_update_snap() implements the following algorithm to perform the above task: Step 1: Start. Step 2: Check if the peer is missing a delete on the said snap. If yes, goto step 6. Step 3: Check if there is a conflict between the peer's data and the local snap. If no, goto step 5. Step 4: As there is a conflict, check if both the peer and the local nodes are hosting bricks. Based on the results perform the following: Peer Hosts Bricks Local Node Hosts Bricks Action Yes Yes Goto Step 7 No No Goto Step 7 Yes No Goto Step 8 No Yes Goto Step 6 Step 5: Check if the local node is missing the peer's data. If yes, goto step 9. Step 6: It's a no-op. Goto step 10 Step 7: Peer Reject. Goto step 10 Step 8: Delete local node's data. Step 9: Accept Peer Data. Step 10: Stop Change-Id: I79be0f0f5f2a4f5c72277a4e77c2be732af432e1 BUG: 1061685 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/7525 Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi Reviewed-by: Rajesh Joseph Reviewed-by: Atin Mukherjee Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-utils.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.h') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index 5d7c76b84..84fa89b0e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -281,7 +281,8 @@ int32_t glusterd_volume_count_get (void); int32_t glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo, - dict_t *dict, int32_t count); + dict_t *dict, int32_t count, + char *prefix); int glusterd_get_brickinfo (xlator_t *this, const char *brickname, int port, gf_boolean_t localhost, @@ -735,4 +736,23 @@ gd_restore_snap_volume (dict_t *rsp_dict, int32_t glusterd_mount_lvm_snapshot (char *device_path, char *brick_mount_path); +int32_t +glusterd_add_snapshots_to_export_dict (dict_t *peer_data); + +int32_t +glusterd_compare_friend_snapshots (dict_t *peer_data, + glusterd_peerinfo_t *peerinfo); + +int32_t +glusterd_snapobject_delete (glusterd_snap_t *snap); + +int32_t +glusterd_snap_volume_remove (dict_t *rsp_dict, + glusterd_volinfo_t *snap_vol, + gf_boolean_t remove_lvm, + gf_boolean_t force); + +int32_t +glusterd_store_create_snap_dir (glusterd_snap_t *snap); + #endif -- cgit