OpenClovis Logo

clAmsEntities.h
1 /*
2  * Copyright (C) 2002-2012 OpenClovis Solutions Inc. All Rights Reserved.
3  *
4  * This file is available under a commercial license from the
5  * copyright holder or the GNU General Public License Version 2.0.
6  *
7  * The source code for this program is not published or otherwise
8  * divested of its trade secrets, irrespective of what has been
9  * deposited with the U.S. Copyright office.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * For more information, see the file COPYING provided with this
17  * material.
18  */
19 /*******************************************************************************
20  * ModuleName : amf
21  * File : clAmsEntities.h
22  *******************************************************************************/
23 
24 /*******************************************************************************
25  * Description :
26  * This header file defines the various entities that are tracked by AMS.
27  * These definitions are exposed via the Management API. This file is Clovis
28  * internal if the management API is not directly exposed to a ASP customer.
29  * However, if the management API is exposed to a ASP customer, this file is
30  * not Clovis internal.
31  ***************************** Editor Commands ********************************
32  * For vi/vim
33  * :set shiftwidth=4
34  * :set softtabstop=4
35  * :set expandtab
36  *****************************************************************************/
37 
38 #ifndef _CL_AMS_ENTITIES_H_
39 #define _CL_AMS_ENTITIES_H_
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /******************************************************************************
46  * Include files needed to compile this file
47  *****************************************************************************/
48 
49 #include <clCommon.h>
50 #include <clCntApi.h>
51 #include <clTimerApi.h>
52 #include <clIocApi.h>
53 
54 #include <clAmsTypes.h>
55 #include <clAmsSAClientApi.h>
56 #include <clCpmApi.h>
57 #include <clList.h>
58 
59 /******************************************************************************
60  * AMS Entities
61  *
62  * AMS keeps track of various entities such as Cluster Node, Application,
63  * SG, SU, SI, Component and CSI.
64  *
65  * Each AMS entity has an associated object of the form ClAms<Entity>T. The
66  * object is further divided into config and status objects of the form
67  * ClAmsEntityConfigT and ClAmsEntityStatusT. The aim of this separation is
68  * three fold: (1) to clearly separate out attributes that are configurable
69  * from those that change as a result of AMS activity (2) to simply certain
70  * instantiation, termination and modification operations (3) make it easier
71  * in future to checkpoint only status.
72  *
73  *****************************************************************************/
74 
78 typedef enum
79 {
80  CL_AMS_ENTITY_TYPE_ENTITY = 0,
81  CL_AMS_ENTITY_TYPE_NODE = 1,
82  CL_AMS_ENTITY_TYPE_APP = 2,
83  CL_AMS_ENTITY_TYPE_SG = 3,
84  CL_AMS_ENTITY_TYPE_SU = 4,
85  CL_AMS_ENTITY_TYPE_SI = 5,
86  CL_AMS_ENTITY_TYPE_COMP = 6,
87  CL_AMS_ENTITY_TYPE_CSI = 7,
88  CL_AMS_ENTITY_TYPE_CLUSTER = 8,
89 } ClAmsEntityTypeT;
90 
91 #define CL_AMS_ENTITY_TYPE_MAX 7 // not ready for cluster yet
92 
93 /******************************************************************************
94  * Entity Operations
95  *****************************************************************************/
96 
97 typedef struct ClAmsEntityOpStack
98 {
99  ClInt32T numOps;
100  ClListHeadT opList;
101 } ClAmsEntityOpStackT;
102 
103 /******************************************************************************
104  * AMS Entity - Generic Base Class
105  *****************************************************************************/
106 
109 typedef struct
110 {
111  ClAmsEntityTypeT type;
113  ClUint8T debugFlags; /* debug sub area flags */
114 
115 #if defined (CL_AMS_MGMT_HOOKS)
116  ClUint64T hookId;
117 #endif
118 
120 
123 typedef struct
124 {
126  ClUint32T timerCount;
127  ClAmsEntityOpStackT opStack;
129 
133 
134 typedef ClRcT (*ClAmsEntityCallbackT)(ClAmsEntityT *);
135 typedef ClRcT (*ClAmsEntityCallbackExtendedT)(ClAmsEntityT *, ClPtrT userArg);
136 
137 typedef struct
138 {
139  ClAmsEntityCallbackT printOut;
140  ClAmsEntityCallbackT validateConfig;
141  ClAmsEntityCallbackT validateRelationships;
142 } ClAmsEntityMethodsT;
143 
144 
145 typedef struct ClAmsEntityOp
146 {
147 #define CL_AMS_ENTITY_OP_REMOVE_MPLUSN 0x1
148 #define CL_AMS_ENTITY_OP_SWAP_REMOVE_MPLUSN 0x2
149 #define CL_AMS_ENTITY_OP_REDUCE_REMOVE_MPLUSN 0x4
150 #define CL_AMS_ENTITY_OP_ACTIVE_REMOVE_MPLUSN 0x8
151 
152 #define CL_AMS_ENTITY_OP_REMOVES_MPLUSN (CL_AMS_ENTITY_OP_REMOVE_MPLUSN | \
153  CL_AMS_ENTITY_OP_SWAP_REMOVE_MPLUSN |\
154  CL_AMS_ENTITY_OP_REDUCE_REMOVE_MPLUSN )
155 
156 #define CL_AMS_ENTITY_OP_SWAP_ACTIVE_MPLUSN 0x10
157 #define CL_AMS_ENTITY_OP_SI_REASSIGN_MPLUSN 0x20
158 #define CL_AMS_ENTITY_OP_ACTIVE_REMOVE_REF_MPLUSN 0x40
159  ClUint32T op;
160  ClUint32T dataSize;
161  void *data;
162  ClListHeadT list;
163 } ClAmsEntityOpT;
164 
165 typedef struct ClAmsEntityRemoveOp
166 {
167  ClAmsEntityT entity;
168  ClInt32T sisRemoved;
169  ClUint32T switchoverMode;
170  ClUint32T error;
171 }ClAmsEntityRemoveOpT;
172 
173 typedef struct ClAmsEntitySwapRemoveOp
174 {
175  ClAmsEntityT entity; /*standby SU pending other SI removal*/
176  ClInt32T sisRemoved; /*pending extended SI removals*/
177  ClUint32T numOtherSIs;
178  ClAmsEntityT *otherSIs; /*pending list of other SIs awaiting removal*/
179 } ClAmsEntitySwapRemoveOpT;
180 
181 typedef struct ClAmsEntityReduceRemoveOp
182 {
183  ClInt32T sisRemoved;
184 }ClAmsEntityReduceRemoveOpT;
185 
186 typedef struct ClAmsEntitySwapActiveOp
187 {
188  ClInt32T sisReassigned;
189 } ClAmsEntitySwapActiveOpT;
190 
191 typedef struct ClAmsSIReassignOp
192 {
193  ClAmsEntityT su;
194 }ClAmsSIReassignOpT;
195 
196 
197 /******************************************************************************
198  * Timers for entities
199  *****************************************************************************/
200 
201 #define CL_AMS_SG_ADJUST_DURATION (3000) /* For auto adjust in millisecs*/
202 #define CL_AMS_SG_ADJUST_PROBATION CL_AMS_SG_ADJUST_DURATION
203 #define CL_AMS_SU_ASSIGNMENT_DELAY (3000) /* For SI preference only*/
204 typedef enum
205 {
206  CL_AMS_NODE_TIMER_SUFAILOVER = 1,
207 
208  CL_AMS_SG_TIMER_INSTANTIATE = 10,
209  CL_AMS_SG_TIMER_ADJUST = 11,
210  CL_AMS_SG_TIMER_ADJUST_PROBATION = 12,
211  CL_AMS_SU_TIMER_COMPRESTART = 20,
212  CL_AMS_SU_TIMER_SURESTART = 21,
213  CL_AMS_SU_TIMER_PROBATION = 22,
214  CL_AMS_SU_TIMER_ASSIGNMENT = 23,
215 
216  CL_AMS_COMP_TIMER_INSTANTIATE = 40,
217  CL_AMS_COMP_TIMER_TERMINATE = 41,
218  CL_AMS_COMP_TIMER_CLEANUP = 42,
219  CL_AMS_COMP_TIMER_AMSTART = 43,
220  CL_AMS_COMP_TIMER_AMSTOP = 44,
221  CL_AMS_COMP_TIMER_QUIESCINGCOMPLETE = 45,
222  CL_AMS_COMP_TIMER_CSISET = 46,
223  CL_AMS_COMP_TIMER_CSIREMOVE = 47,
224  CL_AMS_COMP_TIMER_PROXIEDCOMPINSTANTIATE = 48,
225  CL_AMS_COMP_TIMER_PROXIEDCOMPCLEANUP = 49,
226  CL_AMS_COMP_TIMER_INSTANTIATEDELAY = 50,
227  CL_AMS_COMP_TIMER_MAX,
228 } ClAmsEntityTimerTypeT;
229 
230 typedef struct
231 {
232  ClAmsEntityTimerTypeT type; /* timer type */
233  ClTimeT count; /* num of times started */
234  ClTimerHandleT handle; /* osal timer handle */
235  ClAmsEntityT *entity; /* timer is for entity */
236 
237  ClUint32T currentOp; /* started by op id */
238 
239 } ClAmsEntityTimerT;
240 
241 typedef ClRcT (*ClAmsEntityTimerCallbackT)(ClAmsEntityTimerT *);
242 
243 /******************************************************************************
244  * References to entities
245  *****************************************************************************/
246 
247 typedef struct
248 {
249  ClAmsEntityT entity; /* type/name of target */
250  ClAmsEntityT *ptr; /* ptr to target */
251  ClCntNodeHandleT nodeHandle; /* target's cnt handle */
252 } ClAmsEntityRefT;
253 
254 
255 typedef enum
256 {
257  CL_AMS_ENTITY_REF_TYPE_ENTITY = 0,
258  CL_AMS_ENTITY_REF_TYPE_NODE = 1,
259  CL_AMS_ENTITY_REF_TYPE_APP = 2,
260  CL_AMS_ENTITY_REF_TYPE_SG = 3,
261  CL_AMS_ENTITY_REF_TYPE_SU = 4,
262  CL_AMS_ENTITY_REF_TYPE_SI = 5,
263  CL_AMS_ENTITY_REF_TYPE_COMP = 6,
264  CL_AMS_ENTITY_REF_TYPE_CSI = 7,
265  CL_AMS_ENTITY_REF_TYPE_SUSI = 8,
266  CL_AMS_ENTITY_REF_TYPE_SISU = 9,
267  CL_AMS_ENTITY_REF_TYPE_COMPCSI = 10,
268  CL_AMS_ENTITY_REF_TYPE_CSICOMP = 11,
269 } ClAmsEntityRefTypeT;
270 
271 #define CL_AMS_ENTITY_REF_TYPE_MAX 11
272 
273 /******************************************************************************
274  * A list of entity references
275  *****************************************************************************/
276 
277 typedef struct
278 {
279  ClAmsEntityTypeT type; /* entity type in list */
280  ClBoolT isRankedList; /* Ranked list or Unranked list */
281  ClBoolT isValid; /* is list valid */
282  ClUint32T numEntities; /* list count */
283  ClCntHandleT list; /* list container */
284 } ClAmsEntityListT;
285 
286 
287 
291 typedef enum
292 {
293  CL_AMS_START_LIST ,
294 
295  /*
296  * Config lists
297  */
298  CL_AMS_CONFIG_LIST_START ,
299  CL_AMS_NODE_CONFIG_NODE_DEPENDENT_LIST ,
300  CL_AMS_NODE_CONFIG_NODE_DEPENDENCIES_LIST ,
301  CL_AMS_NODE_CONFIG_SU_LIST ,
302  CL_AMS_SG_CONFIG_SU_LIST ,
303  CL_AMS_SG_CONFIG_SI_LIST ,
304  CL_AMS_SU_CONFIG_COMP_LIST ,
305  CL_AMS_SI_CONFIG_SU_RANK_LIST ,
306  CL_AMS_SI_CONFIG_SI_DEPENDENTS_LIST ,
307  CL_AMS_SI_CONFIG_SI_DEPENDENCIES_LIST ,
308  CL_AMS_SI_CONFIG_CSI_LIST ,
309  CL_AMS_CSI_CONFIG_NVP_LIST ,
310  CL_AMS_CSI_CONFIG_CSI_DEPENDENTS_LIST ,
311  CL_AMS_CSI_CONFIG_CSI_DEPENDENCIES_LIST ,
312  CL_AMS_CONFIG_LIST_END ,
313  /*
314  * Status lists
315  */
316 
317  CL_AMS_SG_STATUS_INSTANTIABLE_SU_LIST ,
318  CL_AMS_SG_STATUS_INSTANTIATED_SU_LIST ,
319  CL_AMS_SG_STATUS_IN_SERVICE_SPARE_SU_LIST ,
320  CL_AMS_SG_STATUS_ASSIGNED_SU_LIST ,
321  CL_AMS_SG_STATUS_FAULTY_SU_LIST ,
322  CL_AMS_SU_STATUS_SI_LIST ,
323  CL_AMS_SI_STATUS_SU_LIST ,
324  CL_AMS_COMP_STATUS_CSI_LIST ,
325  CL_AMS_CSI_STATUS_PG_LIST ,
326 
327  /*
328  * Start of entity all list types.
329  */
330  CL_AMS_ENTITY_LIST_ALL_START ,
331 
332  CL_AMS_SG_LIST ,
333  CL_AMS_SI_LIST ,
334  CL_AMS_NODE_LIST ,
335  CL_AMS_SU_LIST ,
336  CL_AMS_COMP_LIST ,
337  CL_AMS_CSI_LIST ,
338  /*
339  * End of entity all list types.
340  */
341  CL_AMS_ENTITY_LIST_ALL_END ,
342 
343  /* Internal entity list types.*/
344  CL_AMS_CSI_PGTRACK_CLIENT_LIST,
345 
346  CL_AMS_SU_STATUS_SI_EXTENDED_LIST ,
347 
348  CL_AMS_SI_STATUS_SU_EXTENDED_LIST ,
349 
350  CL_AMS_END_LIST ,
351 
352 }ClAmsEntityListTypeT;
353 
354 
355 typedef ClRcT (*ClAmsEntityRefCallbackT)(
356  ClAmsEntityRefT *entityRef,
357  ClAmsEntityListTypeT listName);
358 
363 typedef struct
364 {
367  ClUint32T configSize;
369  ClUint32T methodSize;
370  ClUint32T entitySize;
372 
373 /******************************************************************************
374  * AMS NODE
375  *****************************************************************************/
376 
380 typedef struct
381 {
384  ClAmsAdminStateT adminState;
385  ClUint32T id;
386  ClAmsNodeClassT classType;
388  ClBoolT isSwappable;
389  ClBoolT isRestartable;
390  ClBoolT autoRepair;
391  ClBoolT isASPAware;
393  ClUint32T suFailoverCountMax;
394  ClAmsEntityListT nodeDependentsList;
395  ClAmsEntityListT nodeDependenciesList;
396  ClAmsEntityListT suList;
398 
402 typedef struct
403 {
404  ClAmsEntityStatusT entity;
406  ClAmsPresenceStateT presenceState;
407  ClAmsOperStateT operState;
408  ClAmsNodeClusterMemberT isClusterMember;
409  ClBoolT wasMemberBefore;
410  ClAmsLocalRecoveryT recovery;
411  ClUint32T alarmHandle;
412  ClUint32T suFailoverCount;
413  ClAmsEntityTimerT suFailoverTimer;
414  ClUint32T numInstantiatedSUs;
415  ClUint32T numAssignedSUs;
417 
418 typedef struct
419 {
420  ClAmsEntityMethodsT entity; /* base methods */
421 
422  ClAmsEntityTimerCallbackT suFailoverTimeout; /* call this on timeout */
423 } ClAmsNodeMethodsT;
424 
425 typedef struct
426 {
427  ClAmsNodeConfigT config;
428  ClAmsNodeStatusT status;
429  ClAmsNodeMethodsT methods;
430 } ClAmsNodeT;
431 
432 /******************************************************************************
433  * AMS APPLICATION
434  *****************************************************************************/
435 
436 typedef struct
437 {
438  ClAmsEntityConfigT entity; /* base class */
439 } ClAmsAppConfigT;
440 
441 typedef struct
442 {
443  ClAmsEntityStatusT entity; /* base class */
444 } ClAmsAppStatusT;
445 
446 typedef struct
447 {
448  ClAmsEntityMethodsT entity; /* base methods */
449 } ClAmsAppMethodsT;
450 
451 typedef struct
452 {
453  ClAmsAppConfigT config;
454  ClAmsAppStatusT status;
455  ClAmsAppMethodsT methods;
456 } ClAmsAppT;
457 
458 /******************************************************************************
459  * AMS SERVICE GROUP
460  *****************************************************************************/
461 
465 typedef struct
466 {
469  ClAmsAdminStateT adminState;
470  ClAmsSGRedundancyModelT redundancyModel;
471  ClAmsSGLoadingStrategyT loadingStrategy;
472  ClBoolT failbackOption;
473  ClBoolT autoRepair;
475  ClUint32T numPrefActiveSUs;
476  ClUint32T numPrefStandbySUs;
478  ClUint32T numPrefAssignedSUs;
480  ClUint32T maxActiveSIsPerSU;
481  ClUint32T maxStandbySIsPerSU;
485  ClUint32T suRestartCountMax;
487  ClUint32T alpha;
488  ClBoolT autoAdjust;
490  ClBoolT reductionProcedure; /*enable reduction procedure*/
491  ClAmsEntityRefT parentApp;
492  ClUint32T maxFailovers; /* max failovers configured for the SG*/
493  ClTimeT failoverDuration; /* failover protection duration*/
494  ClUint32T beta;
495  ClAmsEntityListT suList;
496  ClAmsEntityListT siList;
498 
499 typedef ClAmsSGConfigT VDECL_VER(ClAmsSGConfigT, 4, 1, 0);
500 typedef ClAmsSGConfigT VDECL_VER(ClAmsSGConfigT, 5, 0, 0);
501 
502 typedef struct ClAmsSGFailoverHistoryKey
503 {
504  ClAmsEntityT entity;
505  ClUint32T index;
506 }ClAmsSGFailoverHistoryKeyT;
507 
508 typedef struct ClAmsSGFailoverHistory
509 {
510  ClListHeadT list;
511  ClAmsEntityT entity;
512  ClUint32T index;
513  ClTimerHandleT timer;
514  ClUint32T numFailovers;
515 }ClAmsSGFailoverHistoryT;
516 
520 typedef struct
521 {
523  ClBoolT isStarted;
524  ClAmsEntityTimerT instantiateTimer;
525  ClAmsEntityTimerT adjustTimer;
526  ClAmsEntityTimerT adjustProbationTimer; /*** adjust probation timer*/
527  ClAmsEntityTimerT assignmentTimer;
528  ClAmsEntityListT instantiableSUList;
529  ClAmsEntityListT instantiatedSUList;
530  ClAmsEntityListT inserviceSpareSUList;
531  ClAmsEntityListT assignedSUList;
532  ClAmsEntityListT faultySUList;
535  ClUint32T numCurrActiveSUs;
536  ClUint32T numCurrStandbySUs;
537  ClUint32T failoverHistoryIndex;
538  ClInt32T failoverHistoryCount; /*present count of failover history entries*/
539  ClListHeadT failoverHistory;
541 
542 typedef ClAmsSGStatusT VDECL_VER(ClAmsSGStatusT, 4, 1, 0);
543 
544 typedef struct
545 {
546  ClAmsEntityMethodsT entity; /* base methods */
547 
548  ClAmsEntityTimerCallbackT instantiateTimeout;
549  ClAmsEntityTimerCallbackT adjustTimeout;
550  ClAmsEntityTimerCallbackT adjustProbationTimeout;
551 } ClAmsSGMethodsT;
552 
553 typedef struct
554 {
555  ClAmsSGConfigT config;
556  ClAmsSGStatusT status;
557  ClAmsSGMethodsT methods;
558 } ClAmsSGT;
559 
560 typedef ClAmsSGT VDECL_VER(ClAmsSGT, 4, 1, 0);
561 typedef ClAmsSGT VDECL_VER(ClAmsSGT, 5, 0, 0);
562 
563 /******************************************************************************
564  * AMS SERVICE UNIT
565  *****************************************************************************/
566 
574 typedef struct
575 {
576  ClAmsEntityRefT entityRef;
577  ClAmsHAStateT haState;
578  ClUint32T numActiveCSIs;
579  ClUint32T numStandbyCSIs;
580  ClUint32T numQuiescedCSIs;
581  ClUint32T numQuiescingCSIs;
582  ClUint32T rank;
583 } ClAmsSUSIRefT;
584 
585 typedef struct
586 {
587  ClAmsEntityRefT entityRef;
588  ClAmsHAStateT haState;
589  ClUint32T numActiveCSIs;
590  ClUint32T numStandbyCSIs;
591  ClUint32T numQuiescedCSIs;
592  ClUint32T numQuiescingCSIs;
593  ClUint32T numCSIs; /* num configured csis in this si*/
594  ClUint32T rank;
595  ClUint32T pendingInvocations; /* number of pending invocations for this si*/
596 } ClAmsSUSIExtendedRefT;
597 
598 
602 typedef struct
603 {
606  ClAmsAdminStateT adminState;
607  ClUint32T rank;
608  ClUint32T numComponents;
610  ClBoolT isRestartable;
612  ClBoolT isContainerSU;
613  /* not used for now */
614  ClAmsEntityListT compList;
615  ClAmsEntityRefT parentSG;
616  ClAmsEntityRefT parentNode;
618 
622 typedef struct
623 {
626  ClAmsPresenceStateT presenceState;
627  ClAmsOperStateT operState;
628  ClAmsReadinessStateT readinessState;
629  ClAmsLocalRecoveryT recovery;
630  ClUint32T numActiveSIs;
631  ClUint32T numStandbySIs;
632  ClUint32T numQuiescedSIs;
633  ClUint32T compRestartCount;
634  ClAmsEntityTimerT compRestartTimer;
635  ClUint32T suRestartCount;
636  ClAmsEntityTimerT suRestartTimer;
637  ClAmsEntityTimerT suProbationTimer;
638  ClAmsEntityTimerT suAssignmentTimer;
640  ClUint32T numPIComp;
641  ClUint32T instantiateLevel;
642  ClUint32T numWaitAdjustments;
643  ClUint32T numDelayAssignments;
644  ClAmsEntityListT siList;
646 
647 typedef struct
648 {
649  ClAmsEntityMethodsT entity;
651  ClAmsEntityTimerCallbackT suRestartTimeout; /* Fn to call */
652  ClAmsEntityTimerCallbackT compRestartTimeout; /* Fn to call */
653  ClAmsEntityTimerCallbackT suProbationTimeout;
654  ClAmsEntityTimerCallbackT suAssignmentTimeout;
655 } ClAmsSUMethodsT;
656 
657 typedef struct
658 {
659  ClAmsSUConfigT config;
660  ClAmsSUStatusT status;
661  ClAmsSUMethodsT methods;
662 } ClAmsSUT;
663 
664 /******************************************************************************
665  * AMS SERVICE INSTANCE
666  *****************************************************************************/
667 
676 typedef struct
677 {
678  ClAmsEntityRefT entityRef;
679  ClUint32T rank;
680  ClAmsHAStateT haState;
681 } ClAmsSISURefT;
682 
683 typedef struct
684 {
685  ClAmsEntityRefT entityRef;
686  ClUint32T rank;
687  ClAmsHAStateT haState;
688  ClUint32T pendingInvocations; /* pending invocations against this SU */
689 } ClAmsSISUExtendedRefT;
690 
694 typedef struct
695 {
698  ClAmsAdminStateT adminState;
699  ClUint32T rank;
700  ClUint32T numCSIs;
702  ClUint32T standbyAssignmentOrder; /*standby assignment order for CSI dep.*/
703  ClAmsEntityRefT parentSG;
704  ClAmsEntityListT suList;
705  ClAmsEntityListT siDependentsList;
706  ClAmsEntityListT siDependenciesList;
707  ClAmsEntityListT csiList;
709 
710 
714 typedef struct
715 {
718  ClAmsOperStateT operState;
721  ClAmsEntityListT suList;
723 
724 typedef struct
725 {
726  ClAmsEntityMethodsT entity; /* base methods */
727 } ClAmsSIMethodsT;
728 
729 typedef struct
730 {
731  ClAmsSIConfigT config;
732  ClAmsSIStatusT status;
733  ClAmsSIMethodsT methods;
734 } ClAmsSIT;
735 
736 /******************************************************************************
737  * AMS COMPONENT
738  *****************************************************************************/
739 
740 typedef struct
741 {
742  ClAmsEntityRefT entityRef;
743  ClAmsHAStateT haState;
744  ClAmsCSITransitionDescriptorT tdescriptor;
745  ClUint32T rank;
747  ClAmsEntityT *activeComp;
748  ClUint16T pendingOp;
749 } ClAmsCompCSIRefT;
750 
751 typedef struct
752 {
753  ClTimeT instantiate;
754  ClTimeT terminate;
755  ClTimeT cleanup;
756  ClTimeT amStart;
757  ClTimeT amStop;
758  ClTimeT quiescingComplete;
759  ClTimeT csiSet;
760  ClTimeT csiRemove;
761  ClTimeT proxiedCompInstantiate;
762  ClTimeT proxiedCompCleanup;
763  ClTimeT instantiateDelay;
764 } ClAmsCompTimerDurationsT;
765 
766 typedef struct
767 {
768  ClAmsEntityTimerT instantiate;
769  ClAmsEntityTimerT terminate;
770  ClAmsEntityTimerT cleanup;
771  ClAmsEntityTimerT amStart;
772  ClAmsEntityTimerT amStop;
773  ClAmsEntityTimerT quiescingComplete;
774  ClAmsEntityTimerT csiSet;
775  ClAmsEntityTimerT csiRemove;
776  ClAmsEntityTimerT proxiedCompInstantiate;
777  ClAmsEntityTimerT proxiedCompCleanup;
778  ClAmsEntityTimerT instantiateDelay;
779 } ClAmsCompTimersT;
780 
784 typedef struct
785 {
790  ClAmsCompCapModelT capabilityModel;
791  ClAmsCompPropertyT property;
792  ClBoolT isRestartable;
794  ClUint32T instantiateLevel;
795  ClUint32T numMaxInstantiate;
796  ClUint32T numMaxInstantiateWithDelay;
797  ClUint32T numMaxTerminate;
798  ClUint32T numMaxAmStart;
799  ClUint32T numMaxAmStop;
800  ClUint32T numMaxActiveCSIs;
801  ClUint32T numMaxStandbyCSIs;
802  ClAmsCompTimerDurationsT timeouts;
803  ClAmsLocalRecoveryT recoveryOnTimeout;
804  ClAmsEntityRefT parentSU;
805  ClCharT instantiateCommand[CL_MAX_NAME_LENGTH];
806  /*
807  * No need to add terminate and cleanup as those aren't supported
808  */
810 
814 typedef struct
815 {
817  ClAmsPresenceStateT presenceState;
818  ClAmsOperStateT operState;
819  ClAmsReadinessStateT readinessState;
820  ClAmsLocalRecoveryT recovery;
821  ClUint32T alarmHandle;
822  ClUint32T numActiveCSIs;
823  ClUint32T numStandbyCSIs;
824  ClUint32T numQuiescingCSIs;
825  ClUint32T numQuiescedCSIs;
826  ClUint32T restartCount;
827  ClUint32T failoverCount;
828  ClUint32T instantiateCount;
830  ClUint32T amStartCount;
831  ClUint32T amStopCount;
832  ClUint64T instantiateCookie;
833  ClAmsCompTimersT timers;
834  ClAmsEntityT *proxyComp;
835  ClAmsEntityListT csiList;
836  ClAmsSAClientCallbacksT clientCallbacks;
838 
839 typedef ClAmsCompStatusT VDECL_VER(ClAmsCompStatusT, 5, 1, 0);
840 
841 typedef struct
842 {
843  ClAmsEntityMethodsT entity;
844 
845  ClAmsEntityTimerCallbackT instantiateTimeout;
846  ClAmsEntityTimerCallbackT terminateTimeout;
847  ClAmsEntityTimerCallbackT cleanupTimeout;
848  ClAmsEntityTimerCallbackT amStartTimeout;
849  ClAmsEntityTimerCallbackT amStopTimeout;
850  ClAmsEntityTimerCallbackT quiescingCompleteTimeout;
851  ClAmsEntityTimerCallbackT csiSetTimeout;
852  ClAmsEntityTimerCallbackT csiRemoveTimeout;
853  ClAmsEntityTimerCallbackT proxiedCompInstantiateTimeout;
854  ClAmsEntityTimerCallbackT proxiedCompCleanupTimeout;
855  ClAmsEntityTimerCallbackT instantiateDelayTimeout;
856 } ClAmsCompMethodsT;
857 
858 typedef struct
859 {
860  ClAmsCompConfigT config;
861  ClAmsCompStatusT status;
862  ClAmsCompMethodsT methods;
863 } ClAmsCompT;
864 
865 typedef ClAmsCompT VDECL_VER(ClAmsCompT, 5, 1, 0);
866 
867 /******************************************************************************
868  * AMS COMPONENT SERVICE INSTANCE
869  *****************************************************************************/
870 
871 /*
872  * This structure is used as the list element in pgList
873  */
874 
875 typedef struct
876 {
877  ClAmsEntityRefT entityRef;
878  ClAmsHAStateT haState;
879  ClUint32T rank;
881 } ClAmsCSICompRefT;
882 
883 typedef struct
884 {
885  ClIocAddressT address;
886  ClAmsPGTrackFlagT trackFlags;
887  ClCpmHandleT cpmHandle;
888 } ClAmsCSIPGTrackClientT;
889 
890 
897 typedef struct
898 {
903 
907 typedef struct
908 {
912  ClBoolT isProxyCSI;
915  ClUint32T rank;
917  ClAmsEntityRefT parentSI;
918  ClAmsEntityListT csiDependentsList; /* list of dependents of this CSI*/
919  ClAmsEntityListT csiDependenciesList; /* dependencies of this CSI */
920 } ClAmsCSIConfigT;
921 
925 typedef struct
926 {
928  ClAmsEntityListT pgList;
931 
932 typedef struct
933 {
934  ClAmsEntityMethodsT entity;
935 } ClAmsCSIMethodsT;
936 
937 typedef struct
938 {
939  ClAmsCSIConfigT config;
940  ClAmsCSIStatusT status;
941  ClAmsCSIMethodsT methods;
942 } ClAmsCSIT;
943 
944 typedef struct ClAmsSUReassignOp
945 {
946  ClInt32T numSIs;
947  ClAmsEntityT *sis;
948 }ClAmsSUReassignOpT;
949 
950 typedef struct ClAmsSIReassignEntry
951 {
952  ClAmsSIT *si;
953  ClListHeadT list;
954 }ClAmsSIReassignEntryT;
955 
956 #define CL_AMS_TIMER_CONVERT(x,y) \
957 { \
958  (y).tsSec = (x) / 1000; \
959  (y).tsMilliSec = (x) % 1000; \
960 }
961 
962 /******************************************************************************
963  * Macros and functions for validating entities
964  *****************************************************************************/
965 
966 #define AMS_VALIDATE_ADMINSTATE(x) \
967 { \
968  if ( ((x)->config.adminState < 1) || \
969  ((x)->config.adminState > 4) ) \
970  { \
971  AMS_LOG(CL_DEBUG_ERROR, \
972  ("Entity[%s] fails adminState validation.\n", \
973  (x)->config.entity.name.value)); \
974  return CL_AMS_ERR_INVALID_ENTITY; \
975  } \
976 }
977 
978 #define AMS_VALIDATE_OPERSTATE(x) \
979 { \
980  if ( ((x)->status.operState < 1) || \
981  ((x)->status.operState > 2) ) \
982  { \
983  AMS_LOG(CL_DEBUG_ERROR, \
984  ("Entity[%s] fails operState validation.\n", \
985  (x)->config.entity.name.value)); \
986  } \
987 }
988 
989 #define AMS_VALIDATE_PRESENCESTATE(x) \
990 { \
991  if ( ((x)->status.presenceState < 1) || \
992  ((x)->status.presenceState > 10) ) \
993  { \
994  AMS_LOG(CL_DEBUG_ERROR, \
995  ("Entity[%s] fails presenceState validation.\n", \
996  (x)->config.entity.name.value)); \
997  } \
998 }
999 
1000 #define AMS_VALIDATE_READINESSSTATE(x) \
1001 { \
1002  if ( ((x)->status.readinessState < 1) || \
1003  ((x)->status.readinessState > 10) ) \
1004  { \
1005  AMS_LOG(CL_DEBUG_ERROR, \
1006  ("Entity[%s] fails readinessState validation.\n", \
1007  (x)->config.entity.name.value)); \
1008  } \
1009 }
1010 
1011 #define AMS_VALIDATE_NODE_CLASS_TYPE(x) \
1012 { \
1013  if ( ((x)->config.classType) < CL_AMS_NODE_CLASS_NONE || \
1014  ((x)->config.classType) > CL_AMS_NODE_CLASS_D ) \
1015  { \
1016  AMS_LOG(CL_DEBUG_ERROR, \
1017  ("Entity[%s] fails node class type validation.\n", \
1018  (x)->config.entity.name.value)); \
1019  return CL_AMS_ERR_INVALID_ENTITY; \
1020  } \
1021 }
1022 
1023 #define AMS_VALIDATE_COMP_CAPABILITY_MODEL(x) \
1024 { \
1025  if ( ((x)->config.capabilityModel < \
1026  CL_AMS_COMP_CAP_X_ACTIVE_AND_Y_STANDBY) || \
1027  ((x)->config.capabilityModel > \
1028  CL_AMS_COMP_CAP_NON_PREINSTANTIABLE) ) \
1029  { \
1030  AMS_LOG(CL_DEBUG_ERROR, \
1031  ("Entity[%s] fails comp capability model validation.\n",\
1032  (x)->config.entity.name.value)); \
1033  return CL_AMS_ERR_INVALID_ENTITY; \
1034  } \
1035 }
1036 
1037 
1038 #define AMS_VALIDATE_COMP_RECOVERY_ON_ERROR(x) \
1039 { \
1040  if ( ((x)->config.recoveryOnTimeout < \
1041  CL_AMS_RECOVERY_NO_RECOMMENDATION) || \
1042  ((x)->config.recoveryOnTimeout > \
1043  CL_AMS_RECOVERY_SU_RESTART) ) \
1044  { \
1045  AMS_LOG(CL_DEBUG_ERROR, \
1046  ("Entity[%s] fails comp recoveryOnError validation.\n", \
1047  (x)->config.entity.name.value)); \
1048  return CL_AMS_ERR_INVALID_ENTITY; \
1049  } \
1050 }
1051 
1052 
1053 
1054 #define AMS_VALIDATE_COMP_PROPERTY(x) \
1055 { \
1056  if ( ((x)->config.property < CL_AMS_COMP_PROPERTY_SA_AWARE ) || \
1057  ((x)->config.property > \
1058  CL_AMS_COMP_PROPERTY_NON_PROXIED_NON_PREINSTANTIABLE )) \
1059  { \
1060  AMS_LOG(CL_DEBUG_ERROR, \
1061  ("Entity[%s] fails comp property validation.\n", \
1062  (x)->config.entity.name.value)); \
1063  return CL_AMS_ERR_INVALID_ENTITY; \
1064  } \
1065 }
1066 
1067 
1068 #define AMS_VALIDATE_BOOL_VALUE(x) \
1069 { \
1070  if ( ! ( (x) == CL_TRUE || (x) == CL_FALSE) ) \
1071  { \
1072  AMS_LOG(CL_DEBUG_ERROR, \
1073  ("Expecting boolean value, received value %d \n", \
1074  x)); \
1075  return CL_ERR_INVALID_PARAMETER; \
1076  } \
1077 }
1078 
1079 #define AMS_VALIDATE_RESTART_COUNT(x) do { \
1080  if( !(x) ) \
1081  { \
1082  AMS_LOG(CL_DEBUG_ERROR,("Expecting non-zero restart count\n")); \
1083  return CL_ERR_INVALID_PARAMETER; \
1084  } \
1085 }while(0)
1086 
1087 
1088 #define AMS_VALIDATE_RESTART_DURATION(x) do { \
1089  if( !(x) ) \
1090  { \
1091  AMS_LOG(CL_DEBUG_ERROR,("Expecting non-zero restart duration\n")); \
1092  return CL_ERR_INVALID_PARAMETER; \
1093  } \
1094 }while(0)
1095 
1096 #ifdef __cplusplus
1097 }
1098 #endif
1099 
1100 #endif /* _CL_AMS_ENTITIES_H_ */

Generated on Tue Jan 10 10:29:15 PST 2012 for OpenClovis SDK using Doxygen