Exemple #1
0
            private static bool IsTopologyChange(ManagementJobStep jobStep)
            {
                bool isTopologyChange = false;

                isTopologyChange |= IsTopologyChange(jobStep.ListImpactedRoleInstances().Values);
                isTopologyChange |= IsTopologyChange(jobStep.SourceJob.ListImpactedRoleInstances().Values);

                return(isTopologyChange);
            }
Exemple #2
0
            private IEnumerable <ImpactedInstance> BuildImpactList()
            {
                ManagementJobStep jobStep = this.notification.SourceJobStep;

                IDictionary <string, ImpactedRoleInstance> jobImpactMap;
                IDictionary <string, ImpactedRoleInstance> jobStepImpactMap;

                try
                {
                    jobImpactMap     = jobStep.SourceJob.ListImpactedRoleInstances();
                    jobStepImpactMap = jobStep.ListImpactedRoleInstances();
                }
                catch (Exception ex)
                {
                    string message = string.Format(
                        CultureInfo.InvariantCulture,
                        "Error getting impacted role instances from management protocol while building impact list for notification Id: {0}, source job step: {1}, source job: {2}, target UD: {3}",
                        notification.Id,
                        jobStep,
                        jobStep.SourceJob,
                        jobStep.TargetUpdateDomain);

                    Trace.WriteWarning(TraceType, message);

                    throw new ManagementException(message, ex);
                }

                List <ImpactedInstance> jobStepImpactList = new List <ImpactedInstance>(jobStepImpactMap.Count);

                // Extract impact list from the job step, potentially augmented with impact from the job
                foreach (var impactedInstance in jobStepImpactMap.Values)
                {
                    string instanceId = impactedInstance.Id;
                    IEnumerable <ImpactReason> jobStepImpact = impactedInstance.ImpactReasons;
                    IImpactDetail jobStepImpactDetail        = impactedInstance.ImpactStatement;

                    // Workaround for RDBug#783846: MR platform repair job notifications present no impact reasons for impacted role instances
                    //
                    // If this is a PlatformRepairJob and the job *step* provides no impact reasons,
                    // then merge in the impact reasons given for that role instance in the job.
                    if (this.ActiveJobType == JobType.PlatformRepairJob && !jobStepImpact.Any())
                    {
                        ImpactedRoleInstance jobImpactedInstance;
                        if (jobImpactMap.TryGetValue(instanceId, out jobImpactedInstance))
                        {
                            Trace.WriteWarning(TraceType, "Job step impact for {0} is empty; using impact from job ({1})",
                                               instanceId,
                                               string.Join(",", jobImpactedInstance.ImpactReasons));

                            jobStepImpact = jobStepImpact.Union(jobImpactedInstance.ImpactReasons);
                        }
                        else
                        {
                            Trace.WriteWarning(TraceType, "Job step impact for {0} is empty, and job provides no impact", instanceId);
                        }
                    }

                    ImpactedInstance element = new ImpactedInstance(
                        instanceId,
                        jobStepImpact.ToArray(),
                        jobStepImpactDetail);

                    jobStepImpactList.Add(element);
                }

                return(jobStepImpactList);
            }