Permalink
Browse files

Remove "-f" option in grant and revoke commands

The "-f" option in grant and revoke commands had intended to provide
a method to bypass the paxos algorithm hence provide the user a totally
manual way to manage the ticket. However, because the usage of "-f"
often confused the user and also crm_ticket commmand in pacemaker can
provide the same functionality, so remove the "-f" option now.

Signed-off-by: Jiaju Zhang <jjzhang@suse.de>
  • Loading branch information...
1 parent 1be2b6b commit caeb04051b7642e9f4facbdb217d2fa27053f786 @jjzhang committed Apr 9, 2012
Showing with 10 additions and 41 deletions.
  1. +0 −3 src/booth.h
  2. +6 −23 src/main.c
  3. +2 −13 src/ticket.c
  4. +2 −2 src/ticket.h
View
@@ -42,13 +42,10 @@
#define BOOTHC_MAGIC 0x5F1BA08C
#define BOOTHC_VERSION 0x00010000
-#define BOOTHC_OPT_FORCE 0x00000001
-
struct boothc_header {
uint32_t magic;
uint32_t version;
uint32_t cmd;
- uint32_t option;
uint32_t expiry;
uint32_t len;
uint32_t result;
View
@@ -77,7 +77,6 @@ typedef enum {
struct command_line {
int type; /* ACT_ */
int op; /* OP_ */
- int force;
char configfile[BOOTH_PATH_LEN];
char lockfile[BOOTH_PATH_LEN];
char site[BOOTH_NAME_LEN];
@@ -156,7 +155,7 @@ static int do_connect(const char *sock_path)
return fd;
}
-static void init_header(struct boothc_header *h, int cmd, int option,
+static void init_header(struct boothc_header *h, int cmd,
int result, int data_len)
{
memset(h, 0, sizeof(struct boothc_header));
@@ -165,7 +164,6 @@ static void init_header(struct boothc_header *h, int cmd, int option,
h->version = BOOTHC_VERSION;
h->len = data_len;
h->cmd = cmd;
- h->option = option;
h->result = result;
}
@@ -346,7 +344,7 @@ void process_connection(int ci)
goto reply;
}
if (local)
- h.result = grant_ticket(ticket, h.option);
+ h.result = grant_ticket(ticket);
else
h.result = BOOTHC_RLT_REMOTE_OP;
break;
@@ -364,7 +362,7 @@ void process_connection(int ci)
goto reply;
}
if (local)
- h.result = revoke_ticket(ticket, h.option);
+ h.result = revoke_ticket(ticket);
else
h.result = BOOTHC_RLT_REMOTE_OP;
break;
@@ -527,7 +525,7 @@ static int do_list(void)
int data_len;
int fd, rv;
- init_header(&h, BOOTHC_CMD_LIST, 0, 0, 0);
+ init_header(&h, BOOTHC_CMD_LIST, 0, 0);
fd = do_connect(BOOTHC_SOCK_PATH);
if (fd < 0) {
@@ -628,7 +626,6 @@ static int do_command(cmd_request_t cmd)
char *buf;
struct boothc_header *h, reply;
int buflen;
- uint32_t force = 0;
int fd, rv;
int expire_time;
int i;
@@ -641,10 +638,7 @@ static int do_command(cmd_request_t cmd)
goto out;
}
h = (struct boothc_header *)buf;
- if (cl.force)
- force = BOOTHC_OPT_FORCE;
- init_header(h, cmd, force, 0,
- sizeof(cl.site) + sizeof(cl.ticket));
+ init_header(h, cmd, 0, sizeof(cl.site) + sizeof(cl.ticket));
strcpy(buf + sizeof(struct boothc_header), cl.site);
strcpy(buf + sizeof(struct boothc_header) + sizeof(cl.site), cl.ticket);
@@ -854,12 +848,10 @@ static void print_usage(void)
printf(" -D Enable debugging to stderr and don't fork\n");
printf(" -t ticket name\n");
printf(" -s site name\n");
- printf(" -f ticket attribute: force, only valid when "
- "granting\n");
printf(" -h Print this help, then exit\n");
}
-#define OPTION_STRING "c:Dl:t:s:fh"
+#define OPTION_STRING "c:Dl:t:s:h"
static char *logging_entity = NULL;
@@ -970,15 +962,6 @@ static int read_arguments(int argc, char **argv)
}
break;
- case 'f':
- if (cl.op == OP_GRANT)
- cl.force = 1;
- else {
- print_usage();
- exit(EXIT_FAILURE);
- }
- break;
-
case 'h':
print_usage();
exit(EXIT_SUCCESS);
View
@@ -382,17 +382,11 @@ int ticket_recv(void *msg, int msglen)
msglen - sizeof(struct booth_msghdr));
}
-int grant_ticket(char *ticket, int force)
+int grant_ticket(char *ticket)
{
struct ticket *tk;
int found = 0;
- if (force) {
- pcmk_handler.store_ticket(ticket, ticket_get_myid(), 0, -1);
- pcmk_handler.grant_ticket(ticket);
- return BOOTHC_RLT_SYNC_SUCC;
- }
-
list_for_each_entry(tk, &ticket_list, list) {
if (!strcmp(tk->id, ticket)) {
found = 1;
@@ -412,7 +406,7 @@ int grant_ticket(char *ticket, int force)
}
}
-int revoke_ticket(char *ticket, int force)
+int revoke_ticket(char *ticket)
{
struct ticket *tk;
int found = 0;
@@ -428,11 +422,6 @@ int revoke_ticket(char *ticket, int force)
return BOOTHC_RLT_SYNC_FAIL;
}
- if (force) {
- pcmk_handler.store_ticket(tk->id, -1, 0, 0);
- pcmk_handler.revoke_ticket(tk->id);
- }
-
if (tk->owner == -1)
return BOOTHC_RLT_SYNC_SUCC;
else {
View
@@ -23,8 +23,8 @@
int check_ticket(char *ticket);
int check_site(char *site, int *local);
-int grant_ticket(char *ticket, int force);
-int revoke_ticket(char *ticket, int force);
+int grant_ticket(char *ticket);
+int revoke_ticket(char *ticket);
int list_ticket(char **pdata, unsigned int *len);
int catchup_ticket(char **pdata, unsigned int len);
int ticket_recv(void *msg, int msglen);

0 comments on commit caeb040

Please sign in to comment.