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

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