LCOV - code coverage report
Current view: top level - common - resources.c (source / functions) Hit Total Coverage
Test: Pacemaker code coverage Lines: 4 15 26.7 %
Date: 2024-05-07 11:09:47 Functions: 2 3 66.7 %

          Line data    Source code
       1             : /*
       2             :  * Copyright 2024 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             : #include <crm_internal.h>
      11             : 
      12             : #include <stdio.h>      // NULL
      13             : #include <stdbool.h>    // bool, false
      14             : 
      15             : #include <crm/common/scheduler.h>
      16             : #include <crm/common/scheduler_internal.h>
      17             : 
      18             : /*!
      19             :  * \internal
      20             :  * \brief Get a resource's ID
      21             :  *
      22             :  * \param[in] rsc  Resource to check
      23             :  *
      24             :  * \return ID of \p rsc (or NULL if \p rsc is NULL)
      25             :  */
      26             : const char *
      27           2 : pcmk_resource_id(const pcmk_resource_t *rsc)
      28             : {
      29           2 :     return (rsc == NULL)? NULL : rsc->id;
      30             : }
      31             : 
      32             : /*!
      33             :  * \internal
      34             :  * \brief Check whether a resource is managed by the cluster
      35             :  *
      36             :  * \param[in] rsc  Resource to check
      37             :  *
      38             :  * \return true if \p rsc is managed, otherwise false
      39             :  */
      40             : bool
      41           3 : pcmk_resource_is_managed(const pcmk_resource_t *rsc)
      42             : {
      43           3 :     return (rsc == NULL)? false : pcmk_is_set(rsc->flags, pcmk_rsc_managed);
      44             : }
      45             : 
      46             : /*!
      47             :  * \brief Get readable description of a multiply-active recovery type
      48             :  *
      49             :  * \param[in] recovery  Recovery type
      50             :  *
      51             :  * \return Static string describing \p recovery
      52             :  */
      53             : const char *
      54           0 : pcmk_multiply_active_text(enum rsc_recovery_type recovery)
      55             : {
      56           0 :     switch (recovery) {
      57           0 :         case pcmk_multiply_active_stop:
      58           0 :             return "shutting it down";
      59           0 :         case pcmk_multiply_active_restart:
      60           0 :             return "attempting recovery";
      61           0 :         case pcmk_multiply_active_block:
      62           0 :             return "waiting for an administrator";
      63           0 :         case pcmk_multiply_active_unexpected:
      64           0 :             return "stopping unexpected instances";
      65             :     }
      66           0 :     return "Unknown";
      67             : }

Generated by: LCOV version 1.14