diff --git a/cts/cli/regression.tools.exp b/cts/cli/regression.tools.exp
index 0e69d0d..98c8f23 100644
--- a/cts/cli/regression.tools.exp
+++ b/cts/cli/regression.tools.exp
@@ -3529,7 +3529,7 @@ Colocations:
-
+
@@ -3546,7 +3546,7 @@ Colocations:
-
+
@@ -3584,7 +3584,7 @@ Colocations:
-
+
@@ -3593,7 +3593,7 @@ Colocations:
-
+
@@ -3607,7 +3607,7 @@ Colocations:
-
+
@@ -3616,7 +3616,7 @@ Colocations:
-
+
@@ -3658,9 +3658,9 @@ Colocations:
-
+
-
+
@@ -3669,7 +3669,7 @@ Colocations:
-
+
@@ -3681,9 +3681,9 @@ Colocations:
-
+
-
+
@@ -3692,7 +3692,7 @@ Colocations:
-
+
@@ -3722,7 +3722,7 @@ prim5:
-
+
@@ -3739,7 +3739,7 @@ prim5:
-
+
@@ -3813,7 +3813,7 @@ Colocations:
-
+
@@ -3828,7 +3828,7 @@ Colocations:
-
+
@@ -3859,7 +3859,7 @@ Colocations:
-
+
@@ -3874,7 +3874,7 @@ Colocations:
-
+
@@ -3905,7 +3905,7 @@ Colocations:
-
+
@@ -3920,7 +3920,7 @@ Colocations:
-
+
@@ -3953,7 +3953,7 @@ Colocations:
-
+
@@ -3970,7 +3970,7 @@ Colocations:
-
+
@@ -4006,14 +4006,14 @@ Colocations:
-
+
-
+
@@ -4025,14 +4025,14 @@ Colocations:
-
+
-
+
@@ -4066,14 +4066,14 @@ Colocations:
-
+
-
+
@@ -4085,14 +4085,14 @@ Colocations:
-
+
-
+
@@ -4126,14 +4126,14 @@ Colocations:
-
+
-
+
@@ -4145,14 +4145,14 @@ Colocations:
-
+
-
+
@@ -4180,7 +4180,7 @@ group:
-
+
@@ -4195,7 +4195,7 @@ group:
-
+
@@ -4226,7 +4226,7 @@ clone:
-
+
@@ -4241,7 +4241,7 @@ clone:
-
+
diff --git a/lib/pacemaker/pcmk_output.c b/lib/pacemaker/pcmk_output.c
index 8ff3e9d..78171d7 100644
--- a/lib/pacemaker/pcmk_output.c
+++ b/lib/pacemaker/pcmk_output.c
@@ -66,6 +66,35 @@ colocations_header(pe_resource_t *rsc, rsc_colocation_t *cons,
return retval;
}
+static void
+colocations_xml_node(pcmk__output_t *out, pe_resource_t *rsc,
+ rsc_colocation_t *cons) {
+ char *score = NULL;
+ xmlNodePtr node = NULL;
+
+ score = score2char(cons->score);
+ node = pcmk__output_create_xml_node(out, XML_CONS_TAG_RSC_DEPEND,
+ "id", cons->id,
+ "rsc", cons->rsc_lh->id,
+ "with-rsc", cons->rsc_rh->id,
+ "score", score,
+ NULL);
+
+ if (cons->node_attribute) {
+ xmlSetProp(node, (pcmkXmlStr) "node-attribute", (pcmkXmlStr) cons->node_attribute);
+ }
+
+ if (cons->role_lh != RSC_ROLE_UNKNOWN) {
+ xmlSetProp(node, (pcmkXmlStr) "rsc-role", (pcmkXmlStr) role2text(cons->role_lh));
+ }
+
+ if (cons->role_rh != RSC_ROLE_UNKNOWN) {
+ xmlSetProp(node, (pcmkXmlStr) "with-rsc-role", (pcmkXmlStr) role2text(cons->role_rh));
+ }
+
+ free(score);
+}
+
PCMK__OUTPUT_ARGS("colocations-list", "pe_resource_t *", "gboolean", "gboolean")
static int colocations_list(pcmk__output_t *out, va_list args) {
pe_resource_t *rsc = va_arg(args, pe_resource_t *);
@@ -160,7 +189,6 @@ static int colocations_list_xml(pcmk__output_t *out, va_list args) {
for (lpc = list; lpc != NULL; lpc = lpc->next) {
rsc_colocation_t *cons = (rsc_colocation_t *) lpc->data;
pe_resource_t *peer = cons->rsc_rh;
- char *score = NULL;
if (dependents) {
peer = cons->rsc_lh;
@@ -195,24 +223,7 @@ static int colocations_list_xml(pcmk__output_t *out, va_list args) {
printed_header = true;
}
- score = score2char(cons->score);
- if (cons->role_rh > RSC_ROLE_STARTED) {
- pcmk__output_create_xml_node(out, "colocation",
- "peer", peer->id,
- "id", cons->id,
- "score", score,
- "dependents", dependents ? "needs" : "with",
- "role", role2text(cons->role_rh),
- NULL);
- } else {
- pcmk__output_create_xml_node(out, "colocation",
- "peer", peer->id,
- "id", cons->id,
- "score", score,
- NULL);
- }
-
- free(score);
+ colocations_xml_node(out, peer, cons);
out->message(out, "locations-list", peer);
if (!dependents && recursive) {