pacemaker  2.0.2-debe490
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 }
#define LOG_TRACE
Definition: logging.h:26
A dumping ground.
gboolean stage2(pe_working_set_t *data_set)
gboolean stage5(pe_working_set_t *data_set)
gboolean stage3(pe_working_set_t *data_set)
struct crm_time_s crm_time_t
Definition: iso8601.h:32
enum rsc_role_e role
Definition: pe_types.h:333
int utilization_log_level
gboolean stage0(pe_working_set_t *data_set)
resource_object_functions_t * fns
Definition: pe_types.h:295
GListPtr resources
Definition: pe_types.h:134
#define pe_flag_have_status
Definition: pe_types.h:105
gboolean show_scores
xmlNode * pcmk__schedule_actions(pe_working_set_t *data_set, xmlNode *xml_input, crm_time_t *now)
gboolean stage8(pe_working_set_t *data_set)
void log_action(unsigned int log_level, const char *pre_text, action_t *action, gboolean details)
gboolean stage4(pe_working_set_t *data_set)
#define crm_trace(fmt, args...)
Definition: logging.h:246
void set_working_set_defaults(pe_working_set_t *data_set)
Definition: status.c:345
unsigned long long flags
Definition: pe_types.h:311
GListPtr actions
Definition: pe_types.h:140
Wrappers for and extensions to libxml2.
xmlNode * input
Definition: pe_types.h:113
void(* print)(pe_resource_t *, const char *, long, void *)
Definition: pe_types.h:49
int scores_log_level
unsigned int get_crm_log_level(void)
Definition: logging.c:979
gboolean show_utilization
gboolean stage7(pe_working_set_t *data_set)
#define pe_flag_quick_location
Definition: pe_types.h:108
Cluster status and scheduling.
#define CRM_ASSERT(expr)
Definition: results.h:42
Cluster Configuration.
crm_time_t * crm_time_new(const char *string)
Definition: iso8601.c:84
gboolean stage6(pe_working_set_t *data_set)
enum pe_action_flags flags
Definition: pe_types.h:374
unsigned long long flags
Definition: pe_types.h:122
GList * GListPtr
Definition: crm.h:192
crm_time_t * now
Definition: pe_types.h:114
#define pe_rsc_orphan
Definition: pe_types.h:217
xmlNode * graph
Definition: pe_types.h:152