root/include/crm/pengine/common.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. recovery2text

   1 /* 
   2  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
   3  * 
   4  * This program is free software; you can redistribute it and/or
   5  * modify it under the terms of the GNU Lesser General Public
   6  * License as published by the Free Software Foundation; either
   7  * version 2 of the License, or (at your option) any later version.
   8  * 
   9  * This software is distributed in the hope that it will be useful,
  10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12  * General Public License for more details.
  13  * 
  14  * You should have received a copy of the GNU Lesser General Public
  15  * License along with this library; if not, write to the Free Software
  16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  17  */
  18 #ifndef PE_COMMON__H
  19 #  define PE_COMMON__H
  20 #  include <glib.h>
  21 
  22 extern gboolean was_processing_error;
  23 extern gboolean was_processing_warning;
  24 
  25 /* order is significant here
  26  * items listed in order of accending severeness
  27  * more severe actions take precedent over lower ones
  28  */
  29 enum action_fail_response {
  30     action_fail_ignore,
  31     action_fail_recover,
  32     action_fail_migrate,        /* recover by moving it somewhere else */
  33     action_fail_block,
  34     action_fail_stop,
  35     action_fail_standby,
  36     action_fail_fence,
  37     action_fail_restart_container,
  38     /* This is reserved for internal use for baremetal remote node connection
  39      * resources. This fail action means
  40      * 1. If stonith is enabled, fence the baremetal remote node
  41      * 2. stonith not enabled, attempt to recover the connection resources
  42      *
  43      * This response value gives us control of saying types of
  44      * connection resource failures result in fencing the remote node.
  45      * Example: recurring monitors failure should result in fencing.
  46      */
  47     action_fail_reset_remote,
  48 
  49 };
  50 
  51 /* the "done" action must be the "pre" action +1 */
  52 enum action_tasks {
  53     no_action,
  54     monitor_rsc,
  55     stop_rsc,
  56     stopped_rsc,
  57     start_rsc,
  58     started_rsc,
  59     action_notify,
  60     action_notified,
  61     action_promote,
  62     action_promoted,
  63     action_demote,
  64     action_demoted,
  65     shutdown_crm,
  66     stonith_node
  67 };
  68 
  69 enum rsc_recovery_type {
  70     recovery_stop_start,
  71     recovery_stop_only,
  72     recovery_block
  73 };
  74 
  75 enum rsc_start_requirement {
  76     rsc_req_nothing,            /* Allowed by custom_action() */
  77     rsc_req_quorum,             /* Enforced by custom_action() */
  78     rsc_req_stonith             /* Enforced by native_start_constraints() */
  79 };
  80 
  81 enum rsc_role_e {
  82     RSC_ROLE_UNKNOWN,
  83     RSC_ROLE_STOPPED,
  84     RSC_ROLE_STARTED,
  85     RSC_ROLE_SLAVE,
  86     RSC_ROLE_MASTER,
  87 };
  88 
  89 #  define RSC_ROLE_MAX  RSC_ROLE_MASTER+1
  90 
  91 #  define RSC_ROLE_UNKNOWN_S "Unknown"
  92 #  define RSC_ROLE_STOPPED_S "Stopped"
  93 #  define RSC_ROLE_STARTED_S "Started"
  94 #  define RSC_ROLE_SLAVE_S   "Slave"
  95 #  define RSC_ROLE_MASTER_S  "Master"
  96 
  97 enum pe_print_options {
  98     pe_print_log            = 0x0001,
  99     pe_print_html           = 0x0002,
 100     pe_print_ncurses        = 0x0004,
 101     pe_print_printf         = 0x0008,
 102     pe_print_dev            = 0x0010,
 103     pe_print_details        = 0x0020,
 104     pe_print_max_details    = 0x0040,
 105     pe_print_rsconly        = 0x0080,
 106     pe_print_ops            = 0x0100,
 107     pe_print_suppres_nl     = 0x0200,
 108     pe_print_xml            = 0x0400,
 109     pe_print_brief          = 0x0800,
 110     pe_print_pending        = 0x1000,
 111     pe_print_clone_details  = 0x2000,
 112     pe_print_clone_active   = 0x4000, // Print clone instances only if active
 113     pe_print_implicit       = 0x8000, // Print implicitly created resources
 114 };
 115 
 116 const char *task2text(enum action_tasks task);
 117 enum action_tasks text2task(const char *task);
 118 enum rsc_role_e text2role(const char *role);
 119 const char *role2text(enum rsc_role_e role);
 120 const char *fail2text(enum action_fail_response fail);
 121 
 122 const char *pe_pref(GHashTable * options, const char *name);
 123 void calculate_active_ops(GList * sorted_op_list, int *start_index, int *stop_index);
 124 
 125 static inline const char *
 126 recovery2text(enum rsc_recovery_type type)
     /* [previous][next][first][last][top][bottom][index][help] */
 127 {
 128     switch (type) {
 129         case recovery_stop_only:
 130             return "shutting it down";
 131         case recovery_stop_start:
 132             return "attempting recovery";
 133         case recovery_block:
 134             return "waiting for an administrator";
 135     }
 136     return "Unknown";
 137 }
 138 
 139 #endif

/* [previous][next][first][last][top][bottom][index][help] */