public MoveToExecutingAction(CoordinatorEnvironment environment, IRepairManager repairManager, IRepairTask repairTask, string warning = null)
     : base(environment, ActionType.Execute)
 {
     this.repairManager = repairManager.Validate("repairManager");
     this.repairTask    = repairTask.Validate("repairTask");
     this.warning       = warning;
 }
Example #2
0
        public AzureParallelDisabledCoordinator(
            CoordinatorEnvironment environment,
            string tenantId,
            Func <Task <IPolicyAgentClient> > policyAgentClientAsyncFactory,
            IRepairManager repairManager,
            IHealthClient healthClient,
            IActivityLogger activityLogger,
            Guid partitionId,
            long replicaId)
        {
            this.environment = environment.Validate("environment");
            this.tenantId    = tenantId.Validate("tenantId");
            this.partitionId = partitionId;
            this.policyAgentClientAsyncFactory = policyAgentClientAsyncFactory.Validate("policyAgentClientAsyncFactory");

            this.traceType = environment.CreateTraceType("DisabledCoordinator");

            this.repairManager = repairManager.Validate("repairManager");
            this.healthClient  = healthClient.Validate("healthClient");

            this.configSection  = environment.Config;
            this.activityLogger = activityLogger.Validate("activityLogger");

            var assembly = this.GetType().GetTypeInfo().Assembly;

            assemblyFileVersion = FileVersionInfo.GetVersionInfo(assembly.Location).FileVersion;
        }
Example #3
0
            public Task ExecuteAsync(IRepairManager repairManager)
            {
                this.repairTask.State        = RepairTaskState.Restoring;
                this.repairTask.ResultStatus = RepairTaskResult.Succeeded;

                return(repairManager.UpdateRepairExecutionStateAsync(Guid.Empty, this.repairTask));
            }
Example #4
0
            public async Task ExecuteAsync(IRepairManager repairManager)
            {
                this.repairTask.State = RepairTaskState.Executing;

                await repairManager.UpdateRepairExecutionStateAsync(Guid.Empty, this.repairTask);

                this.record.IsApproved = true;
            }
 public CancelRestoringHealthCheckAction(
     CoordinatorEnvironment environment,
     IRepairManager repairManager,
     IRepairTask repairTask)
     : base(environment, ActionType.Restore)
 {
     this.repairManager = repairManager.Validate("repairManager");
     this.repairTask    = repairTask.Validate("repairTask");
 }
Example #6
0
 public ActionFactory(
     CoordinatorEnvironment environment,
     IPolicyAgentClient policyAgentClient,
     IRepairManager repairManager,
     RepairActionProvider repairActionProvider)
 {
     this.environment          = environment.Validate("environment");
     this.policyAgentClient    = policyAgentClient.Validate("policyAgentClient");
     this.repairManager        = repairManager.Validate("repairManager");
     this.repairActionProvider = repairActionProvider.Validate("repairActionProvider");
     this.jobResponseMap       = new Dictionary <Guid, JobStepResponseEnum>();
 }
 public ClaimedRepairTaskAction(
     CoordinatorEnvironment environment,
     IRepairManager repairManager,
     IRepairTask repairTask,
     IList <string> roleInstanceNames,
     RepairActionProvider repairActionProvider)
     : base(environment, ActionType.None)
 {
     this.repairManager        = repairManager.Validate("repairManager");
     this.repairTask           = repairTask.Validate("repairTask");
     this.roleInstanceNames    = roleInstanceNames.Validate("roleInstanceName");
     this.repairActionProvider = repairActionProvider.Validate("repairActionProvider");
 }
Example #8
0
 public ExecuteJobAction(
     CoordinatorEnvironment environment,
     Action <Guid> approveJobAction,
     IRepairManager repairManager,
     ITenantJob tenantJob,
     IRepairTask repairTask)
     : base(environment, ActionType.None)
 {
     this.approveJobAction = approveJobAction.Validate("approveJobAction");
     this.repairManager    = repairManager.Validate("repairManager");
     this.tenantJob        = tenantJob.Validate("tenantJob");
     this.repairTask       = repairTask.Validate("repairTask");
 }
Example #9
0
 public CreateInPreparingAction(
     CoordinatorEnvironment environment,
     IRepairManager repairManager,
     ITenantJob tenantJob,
     bool surpriseJob,
     RepairTaskPrepareArgs args)
     : base(environment, ActionType.Prepare)
 {
     this.repairManager = repairManager.Validate("repairManager");
     this.tenantJob     = tenantJob.Validate("tenantJob");
     this.surpriseJob   = surpriseJob;
     this.args          = args.Validate("args");
 }
 public MoveToCompletedAction(
     CoordinatorEnvironment environment,
     IRepairManager repairManager,
     IRepairTask repairTask,
     RepairTaskResult repairTaskResult,
     string repairTaskResultDetails,
     bool surpriseJob)
     : base(environment, ActionType.None)
 {
     this.repairManager           = repairManager.Validate("repairManager");
     this.repairTask              = repairTask.Validate("repairTask");
     this.repairTaskResult        = repairTaskResult;
     this.repairTaskResultDetails = repairTaskResultDetails;
     this.surpriseJob             = surpriseJob;
 }
 public MoveToRestoringAction(
     CoordinatorEnvironment environment,
     IRepairManager repairManager,
     IRepairTask repairTask,
     RepairTaskResult repairTaskResult,
     string repairTaskResultDetails,
     bool surpriseJob,
     bool cancelRestoringHealthCheck,
     bool processRemovedNodes)
     : base(environment, ActionType.Restore)
 {
     this.repairManager              = repairManager.Validate("repairManager");
     this.repairTask                 = repairTask.Validate("repairTask");
     this.repairTaskResult           = repairTaskResult;
     this.repairTaskResultDetails    = repairTaskResultDetails;
     this.surpriseJob                = surpriseJob;
     this.cancelRestoringHealthCheck = cancelRestoringHealthCheck;
     this.processRemovedNodes        = processRemovedNodes;
 }
