pacemaker  1.1.14-70404b0
Scalable High-Availability cluster resource manager
systemd.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public
4  * License as published by the Free Software Foundation; either
5  * version 2.1 of the License, or (at your option) any later version.
6  *
7  * This software is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10  * General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public
13  * License along with this library; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  *
16  * Copyright (C) 2012 Andrew Beekhof <andrew@beekhof.net>
17  */
18 
19 #include <crm_internal.h>
20 #include <crm/crm.h>
21 #include <crm/services.h>
22 #include <crm/common/mainloop.h>
23 
24 #include <gio/gio.h>
25 #include <services_private.h>
26 #include <systemd.h>
27 #include <dbus/dbus.h>
28 #include <pcmk-dbus.h>
29 
30 #define BUS_NAME "org.freedesktop.systemd1"
31 #define BUS_PATH "/org/freedesktop/systemd1"
32 
33 #define BUS_PROPERTY_IFACE "org.freedesktop.DBus.Properties"
34 
35 /*
36  /usr/share/dbus-1/interfaces/org.freedesktop.systemd1.Manager.xml
37 */
38 gboolean
39 systemd_unit_exec_with_unit(svc_action_t * op, const char *unit);
40 
41 
42 struct unit_info {
43  const char *id;
44  const char *description;
45  const char *load_state;
46  const char *active_state;
47  const char *sub_state;
48  const char *following;
49  const char *unit_path;
50  uint32_t job_id;
51  const char *job_type;
52  const char *job_path;
53 };
54 
55 struct pcmk_dbus_data
56 {
57  char *name;
58  char *unit;
59  DBusError error;
60  svc_action_t *op;
61  void (*callback)(DBusMessage *reply, svc_action_t *op);
62 };
63 
64 static DBusMessage *systemd_new_method(const char *iface, const char *method)
65 {
66  crm_trace("Calling: %s on %s", method, iface);
67  return dbus_message_new_method_call(BUS_NAME, // target for the method call
68  BUS_PATH, // object to call on
69  iface, // interface to call on
70  method); // method name
71 }
72 
73 
74 static DBusConnection* systemd_proxy = NULL;
75 static gboolean
76 systemd_init(void)
77 {
78  static int need_init = 1;
79  /* http://dbus.freedesktop.org/doc/api/html/group__DBusConnection.html */
80 
81  if (systemd_proxy
82  && dbus_connection_get_is_connected(systemd_proxy) == FALSE) {
83  crm_warn("Connection to System DBus is closed. Reconnecting...");
84  pcmk_dbus_disconnect(systemd_proxy);
85  systemd_proxy = NULL;
86  need_init = 1;
87  }
88 
89  if (need_init) {
90  need_init = 0;
91  systemd_proxy = pcmk_dbus_connect();
92  }
93  if (systemd_proxy == NULL) {
94  return FALSE;
95  }
96  return TRUE;
97 }
98 
99 void
101 {
102  if (systemd_proxy) {
103  pcmk_dbus_disconnect(systemd_proxy);
104  systemd_proxy = NULL;
105  }
106 }
107 
108 static char *
109 systemd_service_name(const char *name)
110 {
111  if (name == NULL) {
112  return NULL;
113 
114  } else if (strstr(name, ".service")) {
115  return strdup(name);
116  }
117 
118  return crm_strdup_printf("%s.service", name);
119 }
120 
121 static void
122 systemd_daemon_reload_complete(DBusPendingCall *pending, void *user_data)
123 {
124  DBusError error;
125  DBusMessage *reply = NULL;
126  unsigned int reload_count = GPOINTER_TO_UINT(user_data);
127 
128  dbus_error_init(&error);
129  if(pending) {
130  reply = dbus_pending_call_steal_reply(pending);
131  }
132 
133  if(pcmk_dbus_find_error("Reload", pending, reply, &error)) {
134  crm_err("Could not issue systemd reload %d: %s", reload_count, error.message);
135 
136  } else {
137  crm_trace("Reload %d complete", reload_count);
138  }
139 
140  if(pending) {
141  dbus_pending_call_unref(pending);
142  }
143  if(reply) {
144  dbus_message_unref(reply);
145  }
146 }
147 
148 static bool
149 systemd_daemon_reload(int timeout)
150 {
151  static unsigned int reload_count = 0;
152  const char *method = "Reload";
153 
154 
155  reload_count++;
156  if(reload_count % 10 == 0) {
157  DBusMessage *msg = systemd_new_method(BUS_NAME".Manager", method);
158 
159  CRM_ASSERT(msg != NULL);
160  pcmk_dbus_send(msg, systemd_proxy, systemd_daemon_reload_complete, GUINT_TO_POINTER(reload_count), timeout);
161  dbus_message_unref(msg);
162  }
163  return TRUE;
164 }
165 
166 static bool
167 systemd_mask_error(svc_action_t *op, const char *error)
168 {
169  crm_trace("Could not issue %s for %s: %s", op->action, op->rsc, error);
170  if(strstr(error, "org.freedesktop.systemd1.InvalidName")
171  || strstr(error, "org.freedesktop.systemd1.LoadFailed")
172  || strstr(error, "org.freedesktop.systemd1.NoSuchUnit")) {
173 
174  if (safe_str_eq(op->action, "stop")) {
175  crm_trace("Masking %s failure for %s: unknown services are stopped", op->action, op->rsc);
176  op->rc = PCMK_OCF_OK;
177  return TRUE;
178 
179  } else {
180  crm_trace("Mapping %s failure for %s: unknown services are not installed", op->action, op->rsc);
183  return FALSE;
184  }
185  }
186 
187  return FALSE;
188 }
189 
190 static const char *
191 systemd_loadunit_result(DBusMessage *reply, svc_action_t * op)
192 {
193  const char *path = NULL;
194  DBusError error;
195 
196  if(pcmk_dbus_find_error("LoadUnit", (void*)&path, reply, &error)) {
197  if(op && !systemd_mask_error(op, error.name)) {
198  crm_err("Could not find unit %s for %s: LoadUnit error '%s'",
199  op->agent, op->id, error.name);
200  }
201 
202  } else if(pcmk_dbus_type_check(reply, NULL, DBUS_TYPE_OBJECT_PATH, __FUNCTION__, __LINE__)) {
203  dbus_message_get_args (reply, NULL,
204  DBUS_TYPE_OBJECT_PATH, &path,
205  DBUS_TYPE_INVALID);
206  }
207 
208  if(op) {
209  if (path) {
210  systemd_unit_exec_with_unit(op, path);
211 
212  } else if (op->synchronous == FALSE) {
213  operation_finalize(op);
214  }
215  }
216 
217  return path;
218 }
219 
220 
221 static void
222 systemd_loadunit_cb(DBusPendingCall *pending, void *user_data)
223 {
224  DBusMessage *reply = NULL;
225  svc_action_t * op = user_data;
226 
227  if(pending) {
228  reply = dbus_pending_call_steal_reply(pending);
229  }
230 
231  crm_trace("Got result: %p for %p / %p for %s", reply, pending, op->opaque->pending, op->id);
232 
233  CRM_LOG_ASSERT(pending == op->opaque->pending);
234  services_set_op_pending(op, NULL);
235 
236  systemd_loadunit_result(reply, user_data);
237 
238  if(reply) {
239  dbus_message_unref(reply);
240  }
241 }
242 
243 static char *
244 systemd_unit_by_name(const gchar * arg_name, svc_action_t *op)
245 {
246  DBusMessage *msg;
247  DBusMessage *reply = NULL;
248  DBusPendingCall* pending = NULL;
249  char *name = NULL;
250 
251 /*
252  Equivalent to GetUnit if its already loaded
253  <method name="LoadUnit">
254  <arg name="name" type="s" direction="in"/>
255  <arg name="unit" type="o" direction="out"/>
256  </method>
257  */
258 
259  if (systemd_init() == FALSE) {
260  return FALSE;
261  }
262 
263  msg = systemd_new_method(BUS_NAME".Manager", "LoadUnit");
264  CRM_ASSERT(msg != NULL);
265 
266  name = systemd_service_name(arg_name);
267  CRM_LOG_ASSERT(dbus_message_append_args(msg, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID));
268  free(name);
269 
270  if(op == NULL || op->synchronous) {
271  const char *unit = NULL;
272  char *munit = NULL;
273  DBusError error;
274 
275  dbus_error_init(&error);
276  reply = pcmk_dbus_send_recv(msg, systemd_proxy, &error, op? op->timeout : DBUS_TIMEOUT_USE_DEFAULT);
277  dbus_message_unref(msg);
278 
279  unit = systemd_loadunit_result(reply, op);
280  if(unit) {
281  munit = strdup(unit);
282  }
283  if(reply) {
284  dbus_message_unref(reply);
285  }
286  return munit;
287  }
288 
289  pending = pcmk_dbus_send(msg, systemd_proxy, systemd_loadunit_cb, op, op->timeout);
290  if(pending) {
291  services_set_op_pending(op, pending);
292  }
293 
294  dbus_message_unref(msg);
295  return NULL;
296 }
297 
298 GList *
300 {
301  int lpc = 0;
302  GList *units = NULL;
303  DBusMessageIter args;
304  DBusMessageIter unit;
305  DBusMessageIter elem;
306  DBusMessage *msg = NULL;
307  DBusMessage *reply = NULL;
308  const char *method = "ListUnits";
309  DBusError error;
310 
311  if (systemd_init() == FALSE) {
312  return NULL;
313  }
314 
315 /*
316  " <method name=\"ListUnits\">\n" \
317  " <arg name=\"units\" type=\"a(ssssssouso)\" direction=\"out\"/>\n" \
318  " </method>\n" \
319 */
320 
321  dbus_error_init(&error);
322  msg = systemd_new_method(BUS_NAME".Manager", method);
323  CRM_ASSERT(msg != NULL);
324 
325  reply = pcmk_dbus_send_recv(msg, systemd_proxy, &error, DBUS_TIMEOUT_USE_DEFAULT);
326  dbus_message_unref(msg);
327 
328  if(error.name) {
329  crm_err("Call to %s failed: %s", method, error.name);
330  return NULL;
331 
332  } else if (reply == NULL) {
333  crm_err("Call to %s failed: Message has no reply", method);
334  return NULL;
335 
336  } else if (!dbus_message_iter_init(reply, &args)) {
337  crm_err("Call to %s failed: Message has no arguments", method);
338  dbus_message_unref(reply);
339  return NULL;
340  }
341 
342  if(!pcmk_dbus_type_check(reply, &args, DBUS_TYPE_ARRAY, __FUNCTION__, __LINE__)) {
343  crm_err("Call to %s failed: Message has invalid arguments", method);
344  dbus_message_unref(reply);
345  return NULL;
346  }
347 
348  dbus_message_iter_recurse(&args, &unit);
349  while (dbus_message_iter_get_arg_type (&unit) != DBUS_TYPE_INVALID) {
350  DBusBasicValue value;
351 
352  if(!pcmk_dbus_type_check(reply, &unit, DBUS_TYPE_STRUCT, __FUNCTION__, __LINE__)) {
353  continue;
354  }
355 
356  dbus_message_iter_recurse(&unit, &elem);
357  if(!pcmk_dbus_type_check(reply, &elem, DBUS_TYPE_STRING, __FUNCTION__, __LINE__)) {
358  continue;
359  }
360 
361  dbus_message_iter_get_basic(&elem, &value);
362  crm_trace("Got: %s", value.str);
363  if(value.str) {
364  char *match = strstr(value.str, ".service");
365 
366  if (match) {
367  lpc++;
368  match[0] = 0;
369 
370  units = g_list_append(units, strdup(value.str));
371  }
372  }
373  dbus_message_iter_next (&unit);
374  }
375 
376  dbus_message_unref(reply);
377 
378  crm_trace("Found %d systemd services", lpc);
379  return units;
380 }
381 
382 gboolean
383 systemd_unit_exists(const char *name)
384 {
385  char *unit = NULL;
386 
387  /* Note: Makes a blocking dbus calls
388  * Used by resources_find_service_class() when resource class=service
389  */
390  unit = systemd_unit_by_name(name, NULL);
391  if(unit) {
392  free(unit);
393  return TRUE;
394  }
395  return FALSE;
396 }
397 
398 static char *
399 systemd_unit_metadata(const char *name, int timeout)
400 {
401  char *meta = NULL;
402  char *desc = NULL;
403  char *path = systemd_unit_by_name(name, NULL);
404 
405  if (path) {
406  /* TODO: Worth a making blocking call for? Probably not. Possibly if cached. */
407  desc = pcmk_dbus_get_property(systemd_proxy, BUS_NAME, path, BUS_NAME ".Unit", "Description", NULL, NULL, NULL, timeout);
408  } else {
409  desc = crm_strdup_printf("Systemd unit file for %s", name);
410  }
411 
412  meta = crm_strdup_printf("<?xml version=\"1.0\"?>\n"
413  "<!DOCTYPE resource-agent SYSTEM \"ra-api-1.dtd\">\n"
414  "<resource-agent name=\"%s\" version=\"0.1\">\n"
415  " <version>1.0</version>\n"
416  " <longdesc lang=\"en\">\n"
417  " %s\n"
418  " </longdesc>\n"
419  " <shortdesc lang=\"en\">systemd unit file for %s</shortdesc>\n"
420  " <parameters>\n"
421  " </parameters>\n"
422  " <actions>\n"
423  " <action name=\"start\" timeout=\"100\" />\n"
424  " <action name=\"stop\" timeout=\"100\" />\n"
425  " <action name=\"status\" timeout=\"100\" />\n"
426  " <action name=\"monitor\" timeout=\"100\" interval=\"60\"/>\n"
427  " <action name=\"meta-data\" timeout=\"5\" />\n"
428  " </actions>\n"
429  " <special tag=\"systemd\">\n"
430  " </special>\n" "</resource-agent>\n", name, desc, name);
431  free(desc);
432  free(path);
433  return meta;
434 }
435 
436 static void
437 systemd_exec_result(DBusMessage *reply, svc_action_t *op)
438 {
439  DBusError error;
440 
441  if(pcmk_dbus_find_error(op->action, (void*)&error, reply, &error)) {
442 
443  /* ignore "already started" or "not running" errors */
444  if (!systemd_mask_error(op, error.name)) {
445  crm_err("Could not issue %s for %s: %s", op->action, op->rsc, error.message);
446  }
447 
448  } else {
449  if(!pcmk_dbus_type_check(reply, NULL, DBUS_TYPE_OBJECT_PATH, __FUNCTION__, __LINE__)) {
450  crm_warn("Call to %s passed but return type was unexpected", op->action);
451  op->rc = PCMK_OCF_OK;
452 
453  } else {
454  const char *path = NULL;
455 
456  dbus_message_get_args (reply, NULL,
457  DBUS_TYPE_OBJECT_PATH, &path,
458  DBUS_TYPE_INVALID);
459  crm_info("Call to %s passed: %s", op->action, path);
460  op->rc = PCMK_OCF_OK;
461  }
462  }
463 
464  operation_finalize(op);
465 }
466 
467 static void
468 systemd_async_dispatch(DBusPendingCall *pending, void *user_data)
469 {
470  DBusError error;
471  DBusMessage *reply = NULL;
472  svc_action_t *op = user_data;
473 
474  dbus_error_init(&error);
475  if(pending) {
476  reply = dbus_pending_call_steal_reply(pending);
477  }
478 
479  crm_trace("Got result: %p for %p for %s, %s", reply, pending, op->rsc, op->action);
480 
481  CRM_LOG_ASSERT(pending == op->opaque->pending);
482  services_set_op_pending(op, NULL);
483  systemd_exec_result(reply, op);
484 
485  if(reply) {
486  dbus_message_unref(reply);
487  }
488 }
489 
490 #define SYSTEMD_OVERRIDE_ROOT "/run/systemd/system/"
491 
492 static void
493 systemd_unit_check(const char *name, const char *state, void *userdata)
494 {
495  svc_action_t * op = userdata;
496 
497  crm_trace("Resource %s has %s='%s'", op->rsc, name, state);
498 
499  if(state == NULL) {
500  op->rc = PCMK_OCF_NOT_RUNNING;
501 
502  } else if (g_strcmp0(state, "active") == 0) {
503  op->rc = PCMK_OCF_OK;
504  } else if (g_strcmp0(state, "activating") == 0) {
505  op->rc = PCMK_OCF_PENDING;
506  } else if (g_strcmp0(state, "deactivating") == 0) {
507  op->rc = PCMK_OCF_PENDING;
508  } else {
509  op->rc = PCMK_OCF_NOT_RUNNING;
510  }
511 
512  if (op->synchronous == FALSE) {
513  services_set_op_pending(op, NULL);
514  operation_finalize(op);
515  }
516 }
517 
518 gboolean
520 {
521  const char *method = op->action;
522  DBusMessage *msg = NULL;
523  DBusMessage *reply = NULL;
524 
525  CRM_ASSERT(unit);
526 
527  if (safe_str_eq(op->action, "monitor") || safe_str_eq(method, "status")) {
528  DBusPendingCall *pending = NULL;
529  char *state;
530 
531  state = pcmk_dbus_get_property(systemd_proxy, BUS_NAME, unit,
532  BUS_NAME ".Unit", "ActiveState",
533  op->synchronous?NULL:systemd_unit_check,
534  op, op->synchronous?NULL:&pending, op->timeout);
535  if (op->synchronous) {
536  systemd_unit_check("ActiveState", state, op);
537  free(state);
538  return op->rc == PCMK_OCF_OK;
539  } else if (pending) {
540  services_set_op_pending(op, pending);
541  return TRUE;
542 
543  } else {
544  return operation_finalize(op);
545  }
546 
547  } else if (g_strcmp0(method, "start") == 0) {
548  FILE *file_strm = NULL;
549  char *override_dir = crm_strdup_printf("%s/%s.service.d", SYSTEMD_OVERRIDE_ROOT, op->agent);
550  char *override_file = crm_strdup_printf("%s/%s.service.d/50-pacemaker.conf", SYSTEMD_OVERRIDE_ROOT, op->agent);
551 
552  method = "StartUnit";
553  crm_build_path(override_dir, 0755);
554 
555  file_strm = fopen(override_file, "w");
556  if (file_strm != NULL) {
557  /* TODO: Insert the start timeout in too */
558  char *override = crm_strdup_printf(
559  "[Unit]\n"
560  "Description=Cluster Controlled %s\n"
561  "Before=pacemaker.service\n"
562  "\n"
563  "[Service]\n"
564  "Restart=no\n",
565  op->agent);
566 
567  int rc = fprintf(file_strm, "%s\n", override);
568 
569  free(override);
570  if (rc < 0) {
571  crm_perror(LOG_ERR, "Cannot write to systemd override file %s", override_file);
572  }
573 
574  } else {
575  crm_err("Cannot open systemd override file %s for writing", override_file);
576  }
577 
578  if (file_strm != NULL) {
579  fflush(file_strm);
580  fclose(file_strm);
581  }
582  systemd_daemon_reload(op->timeout);
583  free(override_file);
584  free(override_dir);
585 
586  } else if (g_strcmp0(method, "stop") == 0) {
587  char *override_file = crm_strdup_printf("%s/%s.service.d/50-pacemaker.conf", SYSTEMD_OVERRIDE_ROOT, op->agent);
588 
589  method = "StopUnit";
590  unlink(override_file);
591  free(override_file);
592  systemd_daemon_reload(op->timeout);
593 
594  } else if (g_strcmp0(method, "restart") == 0) {
595  method = "RestartUnit";
596 
597  } else {
599  goto cleanup;
600  }
601 
602  crm_debug("Calling %s for %s: %s", method, op->rsc, unit);
603 
604  msg = systemd_new_method(BUS_NAME".Manager", method);
605  CRM_ASSERT(msg != NULL);
606 
607  /* (ss) */
608  {
609  const char *replace_s = "replace";
610  char *name = systemd_service_name(op->agent);
611 
612  CRM_LOG_ASSERT(dbus_message_append_args(msg, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID));
613  CRM_LOG_ASSERT(dbus_message_append_args(msg, DBUS_TYPE_STRING, &replace_s, DBUS_TYPE_INVALID));
614 
615  free(name);
616  }
617 
618  if (op->synchronous == FALSE) {
619  DBusPendingCall* pending = pcmk_dbus_send(msg, systemd_proxy, systemd_async_dispatch, op, op->timeout);
620 
621  dbus_message_unref(msg);
622  if(pending) {
623  services_set_op_pending(op, pending);
624  return TRUE;
625 
626  } else {
627  return operation_finalize(op);
628  }
629 
630  } else {
631  DBusError error;
632 
633  reply = pcmk_dbus_send_recv(msg, systemd_proxy, &error, op->timeout);
634  dbus_message_unref(msg);
635  systemd_exec_result(reply, op);
636 
637  if(reply) {
638  dbus_message_unref(reply);
639  }
640  return FALSE;
641  }
642 
643  cleanup:
644  if (op->synchronous == FALSE) {
645  return operation_finalize(op);
646  }
647 
648  return op->rc == PCMK_OCF_OK;
649 }
650 
651 static gboolean
652 systemd_timeout_callback(gpointer p)
653 {
654  svc_action_t * op = p;
655 
656  op->opaque->timerid = 0;
657  crm_warn("%s operation on systemd unit %s named '%s' timed out", op->action, op->agent, op->rsc);
658  operation_finalize(op);
659 
660  return FALSE;
661 }
662 
663 /* For an asynchronous 'op', returns FALSE if 'op' should be free'd by the caller */
664 /* For a synchronous 'op', returns FALSE if 'op' fails */
665 gboolean
667 {
668  char *unit = NULL;
669 
670  CRM_ASSERT(op);
671  CRM_ASSERT(systemd_init());
673  crm_debug("Performing %ssynchronous %s op on systemd unit %s named '%s'",
674  op->synchronous ? "" : "a", op->action, op->agent, op->rsc);
675 
676  if (safe_str_eq(op->action, "meta-data")) {
677  /* TODO: See if we can teach the lrmd not to make these calls synchronously */
678  op->stdout_data = systemd_unit_metadata(op->agent, op->timeout);
679  op->rc = PCMK_OCF_OK;
680 
681  if (op->synchronous == FALSE) {
682  return operation_finalize(op);
683  }
684  return TRUE;
685  }
686 
687  unit = systemd_unit_by_name(op->agent, op);
688  free(unit);
689 
690  if (op->synchronous == FALSE) {
691  if (op->opaque->pending) {
692  op->opaque->timerid = g_timeout_add(op->timeout + 5000, systemd_timeout_callback, op);
694  return TRUE;
695 
696  } else {
697  return operation_finalize(op);
698  }
699  }
700 
701  return op->rc == PCMK_OCF_OK;
702 }
Services API.
A dumping ground.
void crm_build_path(const char *path_c, mode_t mode)
Create a directory, including any parent directories needed.
Definition: io.c:49
char * id
Definition: services.h:152
void pcmk_dbus_disconnect(DBusConnection *connection)
Definition: dbus.c:45
#define DBUS_TIMEOUT_USE_DEFAULT
Definition: pcmk-dbus.h:2
char * rsc
Definition: services.h:153
#define CRM_LOG_ASSERT(expr)
Definition: logging.h:150
Wrappers for and extensions to glib mainloop.
#define crm_warn(fmt, args...)
Definition: logging.h:249
svc_action_private_t * opaque
Definition: services.h:184
uint32_t id
Definition: internal.h:48
#define crm_debug(fmt, args...)
Definition: logging.h:253
gboolean operation_finalize(svc_action_t *op)
char * stdout_data
Definition: services.h:174
gboolean systemd_unit_exists(const char *name)
Definition: systemd.c:383
#define crm_trace(fmt, args...)
Definition: logging.h:254
#define BUS_NAME
Definition: systemd.c:30
char * agent
Definition: services.h:159
int synchronous
Definition: services.h:170
#define BUS_PATH
Definition: systemd.c:31
char * pcmk_dbus_get_property(DBusConnection *connection, const char *target, const char *obj, const gchar *iface, const char *name, void(*callback)(const char *name, const char *value, void *userdata), void *userdata, DBusPendingCall **pending, int timeout)
Definition: dbus.c:343
#define SYSTEMD_OVERRIDE_ROOT
Definition: systemd.c:490
GList * systemd_unit_listall(void)
Definition: systemd.c:299
DBusPendingCall * pcmk_dbus_send(DBusMessage *msg, DBusConnection *connection, void(*done)(DBusPendingCall *pending, void *user_data), void *user_data, int timeout)
Definition: dbus.c:157
DBusConnection * pcmk_dbus_connect(void)
Definition: dbus.c:28
void services_add_inflight_op(svc_action_t *op)
Definition: services.c:603
void systemd_cleanup(void)
Definition: systemd.c:100
char * action
Definition: services.h:154
#define crm_perror(level, fmt, args...)
Log a system error message.
Definition: logging.h:226
#define crm_err(fmt, args...)
Definition: logging.h:248
bool pcmk_dbus_type_check(DBusMessage *msg, DBusMessageIter *field, int expected, const char *function, int line)
Definition: dbus.c:204
#define uint32_t
Definition: stdint.in.h:158
#define CRM_ASSERT(expr)
Definition: error.h:35
gboolean systemd_unit_exec_with_unit(svc_action_t *op, const char *unit)
Definition: systemd.c:519
#define safe_str_eq(a, b)
Definition: util.h:74
char * crm_strdup_printf(char const *format,...) __attribute__((__format__(__printf__
DBusMessage * pcmk_dbus_send_recv(DBusMessage *msg, DBusConnection *connection, DBusError *error, int timeout)
Definition: dbus.c:113
gboolean systemd_unit_exec(svc_action_t *op)
Definition: systemd.c:666
#define crm_info(fmt, args...)
Definition: logging.h:251
bool pcmk_dbus_find_error(const char *method, DBusPendingCall *pending, DBusMessage *reply, DBusError *ret)
Definition: dbus.c:50