commit 27adba1575f508166e7203225a3ff6d580842dfd
Author: David Vossel <dvossel@redhat.com>
Date: Tue Aug 27 17:46:28 2013 -0500
Fix: tools: Fixes formatting of remote-nodes in crm_mon and crm_simulate
(cherry picked from commit b32b60ec6d0963ea3767196f0fdd50746d27fafa)
Conflicts:
pengine/test10/whitebox-ms-ordering.summary
diff --git a/pengine/test10/whitebox-asymmetric.summary b/pengine/test10/whitebox-asymmetric.summary
index c4a8e0a..1a68802 100644
--- a/pengine/test10/whitebox-asymmetric.summary
+++ b/pengine/test10/whitebox-asymmetric.summary
@@ -1,7 +1,6 @@
Current cluster status:
Online: [ 18builder ]
-OFFLINE: [ 18node2:container2 ]
fence_false (stonith:fence_false): Stopped
container2 (ocf::pacemaker:Dummy): Started 18builder
@@ -22,7 +21,8 @@ Executing cluster transition:
* Resource action: nfs_mount monitor=10000 on 18node2
Revised cluster status:
-Online: [ 18builder 18node2:container2 ]
+Online: [ 18builder ]
+Containers: [ 18node2:container2 ]
fence_false (stonith:fence_false): Stopped
container2 (ocf::pacemaker:Dummy): Started 18builder
diff --git a/pengine/test10/whitebox-fail1.summary b/pengine/test10/whitebox-fail1.summary
index 02d0f8e..5e5887b 100644
--- a/pengine/test10/whitebox-fail1.summary
+++ b/pengine/test10/whitebox-fail1.summary
@@ -1,7 +1,7 @@
Current cluster status:
-Online: [ 18node1 18node2 18node3 lxc2:container2 ]
-OFFLINE: [ lxc1:container1 ]
+Online: [ 18node1 18node2 18node3 ]
+Containers: [ lxc2:container2 ]
container1 (ocf::heartbeat:VirtualDomain): FAILED 18node2
container2 (ocf::heartbeat:VirtualDomain): Started 18node2
@@ -38,7 +38,8 @@ Executing cluster transition:
* Resource action: B monitor=10000 on lxc1
Revised cluster status:
-Online: [ 18node1 18node2 18node3 lxc1:container1 lxc2:container2 ]
+Online: [ 18node1 18node2 18node3 ]
+Containers: [ lxc1:container1 lxc2:container2 ]
container1 (ocf::heartbeat:VirtualDomain): Started 18node2
container2 (ocf::heartbeat:VirtualDomain): Started 18node2
diff --git a/pengine/test10/whitebox-fail2.summary b/pengine/test10/whitebox-fail2.summary
index 0e53524..338173d 100644
--- a/pengine/test10/whitebox-fail2.summary
+++ b/pengine/test10/whitebox-fail2.summary
@@ -1,7 +1,7 @@
Current cluster status:
-Online: [ 18node1 18node2 18node3 lxc2:container2 ]
-OFFLINE: [ lxc1:container1 ]
+Online: [ 18node1 18node2 18node3 ]
+Containers: [ lxc2:container2 ]
container1 (ocf::heartbeat:VirtualDomain): FAILED 18node2
container2 (ocf::heartbeat:VirtualDomain): Started 18node2
@@ -38,7 +38,8 @@ Executing cluster transition:
* Resource action: B monitor=10000 on lxc1
Revised cluster status:
-Online: [ 18node1 18node2 18node3 lxc1:container1 lxc2:container2 ]
+Online: [ 18node1 18node2 18node3 ]
+Containers: [ lxc1:container1 lxc2:container2 ]
container1 (ocf::heartbeat:VirtualDomain): Started 18node2
container2 (ocf::heartbeat:VirtualDomain): Started 18node2
diff --git a/pengine/test10/whitebox-fail3.summary b/pengine/test10/whitebox-fail3.summary
index 1d25724..395d218 100644
--- a/pengine/test10/whitebox-fail3.summary
+++ b/pengine/test10/whitebox-fail3.summary
@@ -1,7 +1,6 @@
Current cluster status:
Online: [ dvossel-laptop2 ]
-OFFLINE: [ 18builder:vm 18node1:vm2 ]
vm (ocf::heartbeat:VirtualDomain): Stopped
vm2 (ocf::heartbeat:VirtualDomain): Stopped
@@ -39,8 +38,8 @@ Executing cluster transition:
* Resource action: X monitor=10000 on 18builder
Revised cluster status:
-Online: [ 18builder:vm dvossel-laptop2 ]
-OFFLINE: [ 18node1:vm2 ]
+Online: [ dvossel-laptop2 ]
+Containers: [ 18builder:vm ]
vm (ocf::heartbeat:VirtualDomain): Started dvossel-laptop2
vm2 (ocf::heartbeat:VirtualDomain): Stopped
diff --git a/pengine/test10/whitebox-move.summary b/pengine/test10/whitebox-move.summary
index 6dc2f6f..3422ac7 100644
--- a/pengine/test10/whitebox-move.summary
+++ b/pengine/test10/whitebox-move.summary
@@ -1,6 +1,7 @@
Current cluster status:
-Online: [ 18node1 18node2 18node3 lxc1:container1 lxc2:container2 ]
+Online: [ 18node1 18node2 18node3 ]
+Containers: [ lxc1:container1 lxc2:container2 ]
container1 (ocf::heartbeat:VirtualDomain): Started 18node1
container2 (ocf::heartbeat:VirtualDomain): Started 18node2
@@ -34,7 +35,8 @@ Executing cluster transition:
* Resource action: lxc1 monitor=30000 on 18node2
Revised cluster status:
-Online: [ 18node1 18node2 18node3 lxc1:container1 lxc2:container2 ]
+Online: [ 18node1 18node2 18node3 ]
+Containers: [ lxc1:container1 lxc2:container2 ]
container1 (ocf::heartbeat:VirtualDomain): Started 18node2
container2 (ocf::heartbeat:VirtualDomain): Started 18node2
diff --git a/pengine/test10/whitebox-start.summary b/pengine/test10/whitebox-start.summary
index e5d654b..2801abe 100644
--- a/pengine/test10/whitebox-start.summary
+++ b/pengine/test10/whitebox-start.summary
@@ -1,7 +1,7 @@
Current cluster status:
-Online: [ 18node1 18node2 18node3 lxc2:container2 ]
-OFFLINE: [ lxc1:container1 ]
+Online: [ 18node1 18node2 18node3 ]
+Containers: [ lxc2:container2 ]
container1 (ocf::heartbeat:VirtualDomain): Stopped
container2 (ocf::heartbeat:VirtualDomain): Started 18node2
@@ -29,7 +29,8 @@ Executing cluster transition:
* Resource action: M monitor=10000 on lxc1
Revised cluster status:
-Online: [ 18node1 18node2 18node3 lxc1:container1 lxc2:container2 ]
+Online: [ 18node1 18node2 18node3 ]
+Containers: [ lxc1:container1 lxc2:container2 ]
container1 (ocf::heartbeat:VirtualDomain): Started 18node1
container2 (ocf::heartbeat:VirtualDomain): Started 18node2
diff --git a/pengine/test10/whitebox-stop.summary b/pengine/test10/whitebox-stop.summary
index 4116571..51357b9 100644
--- a/pengine/test10/whitebox-stop.summary
+++ b/pengine/test10/whitebox-stop.summary
@@ -1,6 +1,7 @@
Current cluster status:
-Online: [ 18node1 18node2 18node3 lxc1:container1 lxc2:container2 ]
+Online: [ 18node1 18node2 18node3 ]
+Containers: [ lxc1:container1 lxc2:container2 ]
container1 (ocf::heartbeat:VirtualDomain): Started 18node2
container2 (ocf::heartbeat:VirtualDomain): Started 18node2
@@ -30,8 +31,8 @@ Executing cluster transition:
* Pseudo action: all_stopped
Revised cluster status:
-Online: [ 18node1 18node2 18node3 lxc2:container2 ]
-OFFLINE: [ lxc1:container1 ]
+Online: [ 18node1 18node2 18node3 ]
+Containers: [ lxc2:container2 ]
container1 (ocf::heartbeat:VirtualDomain): Stopped
container2 (ocf::heartbeat:VirtualDomain): Started 18node2
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
index 7c6e495..599df02 100644
--- a/tools/crm_mon.c
+++ b/tools/crm_mon.c
@@ -1153,7 +1153,10 @@ print_status(pe_working_set_t * data_set)
node_t *dc = NULL;
char *since_epoch = NULL;
char *online_nodes = NULL;
+ char *online_remote_nodes = NULL;
+ char *online_remote_containers = NULL;
char *offline_nodes = NULL;
+ char *offline_remote_nodes = NULL;
const char *stack_s = NULL;
xmlNode *dc_version = NULL;
xmlNode *quorum_node = NULL;
@@ -1246,7 +1249,7 @@ print_status(pe_working_set_t * data_set)
const char *node_mode = NULL;
char *node_name = NULL;
- if(node->details->remote_rsc) {
+ if (node->details->remote_rsc && node->details->remote_rsc->container) {
node_name = g_strdup_printf("%s:%s", node->details->uname, node->details->remote_rsc->container->id);
} else {
node_name = g_strdup_printf("%s", node->details->uname);
@@ -1286,23 +1289,37 @@ print_status(pe_working_set_t * data_set)
} else if (node->details->online) {
node_mode = "online";
if (group_by_node == FALSE) {
- online_nodes = add_list_element(online_nodes, node_name);
+ if (node->details->remote_rsc && node->details->remote_rsc->container) {
+ online_remote_containers = add_list_element(online_remote_containers, node_name);
+ } else if (node->details->remote_rsc) {
+ online_remote_nodes = add_list_element(online_remote_nodes, node_name);
+ } else {
+ online_nodes = add_list_element(online_nodes, node_name);
+ }
continue;
}
-
} else {
node_mode = "OFFLINE";
if (group_by_node == FALSE) {
- offline_nodes = add_list_element(offline_nodes, node_name);
+
+ if (node->details->remote_rsc) {
+ if (node->details->remote_rsc->container == NULL) {
+ offline_remote_nodes = add_list_element(offline_remote_nodes, node_name);
+ } else {
+ /* ignore displaying offline container nodes */
+ }
+ } else {
+ offline_nodes = add_list_element(offline_nodes, node_name);
+ }
continue;
}
}
- if(node->details->remote_rsc) {
- online_nodes = add_list_element(online_nodes, node->details->remote_rsc->id);
- }
-
- if (safe_str_eq(node->details->uname, node->details->id)) {
+ if (node->details->remote_rsc && node->details->remote_rsc->container) {
+ print_as("ContainerNode %s: %s\n", node_name, node_mode);
+ } else if (node->details->remote_rsc) {
+ print_as("RemoteNode %s: %s\n", node_name, node_mode);
+ } else if (safe_str_eq(node->details->uname, node->details->id)) {
print_as("Node %s: %s\n", node_name, node_mode);
} else {
print_as("Node %s (%s): %s\n", node_name, node->details->id, node_mode);
@@ -1328,6 +1345,18 @@ print_status(pe_working_set_t * data_set)
print_as("OFFLINE: [%s ]\n", offline_nodes);
free(offline_nodes);
}
+ if (online_remote_nodes) {
+ print_as("RemoteOnline: [%s ]\n", online_remote_nodes);
+ free(online_remote_nodes);
+ }
+ if (offline_remote_nodes) {
+ print_as("RemoteOFFLINE: [%s ]\n", offline_remote_nodes);
+ free(offline_remote_nodes);
+ }
+ if (online_remote_containers) {
+ print_as("Containers: [%s ]\n", online_remote_containers);
+ free(online_remote_containers);
+ }
if (group_by_node == FALSE && inactive_resources) {
print_as("\nFull list of resources:\n");
diff --git a/tools/crm_simulate.c b/tools/crm_simulate.c
index 0d95e53..78cab50 100644
--- a/tools/crm_simulate.c
+++ b/tools/crm_simulate.c
@@ -530,7 +530,10 @@ static void
print_cluster_status(pe_working_set_t * data_set)
{
char *online_nodes = NULL;
+ char *online_remote_nodes = NULL;
+ char *online_remote_containers = NULL;
char *offline_nodes = NULL;
+ char *offline_remote_nodes = NULL;
GListPtr gIter = NULL;
@@ -539,7 +542,7 @@ print_cluster_status(pe_working_set_t * data_set)
const char *node_mode = NULL;
char *node_name = NULL;
- if(node->details->remote_rsc) {
+ if (node->details->remote_rsc && node->details->remote_rsc->container) {
node_name = g_strdup_printf("%s:%s", node->details->uname, node->details->remote_rsc->container->id);
} else {
node_name = g_strdup_printf("%s", node->details->uname);
@@ -576,24 +579,45 @@ print_cluster_status(pe_working_set_t * data_set)
node_mode = "OFFLINE (maintenance)";
}
+
+
} else if (node->details->online) {
node_mode = "online";
- online_nodes = add_list_element(online_nodes, node_name);
+ if (node->details->remote_rsc && node->details->remote_rsc->container) {
+ online_remote_containers = add_list_element(online_remote_containers, node_name);
+ } else if (node->details->remote_rsc) {
+ online_remote_nodes = add_list_element(online_remote_nodes, node_name);
+ } else {
+ online_nodes = add_list_element(online_nodes, node_name);
+ }
free(node_name);
continue;
} else {
node_mode = "OFFLINE";
- offline_nodes = add_list_element(offline_nodes, node_name);
+ if (node->details->remote_rsc) {
+ if (node->details->remote_rsc->container == NULL) {
+ offline_remote_nodes = add_list_element(offline_remote_nodes, node_name);
+ } else {
+ /* ignore displaying offline container nodes */
+ }
+ } else {
+ offline_nodes = add_list_element(offline_nodes, node_name);
+ }
free(node_name);
continue;
}
- if (safe_str_eq(node_name, node->details->id)) {
+ if (node->details->remote_rsc && node->details->remote_rsc->container) {
+ printf("ContainerNode %s: %s\n", node_name, node_mode);
+ } else if (node->details->remote_rsc) {
+ printf("RemoteNode %s: %s\n", node_name, node_mode);
+ } else if (safe_str_eq(node->details->uname, node->details->id)) {
printf("Node %s: %s\n", node_name, node_mode);
} else {
printf("Node %s (%s): %s\n", node_name, node->details->id, node_mode);
}
+
free(node_name);
}
@@ -605,6 +629,18 @@ print_cluster_status(pe_working_set_t * data_set)
printf("OFFLINE: [%s ]\n", offline_nodes);
free(offline_nodes);
}
+ if (online_remote_nodes) {
+ printf("RemoteOnline: [%s ]\n", online_remote_nodes);
+ free(online_remote_nodes);
+ }
+ if (offline_remote_nodes) {
+ printf("RemoteOFFLINE: [%s ]\n", offline_remote_nodes);
+ free(offline_remote_nodes);
+ }
+ if (online_remote_containers) {
+ printf("Containers: [%s ]\n", online_remote_containers);
+ free(online_remote_containers);
+ }
fprintf(stdout, "\n");
for (gIter = data_set->resources; gIter != NULL; gIter = gIter->next) {