From 3f05a6fd6463e62f70d8d79c993795c9a869f884 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Fri, 17 Jun 2005 18:39:51 +0000 Subject: [PATCH] defect 628 saCkptCheckpointStatusGet test case 13 from saftest fails (Logical change 1.209) git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@675 fd59a12c-fef9-0310-b244-a6a79926bd2f --- exec/ckpt.c | 15 ++++++++++++++- exec/ckpt.h | 1 + lib/ckpt.c | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/exec/ckpt.c b/exec/ckpt.c index dacde215..67ea7430 100644 --- a/exec/ckpt.c +++ b/exec/ckpt.c @@ -1055,6 +1055,14 @@ static int message_handler_req_exec_ckpt_checkpointopen (void *message, struct i ckptCheckpoint->referenceCount = 0; ckptCheckpoint->retention_timer = 0; ckptCheckpoint->expired = 0; + + if ((ckptCheckpoint->checkpointCreationAttributes.creationFlags & SA_CKPT_WR_ALL_REPLICAS) == 1 && + (ckptCheckpoint->checkpointCreationAttributes.creationFlags & SA_CKPT_CHECKPOINT_COLLOCATED) == 0) { + ckptCheckpoint->active_replica_set = 1; + } else { + ckptCheckpoint->active_replica_set = 0; + } + initialize_ckpt_refcount_array(ckptCheckpoint->ckpt_refcount); /* @@ -2345,6 +2353,7 @@ static int message_handler_req_lib_ckpt_activereplicaset (struct conn_info *conn (checkpoint->checkpointCreationAttributes.creationFlags & (SA_CKPT_WR_ACTIVE_REPLICA | SA_CKPT_WR_ACTIVE_REPLICA_WEAK)) == 0) { error = SA_AIS_ERR_BAD_OPERATION; } + checkpoint->active_replica_set = 1; res_lib_ckpt_activereplicaset.header.size = sizeof (struct res_lib_ckpt_activereplicaset); res_lib_ckpt_activereplicaset.header.id = MESSAGE_RES_CKPT_ACTIVEREPLICASET; res_lib_ckpt_activereplicaset.header.error = error; @@ -2387,7 +2396,11 @@ static int message_handler_req_lib_ckpt_checkpointstatusget (struct conn_info *c */ res_lib_ckpt_checkpointstatusget.header.size = sizeof (struct res_lib_ckpt_checkpointstatusget); res_lib_ckpt_checkpointstatusget.header.id = MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET; - res_lib_ckpt_checkpointstatusget.header.error = SA_AIS_OK; + if (checkpoint->active_replica_set == 1) { + res_lib_ckpt_checkpointstatusget.header.error = SA_AIS_OK; + } else { + res_lib_ckpt_checkpointstatusget.header.error = SA_AIS_ERR_NOT_EXIST; + } memcpy (&res_lib_ckpt_checkpointstatusget.checkpointDescriptor.checkpointCreationAttributes, &checkpoint->checkpointCreationAttributes, diff --git a/exec/ckpt.h b/exec/ckpt.h index 88db529d..831a229d 100644 --- a/exec/ckpt.h +++ b/exec/ckpt.h @@ -61,6 +61,7 @@ struct saCkptCheckpoint { int unlinked; poll_timer_handle retention_timer; int expired; + int active_replica_set; struct ckpt_refcnt ckpt_refcount[PROCESSOR_COUNT_MAX]; }; diff --git a/lib/ckpt.c b/lib/ckpt.c index 7b973a29..acb4740b 100644 --- a/lib/ckpt.c +++ b/lib/ckpt.c @@ -853,7 +853,7 @@ saCkptCheckpointStatusGet ( error_exit: saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle); - return (error); + return (error == SA_AIS_OK ? res_lib_ckpt_checkpointstatusget.header.error : error); } SaAisErrorT