Example #12
0
        public AutopilotInfrastructureCoordinator(
            CoordinatorEnvironment environment,
            IAutopilotDMClient dmClient,
            IRepairManager repairManager,
            IHealthClient healthClient,
            Guid partitionId,
            long replicaId)
        {
            this.environment = environment.Validate("environment");
            this.partitionId = partitionId;

            this.traceType = environment.CreateTraceType("Coordinator");

            this.repairManager = repairManager.Validate("repairManager");
            this.healthClient  = healthClient.Validate("healthClient");
            this.dmClient      = new AutopilotDMClientWrapper(dmClient.Validate("dmClient"));

            this.configReader = new ConfigReader(environment.Config);
        }
        /// <remarks>
        /// If <see cref="configSettings"/> is null, a default value is used.
        /// </remarks>
        public MockInfrastructureCoordinatorFactory(
            IDictionary <string, string> configSettings = null,
            IPolicyAgentClient policyAgentClient        = null,
            IRepairManager repairManager = null)
        {
            this.configSettings = configSettings != null
                ? new Dictionary <string, string>(configSettings, StringComparer.OrdinalIgnoreCase)
                : new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            var activityLogger = new ActivityLoggerFactory().Create(Constants.TraceType);

            var env = new CoordinatorEnvironment(
                "fabric:/System/InfrastructureService",
                new ConfigSection(Constants.TraceType, new MockConfigStore(), "ConfigSection"),
                string.Empty,
                new MockInfrastructureAgentWrapper());

            this.policyAgentClient = policyAgentClient ?? new PolicyAgentClient(env, new PolicyAgentServiceWrapper(env, activityLogger), activityLogger);
            this.repairManager     = repairManager ?? new MockRepairManager();
        }
Example #14
0
            public async Task ExecuteAsync(IRepairManager repairManager)
            {
                string taskId = GenerateTaskId(this.record.RecordId, DateTime.UtcNow);

                var repairTask = repairManager.NewRepairTask(taskId, this.record.RepairType.ToString());

                repairTask.State    = RepairTaskState.Preparing;
                repairTask.Executor = this.serviceName;

                var target = new NodeRepairTargetDescription(this.record.MachineName);

                repairTask.Target = target;

                var impact = new NodeRepairImpactDescription();

                impact.ImpactedNodes.Add(new NodeImpact(this.record.MachineName, this.impactLevel));
                repairTask.Impact = impact;
                repairTask.PerformPreparingHealthCheck = this.performHealthCheck;

                await repairManager.CreateRepairTaskAsync(Guid.Empty, repairTask);
            }
        public AzureParallelInfrastructureCoordinator(
            CoordinatorEnvironment environment,
            string tenantId,
            IPolicyAgentClient policyAgentClient,
            IRepairManager repairManager,
            IHealthClient healthClient,
            ICoordinatorCommandProcessor coordinatorCommandProcessor,
            IJobBlockingPolicyManager jobBlockingPolicyManager,
            IActionPolicyFactory actionPolicyFactory,
            IActivityLogger activityLogger,
            Guid partitionId,
            long replicaId)
        {
            this.environment       = environment.Validate("environment");
            this.tenantId          = tenantId.Validate("tenantId");
            this.partitionId       = partitionId;
            this.policyAgentClient = policyAgentClient.Validate("policyAgentClient");

            this.traceType       = environment.CreateTraceType("Coordinator");
            this.actionTraceType = environment.CreateTraceType("Action");

            this.repairManager = repairManager.Validate("repairManager");
            this.healthClient  = healthClient.Validate("healthClient");

            this.configSection = environment.Config;
            this.coordinatorCommandProcessor = coordinatorCommandProcessor.Validate("coordinatorCommandProcessor");
            this.jobBlockingPolicyManager    = jobBlockingPolicyManager.Validate("jobBlockingPolicyManager");
            this.actionPolicies = actionPolicyFactory.Validate("actionPolicyFactory").Create();
            this.activityLogger = activityLogger.Validate("activityLogger");

            var assembly = this.GetType().GetTypeInfo().Assembly;

            assemblyFileVersion = FileVersionInfo.GetVersionInfo(assembly.Location).FileVersion;

            var healthWatchdogFactory = new RoleInstanceHealthWatchdogFactory(configSection, healthClient);

            roleInstanceHealthWatchdog = healthWatchdogFactory.Create(Constants.ConfigKeys.ConfigKeyPrefix);
        }
Example #16
0
 public IRepairManager Create()
 {
     return(repairManager ?? (repairManager = new MockRepairManager()));
 }
Example #17
0
 public Task ExecuteAsync(IRepairManager repairManager)
 {
     return(repairManager.CancelRepairTaskAsync(Guid.Empty, this.repairTask));
 }