root/include/crm/services_compat.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. services_lrm_status_str
  2. services_get_ocf_exitcode

   1 /*
   2  * Copyright 2010-2021 the Pacemaker project contributors
   3  *
   4  * The version control history for this file may have further details.
   5  *
   6  * This source code is licensed under the GNU Lesser General Public License
   7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
   8  */
   9 
  10 #ifndef PCMK__SERVICES_COMPAT__H
  11 #  define PCMK__SERVICES_COMPAT__H
  12 
  13 #ifdef __cplusplus
  14 extern "C" {
  15 #endif
  16 
  17 /**
  18  * \file
  19  * \brief Deprecated services API
  20  * \ingroup core
  21  * \deprecated Do not include this header directly. The service APIs in this
  22  *             header, and the header itself, will be removed in a future
  23  *             release.
  24  */
  25 
  26 #include <crm/common/results.h>
  27 
  28 #  ifndef LSB_ROOT_DIR
  29      //! \deprecated Do not use
  30 #    define LSB_ROOT_DIR "/etc/init.d"
  31 #  endif
  32 
  33 //! \deprecated Use enum pcmk_exec_status instead
  34 enum op_status {
  35     PCMK_LRM_OP_UNKNOWN = PCMK_EXEC_UNKNOWN,
  36     PCMK_LRM_OP_PENDING = PCMK_EXEC_PENDING,
  37     PCMK_LRM_OP_DONE = PCMK_EXEC_DONE,
  38     PCMK_LRM_OP_CANCELLED = PCMK_EXEC_CANCELLED,
  39     PCMK_LRM_OP_TIMEOUT = PCMK_EXEC_TIMEOUT,
  40     PCMK_LRM_OP_NOTSUPPORTED = PCMK_EXEC_NOT_SUPPORTED,
  41     PCMK_LRM_OP_ERROR = PCMK_EXEC_ERROR,
  42     PCMK_LRM_OP_ERROR_HARD = PCMK_EXEC_ERROR_HARD,
  43     PCMK_LRM_OP_ERROR_FATAL = PCMK_EXEC_ERROR_FATAL,
  44     PCMK_LRM_OP_NOT_INSTALLED = PCMK_EXEC_NOT_INSTALLED,
  45     PCMK_LRM_OP_NOT_CONNECTED = PCMK_EXEC_NOT_CONNECTED,
  46     PCMK_LRM_OP_INVALID = PCMK_EXEC_INVALID,
  47 };
  48 
  49 //! \deprecated Use resources_action_create() instead
  50 svc_action_t *services_action_create(const char *name, const char *action,
  51                                      guint interval_ms, int timeout);
  52 
  53 //! \deprecated Use resources_list_agents() instead
  54 GList *services_list(void);
  55 
  56 //! \deprecated Use pcmk_exec_status_str() instead
  57 static inline const char *
  58 services_lrm_status_str(enum op_status status)
     /* [previous][next][first][last][top][bottom][index][help] */
  59 {
  60     return pcmk_exec_status_str((enum pcmk_exec_status) status);
  61 }
  62 
  63 //! \deprecated Use services_result2ocf() instead
  64 static inline enum ocf_exitcode
  65 services_get_ocf_exitcode(const char *action, int lsb_exitcode)
     /* [previous][next][first][last][top][bottom][index][help] */
  66 {
  67     /* For non-status actions, LSB and OCF share error code meaning <= 7 */
  68     if (action && strcmp(action, "status") && strcmp(action, "monitor")) {
  69         if ((lsb_exitcode < 0) || (lsb_exitcode > PCMK_LSB_NOT_RUNNING)) {
  70             return PCMK_OCF_UNKNOWN_ERROR;
  71         }
  72         return (enum ocf_exitcode)lsb_exitcode;
  73     }
  74 
  75     /* status has different return codes */
  76     switch (lsb_exitcode) {
  77         case PCMK_LSB_STATUS_OK:
  78             return PCMK_OCF_OK;
  79         case PCMK_LSB_STATUS_NOT_INSTALLED:
  80             return PCMK_OCF_NOT_INSTALLED;
  81         case PCMK_LSB_STATUS_INSUFFICIENT_PRIV:
  82             return PCMK_OCF_INSUFFICIENT_PRIV;
  83         case PCMK_LSB_STATUS_VAR_PID:
  84         case PCMK_LSB_STATUS_VAR_LOCK:
  85         case PCMK_LSB_STATUS_NOT_RUNNING:
  86             return PCMK_OCF_NOT_RUNNING;
  87     }
  88     return PCMK_OCF_UNKNOWN_ERROR;
  89 }
  90 
  91 #ifdef __cplusplus
  92 }
  93 #endif
  94 
  95 #endif

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