| 868 | } |
| 869 | |
| 870 | static void |
| 871 | modify_configuration(pe_working_set_t * data_set, |
| 872 | const char *quorum, GListPtr node_up, GListPtr node_down, GListPtr node_fail, |
| 873 | GListPtr op_inject, GListPtr ticket_grant, GListPtr ticket_revoke, |
| 874 | GListPtr ticket_standby, GListPtr ticket_activate) |
| 875 | { |
| 876 | int rc = pcmk_ok; |
| 877 | GListPtr gIter = NULL; |
| 878 | |
| 879 | xmlNode *cib_op = NULL; |
| 880 | xmlNode *cib_node = NULL; |
| 881 | xmlNode *cib_resource = NULL; |
| 882 | |
| 883 | lrmd_event_data_t *op = NULL; |
| 884 | |
| 885 | if (quorum) { |
| 886 | xmlNode *top = create_xml_node(NULL, XML_TAG_CIB); |
| 887 | |
| 888 | quiet_log(" + Setting quorum: %s\n", quorum); |
| 889 | /* crm_xml_add(top, XML_ATTR_DC_UUID, dc_uuid); */ |
| 890 | crm_xml_add(top, XML_ATTR_HAVE_QUORUM, quorum); |
| 891 | |
| 892 | rc = global_cib->cmds->modify(global_cib, NULL, top, cib_sync_call | cib_scope_local); |
| 893 | CRM_ASSERT(rc == pcmk_ok); |
| 894 | } |
| 895 | |
| 896 | for (gIter = node_up; gIter != NULL; gIter = gIter->next) { |
| 897 | char *node = (char *)gIter->data; |
| 898 | |
| 899 | quiet_log(" + Bringing node %s online\n", node); |
| 900 | cib_node = modify_node(global_cib, node, TRUE); |
| 901 | CRM_ASSERT(cib_node != NULL); |
| 902 | |
| 903 | rc = global_cib->cmds->modify(global_cib, XML_CIB_TAG_STATUS, cib_node, |
| 904 | cib_sync_call | cib_scope_local); |
| 905 | CRM_ASSERT(rc == pcmk_ok); |
| 906 | } |
| 907 | |
| 908 | for (gIter = node_down; gIter != NULL; gIter = gIter->next) { |
| 909 | char *node = (char *)gIter->data; |
| 910 | |
| 911 | quiet_log(" + Taking node %s offline\n", node); |
| 912 | cib_node = modify_node(global_cib, node, FALSE); |
| 913 | CRM_ASSERT(cib_node != NULL); |
| 914 | |
| 915 | rc = global_cib->cmds->modify(global_cib, XML_CIB_TAG_STATUS, cib_node, |
| 916 | cib_sync_call | cib_scope_local); |
| 917 | CRM_ASSERT(rc == pcmk_ok); |
| 918 | } |
| 919 | |
| 920 | for (gIter = node_fail; gIter != NULL; gIter = gIter->next) { |
| 921 | char *node = (char *)gIter->data; |
| 922 | |
| 923 | quiet_log(" + Failing node %s\n", node); |
| 924 | cib_node = modify_node(global_cib, node, TRUE); |
| 925 | crm_xml_add(cib_node, XML_NODE_IN_CLUSTER, XML_BOOLEAN_NO); |
| 926 | CRM_ASSERT(cib_node != NULL); |
| 927 |
no test coverage detected