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