/*
* 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
*/
/*
* fs_client.h
*
* This file contains all the interface constructs for client functions
*/
#ifndef FS_CLIENT_H
#define FS_CLIENT_H
#ident "$Id: fs_client.h,v 1.1 2000/08/31 19:55:34 vasa Exp $"
/*
* Possible administration debug actions
*/
typedef enum {
FSDEBUG_NULL = 0,
FSDEBUG_LOG_INFO = 1,
FSDEBUG_RETURN_INFO = 2
} fs_adm_debug_action_t;
/*
* Strings used
*/
#define ALL_STR "all"
#define NODES_STR "nodes"
#define RESGRPS_STR "resgrps"
/*
* Flag values used when performing debug administration
*/
#define DUMP_NODES 0x00000001
#define DUMP_RESGRPS 0x00000002
#define DUMP_ALL (DUMP_NODES|DUMP_RESGRPS)
/*
* Administration user level actions. Get strings by using:
*
* char *fs_admin_request_string(fs_adm_admin_actions_t action)
*/
typedef enum {
FSACT_NULL = 0,
FSACT_OFFLINE = 1,
FSACT_ONLINE = 2,
FSACT_MOVE = 3,
FSACT_MOVETO = 4,
FSACT_SHUTDOWN_CLUSTER = 5,
FSACT_MOVEALL = 6,
FSACT_MAINT_ON = 7,
FSACT_MAINT_OFF = 8,
FSACT_DETACH = 9,
FSACT_ANY = 10,
FSACT_MOD_FAILOVER = 11,
FSACT_ADD_RESOURCES = 12,
FSACT_DEL_RESOURCES = 13,
FSACT_OFFLINE_FORCE = 14,
FSACT_MAX = 15
} fs_adm_admin_actions_t;
/*
* Reply status codes. Get strings by using:
*
* char *fs_admin_status_string(fs_adm_reply_status_t status)
*/
typedef enum {
FSADM_REPLY_OK = 0,
FSADM_REPLY_ACTION_NOTDONE = 1,
FSADM_REPLY_INTERNAL_ERROR = 2,
FSADM_REPLY_INVAL = 3,
FSADM_REPLY_INVALVERS = 4,
FSADM_REPLY_NOCONNECTION = 5,
FSADM_REPLY_REPLY_ERR = 6,
FSADM_REPLY_SEND_ERR = 7,
FSADM_REPLY_NOMEM = 8,
FSADM_REPLY_NOTFOUND = 9,
FSADM_REPLY_NOTMOVING = 10,
FSADM_REPLY_CDB_TEMP_ERROR = 11,
FSADM_REPLY_ACTION_ERRS = 20,
FSADM_REPLY_ACTION_INVAL = 20,
FSADM_REPLY_NODE_NOTUP = 21,
FSADM_REPLY_NODE_NOTGIVEN = 22,
FSADM_REPLY_TARGET_NODE_NOTUP = 23,
FSADM_REPLY_TARGET_NODE_NOTINAFD = 24,
FSADM_REPLY_TARGET_NODE_NOTFOUND = 25,
FSADM_REPLY_RESGROUP_ON_TARGET = 26,
FSADM_REPLY_RESGROUP_NOTFOUND = 27,
FSADM_REPLY_RESGROUP_ALREADY_OFFLINE = 28,
FSADM_REPLY_RESGROUP_ALREADY_ONLINE = 29,
FSADM_REPLY_RESGROUP_OFFLINE = 30,
FSADM_REPLY_RESGROUP_ONLINE = 31,
FSADM_REPLY_RESGROUP_CHANGING = 32,
FSADM_REPLY_RESGROUP_SPLIT = 33,
FSADM_REPLY_RESGROUP_BAD = 34,
FSADM_REPLY_ACTION_SRMD = 35,
FSADM_REPLY_ALREADY_SHUTDOWN_CLUSTER = 36,
FSADM_REPLY_ALREADY_SHUTDOWN_NODE = 37,
FSADM_REPLY_ALREADY_RESGROUP_ONLINE = 38,
FSADM_REPLY_ALREADY_RESGROUP_OFFLINE = 39,
FSADM_REPLY_ALREADY_RESGROUP_MOVE = 40,
FSADM_REPLY_ALREADY_RESGROUP_MAINT = 41,
FSADM_REPLY_ALREADY_RESGROUP_DETACH = 42,
FSADM_REPLY_NO_FAILOVER_POLICY = 43,
FSADM_REPLY_CONFIG = 44,
FSADM_REPLY_ALREADY_RESGROUP_OFFLINE_FORCE = 45,
FSADM_REPLY_NO_NODE_AVAILABLE = 46,
FSADM_REPLY_AFD_NODE_IS_MISSING = 47,
FSADM_REPLY_FORCE_RELEASE = 48,
FSADM_REPLY_MAX = 49
} fs_adm_reply_status_t;
/*
* Reply administration structure
*/
typedef struct fs_admin_reply_s {
uint32_t ar_version;
fs_adm_reply_status_t ar_status;
} fs_admin_reply_t;
/*
* Used to return status for a given resource group. To get string use:
*
* char *fs_resgroup_state_string(fs_resgroup_state_t state)
*
* IMPORTANT: This enum is duplicated in
* CI/lib/libcam_mail/inc/ccamail_internal.h. Please keep
* that definition in synch if any change is made here.
*/
typedef enum {
FS_RG_STATE_NULL = 0,
FS_RG_STATE_ONLINE = 1,
FS_RG_STATE_MAINTENANCE = 2,
FS_RG_STATE_OFFLINE = 3,
FS_RG_STATE_OFFLINE_PERM = 4, /* not used */
FS_RG_STATE_PENDING = 5,
FS_RG_STATE_ONLINE_PENDING = 6,
FS_RG_STATE_OFFLINE_PENDING = 7,
FS_RG_STATE_BAD = 8,
FS_RG_STATE_ACTION_PENDING = 9,
FS_RG_STATE_INTERNAL_ERROR = 10,
FS_RG_STATE_EXCLUSIVITY = 11,
FS_RG_STATE_INITIALIZING = 12,
FS_RG_STATE_ONLINE_READY = 13,
FS_RG_STATE_MAX = 14
} fs_resgroup_state_t;
/*
* Persistent error states for resource groups. To get strings use:
*
* char *fs_resgroup_error_string(fs_resgroup_error_t error)
*/
typedef enum {
FS_RG_ERROR_NONE = 0,
FS_RG_ERROR_INTERNAL = 1,
FS_RG_ERROR_SRMD_EXEC = 2,
FS_RG_ERROR_NODE_UNKNOWN = 3,
FS_RG_ERROR_SPLIT_RESGRP = 4,
FS_RG_ERROR_NO_SUCH_NODE = 5,
FS_RG_ERROR_MON_UNKNOWN = 6,
FS_RG_ERROR_NO_MORE_NODES = 7,
FS_RG_ERROR_MON_FAIL_LAST_NODE = 8,
FS_RG_ERROR_UNKNOWN_STATE = 9,
FS_RG_ERROR_MAX = 10
} fs_resgroup_error_t;
#define FS_MAX_RESGROUP_STATE_LEN 40
#define FS_MAX_RESGROUP_ERROR_LEN 80
typedef struct fs_resgroup_status_s {
char rgs_name[FS_MAX_RESGRPNAMELEN];
fs_adm_reply_status_t rgs_status;
fs_resgroup_state_t rgs_state_enum;
fs_resgroup_error_t rgs_error_enum;
ci_nodeid_t rgs_nodeid;
} fs_resgroup_status_t;
/*
* Notification functions
*/
typedef struct fs_cam_handle_s {
uint32_t val;
} fs_cam_handle_t;
#define FSCAM_INVALID_FD (-1)
#define FSCAM_INVALID_HANDLE (-1)
#define FSCAM_RESGROUPS 0x1
fs_adm_reply_status_t fs_cam_register(uint32_t flags, fs_cam_handle_t *hdl);
fs_adm_reply_status_t fs_cam_unregister(fs_cam_handle_t hdl);
int fs_cam_hdl2fd(fs_cam_handle_t hdl);
/*
* Administrative functions
*/
ci_err_t fs_admin_debug(fs_adm_debug_action_t action,
uint32_t flags,
fs_admin_reply_t * reply);
ci_err_t fs_admin_perf(void);
char *fs_admin_status_string(fs_adm_reply_status_t);
char *fs_admin_request_string(fs_adm_admin_actions_t);
ci_err_t fs_admin_resgroup(cdb_handle_t db,
fs_adm_admin_actions_t action,
char *resource_group,
char *cluster,
char *machine,
char *buffer,
uint32_t size,
fs_admin_reply_t *reply,
char *errorstr);
ci_err_t fs_create_resgroup_mesg(ci_nlist_t *res_nlist,
char **mesg,
uint32_t *mesg_size);
boolean_t fs_dependencies_satisfied(cdb_handle_t db,
char *cluster,
char *resgroup,
ci_nlist_t *proposed_res_nlist,
char *error);
ci_err_t fs_resource_check_duplicate(ci_nlist_t *, char *);
ci_err_t fs_resgroup_query_status(cdb_handle_t db, char *, char *,
fs_resgroup_status_t *, boolean_t *,
char *);
char * fs_resgroup_state_string(fs_resgroup_state_t state);
char * fs_resgroup_error_string(fs_resgroup_error_t error);
ci_err_t fs_setnodename(char *nodename);
#endif /* FS_CLIENT_H */