public ServiceFabricRepairManager(CoordinatorEnvironment environment)
        {
            //this.activityLogger = activityLogger.Validate("activityLogger");
            this.traceType = environment.Validate("environment").CreateTraceType("RMClient");

            this.repairManager = this.fabricClient.RepairManager;
        }
Пример #2
0
        public static void CancelAll(IEnumerable <MockRepairExecutor> executors, FabricClient.RepairManagementClient repairManager)
        {
            var repairTaskList = repairManager.GetRepairTaskListAsync(null, RepairTaskStateFilter.All, null).Result;

            var query = from repairTask in repairTaskList
                        where executors.Any(e => e.Name == repairTask.Action) && // ignore tasks with action not supported by our mock executors
                        repairTask.State != RepairTaskState.Completed &&         // ignore Completed tasks
                        (repairTask.State == RepairTaskState.Created ||
                         repairTask.Flags.HasFlag(RepairTaskFlags.CancelRequested))
                        select repairTask;

            if (!query.Any())
            {
                return;
            }

            LogHelper.Log(
                "Cancelling the repair tasks with Created state or CancelRequested flags. Number of tasks = {0}",
                query.Count());

            Parallel.ForEach(query, task =>
            {
                var executor = executors.Single(e => e.Name == task.Action);
                executor.Cancel(task);
            });
        }
Пример #3
0
 public MockRepairExecutor(string name, TimeSpan actionTime, bool isEnabled, TimeSpan probationToHealthyPostRepair, FabricClient.RepairManagementClient repairManager)
 {
     Name           = name;
     _repairManager = repairManager;
     IsEnabled      = isEnabled;
     ActionTime     = actionTime;
     ProbationToHealthyPostRepair = probationToHealthyPostRepair;
 }
 public WindowsServerRestartPolicy(
     IHealthCheck healthCheck,
     IPolicyStore policyStore,
     FabricClient.RepairManagementClient repairMgmtClient,
     IConfigStore configStore,
     string configSectionName)
 {
     this.HealthCheck                = healthCheck;
     this.PolicyStore                = policyStore;
     this.repairManagementClient     = repairMgmtClient;
     this.currentChosenUpgradeDomain = EmptyUpgradeDomainValue;
     this.maxTimeRepairTaskActive    = WindowsServerRestartConstant.MaxTimeRepairTaskActiveDefault;
 }
Пример #5
0
        public WindowsAzureRepairExecutor(
            WindowsAzureInfrastructureCoordinator coordinator,
            string internalServiceName,
            IManagementClient managementClient)
        {
            this.fabricClient     = new FabricClient();
            this.repairManager    = fabricClient.RepairManager;
            this.coordinator      = coordinator;
            this.managementClient = managementClient;
            this.executorName     = "fabric:/System/" + internalServiceName;

            this.BuildMaintenanceActionMap();
        }
        public WindowsServerRestartPolicyFactory(
            IHealthCheck healthCheck,
            IPolicyStore policyStore,
            FabricClient.RepairManagementClient repairMgmtClient,
            IConfigStore configStore,
            string configSectionName)
        {
            repairMgmtClient.ThrowIfNull("repairMgmtClient");

            this.policyStore            = policyStore;
            this.healthCheck            = healthCheck;
            this.repairManagementClient = repairMgmtClient;
            this.configStore            = configStore;
            this.configSectionName      = configSectionName;
        }
Пример #7
0
        public static RepairTask GetAnyCreatedTask(string nodeName, FabricClient.RepairManagementClient repairManager)
        {
            var repairTaskList = repairManager.GetRepairTaskListAsync(null, RepairTaskStateFilter.Created, null).Result;
            var query          = from repairTask in repairTaskList
                                 where repairTask.Target is NodeRepairTargetDescription &&
                                 ((NodeRepairTargetDescription)repairTask.Target).Nodes[0] == nodeName
                                 orderby repairTask.CreatedTimestamp descending
                                 select repairTask;

            if (query.Any())
            {
                Assert.IsTrue(query.Count() == 1, "There should be only 1 repair task created");
                return(query.First());
            }

            return(null);
        }
Пример #8
0
        public WindowsServerRestartCoordinator(IConfigStore configStore, string configSectionName, Guid partitionId, long replicaId)
        {
            this.fabricClient           = new FabricClient();
            this.repairManagementClient = this.fabricClient.RepairManager;
            var healthPolicy = new WindowsServerRestartHealthCheckFactory(this.fabricClient).Create();

            this.retryPolicyFactory = new LinearRetryPolicyFactory(
                TraceType,
                WindowsServerRestartConstant.BackoffPeriodInMilliseconds,
                WindowsServerRestartConstant.MaxRetryAttempts,
                IsRetriableException);
            this.restartPolicy = new WindowsServerRestartPolicyFactory(
                healthPolicy,
                this,
                this.repairManagementClient,
                configStore,
                configSectionName).Create();

            this.pollingInterval = WindowsServerRestartConstant.CoordinatorPollingIntervalDefault;
        }
Пример #9
0
        public static void DeleteTask(RepairTask task, FabricClient.RepairManagementClient repairManager)
        {
            var t = repairManager.DeleteRepairTaskAsync(task.TaskId, 0);

            t.Wait();
        }