Exemple #1
0
        public static void WriteChaosFaultScheduledTraceEvent(IList <StateTransitionAction> faultList)
        {
            foreach (var fault in faultList)
            {
                Guid eventInstanceId = Guid.NewGuid();

                RestartNodeStateTransitionAction nodeRestartFault = fault as RestartNodeStateTransitionAction;

                if (nodeRestartFault != null)
                {
                    WriteRestartNodeFaultScheduledTraceEvent(eventInstanceId, nodeRestartFault);
                }
                else
                {
                    RestartReplicaStateTransitionAction replicaRestartFault = fault as RestartReplicaStateTransitionAction;

                    if (replicaRestartFault != null)
                    {
                        WriteRestartReplicaFaultScheduledTraceEvent(eventInstanceId, replicaRestartFault);
                    }
                    else
                    {
                        RemoveReplicaStateTransitionAction replicaRemoveFault = fault as RemoveReplicaStateTransitionAction;

                        if (replicaRemoveFault != null)
                        {
                            WriteRemoveReplicaFaultScheduledTraceEvent(eventInstanceId, replicaRemoveFault);
                        }
                        else
                        {
                            RestartCodePackageStateTransitionAction codePackageRestartFault = fault as RestartCodePackageStateTransitionAction;

                            if (codePackageRestartFault != null)
                            {
                                WriteRestartCodepackageFaultScheduledTraceEvent(eventInstanceId, codePackageRestartFault);
                            }
                            else
                            {
                                MovePrimaryReplicaStateTransitionAction movePrimaryFault = fault as MovePrimaryReplicaStateTransitionAction;

                                if (movePrimaryFault != null)
                                {
                                    WriteMovePrimaryReplicaFaultScheduledTraceEvent(eventInstanceId, movePrimaryFault);
                                }
                                else
                                {
                                    MoveSecondaryReplicaStateTransitionAction moveSecondaryFault = fault as MoveSecondaryReplicaStateTransitionAction;

                                    if (moveSecondaryFault != null)
                                    {
                                        WriteMoveSecondaryReplicaFaultScheduledTraceEvent(eventInstanceId, moveSecondaryFault);
                                    }
                                    else
                                    {
                                        throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Unrecognized Chaos fault type {0}, cannot write trace event.", fault.GetType().Name));
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
 private static void WriteRestartNodeFaultScheduledTraceEvent(Guid eventInstanceId, RestartNodeStateTransitionAction nodeRestartFault)
 {
     FabricEvents.Events.ChaosRestartNodeFaultScheduledEvent(
         eventInstanceId,
         nodeRestartFault.NodeName,
         nodeRestartFault.NodeInstanceId,
         nodeRestartFault.StateTransitionActionGroupId,
         nodeRestartFault.StateTransitionActionId);
 }