예제 #1
0
void PrintAll(BAN MemArray[],int iIndex)
{
for(int i=0; i<iIndex;++i)
{
	PrintMemberData(&MemArray[i]);
}
}
예제 #2
0
void Searching_by_id(BAN ban[],int size)
{
	int Result = Search_index(ban,size);
	if(Result!=-1){
			PrintMemberData(&(ban[Result]));
	}else{
			printf("Not Found!!!");
	}
}
예제 #3
0
void Search(BAN MemArray[],int iIndex)
{
	char Name[1024];
	printf("Name : ");
	gets(Name);
	int iSearch= Search_name(MemArray,&iIndex);
if(iSearch!=-1){
	PrintMemberData(&MemArray[iSearch]);
}else
{
	printf("Not Found");
}
}
예제 #4
0
void DdmRAIDMstrTest
::rmstrEventHandler(
			STATUS			eventCode,
			void			*pStatusData)
{
	U32					i=0;
	rowID				dedicatedSpareId;
	rowID				addMemberId;

	TRACEF_NF(TRACE_RMSTR_1,("\nEnter: DdmRAIDMstrTest::rmstrEventHandler\n"));
	RMSTR_EVT_ARRAY_ADDED_STATUS		*pEvtArrayAdded = NULL;
	RMSTR_EVT_ARRAY_DELETED_STATUS		*pEvtArrayDeleted = NULL;
	RMSTR_EVT_SPARE_ADDED_STATUS		*pEvtSpareAdded = NULL;
	RMSTR_EVT_SPARE_DELETED_STATUS		*pEvtSpareDeleted = NULL;
	RMSTR_EVT_UTIL_STARTED_STATUS		*pEvtUtilStarted = NULL;
	RMSTR_EVT_UTIL_STOPPED_STATUS		*pEvtUtilStopped = NULL;
	RMSTR_PRIORITY_CHANGED_STATUS		*pEvtPriorityChanged = NULL;
	RMSTR_PERCENT_COMPLETE_STATUS		*pEvtPercentComplete = NULL;
	RMSTR_EVT_MEMBER_DOWN_STATUS		*pEvtMemberDown = NULL;
	RMSTR_EVT_MEMBER_ADDED_STATUS		*pEvtMemberAdded = NULL;
	RMSTR_EVT_SPARE_ACTIVATED_STATUS	*pEvtSpareActivated = NULL;
	RMSTR_EVT_ARRAY_CRITICAL_STATUS		*pEvtArrayCriticalStatus = NULL;
	RMSTR_EVT_ARRAY_OFFLINE_STATUS		*pEvtArrayOfflineStatus = NULL;
	RMSTR_EVT_PREFERRED_MEMBER_CHANGED_STATUS		*pEvtPreferredMemberChanged = NULL;
	RMSTR_EVT_SOURCE_MEMBER_CHANGED_STATUS			*pEvtSourceMemberChanged = NULL;
	RMSTR_EVT_ARRAY_FAULT_TOLERANT_STATUS			*pEvtArrayFaultTolerant = NULL;

	RAID_UTIL_POLICIES					utilPolicy;
	rowID								tempRowId = {9,0,1};

	UnicodeString				ucNewArrayName;
	StringClass					scNewArrayName;


	TRACE_STRING(TRACE_RMSTR_1, "\t<<<Event Received>>>:\n");
	TRACEF_NF(TRACE_RMSTR_1,("\t\tEvent=%s\n", 
				dispEventName[eventCode]));
	switch(eventCode){
	case RMSTR_EVT_ARRAY_ADDED:
		pEvtArrayAdded = (RMSTR_EVT_ARRAY_ADDED_STATUS *)pStatusData;
		PrintArrayData(&pEvtArrayAdded->arrayData);
		// Display the array name
		ucNewArrayName = UnicodeString(pEvtArrayAdded->arrayName);
		ucNewArrayName.GetAsciiString(scNewArrayName);
		TRACEF_NF(TRACE_RMSTR_1, ("\t\tArrayName=%s\n", scNewArrayName.CString()));
#if 0
		addMemberId.Table = pEvtArrayAdded->arrayData.SRCTRID.Table;
		addMemberId.HiPart = 0;
		addMemberId.LoPart = 4;		// 5 is still free

		// Add a member
		TestAddMember(
			&pEvtArrayAdded->arrayData.thisRID,
			&addMemberId);
#endif

#if 0
		TestChangePreferredMember(
				&pEvtArrayAdded->arrayData.thisRID,
				&pEvtArrayAdded->arrayData.members[1]);
#endif
#if 0
		TestChangeSourceMember(
				&pEvtArrayAdded->arrayData.thisRID,
				&pEvtArrayAdded->arrayData.members[1]);
#endif

#if 1
		// Add a Dedicated Spare
		dedicatedSpareId.Table = pEvtArrayAdded->SRCData.rid.Table;
		dedicatedSpareId.HiPart = 0;
		dedicatedSpareId.LoPart = 5;		// 5 is still free
		TestAddSpare(
			//RAID_HOST_POOL_SPARE,
			//RAID_GENERAL_POOL_SPARE,
			RAID_DEDICATED_SPARE,
			&dedicatedSpareId,
			//NULL,
			&pEvtArrayAdded->arrayData.thisRID,	// target rid
			NULL);
#endif
#if 0
		memset(&utilPolicy,0,sizeof(RAID_UTIL_POLICIES));
		// Start a verify on the Array
		utilPolicy.SilentMode = 1;
		utilPolicy.RunThruErrors = 1;
		utilPolicy.SpecifyMembersToRunOn = 0;
		TestStartUtility(
			&pEvtArrayAdded->arrayData.thisRID,	// target rid
			RAID_UTIL_VERIFY,
			PRIORITY_HIGH,
			utilPolicy,
			5);							// %complete update rate
#endif

#if 0
		// Down a member
		rowID		memberRowId = pEvtArrayAdded->arrayData.members[1];
		TestDownAMember(&pEvtArrayAdded->arrayData.thisRID,&memberRowId);
#endif
		break;

	case RMSTR_EVT_ARRAY_DELETED:
		pEvtArrayDeleted = (RMSTR_EVT_ARRAY_DELETED_STATUS *)pStatusData;
		PrintArrayData(&pEvtArrayDeleted->arrayData);
#if 0
		TestDeleteArray(&pEvtArrayDeleted->arrayData.thisRID);
#endif

		break;


	case RMSTR_EVT_PREFERRED_MEMBER_CHANGED:
		pEvtPreferredMemberChanged = (RMSTR_EVT_PREFERRED_MEMBER_CHANGED_STATUS *)pStatusData;
		PrintArrayData(&pEvtPreferredMemberChanged->arrayData);
		break;

	case RMSTR_EVT_SOURCE_MEMBER_CHANGED:
		pEvtSourceMemberChanged = (RMSTR_EVT_SOURCE_MEMBER_CHANGED_STATUS *)pStatusData;
		PrintArrayData(&pEvtSourceMemberChanged->arrayData);
		break;


	case RMSTR_EVT_UTIL_STARTED:
		pEvtUtilStarted = (RMSTR_EVT_UTIL_STARTED_STATUS *)pStatusData;
		TRACEF_NF(TRACE_RMSTR_1,("\t\tUtil=%s\n", 
				dispUtilityName[pEvtUtilStarted->utilityData.utilityCode]));
		PrintUtilityData(&pEvtUtilStarted->utilityData);

#if 0
		TestDeleteArray(&pEvtUtilStarted->utilityData.targetRID);
#endif

#if 1
		//TestChangePriority(&pEvtUtilStarted->utilityData.thisRID, PRIORITY_LOW);
		TestAbortUtility(&pEvtUtilStarted->utilityData.thisRID);
#endif
		break;

	case RMSTR_EVT_UTIL_STOPPED:
		pEvtUtilStopped = (RMSTR_EVT_UTIL_STOPPED_STATUS *)pStatusData;
		TRACEF_NF(TRACE_RMSTR_1,("\t\tUtil=%s\n", 
				dispUtilityName[pEvtUtilStopped->utilityData.utilityCode]));
		switch(pEvtUtilStopped->reason){
		case RAID_UTIL_ABORTED:
			TRACEF_NF(TRACE_RMSTR_1, ("\t\tUTIL ABORTED BY USER\n"));
			break;
		case RAID_UTIL_ABORTED_IOERROR:
			TRACEF_NF(TRACE_RMSTR_1, ("\t\tUTIL ABORTED IOERROR\n"));
			break;
		case RAID_UTIL_COMPLETE:
			TRACEF_NF(TRACE_RMSTR_1, ("\t\tUTIL COMPLETED\n"));
			break;
		}
		PrintUtilityData(&pEvtUtilStopped->utilityData);
		switch(pEvtUtilStopped->utilityData.utilityCode){
		case RAID_UTIL_VERIFY:
			TRACEF_NF(TRACE_RMSTR_1, ("\t\tUtil Miscompare cnt=%x\n", 
				pEvtUtilStopped->miscompareCount));

			break;
		}
		break;
	

	case RMSTR_EVT_UTIL_PRIORITY_CHANGED:
		pEvtPriorityChanged = (RMSTR_PRIORITY_CHANGED_STATUS *)pStatusData;
		PrintUtilityData(&pEvtPriorityChanged->utilityData);
		TRACEF_NF(TRACE_RMSTR_1, ("\t\tUtil Old priority=%x\n", 
			pEvtPriorityChanged->oldPriority));
		TRACEF_NF(TRACE_RMSTR_1, ("\t\tUtil New priority=%x\n", 
			pEvtPriorityChanged->utilityData.priority));
		break;

	case RMSTR_EVT_UTIL_PERCENT_COMPLETE:
		pEvtPercentComplete = (RMSTR_PERCENT_COMPLETE_STATUS *)pStatusData;
		PrintUtilityData(&pEvtPercentComplete->utilityData);
		TRACEF_NF(TRACE_RMSTR_1, ("\t\tUtil Percent Complete=%x\n", 
			pEvtPercentComplete->percentComplete));
		break;

	case RMSTR_EVT_ARRAY_FAULT_TOLERANT:
		pEvtArrayFaultTolerant = (RMSTR_EVT_ARRAY_FAULT_TOLERANT_STATUS *)pStatusData;
		PrintArrayData(&pEvtArrayFaultTolerant->arrayData);
		break;

	case RMSTR_EVT_SPARE_ADDED:
		pEvtSpareAdded = (RMSTR_EVT_SPARE_ADDED_STATUS *)pStatusData;
		PrintSpareData(&pEvtSpareAdded->spareData);
#if 1
		// Down a member
		rowID		memberRowId;
		memberRowId.Table = 0xe;
		memberRowId.HiPart = 0;
		memberRowId.LoPart = 1;
		TestDownAMember(&pEvtSpareAdded->spareData.arrayRID,&memberRowId);
#endif
#if 0
		addMemberId.Table = pEvtSpareAdded->spareData.SRCTRID.Table;
		addMemberId.HiPart = 0;
		addMemberId.LoPart = 4;		// 5 is still free

		// Add a member
		TestAddMember(
			&pEvtSpareAdded->spareData.arrayRID,
			&addMemberId);
#endif

#if 0
		TestDeleteSpare(&pEvtSpareAdded->spareData.thisRID);
#endif
		break;
	
	case RMSTR_EVT_MEMBER_DOWN:
		pEvtMemberDown = (RMSTR_EVT_MEMBER_DOWN_STATUS *)pStatusData;
		PrintMemberData(&pEvtMemberDown->memberData);
#if 0
		// Add a Dedicated Spare
		dedicatedSpareId.Table = pEvtMemberDown->memberData.memberRID.Table;
		dedicatedSpareId.HiPart = 0;
		dedicatedSpareId.LoPart = 5;		// 5 is still free
		TestAddSpare(
			//RAID_HOST_POOL_SPARE,
			RAID_GENERAL_POOL_SPARE,
			//RAID_DEDICATED_SPARE,
			&dedicatedSpareId,
			NULL,
			//&pEvtMemberDown->memberData.arrayRID,	// target rid
			NULL);
#endif

		break;

	case RMSTR_EVT_MEMBER_ADDED:
		pEvtMemberAdded = (RMSTR_EVT_MEMBER_ADDED_STATUS *)pStatusData;
		PrintMemberData(&pEvtMemberAdded->memberData);
		break;

	case RMSTR_EVT_SPARE_ACTIVATED:
		pEvtSpareActivated = (RMSTR_EVT_SPARE_ACTIVATED_STATUS *)pStatusData;
		PrintSpareData(&pEvtSpareActivated->spareData);
#if 0
		memset(&utilPolicy,0,sizeof(RAID_UTIL_POLICIES));
		// Start a regenerate on the Array
		utilPolicy.SilentMode = 1;
		utilPolicy.RunThruErrors = 1;
		utilPolicy.SpecifyMembersToRunOn = 0;
		TestStartUtility(
			&pEvtSpareActivated->spareData.arrayRID,	// target rid
			RAID_UTIL_REGENERATE,
			PRIORITY_HIGH,
			utilPolicy,
			15);				// %complete update rate
#endif
#if 0
		// Add a Dedicated Spare
		dedicatedSpareId.Table = pEvtSpareActivated->spareData.SRCTRID.Table;
		dedicatedSpareId.HiPart = 0;
		dedicatedSpareId.LoPart = 5;		// 5 is still free
		TestAddSpare(
			//RAID_HOST_POOL_SPARE,
			//RAID_GENERAL_POOL_SPARE,
			RAID_DEDICATED_SPARE,
			&dedicatedSpareId,
			//NULL,
			&pEvtSpareActivated->spareData.arrayRID,	// target rid
			NULL);
#endif
		break;

	case RMSTR_EVT_SPARE_DELETED:	
		pEvtSpareDeleted = (RMSTR_EVT_SPARE_DELETED_STATUS *)pStatusData;
		PrintSpareData(&pEvtSpareDeleted->spareData);
#if 0
		TestDeleteArray(&pEvtSpareDeleted->spareData.arrayRID);
#endif
#if 0
		TestDeleteSpare(&pEvtSpareDeleted->spareData.thisRID);
#endif
		break;

	case RMSTR_EVT_ARRAY_CRITICAL:
		pEvtArrayCriticalStatus = (RMSTR_EVT_ARRAY_CRITICAL_STATUS *)pStatusData;
		PrintArrayData(&pEvtArrayCriticalStatus->arrayData);
		break;

	case RMSTR_EVT_ARRAY_OFFLINE:
		pEvtArrayOfflineStatus = (RMSTR_EVT_ARRAY_OFFLINE_STATUS *)pStatusData;
		PrintArrayData(&pEvtArrayOfflineStatus->arrayData);
		break;
	}
}