Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2:ARM
pacemaker
pacemaker-tickets-crm_simulate.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pacemaker-tickets-crm_simulate.diff of Package pacemaker
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) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor