Просмотр исходного кода

Enables test caes in saftest to pass by returning failure return codes in both
callback and return function. This may have to change later if a later errata
changes this functionality.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@722 fd59a12c-fef9-0310-b244-a6a79926bd2f

Steven Dake 20 лет назад
Родитель
Сommit
6b719b3504
3 измененных файлов с 19 добавлено и 4 удалено
  1. 7 0
      exec/ckpt.c
  2. 2 0
      include/ipc_ckpt.h
  3. 10 4
      lib/ckpt.c

+ 7 - 0
exec/ckpt.c

@@ -1223,6 +1223,11 @@ static int message_handler_req_exec_ckpt_checkpointopen (void *message, struct i
 
 	log_printf (LOG_LEVEL_DEBUG, "Executive request to open checkpoint %p\n", req_exec_ckpt_checkpointopen);
 	
+	if (req_exec_ckpt_checkpointopen->fail_with_error != SA_AIS_OK) {
+		error = req_exec_ckpt_checkpointopen->fail_with_error;
+		goto error_exit;
+	}
+
 	ckptCheckpoint = ckpt_checkpoint_find_global (&req_lib_ckpt_checkpointopen->checkpointName);
 
 	/*
@@ -2540,6 +2545,7 @@ static int message_handler_req_lib_ckpt_checkpointopen (struct conn_info *conn_i
 	req_exec_ckpt_checkpointopen.async_call = 0;
 	req_exec_ckpt_checkpointopen.invocation = 0;
 	req_exec_ckpt_checkpointopen.checkpointHandle = 0;
+	req_exec_ckpt_checkpointopen.fail_with_error = SA_AIS_OK;
 
 	iovecs[0].iov_base = (char *)&req_exec_ckpt_checkpointopen;
 	iovecs[0].iov_len = sizeof (req_exec_ckpt_checkpointopen);
@@ -2569,6 +2575,7 @@ static int message_handler_req_lib_ckpt_checkpointopenasync (struct conn_info *c
 	req_exec_ckpt_checkpointopen.async_call = 1;
 	req_exec_ckpt_checkpointopen.invocation = req_lib_ckpt_checkpointopenasync->invocation;
 	req_exec_ckpt_checkpointopen.checkpointHandle = req_lib_ckpt_checkpointopenasync->checkpointHandle;
+	req_exec_ckpt_checkpointopen.fail_with_error = req_lib_ckpt_checkpointopenasync->fail_with_error;
 
 	iovecs[0].iov_base = (char *)&req_exec_ckpt_checkpointopen;
 	iovecs[0].iov_len = sizeof (req_exec_ckpt_checkpointopen);

+ 2 - 0
include/ipc_ckpt.h

@@ -117,6 +117,7 @@ struct req_exec_ckpt_checkpointopen {
 	SaCkptCheckpointHandleT checkpointHandle;
 	SaInvocationT invocation;
 	int async_call;
+	SaAisErrorT fail_with_error;
 };
 
 
@@ -128,6 +129,7 @@ struct req_lib_ckpt_checkpointopenasync {
 	SaCkptCheckpointOpenFlagsT checkpointOpenFlags;
 	SaInvocationT invocation;
 	SaCkptCheckpointHandleT checkpointHandle;
+	SaAisErrorT fail_with_error;
 };
 
 struct res_lib_ckpt_checkpointopenasync {

+ 10 - 4
lib/ckpt.c

@@ -597,18 +597,23 @@ saCkptCheckpointOpenAsync (
 	SaAisErrorT error;
 	struct req_lib_ckpt_checkpointopenasync req_lib_ckpt_checkpointopenasync;
 	struct res_lib_ckpt_checkpointopenasync res_lib_ckpt_checkpointopenasync;
+	SaAisErrorT failWithError = SA_AIS_OK;
 
+	if (checkpointOpenFlags &
+		~(SA_CKPT_CHECKPOINT_READ|SA_CKPT_CHECKPOINT_WRITE|SA_CKPT_CHECKPOINT_CREATE)) {
+		failWithError = SA_AIS_ERR_BAD_FLAGS;
+	} else 
 	if ((checkpointOpenFlags & SA_CKPT_CHECKPOINT_CREATE) && 
 		checkpointCreationAttributes == NULL) {
 
-		return (SA_AIS_ERR_INVALID_PARAM);
-	}
-
+		failWithError = SA_AIS_ERR_INVALID_PARAM;
+	} else
 	if (((checkpointOpenFlags & SA_CKPT_CHECKPOINT_CREATE) == 0) && 
 		checkpointCreationAttributes != NULL) {
 
-		return (SA_AIS_ERR_INVALID_PARAM);
+		failWithError = SA_AIS_ERR_INVALID_PARAM;
 	}
+
 	error = saHandleInstanceGet (&ckptHandleDatabase, ckptHandle,
 		(void *)&ckptInstance);
 	if (error != SA_AIS_OK) {
@@ -636,6 +641,7 @@ saCkptCheckpointOpenAsync (
 	req_lib_ckpt_checkpointopenasync.header.size = sizeof (struct req_lib_ckpt_checkpointopenasync);
 	req_lib_ckpt_checkpointopenasync.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTOPENASYNC;
 	req_lib_ckpt_checkpointopenasync.invocation = invocation;
+	req_lib_ckpt_checkpointopenasync.fail_with_error = failWithError;
 	memcpy (&req_lib_ckpt_checkpointopenasync.checkpointName, checkpointName, sizeof (SaNameT));
 	req_lib_ckpt_checkpointopenasync.checkpointCreationAttributesSet = 0;
 	if (checkpointCreationAttributes) {