Blame SOURCES/bz1198886-2ab97ec-systemd-stop-1.patch

80850c
diff --git a/lib/services/systemd.c b/lib/services/systemd.c
80850c
index 10c605a..c797c47 100644
80850c
--- a/lib/services/systemd.c
80850c
+++ b/lib/services/systemd.c
80850c
@@ -545,15 +545,27 @@ systemd_unit_exec_with_unit(svc_action_t * op, const char *unit)
80850c
 
80850c
     } else if (g_strcmp0(method, "start") == 0) {
80850c
         FILE *file_strm = NULL;
80850c
-        char *override_dir = g_strdup_printf("%s/%s", SYSTEMD_OVERRIDE_ROOT, unit);
80850c
-        char *override_file = g_strdup_printf("%s/%s/50-pacemaker.conf", SYSTEMD_OVERRIDE_ROOT, unit);
80850c
+        char *override_dir = g_strdup_printf("%s/%s.service.d", SYSTEMD_OVERRIDE_ROOT, op->agent);
80850c
+        char *override_file = g_strdup_printf("%s/%s.service.d/50-pacemaker.conf", SYSTEMD_OVERRIDE_ROOT, op->agent);
80850c
 
80850c
         method = "StartUnit";
80850c
         crm_build_path(override_dir, 0755);
80850c
 
80850c
         file_strm = fopen(override_file, "w");
80850c
         if (file_strm != NULL) {
80850c
-            int rc = fprintf(file_strm, "[Service]\nRestart=no");
80850c
+            /* TODO: Insert the start timeout in too */
80850c
+            char *override = g_strdup_printf(
80850c
+                "[Unit]\n"
80850c
+                "Description=Cluster Controlled %s\n"
80850c
+                "Before=pacemaker.service\n"
80850c
+                "\n"
80850c
+                "[Service]\n"
80850c
+                "Restart=no\n",
80850c
+                op->agent);
80850c
+
80850c
+            int rc = fprintf(file_strm, "%s\n", override);
80850c
+
80850c
+            free(override);
80850c
             if (rc < 0) {
80850c
                 crm_perror(LOG_ERR, "Cannot write to systemd override file %s", override_file);
80850c
             }
80850c
@@ -571,7 +583,7 @@ systemd_unit_exec_with_unit(svc_action_t * op, const char *unit)
80850c
         free(override_dir);
80850c
 
80850c
     } else if (g_strcmp0(method, "stop") == 0) {
80850c
-        char *override_file = g_strdup_printf("%s/%s/50-pacemaker.conf", SYSTEMD_OVERRIDE_ROOT, unit);
80850c
+        char *override_file = g_strdup_printf("%s/%s.service.d/50-pacemaker.conf", SYSTEMD_OVERRIDE_ROOT, op->agent);
80850c
 
80850c
         method = "StopUnit";
80850c
         unlink(override_file);