From 84372eb118c9e5cd6aa1a410670f15c14807a5c0 Mon Sep 17 00:00:00 2001 From: Mihaela Stoica Date: Mon, 21 Sep 2015 00:04:46 +0100 Subject: [PATCH] CP-13770: Configure the alerts for SR physical utilisation in XenCenter Signed-off-by: Mihaela Stoica --- .../PerfmonAlertEditPage.Designer.cs | 104 +++++++ .../SettingsPanels/PerfmonAlertEditPage.cs | 29 +- .../SettingsPanels/PerfmonAlertEditPage.resx | 253 +++++++++++++++++- XenModel/Alerts/PerfmonDefinition.cs | 5 + XenModel/Messages.Designer.cs | 9 + XenModel/Messages.resx | 3 + 6 files changed, 389 insertions(+), 14 deletions(-) diff --git a/XenAdmin/SettingsPanels/PerfmonAlertEditPage.Designer.cs b/XenAdmin/SettingsPanels/PerfmonAlertEditPage.Designer.cs index df0ec7d0a..ade271d06 100644 --- a/XenAdmin/SettingsPanels/PerfmonAlertEditPage.Designer.cs +++ b/XenAdmin/SettingsPanels/PerfmonAlertEditPage.Designer.cs @@ -34,6 +34,14 @@ namespace XenAdmin.SettingsPanels this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.label1 = new System.Windows.Forms.Label(); this.nudAlertInterval = new XenAdmin.SettingsPanels.AlertNumericUpDown(); + this.PhysicalUtilisationGroupBox = new XenAdmin.Controls.DecentGroupBox(); + this.physicalUtilisationMinutesLabel = new System.Windows.Forms.Label(); + this.nudPhysicalUtilisationDurationThreshold = new XenAdmin.SettingsPanels.AlertNumericUpDown(); + this.physicalUtilisationPercentLabel = new System.Windows.Forms.Label(); + this.nudPhysicalUtilisation = new XenAdmin.SettingsPanels.AlertNumericUpDown(); + this.physicalUtilisationAlertCheckBox = new XenAdmin.SettingsPanels.AlertCheckBox(); + this.physicalUtilisationDurationLabel = new System.Windows.Forms.Label(); + this.physicalUtilisationLabel = new System.Windows.Forms.Label(); this.Dom0MemoryUsageGroupBox = new XenAdmin.Controls.DecentGroupBox(); this.nudDom0MemUsage = new XenAdmin.SettingsPanels.AlertNumericUpDown(); this.Dom0MemoryDurationThresholdLabel = new System.Windows.Forms.Label(); @@ -84,6 +92,9 @@ namespace XenAdmin.SettingsPanels this.CPUDurationThresholdLabel = new System.Windows.Forms.Label(); this.tableLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nudAlertInterval)).BeginInit(); + this.PhysicalUtilisationGroupBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudPhysicalUtilisationDurationThreshold)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudPhysicalUtilisation)).BeginInit(); this.Dom0MemoryUsageGroupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nudDom0MemUsage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudDom0MemoryDurationThreshold)).BeginInit(); @@ -117,6 +128,7 @@ namespace XenAdmin.SettingsPanels // tableLayoutPanel1 // resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1"); + this.tableLayoutPanel1.Controls.Add(this.PhysicalUtilisationGroupBox, 0, 6); this.tableLayoutPanel1.Controls.Add(this.Dom0MemoryUsageGroupBox, 0, 5); this.tableLayoutPanel1.Controls.Add(this.MemoryGroupBox, 0, 3); this.tableLayoutPanel1.Controls.Add(this.SrGroupBox, 0, 4); @@ -155,6 +167,86 @@ namespace XenAdmin.SettingsPanels 0, 0}); // + // PhysicalUtilisationGroupBox + // + this.PhysicalUtilisationGroupBox.Controls.Add(this.physicalUtilisationMinutesLabel); + this.PhysicalUtilisationGroupBox.Controls.Add(this.nudPhysicalUtilisationDurationThreshold); + this.PhysicalUtilisationGroupBox.Controls.Add(this.physicalUtilisationPercentLabel); + this.PhysicalUtilisationGroupBox.Controls.Add(this.nudPhysicalUtilisation); + this.PhysicalUtilisationGroupBox.Controls.Add(this.physicalUtilisationAlertCheckBox); + this.PhysicalUtilisationGroupBox.Controls.Add(this.physicalUtilisationDurationLabel); + this.PhysicalUtilisationGroupBox.Controls.Add(this.physicalUtilisationLabel); + resources.ApplyResources(this.PhysicalUtilisationGroupBox, "PhysicalUtilisationGroupBox"); + this.PhysicalUtilisationGroupBox.Name = "PhysicalUtilisationGroupBox"; + this.PhysicalUtilisationGroupBox.TabStop = false; + // + // physicalUtilisationMinutesLabel + // + resources.ApplyResources(this.physicalUtilisationMinutesLabel, "physicalUtilisationMinutesLabel"); + this.physicalUtilisationMinutesLabel.Name = "physicalUtilisationMinutesLabel"; + // + // nudPhysicalUtilisationDurationThreshold + // + resources.ApplyResources(this.nudPhysicalUtilisationDurationThreshold, "nudPhysicalUtilisationDurationThreshold"); + this.nudPhysicalUtilisationDurationThreshold.Maximum = new decimal(new int[] { + 60, + 0, + 0, + 0}); + this.nudPhysicalUtilisationDurationThreshold.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.nudPhysicalUtilisationDurationThreshold.Name = "nudPhysicalUtilisationDurationThreshold"; + this.nudPhysicalUtilisationDurationThreshold.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // physicalUtilisationPercentLabel + // + resources.ApplyResources(this.physicalUtilisationPercentLabel, "physicalUtilisationPercentLabel"); + this.physicalUtilisationPercentLabel.Name = "physicalUtilisationPercentLabel"; + // + // nudPhysicalUtilisation + // + this.nudPhysicalUtilisation.Increment = new decimal(new int[] { + 5, + 0, + 0, + 0}); + resources.ApplyResources(this.nudPhysicalUtilisation, "nudPhysicalUtilisation"); + this.nudPhysicalUtilisation.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.nudPhysicalUtilisation.Name = "nudPhysicalUtilisation"; + this.nudPhysicalUtilisation.Value = new decimal(new int[] { + 80, + 0, + 0, + 0}); + // + // physicalUtilisationAlertCheckBox + // + resources.ApplyResources(this.physicalUtilisationAlertCheckBox, "physicalUtilisationAlertCheckBox"); + this.physicalUtilisationAlertCheckBox.BackColor = System.Drawing.Color.White; + this.physicalUtilisationAlertCheckBox.Name = "physicalUtilisationAlertCheckBox"; + this.physicalUtilisationAlertCheckBox.UseVisualStyleBackColor = false; + // + // physicalUtilisationDurationLabel + // + resources.ApplyResources(this.physicalUtilisationDurationLabel, "physicalUtilisationDurationLabel"); + this.physicalUtilisationDurationLabel.Name = "physicalUtilisationDurationLabel"; + // + // physicalUtilisationLabel + // + resources.ApplyResources(this.physicalUtilisationLabel, "physicalUtilisationLabel"); + this.physicalUtilisationLabel.Name = "physicalUtilisationLabel"; + // // Dom0MemoryUsageGroupBox // this.Dom0MemoryUsageGroupBox.Controls.Add(this.nudDom0MemUsage); @@ -662,6 +754,10 @@ namespace XenAdmin.SettingsPanels this.Name = "PerfmonAlertEditPage"; this.tableLayoutPanel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.nudAlertInterval)).EndInit(); + this.PhysicalUtilisationGroupBox.ResumeLayout(false); + this.PhysicalUtilisationGroupBox.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudPhysicalUtilisationDurationThreshold)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudPhysicalUtilisation)).EndInit(); this.Dom0MemoryUsageGroupBox.ResumeLayout(false); this.Dom0MemoryUsageGroupBox.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.nudDom0MemUsage)).EndInit(); @@ -746,5 +842,13 @@ namespace XenAdmin.SettingsPanels private AlertCheckBox Dom0MemoryAlertCheckBox; private System.Windows.Forms.Label dom0MemoryMinutesLabel; private System.Windows.Forms.Label dom0MemoryPercentLabel; + private Controls.DecentGroupBox PhysicalUtilisationGroupBox; + private System.Windows.Forms.Label physicalUtilisationMinutesLabel; + private AlertNumericUpDown nudPhysicalUtilisationDurationThreshold; + private System.Windows.Forms.Label physicalUtilisationPercentLabel; + private AlertNumericUpDown nudPhysicalUtilisation; + private AlertCheckBox physicalUtilisationAlertCheckBox; + private System.Windows.Forms.Label physicalUtilisationDurationLabel; + private System.Windows.Forms.Label physicalUtilisationLabel; } } diff --git a/XenAdmin/SettingsPanels/PerfmonAlertEditPage.cs b/XenAdmin/SettingsPanels/PerfmonAlertEditPage.cs index 295470e53..84133d01d 100644 --- a/XenAdmin/SettingsPanels/PerfmonAlertEditPage.cs +++ b/XenAdmin/SettingsPanels/PerfmonAlertEditPage.cs @@ -60,6 +60,7 @@ namespace XenAdmin.SettingsPanels private readonly AlertGroup memoryAlert; private readonly AlertGroup srAlert; private readonly AlertGroup dom0MemoryAlert; + private readonly AlertGroup physicalUtilisationAlert; public PerfmonAlertEditPage() { @@ -168,6 +169,21 @@ namespace XenAdmin.SettingsPanels GuiToXapiTriggerPeriod = (num => num * 60), GuiToXapiAlertInterval = (num => num * 60), }; + + physicalUtilisationAlert = new AlertGroup(physicalUtilisationAlertCheckBox, PhysicalUtilisationGroupBox, + nudPhysicalUtilisation, nudPhysicalUtilisationDurationThreshold, nudAlertInterval, + new[] { physicalUtilisationLabel, physicalUtilisationDurationLabel, physicalUtilisationPercentLabel, physicalUtilisationMinutesLabel }) + { + AlertEnablementChanged = SetAlertIntervalEnablement, + SubTextFormat = Messages.ALERT_SR_PHYSICAL_UTILISATION_SUB_TEXT, + PerfmonDefinitionName = PerfmonDefinition.ALARM_TYPE_SR_PHYSICAL_UTILISATION, + XapiToGuiTriggerLevel = (num => num * 100), + XapiToGuiTriggerPeriod = (num => num / 60), + XapiToGuiAlertInterval = (num => num / 60), + GuiToXapiTriggerLevel = (num => num / 100), + GuiToXapiTriggerPeriod = (num => num * 60), + GuiToXapiAlertInterval = (num => num * 60), + }; cpuAlert.ToggleAlertGroupEnablement(); netAlert.ToggleAlertGroupEnablement(); @@ -175,13 +191,14 @@ namespace XenAdmin.SettingsPanels memoryAlert.ToggleAlertGroupEnablement(); srAlert.ToggleAlertGroupEnablement(); dom0MemoryAlert.ToggleAlertGroupEnablement(); + physicalUtilisationAlert.ToggleAlertGroupEnablement(); } public string SubText { get { - var subs = from AlertGroup g in new[] { cpuAlert, netAlert, diskAlert, memoryAlert, srAlert } + var subs = from AlertGroup g in new[] { cpuAlert, netAlert, diskAlert, memoryAlert, srAlert, physicalUtilisationAlert } where !string.IsNullOrEmpty(g.SubText) select g.SubText; @@ -208,6 +225,7 @@ namespace XenAdmin.SettingsPanels memoryAlert.Show(isHost && Helpers.ClearwaterOrGreater(_XenObject.Connection)); srAlert.Show(isSr && Helpers.ClearwaterOrGreater(_XenObject.Connection)); dom0MemoryAlert.Show(isHost && Helpers.CreedenceOrGreater(_XenObject.Connection)); + physicalUtilisationAlert.Show(isSr && ((SR)_XenObject).IsThinProvisioned); if (isHost) { @@ -244,6 +262,8 @@ namespace XenAdmin.SettingsPanels srAlert.Populate(perfmonDefinition); else if (perfmonDefinition.IsDom0MemoryUsage) dom0MemoryAlert.Populate(perfmonDefinition); + else if (perfmonDefinition.IsSrPhysicalUtilisation) + physicalUtilisationAlert.Populate(perfmonDefinition); } } catch { } @@ -257,7 +277,7 @@ namespace XenAdmin.SettingsPanels return true; if (_XenObject is SR) - return srAlert.HasChanged; + return srAlert.HasChanged || physicalUtilisationAlert.HasChanged; if (_XenObject is VM) return cpuAlert.HasChanged || netAlert.HasChanged || diskAlert.HasChanged; @@ -321,6 +341,9 @@ namespace XenAdmin.SettingsPanels if (_XenObject is Host && dom0MemoryAlert.Enabled) perfmonDefinitions.Add(dom0MemoryAlert.AlertDefinition); + + if (_XenObject is SR && physicalUtilisationAlert.Enabled) + perfmonDefinitions.Add(physicalUtilisationAlert.AlertDefinition); return new PerfmonDefinitionAction(_XenObject, perfmonDefinitions, true); } @@ -328,7 +351,7 @@ namespace XenAdmin.SettingsPanels private void SetAlertIntervalEnablement() { bool enable = cpuAlert.Enabled || netAlert.Enabled || diskAlert.Enabled - || memoryAlert.Enabled || srAlert.Enabled || dom0MemoryAlert.Enabled; + || memoryAlert.Enabled || srAlert.Enabled || dom0MemoryAlert.Enabled || physicalUtilisationAlert.Enabled; nudAlertInterval.Enabled = enable; AlertIntervalMinutesLabel.Enabled = enable; diff --git a/XenAdmin/SettingsPanels/PerfmonAlertEditPage.resx b/XenAdmin/SettingsPanels/PerfmonAlertEditPage.resx index 05ad43a88..369142739 100644 --- a/XenAdmin/SettingsPanels/PerfmonAlertEditPage.resx +++ b/XenAdmin/SettingsPanels/PerfmonAlertEditPage.resx @@ -198,6 +198,237 @@ 1 + + True + + + NoControl + + + 372, 50 + + + 43, 13 + + + 6 + + + minutes + + + physicalUtilisationMinutesLabel + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + PhysicalUtilisationGroupBox + + + 0 + + + 290, 48 + + + 3, 3, 3, 0 + + + 75, 20 + + + 5 + + + nudPhysicalUtilisationDurationThreshold + + + XenAdmin.SettingsPanels.AlertNumericUpDown, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + PhysicalUtilisationGroupBox + + + 1 + + + True + + + NoControl + + + 372, 24 + + + 15, 13 + + + 3 + + + % + + + physicalUtilisationPercentLabel + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + PhysicalUtilisationGroupBox + + + 2 + + + 290, 22 + + + 75, 20 + + + 2 + + + nudPhysicalUtilisation + + + XenAdmin.SettingsPanels.AlertNumericUpDown, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + PhysicalUtilisationGroupBox + + + 3 + + + True + + + NoControl + + + 6, 0 + + + 3, 0, 0, 0 + + + 241, 17 + + + 0 + + + Generate storage repository &disk space alerts + + + physicalUtilisationAlertCheckBox + + + XenAdmin.SettingsPanels.AlertCheckBox, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + PhysicalUtilisationGroupBox + + + 4 + + + True + + + NoControl + + + 12, 50 + + + 81, 13 + + + 4 + + + For longer &than: + + + MiddleLeft + + + physicalUtilisationDurationLabel + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + PhysicalUtilisationGroupBox + + + 5 + + + True + + + NoControl + + + 12, 24 + + + 187, 13 + + + 1 + + + When SR physical utilisation &exceeds: + + + MiddleLeft + + + physicalUtilisationLabel + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + PhysicalUtilisationGroupBox + + + 6 + + + 3, 507 + + + 3, 3, 3, 0 + + + 445, 78 + + + 8 + + + + + + PhysicalUtilisationGroupBox + + + XenAdmin.Controls.DecentGroupBox, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + tableLayoutPanel1 + + + 0 + 290, 22 @@ -427,7 +658,7 @@ tableLayoutPanel1 - 0 + 1 True @@ -658,7 +889,7 @@ tableLayoutPanel1 - 1 + 2 True @@ -889,7 +1120,7 @@ tableLayoutPanel1 - 2 + 3 True @@ -1120,7 +1351,7 @@ tableLayoutPanel1 - 3 + 4 True @@ -1348,7 +1579,7 @@ tableLayoutPanel1 - 4 + 5 True @@ -1579,7 +1810,7 @@ tableLayoutPanel1 - 5 + 6 6, 83 @@ -1588,10 +1819,10 @@ 3, 10, 3, 3 - 6 + 7 - 451, 504 + 451, 588 4 @@ -1609,7 +1840,7 @@ 4 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="Dom0MemoryUsageGroupBox" Row="5" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="MemoryGroupBox" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="SrGroupBox" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="DiskGroupBox" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="NetGroupBox" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="CpuGroupBox" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="PhysicalUtilisationGroupBox" Row="6" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="Dom0MemoryUsageGroupBox" Row="5" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="MemoryGroupBox" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="SrGroupBox" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="DiskGroupBox" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="NetGroupBox" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="CpuGroupBox" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0" /></TableLayoutSettings> Top, Left, Right @@ -1624,7 +1855,7 @@ 3, 3, 3, 3 - 482, 53 + 454, 53 0 @@ -1678,7 +1909,7 @@ GrowAndShrink - 488, 608 + 420, 538 PerfmonAlertEditPage diff --git a/XenModel/Alerts/PerfmonDefinition.cs b/XenModel/Alerts/PerfmonDefinition.cs index 2bb169c4d..9186aaca6 100644 --- a/XenModel/Alerts/PerfmonDefinition.cs +++ b/XenModel/Alerts/PerfmonDefinition.cs @@ -120,6 +120,11 @@ namespace XenAdmin.Alerts get { return name.Equals(ALARM_TYPE_SR); } } + public bool IsSrPhysicalUtilisation + { + get { return name.Equals(ALARM_TYPE_SR_PHYSICAL_UTILISATION); } + } + public decimal AlarmTriggerLevel { get { return alarmTriggerLevel; } diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index d7e7d8609..acbaa4c14 100644 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -4585,6 +4585,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to When SR physical utilisation exceeds {0} for {1} min(s). + /// + public static string ALERT_SR_PHYSICAL_UTILISATION_SUB_TEXT { + get { + return ResourceManager.GetString("ALERT_SR_PHYSICAL_UTILISATION_SUB_TEXT", resourceCulture); + } + } + /// /// Looks up a localized string similar to When storage throughput exceeds {0} for {1} min(s). /// diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index 30ff54908..c74bb6cf4 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -1687,6 +1687,9 @@ Note that if RBAC is enabled, only alerts which you have privileges to dismiss w Go to Web Page + + When SR physical utilisation exceeds {0} for {1} min(s) + When storage throughput exceeds {0} for {1} min(s)