internal static void DoAutoRunProfileDiscovery(MAControllerConfiguration config, ManagementAgent ma) { foreach (PartitionConfiguration p in config.Partitions) { MAConfigDiscovery.DoAutoRunProfileDiscovery(p, ma); } }
private void AddMissingManagementAgents() { foreach (ManagementAgent ma in ManagementAgent.GetManagementAgents()) { bool found = false; foreach (MAControllerConfiguration config in this.ManagementAgents) { if (config.ManagementAgentID == ma.ID) { found = true; break; } } if (!found) { MAControllerConfiguration p = new MAControllerConfiguration(ma.Name, ma.ID); p.Disabled = true; p.ResolvePartitions(ma); MAConfigDiscovery.AddDefaultTriggers(p, ma); this.ManagementAgents.Add(p); } } }
internal void ResolvePartitions(ManagementAgent ma) { if (this.Partitions == null) { this.Partitions = new PartitionConfigurationCollection(); } foreach (PartitionConfiguration c in this.Partitions) { bool found = false; foreach (Partition p in ma.Partitions.Values.Where(t => t.Selected)) { if (c.ID == p.ID || string.Equals(c.Name, p.Name, StringComparison.OrdinalIgnoreCase)) { c.UpdateConfiguration(p); found = true; break; } } if (!found) { c.IsMissing = true; } } foreach (Partition p in ma.Partitions.Values.Where(t => t.Selected && this.Partitions.GetItemOrNull(t.ID) == null)) { PartitionConfiguration c = new PartitionConfiguration(p); MAConfigDiscovery.DoAutoRunProfileDiscovery(c, ma); this.Partitions.Add(c); } }
internal void ResolvePartitions(ManagementAgent ma) { if (this.Partitions == null) { this.Partitions = new PartitionConfigurationCollection(); } foreach (PartitionConfiguration c in this.Partitions) { bool found = false; foreach (Partition p in ma.Partitions.Values.Where(t => t.Selected)) { if (c.ID == p.ID || string.Equals(c.Name, p.Name, StringComparison.OrdinalIgnoreCase)) { logger.Trace($"Matched existing partition {c.ID}/{p.ID}/{c.Name}/{p.Name}"); c.UpdateConfiguration(p); found = true; break; } } if (!found) { logger.Trace($"Partition is missing from MA {c.ID}/{c.Name}"); c.IsMissing = true; } } foreach (Partition p in ma.Partitions.Values.Where(t => t.Selected && this.Partitions.GetItemOrNull(t.ID) == null)) { logger.Trace($"New partition found in MA {p.ID}/{p.Name}"); PartitionConfiguration c = new PartitionConfiguration(p); MAConfigDiscovery.DoAutoRunProfileDiscovery(c, ma); this.Partitions.Add(c); } logger.Trace($"{this.Partitions.Count} partitions are defined for the controller"); }