From 4056ed598f642d2d23a65b79495b0247d84db2f4 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Tue, 6 Jan 2015 07:40:32 +0000 Subject: glusterd: Refactor glusterd-utils.c Refactor glusterd-utils.c to create glusterd-snapshot-utils.c consisting of all snapshot utility functions. Change-Id: Id9823a2aec9b115f9c040c9940f288d4fe753d9b BUG: 1176770 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/9391 Reviewed-by: Kaushal M Reviewed-by: Rajesh Joseph Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi Tested-by: Krishnan Parthasarathi --- .../mgmt/glusterd/src/glusterd-snapshot-utils.h | 200 +++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h (limited to 'xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h') diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h new file mode 100644 index 00000000000..a5d82af559d --- /dev/null +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h @@ -0,0 +1,200 @@ +/* + Copyright (c) 2015 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ +#ifndef _GLUSTERD_SNAP_UTILS_H +#define _GLUSTERD_SNAP_UTILS_H + +int32_t +glusterd_snap_volinfo_find (char *volname, glusterd_snap_t *snap, + glusterd_volinfo_t **volinfo); + +int32_t +glusterd_snap_volinfo_find_from_parent_volname (char *origin_volname, + glusterd_snap_t *snap, + glusterd_volinfo_t **volinfo); + +int +glusterd_snap_volinfo_find_by_volume_id (uuid_t volume_id, + glusterd_volinfo_t **volinfo); + +int32_t +glusterd_add_snapd_to_dict (glusterd_volinfo_t *volinfo, + dict_t *dict, int32_t count); + +int +glusterd_compare_snap_time(struct list_head *, struct list_head *); + +int +glusterd_compare_snap_vol_time(struct list_head *, struct list_head *); + +int32_t +glusterd_snap_volinfo_restore (dict_t *dict, dict_t *rsp_dict, + glusterd_volinfo_t *new_volinfo, + glusterd_volinfo_t *snap_volinfo, + int32_t volcount); + +int32_t +glusterd_missed_snapinfo_new (glusterd_missed_snap_info **missed_snapinfo); + +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, + glusterd_volinfo_t *snap_vol, + glusterd_brickinfo_t *brickinfo, + int32_t brick_number, int32_t op); + +int32_t +glusterd_add_missed_snaps_to_export_dict (dict_t *peer_data); + +int32_t +glusterd_import_friend_missed_snap_list (dict_t *peer_data); + +int +gd_restore_snap_volume (dict_t *dict, dict_t *rsp_dict, + glusterd_volinfo_t *orig_vol, + glusterd_volinfo_t *snap_vol, + int32_t volcount); + +int32_t +glusterd_mount_lvm_snapshot (glusterd_brickinfo_t *brickinfo, + char *brick_mount_path); + +int32_t +glusterd_umount (const char *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_store_create_snap_dir (glusterd_snap_t *snap); + +int32_t +glusterd_copy_file (const char *source, const char *destination); + +int32_t +glusterd_copy_folder (const char *source, const char *destination); + +int32_t +glusterd_get_geo_rep_session (char *slave_key, char *origin_volname, + dict_t *gsync_slaves_dict, char *session, + char *slave); + +int32_t +glusterd_restore_geo_rep_files (glusterd_volinfo_t *snap_vol); + +int32_t +glusterd_copy_quota_files (glusterd_volinfo_t *src_vol, + glusterd_volinfo_t *dest_vol); + +int +glusterd_snap_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict); + +int +gd_add_vol_snap_details_to_dict (dict_t *dict, char *prefix, + glusterd_volinfo_t *volinfo); + +int +gd_add_brick_snap_details_to_dict (dict_t *dict, char *prefix, + glusterd_brickinfo_t *brickinfo); + +int +gd_import_new_brick_snap_details (dict_t *dict, char *prefix, + glusterd_brickinfo_t *brickinfo); + +int +gd_import_volume_snap_details (dict_t *dict, glusterd_volinfo_t *volinfo, + char *prefix, char *volname); + +int32_t +glusterd_snap_quorum_check (dict_t *dict, gf_boolean_t snap_volume, + char **op_errstr, + struct list_head *peers_list); + +int32_t +glusterd_snap_quorum_check_for_create (dict_t *dict, gf_boolean_t snap_volume, + char **op_errstr, + struct list_head *peers_list); + +int32_t +glusterd_snap_brick_create (glusterd_volinfo_t *snap_volinfo, + glusterd_brickinfo_t *brickinfo, + int32_t brick_count); + +int +glusterd_snapshot_restore_cleanup (dict_t *rsp_dict, + glusterd_volinfo_t *volinfo, + glusterd_snap_t *snap); + +int +glusterd_handle_snapd_option (glusterd_volinfo_t *volinfo); + +int32_t +glusterd_snapd_disconnect (glusterd_volinfo_t *volinfo); + +void +glusterd_get_snapd_dir (glusterd_volinfo_t *volinfo, + char *path, int path_len); + +void +glusterd_get_snapd_rundir (glusterd_volinfo_t *volinfo, + char *path, int path_len); + +void +glusterd_get_snapd_volfile (glusterd_volinfo_t *volinfo, + char *path, int path_len); + +void +glusterd_get_snapd_pidfile (glusterd_volinfo_t *volinfo, + char *path, int path_len); + +void +glusterd_set_snapd_socket_filepath (glusterd_volinfo_t *volinfo, + char *path, int path_len); + +gf_boolean_t +glusterd_is_snapd_running (glusterd_volinfo_t *volinfo); + +int +glusterd_snapd_stop (glusterd_volinfo_t *volinfo); + +int +glusterd_snapd_start (glusterd_volinfo_t *volinfo, gf_boolean_t wait); + +int +glusterd_is_snapd_enabled (glusterd_volinfo_t *volinfo); + +gf_boolean_t +glusterd_is_snapd_online (glusterd_volinfo_t *volinfo); + +void +glusterd_snapd_set_online_status (glusterd_volinfo_t *volinfo, + gf_boolean_t status); + +int +glusterd_restart_snapds (glusterd_conf_t *priv); + +int32_t +glusterd_check_and_set_config_limit (glusterd_conf_t *priv); + +int32_t +glusterd_is_snap_soft_limit_reached (glusterd_volinfo_t *volinfo, + dict_t *dict); + +void +gd_get_snap_conf_values_if_present (dict_t *opts, uint64_t *sys_hard_limit, + uint64_t *sys_soft_limit); + +#endif + -- cgit