pacemaker  2.0.3-4b1f869f0f
Scalable High-Availability cluster resource manager
pcmk_sched_messages.c
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2019 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 General Public License version 2
7  * or later (GPLv2+) WITHOUT ANY WARRANTY.
8  */
9 
10 #include <crm_internal.h>
11 
12 #include <sys/param.h>
13 
14 #include <crm/crm.h>
15 #include <crm/cib.h>
16 #include <crm/msg_xml.h>
17 #include <crm/common/xml.h>
18 
19 #include <glib.h>
20 
21 #include <crm/pengine/status.h>
22 #include <pacemaker-internal.h>
23 #include <crm/common/ipcs.h>
24 
25 gboolean show_scores = FALSE;
27 gboolean show_utilization = FALSE;
29 
38 xmlNode *
39 pcmk__schedule_actions(pe_working_set_t *data_set, xmlNode *xml_input,
40  crm_time_t *now)
41 {
42  GListPtr gIter = NULL;
43  int rsc_log_level = LOG_INFO;
44 
45 /* pe_debug_on(); */
46 
47  CRM_ASSERT(xml_input || is_set(data_set->flags, pe_flag_have_status));
48 
49  if (is_set(data_set->flags, pe_flag_have_status) == FALSE) {
50  set_working_set_defaults(data_set);
51  data_set->input = xml_input;
52  data_set->now = now;
53 
54  } else {
55  crm_trace("Already have status - reusing");
56  }
57 
58  if (data_set->now == NULL) {
59  data_set->now = crm_time_new(NULL);
60  }
61 
62  crm_trace("Calculate cluster status");
63  stage0(data_set);
64 
65  if(is_not_set(data_set->flags, pe_flag_quick_location)) {
66  gIter = data_set->resources;
67  for (; gIter != NULL; gIter = gIter->next) {
68  resource_t *rsc = (resource_t *) gIter->data;
69 
70  if (is_set(rsc->flags, pe_rsc_orphan) && rsc->role == RSC_ROLE_STOPPED) {
71  continue;
72  }
73  rsc->fns->print(rsc, NULL, pe_print_log, &rsc_log_level);
74  }
75  }
76 
77  crm_trace("Applying placement constraints");
78  stage2(data_set);
79 
80  if(is_set(data_set->flags, pe_flag_quick_location)){
81  return NULL;
82  }
83 
84  crm_trace("Create internal constraints");
85  stage3(data_set);
86 
87  crm_trace("Check actions");
88  stage4(data_set);
89 
90  crm_trace("Allocate resources");
91  stage5(data_set);
92 
93  crm_trace("Processing fencing and shutdown cases");
94  stage6(data_set);
95 
96  crm_trace("Applying ordering constraints");
97  stage7(data_set);
98 
99  crm_trace("Create transition graph");
100  stage8(data_set);
101 
102  crm_trace("=#=#=#=#= Summary =#=#=#=#=");
103  crm_trace("\t========= Set %d (Un-runnable) =========", -1);
104  if (get_crm_log_level() >= LOG_TRACE) {
105  gIter = data_set->actions;
106  for (; gIter != NULL; gIter = gIter->next) {
107  action_t *action = (action_t *) gIter->data;
108 
109  if (is_set(action->flags, pe_action_optional) == FALSE
110  && is_set(action->flags, pe_action_runnable) == FALSE
111  && is_set(action->flags, pe_action_pseudo) == FALSE) {
112  log_action(LOG_TRACE, "\t", action, TRUE);
113  }
114  }
115  }
116 
117  return data_set->graph;
118 }
pe_rsc_orphan
#define pe_rsc_orphan
Definition: pe_types.h:224
pcmk__schedule_actions
xmlNode * pcmk__schedule_actions(pe_working_set_t *data_set, xmlNode *xml_input, crm_time_t *now)
Definition: pcmk_sched_messages.c:39
GListPtr
GList * GListPtr
Definition: crm.h:214
pe_working_set_s::input
xmlNode * input
Definition: pe_types.h:118
pe_working_set_s::now
crm_time_t * now
Definition: pe_types.h:119
pe_print_log
Definition: common.h:103
pe_working_set_s::resources
GListPtr resources
Definition: pe_types.h:139
ipcs.h
pacemaker-internal.h
msg_xml.h
RSC_ROLE_STOPPED
Definition: common.h:88
LOG_TRACE
#define LOG_TRACE
Definition: logging.h:26
stage8
gboolean stage8(pe_working_set_t *data_set)
Definition: pcmk_sched_allocate.c:2824
pe_flag_have_status
#define pe_flag_have_status
Definition: pe_types.h:107
pe_action_pseudo
Definition: pe_types.h:266
crm_trace
#define crm_trace(fmt, args...)
Definition: logging.h:247
pe_action_s::flags
enum pe_action_flags flags
Definition: pe_types.h:382
stage6
gboolean stage6(pe_working_set_t *data_set)
Definition: pcmk_sched_allocate.c:1526
stage4
gboolean stage4(pe_working_set_t *data_set)
Definition: pcmk_sched_allocate.c:1053
show_scores
gboolean show_scores
Definition: pcmk_sched_messages.c:25
utilization_log_level
int utilization_log_level
Definition: pcmk_sched_messages.c:28
pe_flag_quick_location
#define pe_flag_quick_location
Definition: pe_types.h:110
xml.h
Wrappers for and extensions to libxml2.
scores_log_level
int scores_log_level
Definition: pcmk_sched_messages.c:26
stage7
gboolean stage7(pe_working_set_t *data_set)
Definition: pcmk_sched_allocate.c:2714
log_action
void log_action(unsigned int log_level, const char *pre_text, action_t *action, gboolean details)
Definition: pcmk_sched_utils.c:290
pe_action_s
Definition: pe_types.h:369
stage0
gboolean stage0(pe_working_set_t *data_set)
Definition: pcmk_sched_allocate.c:898
show_utilization
gboolean show_utilization
Definition: pcmk_sched_messages.c:27
get_crm_log_level
unsigned int get_crm_log_level(void)
Definition: logging.c:979
resource_object_functions_s::print
void(* print)(pe_resource_t *, const char *, long, void *)
Definition: pe_types.h:50
pe_action_optional
Definition: pe_types.h:268
pe_working_set_s
Definition: pe_types.h:117
pe_working_set_s::actions
GListPtr actions
Definition: pe_types.h:145
cib.h
Cluster Configuration.
stage2
gboolean stage2(pe_working_set_t *data_set)
Definition: pcmk_sched_allocate.c:993
stage3
gboolean stage3(pe_working_set_t *data_set)
Definition: pcmk_sched_allocate.c:1035
stage5
gboolean stage5(pe_working_set_t *data_set)
Definition: pcmk_sched_allocate.c:1297
pe_resource_s::flags
unsigned long long flags
Definition: pe_types.h:319
pe_resource_s::role
enum rsc_role_e role
Definition: pe_types.h:341
pe_working_set_s::graph
xmlNode * graph
Definition: pe_types.h:157
CRM_ASSERT
#define CRM_ASSERT(expr)
Definition: results.h:42
pe_action_runnable
Definition: pe_types.h:267
crm_time_new
crm_time_t * crm_time_new(const char *string)
Definition: iso8601.c:96
set_working_set_defaults
void set_working_set_defaults(pe_working_set_t *data_set)
Definition: status.c:352
pe_resource_s
Definition: pe_types.h:291
pe_working_set_s::flags
unsigned long long flags
Definition: pe_types.h:127
crm_internal.h
status.h
Cluster status and scheduling.
crm.h
A dumping ground.
pe_resource_s::fns
resource_object_functions_t * fns
Definition: pe_types.h:303
crm_time_t
struct crm_time_s crm_time_t
Definition: iso8601.h:32