summaryrefslogtreecommitdiffstats
path: root/include/crm/common/scheduler_internal.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/crm/common/scheduler_internal.h118
1 files changed, 91 insertions, 27 deletions
diff --git a/include/crm/common/scheduler_internal.h b/include/crm/common/scheduler_internal.h
index 1f1da9f..c990795 100644
--- a/include/crm/common/scheduler_internal.h
+++ b/include/crm/common/scheduler_internal.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2004-2023 the Pacemaker project contributors
+ * Copyright 2004-2024 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
@@ -8,43 +8,29 @@
*/
#ifndef PCMK__CRM_COMMON_SCHEDULER_INTERNAL__H
-# define PCMK__CRM_COMMON_SCHEDULER_INTERNAL__H
+#define PCMK__CRM_COMMON_SCHEDULER_INTERNAL__H
#include <crm/common/action_relation_internal.h>
+#include <crm/common/actions_internal.h>
+#include <crm/common/attrs_internal.h>
+#include <crm/common/bundles_internal.h>
#include <crm/common/clone_internal.h>
#include <crm/common/digests_internal.h>
#include <crm/common/failcounts_internal.h>
#include <crm/common/group_internal.h>
+#include <crm/common/history_internal.h>
+#include <crm/common/location_internal.h>
+#include <crm/common/nodes_internal.h>
+#include <crm/common/primitive_internal.h>
+#include <crm/common/remote_internal.h>
+#include <crm/common/resources_internal.h>
#include <crm/common/roles_internal.h>
+#include <crm/common/rules_internal.h>
#ifdef __cplusplus
extern "C" {
#endif
-/* Some warnings are too noisy when logged every time a give function is called
- * (for example, using a deprecated feature). As an alternative, we allow
- * warnings to be logged once per scheduler sequence (transition). Each of those
- * warnings needs a flag defined here.
- */
-enum pcmk__sched_warnings {
- pcmk__wo_blind = (1 << 0),
- pcmk__wo_restart_type = (1 << 1),
- pcmk__wo_role_after = (1 << 2),
- pcmk__wo_poweroff = (1 << 3),
- pcmk__wo_require_all = (1 << 4),
- pcmk__wo_order_score = (1 << 5),
- pcmk__wo_neg_threshold = (1 << 6),
- pcmk__wo_remove_after = (1 << 7),
- pcmk__wo_ping_node = (1 << 8),
- pcmk__wo_order_inst = (1 << 9),
- pcmk__wo_coloc_inst = (1 << 10),
- pcmk__wo_group_order = (1 << 11),
- pcmk__wo_group_coloc = (1 << 12),
- pcmk__wo_upstart = (1 << 13),
- pcmk__wo_nagios = (1 << 14),
- pcmk__wo_set_ordering = (1 << 15),
-};
-
enum pcmk__check_parameters {
/* Clear fail count if parameters changed for un-expired start or monitor
* last_failure.
@@ -57,9 +43,87 @@ enum pcmk__check_parameters {
pcmk__check_active,
};
-// Group of enum pcmk__sched_warnings flags for warnings we want to log once
+// Group of enum pcmk__warnings flags for warnings we want to log once
extern uint32_t pcmk__warnings;
+/*!
+ * \internal
+ * \brief Log a resource-tagged message at info severity
+ *
+ * \param[in] rsc Tag message with this resource's ID
+ * \param[in] fmt... printf(3)-style format and arguments
+ */
+#define pcmk__rsc_info(rsc, fmt, args...) \
+ crm_log_tag(LOG_INFO, ((rsc) == NULL)? "<NULL>" : (rsc)->id, (fmt), ##args)
+
+/*!
+ * \internal
+ * \brief Log a resource-tagged message at debug severity
+ *
+ * \param[in] rsc Tag message with this resource's ID
+ * \param[in] fmt... printf(3)-style format and arguments
+ */
+#define pcmk__rsc_debug(rsc, fmt, args...) \
+ crm_log_tag(LOG_DEBUG, ((rsc) == NULL)? "<NULL>" : (rsc)->id, (fmt), ##args)
+
+/*!
+ * \internal
+ * \brief Log a resource-tagged message at trace severity
+ *
+ * \param[in] rsc Tag message with this resource's ID
+ * \param[in] fmt... printf(3)-style format and arguments
+ */
+#define pcmk__rsc_trace(rsc, fmt, args...) \
+ crm_log_tag(LOG_TRACE, ((rsc) == NULL)? "<NULL>" : (rsc)->id, (fmt), ##args)
+
+/*!
+ * \internal
+ * \brief Log an error and remember that current scheduler input has errors
+ *
+ * \param[in] fmt... printf(3)-style format and arguments
+ */
+#define pcmk__sched_err(fmt...) do { \
+ was_processing_error = TRUE; \
+ crm_err(fmt); \
+ } while (0)
+
+/*!
+ * \internal
+ * \brief Log a warning and remember that current scheduler input has warnings
+ *
+ * \param[in] fmt... printf(3)-style format and arguments
+ */
+#define pcmk__sched_warn(fmt...) do { \
+ was_processing_warning = TRUE; \
+ crm_warn(fmt); \
+ } while (0)
+
+/*!
+ * \internal
+ * \brief Set scheduler flags
+ *
+ * \param[in,out] scheduler Scheduler data
+ * \param[in] flags_to_set Group of enum pcmk_scheduler_flags to set
+ */
+#define pcmk__set_scheduler_flags(scheduler, flags_to_set) do { \
+ (scheduler)->flags = pcmk__set_flags_as(__func__, __LINE__, \
+ LOG_TRACE, "Scheduler", crm_system_name, \
+ (scheduler)->flags, (flags_to_set), #flags_to_set); \
+ } while (0)
+
+/*!
+ * \internal
+ * \brief Clear scheduler flags
+ *
+ * \param[in,out] scheduler Scheduler data
+ * \param[in] flags_to_clear Group of enum pcmk_scheduler_flags to clear
+ */
+#define pcmk__clear_scheduler_flags(scheduler, flags_to_clear) do { \
+ (scheduler)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
+ LOG_TRACE, "Scheduler", crm_system_name, \
+ (scheduler)->flags, (flags_to_clear), #flags_to_clear); \
+ } while (0)
+
#ifdef __cplusplus
}
#endif