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