| 1 | /* |
|---|
| 2 | * (C) 2001 Clemson University and The University of Chicago |
|---|
| 3 | * |
|---|
| 4 | * See COPYING in top-level directory. |
|---|
| 5 | */ |
|---|
| 6 | |
|---|
| 7 | #ifndef __SERVER_CONFIG_H |
|---|
| 8 | #define __SERVER_CONFIG_H |
|---|
| 9 | |
|---|
| 10 | #include "pvfs2-types.h" |
|---|
| 11 | #include "src/common/llist/llist.h" |
|---|
| 12 | #include "src/common/gossip/gossip.h" |
|---|
| 13 | |
|---|
| 14 | #ifdef __PVFS2_TROVE_SUPPORT__ |
|---|
| 15 | #include "trove.h" |
|---|
| 16 | #endif |
|---|
| 17 | |
|---|
| 18 | enum |
|---|
| 19 | { |
|---|
| 20 | CTX_GLOBAL = (1 << 1), |
|---|
| 21 | CTX_DEFAULTS = (1 << 2), |
|---|
| 22 | CTX_ALIASES = (1 << 3), |
|---|
| 23 | CTX_FILESYSTEM = (1 << 4), |
|---|
| 24 | CTX_METAHANDLERANGES = (1 << 5), |
|---|
| 25 | CTX_DATAHANDLERANGES = (1 << 6), |
|---|
| 26 | CTX_STORAGEHINTS = (1 << 7), |
|---|
| 27 | CTX_DISTRIBUTION = (1 << 8), |
|---|
| 28 | CTX_SECURITY = (1 << 9), |
|---|
| 29 | CTX_EXPORT = (1 << 10), |
|---|
| 30 | CTX_SERVER_OPTIONS = (1 << 11), |
|---|
| 31 | }; |
|---|
| 32 | |
|---|
| 33 | typedef struct phys_server_desc |
|---|
| 34 | { |
|---|
| 35 | PVFS_BMI_addr_t addr; |
|---|
| 36 | char *addr_string; |
|---|
| 37 | int server_type; |
|---|
| 38 | } phys_server_desc_s; |
|---|
| 39 | |
|---|
| 40 | typedef struct host_alias_s |
|---|
| 41 | { |
|---|
| 42 | char *host_alias; |
|---|
| 43 | char *bmi_address; |
|---|
| 44 | } host_alias_s; |
|---|
| 45 | |
|---|
| 46 | typedef struct host_handle_mapping_s |
|---|
| 47 | { |
|---|
| 48 | struct host_alias_s *alias_mapping; |
|---|
| 49 | char *handle_range; |
|---|
| 50 | |
|---|
| 51 | /* |
|---|
| 52 | the handle_range above, represented as a |
|---|
| 53 | PVFS_handle_extent_array type. This is a |
|---|
| 54 | convenient type for sending/receiving over |
|---|
| 55 | the wire on create/mkdir requests. |
|---|
| 56 | */ |
|---|
| 57 | PVFS_handle_extent_array handle_extent_array; |
|---|
| 58 | } host_handle_mapping_s; |
|---|
| 59 | |
|---|
| 60 | typedef struct filesystem_configuration_s |
|---|
| 61 | { |
|---|
| 62 | char *file_system_name; |
|---|
| 63 | PVFS_fs_id coll_id; |
|---|
| 64 | PVFS_handle root_handle; |
|---|
| 65 | int default_num_dfiles; |
|---|
| 66 | |
|---|
| 67 | /* ptrs are type host_handle_mapping_s* */ |
|---|
| 68 | PINT_llist *meta_handle_ranges; |
|---|
| 69 | |
|---|
| 70 | /* ptrs are type host_handle_mapping_s* */ |
|---|
| 71 | PINT_llist *data_handle_ranges; |
|---|
| 72 | |
|---|
| 73 | enum PVFS_flowproto_type flowproto; /* default flowprotocol */ |
|---|
| 74 | enum PVFS_encoding_type encoding; /* encoding used for messages */ |
|---|
| 75 | |
|---|
| 76 | /* |
|---|
| 77 | misc storage hints. may need to be a union later depending on |
|---|
| 78 | which trove storage backends are available |
|---|
| 79 | */ |
|---|
| 80 | struct timeval handle_recycle_timeout_sec; |
|---|
| 81 | char *attr_cache_keywords; |
|---|
| 82 | int attr_cache_size; |
|---|
| 83 | int attr_cache_max_num_elems; |
|---|
| 84 | int trove_sync_meta; |
|---|
| 85 | int trove_sync_data; |
|---|
| 86 | int immediate_completion; |
|---|
| 87 | int coalescing_high_watermark; |
|---|
| 88 | int coalescing_low_watermark; |
|---|
| 89 | int file_stuffing; |
|---|
| 90 | |
|---|
| 91 | char *secret_key; |
|---|
| 92 | |
|---|
| 93 | int fp_buffer_size; |
|---|
| 94 | int fp_buffers_per_flow; |
|---|
| 95 | |
|---|
| 96 | int trove_method; |
|---|
| 97 | |
|---|
| 98 | /* Export flags bitwise OR of flags specified */ |
|---|
| 99 | int exp_flags; |
|---|
| 100 | |
|---|
| 101 | int ro_count; |
|---|
| 102 | char **ro_hosts; |
|---|
| 103 | int *ro_netmasks; |
|---|
| 104 | |
|---|
| 105 | int root_squash_count; |
|---|
| 106 | char **root_squash_hosts; |
|---|
| 107 | int *root_squash_netmasks; |
|---|
| 108 | |
|---|
| 109 | int root_squash_exceptions_count; |
|---|
| 110 | char **root_squash_exceptions_hosts; |
|---|
| 111 | int *root_squash_exceptions_netmasks; |
|---|
| 112 | |
|---|
| 113 | int all_squash_count; |
|---|
| 114 | char **all_squash_hosts; |
|---|
| 115 | int *all_squash_netmasks; |
|---|
| 116 | |
|---|
| 117 | PVFS_uid exp_anon_uid; |
|---|
| 118 | PVFS_gid exp_anon_gid; |
|---|
| 119 | |
|---|
| 120 | int32_t small_file_size; |
|---|
| 121 | |
|---|
| 122 | int32_t directio_thread_num; |
|---|
| 123 | int32_t directio_ops_per_queue; |
|---|
| 124 | int32_t directio_timeout; |
|---|
| 125 | } filesystem_configuration_s; |
|---|
| 126 | |
|---|
| 127 | typedef struct distribution_param_configuration_s |
|---|
| 128 | { |
|---|
| 129 | char* name; |
|---|
| 130 | int64_t value; /* Temporarily hard code to 64bit type */ |
|---|
| 131 | |
|---|
| 132 | } distribution_param_configuration; |
|---|
| 133 | |
|---|
| 134 | /* Config struct to hold overloaded distribution defaults */ |
|---|
| 135 | typedef struct distribution_configuration_s |
|---|
| 136 | { |
|---|
| 137 | char* name; |
|---|
| 138 | PINT_llist* param_list; |
|---|
| 139 | |
|---|
| 140 | } distribution_configuration; |
|---|
| 141 | |
|---|
| 142 | typedef struct server_configuration_s |
|---|
| 143 | { |
|---|
| 144 | char *host_id; |
|---|
| 145 | int host_index; |
|---|
| 146 | char *server_alias; /* the command line server-alias parameter */ |
|---|
| 147 | int my_server_options; |
|---|
| 148 | char *data_path; /* path to data storage directory */ |
|---|
| 149 | char *meta_path; /* path to metadata storage directory */ |
|---|
| 150 | char *fs_config_filename; /* the fs.conf file name */ |
|---|
| 151 | size_t fs_config_buflen; /* the fs.conf file length */ |
|---|
| 152 | char *fs_config_buf; /* the fs.conf file contents */ |
|---|
| 153 | int initial_unexpected_requests; |
|---|
| 154 | int server_job_bmi_timeout; /* job timeout values in seconds */ |
|---|
| 155 | int server_job_flow_timeout; |
|---|
| 156 | int client_job_bmi_timeout; |
|---|
| 157 | int client_job_flow_timeout; |
|---|
| 158 | int client_retry_limit; /* how many times to retry client operations */ |
|---|
| 159 | int client_retry_delay_ms; /* delay between retries */ |
|---|
| 160 | int perf_update_interval; /* how quickly (in msecs) to |
|---|
| 161 | update perf monitor */ |
|---|
| 162 | uint32_t *precreate_batch_size; /* batch size for each ds type */ |
|---|
| 163 | uint32_t *precreate_low_threshold; /* threshold for each ds type */ |
|---|
| 164 | uint32_t init_num_dirdata_handles; /* initial number of dirdata handles when creating a new directory */ |
|---|
| 165 | char *logfile; /* what log file to write to */ |
|---|
| 166 | char *logtype; /* "file" or "syslog" destination */ |
|---|
| 167 | enum gossip_logstamp logstamp_type; /* how to timestamp logs */ |
|---|
| 168 | char *event_logging; |
|---|
| 169 | int enable_events; |
|---|
| 170 | char *bmi_modules; /* BMI modules */ |
|---|
| 171 | char *flow_modules; /* Flow modules */ |
|---|
| 172 | |
|---|
| 173 | int tcp_buffer_size_receive; /* Size of TCP receive buffer, is set |
|---|
| 174 | later with setsockopt */ |
|---|
| 175 | int tcp_buffer_size_send; /* Size of TCP send buffer */ |
|---|
| 176 | int tcp_bind_specific; /* Flag indicates if we should bind to |
|---|
| 177 | * specific server address |
|---|
| 178 | */ |
|---|
| 179 | #ifdef USE_TRUSTED |
|---|
| 180 | int ports_enabled; /* Should we enable trusted port connections at all? */ |
|---|
| 181 | unsigned long allowed_ports[2]; /* {Min, Max} value of ports from which connections will be allowed */ |
|---|
| 182 | int network_enabled; /* Should we enable trusted network connections at all? */ |
|---|
| 183 | int allowed_networks_count; /* Number of trusted networks parsed */ |
|---|
| 184 | char **allowed_networks; /* BMI addresses of the trusted networks */ |
|---|
| 185 | int *allowed_masks; /* Netmasks for each of the specified trusted network */ |
|---|
| 186 | void *security; /* BMI module specific information */ |
|---|
| 187 | void (*security_dtor)(void *); /* Destructor to free BMI module specific information */ |
|---|
| 188 | #endif |
|---|
| 189 | int configuration_context; |
|---|
| 190 | PINT_llist *host_aliases; /* ptrs are type host_alias_s */ |
|---|
| 191 | PINT_llist *file_systems; /* ptrs are type |
|---|
| 192 | filesystem_configuration_s */ |
|---|
| 193 | distribution_configuration default_dist_config; /* distribution conf */ |
|---|
| 194 | int db_cache_size_bytes; /* cache size to use in berkeley db |
|---|
| 195 | if zero, use defaults */ |
|---|
| 196 | char * db_cache_type; |
|---|
| 197 | int trove_alt_aio_mode; /* enables experimental alternative AIO |
|---|
| 198 | * implementation for some types of |
|---|
| 199 | * operations |
|---|
| 200 | */ |
|---|
| 201 | int trove_max_concurrent_io; /* allow the number of aio operations to |
|---|
| 202 | * be configurable. |
|---|
| 203 | */ |
|---|
| 204 | int trove_method; |
|---|
| 205 | void *private_data; |
|---|
| 206 | } server_configuration_s; |
|---|
| 207 | |
|---|
| 208 | int PINT_parse_config( |
|---|
| 209 | struct server_configuration_s *config_s, |
|---|
| 210 | char *global_config_filename, |
|---|
| 211 | char *server_alias_name); |
|---|
| 212 | |
|---|
| 213 | void PINT_config_release( |
|---|
| 214 | struct server_configuration_s *config_s); |
|---|
| 215 | |
|---|
| 216 | #ifdef USE_TRUSTED |
|---|
| 217 | |
|---|
| 218 | int PINT_config_get_allowed_ports( |
|---|
| 219 | struct server_configuration_s *config, |
|---|
| 220 | int *enabled, |
|---|
| 221 | unsigned long *allowed_ports); |
|---|
| 222 | |
|---|
| 223 | int PINT_config_get_allowed_networks( |
|---|
| 224 | struct server_configuration_s *config, |
|---|
| 225 | int *enabled, |
|---|
| 226 | int *allowed_networks_count, |
|---|
| 227 | char ***allowed_networks, |
|---|
| 228 | int **allowed_masks); |
|---|
| 229 | |
|---|
| 230 | #endif |
|---|
| 231 | |
|---|
| 232 | char *PINT_config_get_host_addr_ptr( |
|---|
| 233 | struct server_configuration_s *config_s, |
|---|
| 234 | char *alias); |
|---|
| 235 | |
|---|
| 236 | char *PINT_config_get_host_alias_ptr( |
|---|
| 237 | struct server_configuration_s *config_s, |
|---|
| 238 | char *bmi_address); |
|---|
| 239 | |
|---|
| 240 | char *PINT_config_get_meta_handle_range_str( |
|---|
| 241 | struct server_configuration_s *config_s, |
|---|
| 242 | struct filesystem_configuration_s *fs); |
|---|
| 243 | |
|---|
| 244 | int PINT_config_get_meta_handle_extent_array( |
|---|
| 245 | struct server_configuration_s *config_s, |
|---|
| 246 | PVFS_fs_id fs_id, |
|---|
| 247 | PVFS_handle_extent_array *extent_array); |
|---|
| 248 | |
|---|
| 249 | char *PINT_config_get_data_handle_range_str( |
|---|
| 250 | struct server_configuration_s *config_s, |
|---|
| 251 | struct filesystem_configuration_s *fs); |
|---|
| 252 | |
|---|
| 253 | char *PINT_config_get_merged_handle_range_str( |
|---|
| 254 | struct server_configuration_s *config_s, |
|---|
| 255 | struct filesystem_configuration_s *fs); |
|---|
| 256 | |
|---|
| 257 | int PINT_config_is_valid_configuration( |
|---|
| 258 | struct server_configuration_s *config_s); |
|---|
| 259 | |
|---|
| 260 | int PINT_config_is_valid_collection_id( |
|---|
| 261 | struct server_configuration_s *config_s, |
|---|
| 262 | PVFS_fs_id fs_id); |
|---|
| 263 | |
|---|
| 264 | struct filesystem_configuration_s *PINT_config_find_fs_name( |
|---|
| 265 | struct server_configuration_s *config_s, |
|---|
| 266 | char *fs_name); |
|---|
| 267 | |
|---|
| 268 | struct filesystem_configuration_s *PINT_config_find_fs_id( |
|---|
| 269 | struct server_configuration_s *config_s, |
|---|
| 270 | PVFS_fs_id fs_id); |
|---|
| 271 | |
|---|
| 272 | PVFS_fs_id PINT_config_get_fs_id_by_fs_name( |
|---|
| 273 | struct server_configuration_s *config_s, |
|---|
| 274 | char *fs_name); |
|---|
| 275 | |
|---|
| 276 | PINT_llist *PINT_config_get_filesystems( |
|---|
| 277 | struct server_configuration_s *config_s); |
|---|
| 278 | |
|---|
| 279 | int PINT_config_trim_filesystems_except( |
|---|
| 280 | struct server_configuration_s *config_s, |
|---|
| 281 | PVFS_fs_id fs_id); |
|---|
| 282 | |
|---|
| 283 | int PINT_config_get_fs_key( |
|---|
| 284 | struct server_configuration_s *config, |
|---|
| 285 | PVFS_fs_id fs_id, |
|---|
| 286 | char ** key, |
|---|
| 287 | int * length); |
|---|
| 288 | |
|---|
| 289 | struct server_configuration_s *PINT_get_server_config(void); |
|---|
| 290 | |
|---|
| 291 | #ifdef __PVFS2_TROVE_SUPPORT__ |
|---|
| 292 | int PINT_config_pvfs2_mkspace( |
|---|
| 293 | struct server_configuration_s *config); |
|---|
| 294 | int PINT_config_pvfs2_rmspace( |
|---|
| 295 | struct server_configuration_s *config); |
|---|
| 296 | int PINT_config_get_trove_sync_meta( |
|---|
| 297 | struct server_configuration_s *config, |
|---|
| 298 | PVFS_fs_id fs_id); |
|---|
| 299 | int PINT_config_get_trove_sync_data( |
|---|
| 300 | struct server_configuration_s *config, |
|---|
| 301 | PVFS_fs_id fs_id); |
|---|
| 302 | #endif |
|---|
| 303 | |
|---|
| 304 | /* |
|---|
| 305 | * Local variables: |
|---|
| 306 | * c-indent-level: 4 |
|---|
| 307 | * c-basic-offset: 4 |
|---|
| 308 | * End: |
|---|
| 309 | * |
|---|
| 310 | * vim: ts=8 sts=4 sw=4 expandtab |
|---|
| 311 | */ |
|---|
| 312 | |
|---|
| 313 | #endif /* __SERVER_CONFIG_H */ |
|---|