- Resolve coverity RESOURCE_LEAK, REVERSE_INULL and UNREACHABLE defects - Tools: crm_simulate - Support to grant/revoke/standby/activate tickets from the new ticket state section (bnc#752241) - Tools: Add crm_ticket to be profiled by valgrind - Tools: crm_ticket - Display the tickets that are referenced in rsc_ticket constraints but have never been granted yet (bnc#752241) - Tools: crm_mon - Support to display tickets (bnc#752242) - PE: Move the ticket state section to "/cib/status/tickets/ticket_state" (bnc#752241) - PE: Support to make tickets standby for relinquishing tickets gracefully (bnc#752241) - Tools: Implement a new crm_ticket (bnc#752241) - Tools: Update CLI regression tests for the new crm_ticket - Tools: Add CLI regression tests for ticket standby state - PE: Update regression tests for the new ticket state section - PE: Support to make tickets standby for relinquishing tickets gracefully (regression tests) - Tools: crm_ticket - Granting/revoking tickets need user to confirm unless "--force" option is used (bnc#752269) - Tools: Implement the support of granting/revoking tickets for crm_simulate (bnc#752241) OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/pacemaker?expand=0&rev=34
98 lines
3.7 KiB
Diff
98 lines
3.7 KiB
Diff
commit 575e1964464f6df7de7b2fbb688469554cdec44f
|
|
Author: Gao,Yan <ygao@suse.com>
|
|
Date: Thu Mar 8 18:40:54 2012 +0800
|
|
|
|
Medium: Tools: crm_simulate - Implement the support of granting/revoking tickets for crm_simulate
|
|
|
|
diff --git a/tools/crm_inject.c b/tools/crm_inject.c
|
|
index 44b5cad..610140b 100644
|
|
--- a/tools/crm_inject.c
|
|
+++ b/tools/crm_inject.c
|
|
@@ -758,7 +758,7 @@ create_dotfile(pe_working_set_t * data_set, const char *dot_file, gboolean all_a
|
|
static void
|
|
modify_configuration(pe_working_set_t * data_set,
|
|
const char *quorum, GListPtr node_up, GListPtr node_down, GListPtr node_fail,
|
|
- GListPtr op_inject)
|
|
+ GListPtr op_inject, GListPtr ticket_grant, GListPtr ticket_revoke)
|
|
{
|
|
int rc = cib_ok;
|
|
GListPtr gIter = NULL;
|
|
@@ -817,6 +817,34 @@ modify_configuration(pe_working_set_t * data_set,
|
|
CRM_ASSERT(rc == cib_ok);
|
|
}
|
|
|
|
+ for (gIter = ticket_grant; gIter != NULL; gIter = gIter->next) {
|
|
+ char *ticket = (char *)gIter->data;
|
|
+ char *attr_name = crm_concat("granted-ticket", ticket, '-');
|
|
+
|
|
+ quiet_log(" + Granting ticket %s\n", ticket);
|
|
+ rc = update_attr(global_cib, cib_sync_call | cib_scope_local,
|
|
+ XML_CIB_TAG_TICKETS, NULL, NULL, NULL, NULL,
|
|
+ attr_name, "true", TRUE);
|
|
+
|
|
+ crm_free(attr_name);
|
|
+
|
|
+ CRM_ASSERT(rc == cib_ok);
|
|
+ }
|
|
+
|
|
+ for (gIter = ticket_revoke; gIter != NULL; gIter = gIter->next) {
|
|
+ char *ticket = (char *)gIter->data;
|
|
+ char *attr_name = crm_concat("granted-ticket", ticket, '-');
|
|
+
|
|
+ quiet_log(" + Revoking ticket %s\n", ticket);
|
|
+ rc = update_attr(global_cib, cib_sync_call | cib_scope_local,
|
|
+ XML_CIB_TAG_TICKETS, NULL, NULL, NULL, NULL,
|
|
+ attr_name, "false", TRUE);
|
|
+
|
|
+ crm_free(attr_name);
|
|
+
|
|
+ CRM_ASSERT(rc == cib_ok);
|
|
+ }
|
|
+
|
|
for (gIter = op_inject; gIter != NULL; gIter = gIter->next) {
|
|
char *spec = (char *)gIter->data;
|
|
|
|
@@ -971,6 +999,8 @@ static struct crm_option long_options[] = {
|
|
{"op-fail", 1, 0, 'F', "\t$rsc_$task_$interval@$node=$rc - Fail the specified task while running the simulation"},
|
|
{"set-datetime", 1, 0, 't', "Set date/time"},
|
|
{"quorum", 1, 0, 'q', "\tSpecify a value for quorum"},
|
|
+ {"ticket-grant", 1, 0, 'g', "Grant a ticket"},
|
|
+ {"ticket-revoke",1, 0, 'r', "Revoke a ticket"},
|
|
|
|
{"-spacer-", 0, 0, '-', "\nOutput Options:"},
|
|
|
|
@@ -1090,6 +1120,8 @@ main(int argc, char **argv)
|
|
GListPtr node_down = NULL;
|
|
GListPtr node_fail = NULL;
|
|
GListPtr op_inject = NULL;
|
|
+ GListPtr ticket_grant = NULL;
|
|
+ GListPtr ticket_revoke = NULL;
|
|
|
|
xmlNode *input = NULL;
|
|
|
|
@@ -1163,6 +1195,14 @@ main(int argc, char **argv)
|
|
modified++;
|
|
quorum = optarg;
|
|
break;
|
|
+ case 'g':
|
|
+ modified++;
|
|
+ ticket_grant = g_list_append(ticket_grant, optarg);
|
|
+ break;
|
|
+ case 'r':
|
|
+ modified++;
|
|
+ ticket_revoke = g_list_append(ticket_revoke, optarg);
|
|
+ break;
|
|
case 'a':
|
|
all_actions = TRUE;
|
|
break;
|
|
@@ -1249,7 +1289,8 @@ main(int argc, char **argv)
|
|
|
|
if (modified) {
|
|
quiet_log("Performing requested modifications\n");
|
|
- modify_configuration(&data_set, quorum, node_up, node_down, node_fail, op_inject);
|
|
+ modify_configuration(&data_set, quorum, node_up, node_down, node_fail, op_inject,
|
|
+ ticket_grant, ticket_revoke);
|
|
|
|
rc = global_cib->cmds->query(global_cib, NULL, &input, cib_sync_call);
|
|
if (rc != cib_ok) {
|