/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
*
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
* Mountain View, CA 94043, or:
*
* http://www.sgi.com
*
* For further information regarding this notice, see:
*
* http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/*
* srm_resources.h
*
* This header file contains all data structures used by srm_main
* thread.
*/
/*
* The srm_main thread maintains the sr_global_resources_list. The
* global_resources_table is list of sr_grte_t elements. The srm_client
* and srm_action threads also access the global resources table
* This table also contains all resources that have been probed/exclusive
* probed.
* REVISIT: All resources successfully released are not stored in
* the sr_global_resources_list.
*/
#ifndef SRM_RESOURCES_H
#define SRM_RESOURCES_H
#ident "$Id: srm_resources.h,v 1.1 2000/08/31 19:16:32 vasa Exp $"
#include <srm.h>
/* SRM identifier. Currently, it is same as srm global instance id */
typedef ci_instid_t sr_srmid_t;
typedef uint32_t sr_res_flags_t;
/* Values for sr_res_flags_t field */
#define SRF_FAILOVERABLE 0x01 /* Specifies whether the resource can be
* failed over locally or not */
#define SRF_ISBINDING 0x02 /* If this "resource" is actually a
* a binding of resources */
#define SRF_MAINTENANCE 0x04 /* resource is in maintenance mode */
typedef enum {
SRPS_NEW = 1,
SRPS_PROBING = 2, /* Resource is being probed locally */
SRPS_PROBED = 3
} sr_probe_states_t;
#define RES_PRIORITY_NONE 0
struct sc_clnt_s;
/* In the following structure the priority and clnt_grp_id refer
* to the priority and the clnt_grp_id of the application on whose
* behalf the srm client process (FS etc) has made the request -
* a srm client is of course free to make a request on its own behalf.
* The clntp pointer points to the direct srm client (e.g. FS). -
* this is used for communication purposes.
*/
/* Values for resclntflags field */
#define SRCF_BINDING 0x00000001 /* This resource was allocated because
* the binding to which the resource
* belongs is allocated */
#define SRCF_NORMAL 0x00000002 /* This resource was allocated by a
* client request */
#define SRCF_NOMONITOR 0x00000004 /* This resource is not being monitored
* due to monitoring failure of the
* resource or monitoring failure of
* the binding */
typedef struct sr_res_clnt_s {
uint32_t priority; /* Priority of the allocate */
uint32_t clnt_grp_id; /* Group id of the client
* making this allocate */
uint32_t resclntflags; /* Flags - See above */
struct sc_clnt_s *clntp; /* Pointer to the client */
} sr_res_clnt_t;
typedef struct sr_probe_cache_s {
ci_nodeid_t nodeid; /* Node id */
srm_probestatus_t status; /* Probe status of
* resource in the node */
} sr_probe_cache_t;
typedef struct sr_probe_s {
sr_probe_states_t state; /* Local state of the resource
* probe */
srm_list_t *list; /* Cache of probe information
* for the nodes in the
* cluster. The list is of
* sr_probe_cache_t */
srm_list_t *probe_clnts_list; /* Clients probing/exclusive
probing the resource.
The list has elements of
type sc_clnt_req_t */
} sr_probe_t;
typedef struct sr_binding_s {
srm_res_t bind_id; /* Name/type of the binding.
* Type field is not used */
sr_bind_states_t state; /* Binding state */
srm_list_t *res_list; /* List of all resources
* belonging to this binding.
* Each entry is of type
* srm_res_t */
srm_list_t *mod_list; /* List of resources to be
* added/deleted to/from this
* binding, in case a local
* bind modification operation
* is pending locally. There
* can be at most one bind
* modification operation
* pending locally at any
* time */
srm_list_t *res_clnts_list; /* Clients associated with
the resource. The list
has elements of type
sc_clnt_req_t */
} sr_binding_t;
#define SRM_BIGVALUE 0xffffffff /* This define is used
* to initialize minimum
* value statistics */
typedef struct sr_stats_t {
uint32_t generation_no; /* These number keeps track
* of stats generation.
* It is incremented when
* monitoring stats are
* reset */
uint32_t num_monfailures; /* Number of monitoring
* failures before declaring
* a monitoring failure. */
uint32_t cumm_num_monfailures; /* Cummulative number of
* monitoring failures. */
uint32_t cumm_num_monitors; /* Cummulative number of
* monitors */
uint32_t max_monitortime; /* Max time to monitor the
* resource. Approximate value
*/
uint32_t min_monitortime; /* Min time to monitor the
* resource. Approximate value
*/
uint32_t recent_monitortime; /* Most recent monitoring time
* for the resource.
* Approximate value. */
uint32_t monitoring_timeout; /* Monitoring timeout */
uint32_t histo_monitortime[5]; /* 20% percentile binning of
* monitor responses. */
} sr_stats_t;
/* SRERR_NODE_UNKNOWN, SRERR_SRM_PULSEFAIL and SRERR_ACTIONERROR are
* maintained in res_globerror field in all srmds. SRERR_MONITORING_FAILURE
* is maintained only in the node that has allocated the resource
* (res_localerror) field. */
typedef struct sr_rte_s {
srm_res_t res_id; /* Resource identifier */
sr_srmid_t res_owner; /* SRM id of the owner of
the resource */
sr_res_states_t res_state;
sr_res_err_t res_globerror; /* Resource errors that are
* maintained in all nodes */
sr_res_err_t res_localerror; /* Resource errors that are
* maintained in only in nodes
* that have allocated the
* resource */
sr_res_flags_t res_flag; /* Flags that are maintained
* globally. */
sr_res_flags_t res_localflags; /* Flags that are maintained
* locally. */
uint32_t res_prio; /* Priority of the highest
* priority client that has
* either allocated this
* resource or has put up
* a request for it. */
uint32_t res_overlapcnt; /* The number of clients that
* have allocated the resource
* either directly or indirectly
* using a binding */
sr_stats_t *res_stats; /* Statistics maintained for
* the resource. */
union {
srm_list_t *binding_list; /* List of all the bindings
* this resource is on */
srm_list_t *res_list; /* List of all the resources
* this binding consists of */
} list_u;
srm_list_t *res_clnts_list; /* Clients associated with
the resource. The list
has elements of type
sc_clnt_req_t */
srm_list_t *res_alloc_clnts_list; /* Clients that have allocated
* this resource. Elements
* of type sr_res_clnt_t */
sr_probe_t *res_probe; /* Pointer to the resource
* probe/exclusive probe
* information */
} sr_rte_t;
typedef struct sr_res_type_info_s {
char *type; /* Resource type */
char *executable; /* Executable to perform the resource
action */
uint32_t order; /* The resource order. Value relative to
other resource types */
uint32_t mon_period; /* Timeperiod between each execution in sec */
uint32_t timeout; /* Timeout value per resource in sec */
uint32_t start_mon; /* Time to wait before executing the
monitor action in sec. */
} sr_res_type_info_t;
/* flags parameter to sr_grte_bindupdate and sr_grte_selective_update()
* functions. See sr_resources.c for details */
#define SR_UPDATE_STATE 0x00000001
/* Updates res_globerror field */
#define SR_UPDATE_GERROR 0x00000002
#define SR_UPDATE_OWNER 0x00000004
#define SR_UPDATE_PRIO 0x00000008
/* Updates res_localerror field */
#define SR_UPDATE_LERROR 0x00000010
#define SR_UPDATE_ALL 0x0000001f
#define SR_UPDATE_ALLGLOBAL 0x0000000f
#define SR_UPDATE_FORCEERR 0x00000020
/* flags parameter to sr_set_probestatus(). See sr_clientcomm.c for
* details. */
#define SRPRFL_ALL 0x00000001
#define SRPRFL_EXCL 0x00000002
#define SRPRFL_NOTEXCL 0x00000004
#endif /* SRM_RESOURCES_H */