From c57800113bea4c7d5816a93621552bf5e02ec879 Mon Sep 17 00:00:00 2001 From: Gabor Apati-Nagy Date: Tue, 5 Aug 2014 21:40:26 +0100 Subject: [PATCH 1/3] CP-9092: XenCenter work for Dom0 memory usage alert -Adding control domain memory usage alerts Signed-off-by: Gabor Apati-Nagy --- XenAdmin/Alerts/Types/AlarmMessageAlert.cs | 13 +- .../PerfmonAlertEditPage.Designer.cs | 162 +++++-- .../SettingsPanels/PerfmonAlertEditPage.cs | 30 +- .../SettingsPanels/PerfmonAlertEditPage.resx | 418 ++++++++++++++---- XenModel/Alerts/PerfmonDefinition.cs | 10 +- XenModel/Messages.Designer.cs | 39 +- XenModel/Messages.resx | 13 + 7 files changed, 562 insertions(+), 123 deletions(-) diff --git a/XenAdmin/Alerts/Types/AlarmMessageAlert.cs b/XenAdmin/Alerts/Types/AlarmMessageAlert.cs index f58bf2e3d..a00209b56 100644 --- a/XenAdmin/Alerts/Types/AlarmMessageAlert.cs +++ b/XenAdmin/Alerts/Types/AlarmMessageAlert.cs @@ -118,9 +118,12 @@ namespace XenAdmin.Alerts case PerfmonDefinition.ALARM_TYPE_FILESYSTEM: AlarmType = AlarmType.FileSystem; break; - case PerfmonDefinition.ALARM_TYPE_MEMORY: + case PerfmonDefinition.ALARM_TYPE_MEMORY_FREE: AlarmType = AlarmType.Memory; break; + case PerfmonDefinition.ALARM_TYPE_MEMORY_DOM0_USAGE: + AlarmType = AlarmType.Dom0MemoryDemand; + break; default: { var match = PerfmonDefinition.SrRegex.Match(variableName); @@ -184,6 +187,10 @@ namespace XenAdmin.Alerts Util.MemorySizeString(CurrentValue * Util.BINARY_KILO),//xapi unit is in kib Util.TimeString(TriggerPeriod), Util.MemorySizeString(TriggerLevel * Util.BINARY_KILO)); + case AlarmType.Dom0MemoryDemand: + return string.Format(Messages.ALERT_ALARM_DOM0_MEMORY_DEMAND_DESCRIPTION, + Helpers.GetNameAndObject(XenObject), + Util.PercentageString(CurrentValue)); case AlarmType.Storage: return string.Format(Messages.ALERT_ALARM_STORAGE_DESCRIPTION, Helpers.GetNameAndObject(XenObject), @@ -215,6 +222,8 @@ namespace XenAdmin.Alerts return Messages.ALERT_ALARM_MEMORY; case AlarmType.Storage: return Messages.ALERT_ALARM_STORAGE; + case AlarmType.Dom0MemoryDemand: + return Messages.ALERT_ALARM_DOM0_MEMORY; default: return base.Title; } @@ -289,5 +298,5 @@ namespace XenAdmin.Alerts } } - public enum AlarmType { None, Cpu, Net, Disk, FileSystem, Memory, Storage } + public enum AlarmType { None, Cpu, Net, Disk, FileSystem, Memory, Storage, Dom0MemoryDemand } } diff --git a/XenAdmin/SettingsPanels/PerfmonAlertEditPage.Designer.cs b/XenAdmin/SettingsPanels/PerfmonAlertEditPage.Designer.cs index a4febaec9..df0ec7d0a 100644 --- a/XenAdmin/SettingsPanels/PerfmonAlertEditPage.Designer.cs +++ b/XenAdmin/SettingsPanels/PerfmonAlertEditPage.Designer.cs @@ -33,6 +33,15 @@ namespace XenAdmin.SettingsPanels this.AlertIntervalMinutesLabel = new System.Windows.Forms.Label(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.label1 = new System.Windows.Forms.Label(); + this.nudAlertInterval = new XenAdmin.SettingsPanels.AlertNumericUpDown(); + this.Dom0MemoryUsageGroupBox = new XenAdmin.Controls.DecentGroupBox(); + this.nudDom0MemUsage = new XenAdmin.SettingsPanels.AlertNumericUpDown(); + this.Dom0MemoryDurationThresholdLabel = new System.Windows.Forms.Label(); + this.nudDom0MemoryDurationThreshold = new XenAdmin.SettingsPanels.AlertNumericUpDown(); + this.Dom0MemoryUsagePercentLabel = new System.Windows.Forms.Label(); + this.Dom0MemoryAlertCheckBox = new XenAdmin.SettingsPanels.AlertCheckBox(); + this.dom0MemoryMinutesLabel = new System.Windows.Forms.Label(); + this.dom0MemoryPercentLabel = new System.Windows.Forms.Label(); this.MemoryGroupBox = new XenAdmin.Controls.DecentGroupBox(); this.memoryMinutesLabel = new System.Windows.Forms.Label(); this.nudMemoryDurationThreshold = new XenAdmin.SettingsPanels.AlertNumericUpDown(); @@ -73,8 +82,11 @@ namespace XenAdmin.SettingsPanels this.CPUAlertCheckBox = new XenAdmin.SettingsPanels.AlertCheckBox(); this.CPUUsagePercentLabel = new System.Windows.Forms.Label(); this.CPUDurationThresholdLabel = new System.Windows.Forms.Label(); - this.nudAlertInterval = new XenAdmin.SettingsPanels.AlertNumericUpDown(); this.tableLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudAlertInterval)).BeginInit(); + this.Dom0MemoryUsageGroupBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudDom0MemUsage)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudDom0MemoryDurationThreshold)).BeginInit(); this.MemoryGroupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nudMemoryDurationThreshold)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudMemoryUsage)).BeginInit(); @@ -90,7 +102,6 @@ namespace XenAdmin.SettingsPanels this.CpuGroupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nudCPUUsagePercent)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudCPUDurationThreshold)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.nudAlertInterval)).BeginInit(); this.SuspendLayout(); // // AlertIntervalLabel @@ -106,8 +117,9 @@ namespace XenAdmin.SettingsPanels // tableLayoutPanel1 // resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1"); + this.tableLayoutPanel1.Controls.Add(this.Dom0MemoryUsageGroupBox, 0, 5); this.tableLayoutPanel1.Controls.Add(this.MemoryGroupBox, 0, 3); - this.tableLayoutPanel1.Controls.Add(this.SrGroupBox, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.SrGroupBox, 0, 4); this.tableLayoutPanel1.Controls.Add(this.DiskGroupBox, 0, 2); this.tableLayoutPanel1.Controls.Add(this.NetGroupBox, 0, 1); this.tableLayoutPanel1.Controls.Add(this.CpuGroupBox, 0, 0); @@ -118,6 +130,111 @@ namespace XenAdmin.SettingsPanels resources.ApplyResources(this.label1, "label1"); this.label1.Name = "label1"; // + // nudAlertInterval + // + this.nudAlertInterval.Increment = new decimal(new int[] { + 5, + 0, + 0, + 0}); + resources.ApplyResources(this.nudAlertInterval, "nudAlertInterval"); + this.nudAlertInterval.Maximum = new decimal(new int[] { + 86400, + 0, + 0, + 0}); + this.nudAlertInterval.Minimum = new decimal(new int[] { + 5, + 0, + 0, + 0}); + this.nudAlertInterval.Name = "nudAlertInterval"; + this.nudAlertInterval.Value = new decimal(new int[] { + 60, + 0, + 0, + 0}); + // + // Dom0MemoryUsageGroupBox + // + this.Dom0MemoryUsageGroupBox.Controls.Add(this.nudDom0MemUsage); + this.Dom0MemoryUsageGroupBox.Controls.Add(this.Dom0MemoryDurationThresholdLabel); + this.Dom0MemoryUsageGroupBox.Controls.Add(this.nudDom0MemoryDurationThreshold); + this.Dom0MemoryUsageGroupBox.Controls.Add(this.Dom0MemoryUsagePercentLabel); + this.Dom0MemoryUsageGroupBox.Controls.Add(this.Dom0MemoryAlertCheckBox); + this.Dom0MemoryUsageGroupBox.Controls.Add(this.dom0MemoryMinutesLabel); + this.Dom0MemoryUsageGroupBox.Controls.Add(this.dom0MemoryPercentLabel); + resources.ApplyResources(this.Dom0MemoryUsageGroupBox, "Dom0MemoryUsageGroupBox"); + this.Dom0MemoryUsageGroupBox.Name = "Dom0MemoryUsageGroupBox"; + this.Dom0MemoryUsageGroupBox.TabStop = false; + // + // nudDom0MemUsage + // + this.nudDom0MemUsage.Increment = new decimal(new int[] { + 5, + 0, + 0, + 0}); + resources.ApplyResources(this.nudDom0MemUsage, "nudDom0MemUsage"); + this.nudDom0MemUsage.Minimum = new decimal(new int[] { + 5, + 0, + 0, + 0}); + this.nudDom0MemUsage.Name = "nudDom0MemUsage"; + this.nudDom0MemUsage.Value = new decimal(new int[] { + 95, + 0, + 0, + 0}); + // + // Dom0MemoryDurationThresholdLabel + // + resources.ApplyResources(this.Dom0MemoryDurationThresholdLabel, "Dom0MemoryDurationThresholdLabel"); + this.Dom0MemoryDurationThresholdLabel.Name = "Dom0MemoryDurationThresholdLabel"; + // + // nudDom0MemoryDurationThreshold + // + resources.ApplyResources(this.nudDom0MemoryDurationThreshold, "nudDom0MemoryDurationThreshold"); + this.nudDom0MemoryDurationThreshold.Maximum = new decimal(new int[] { + 60, + 0, + 0, + 0}); + this.nudDom0MemoryDurationThreshold.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.nudDom0MemoryDurationThreshold.Name = "nudDom0MemoryDurationThreshold"; + this.nudDom0MemoryDurationThreshold.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // Dom0MemoryUsagePercentLabel + // + resources.ApplyResources(this.Dom0MemoryUsagePercentLabel, "Dom0MemoryUsagePercentLabel"); + this.Dom0MemoryUsagePercentLabel.Name = "Dom0MemoryUsagePercentLabel"; + // + // Dom0MemoryAlertCheckBox + // + resources.ApplyResources(this.Dom0MemoryAlertCheckBox, "Dom0MemoryAlertCheckBox"); + this.Dom0MemoryAlertCheckBox.BackColor = System.Drawing.Color.White; + this.Dom0MemoryAlertCheckBox.Name = "Dom0MemoryAlertCheckBox"; + this.Dom0MemoryAlertCheckBox.UseVisualStyleBackColor = false; + // + // dom0MemoryMinutesLabel + // + resources.ApplyResources(this.dom0MemoryMinutesLabel, "dom0MemoryMinutesLabel"); + this.dom0MemoryMinutesLabel.Name = "dom0MemoryMinutesLabel"; + // + // dom0MemoryPercentLabel + // + resources.ApplyResources(this.dom0MemoryPercentLabel, "dom0MemoryPercentLabel"); + this.dom0MemoryPercentLabel.Name = "dom0MemoryPercentLabel"; + // // MemoryGroupBox // this.MemoryGroupBox.Controls.Add(this.memoryMinutesLabel); @@ -533,31 +650,6 @@ namespace XenAdmin.SettingsPanels resources.ApplyResources(this.CPUDurationThresholdLabel, "CPUDurationThresholdLabel"); this.CPUDurationThresholdLabel.Name = "CPUDurationThresholdLabel"; // - // nudAlertInterval - // - this.nudAlertInterval.Increment = new decimal(new int[] { - 5, - 0, - 0, - 0}); - resources.ApplyResources(this.nudAlertInterval, "nudAlertInterval"); - this.nudAlertInterval.Maximum = new decimal(new int[] { - 86400, - 0, - 0, - 0}); - this.nudAlertInterval.Minimum = new decimal(new int[] { - 5, - 0, - 0, - 0}); - this.nudAlertInterval.Name = "nudAlertInterval"; - this.nudAlertInterval.Value = new decimal(new int[] { - 60, - 0, - 0, - 0}); - // // PerfmonAlertEditPage // resources.ApplyResources(this, "$this"); @@ -569,6 +661,11 @@ namespace XenAdmin.SettingsPanels this.Controls.Add(this.tableLayoutPanel1); this.Name = "PerfmonAlertEditPage"; this.tableLayoutPanel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.nudAlertInterval)).EndInit(); + this.Dom0MemoryUsageGroupBox.ResumeLayout(false); + this.Dom0MemoryUsageGroupBox.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudDom0MemUsage)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudDom0MemoryDurationThreshold)).EndInit(); this.MemoryGroupBox.ResumeLayout(false); this.MemoryGroupBox.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.nudMemoryDurationThreshold)).EndInit(); @@ -589,7 +686,6 @@ namespace XenAdmin.SettingsPanels this.CpuGroupBox.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.nudCPUUsagePercent)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudCPUDurationThreshold)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.nudAlertInterval)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -642,5 +738,13 @@ namespace XenAdmin.SettingsPanels private System.Windows.Forms.Label SrDurationThresholdLabel; private System.Windows.Forms.Label SrUsageLabel; private System.Windows.Forms.Label label1; + private Controls.DecentGroupBox Dom0MemoryUsageGroupBox; + private AlertNumericUpDown nudDom0MemUsage; + private System.Windows.Forms.Label Dom0MemoryDurationThresholdLabel; + private AlertNumericUpDown nudDom0MemoryDurationThreshold; + private System.Windows.Forms.Label Dom0MemoryUsagePercentLabel; + private AlertCheckBox Dom0MemoryAlertCheckBox; + private System.Windows.Forms.Label dom0MemoryMinutesLabel; + private System.Windows.Forms.Label dom0MemoryPercentLabel; } } diff --git a/XenAdmin/SettingsPanels/PerfmonAlertEditPage.cs b/XenAdmin/SettingsPanels/PerfmonAlertEditPage.cs index 2fdd41f8c..295470e53 100644 --- a/XenAdmin/SettingsPanels/PerfmonAlertEditPage.cs +++ b/XenAdmin/SettingsPanels/PerfmonAlertEditPage.cs @@ -59,6 +59,7 @@ namespace XenAdmin.SettingsPanels private readonly AlertGroup diskAlert; private readonly AlertGroup memoryAlert; private readonly AlertGroup srAlert; + private readonly AlertGroup dom0MemoryAlert; public PerfmonAlertEditPage() { @@ -127,7 +128,7 @@ namespace XenAdmin.SettingsPanels { AlertEnablementChanged = SetAlertIntervalEnablement, SubTextFormat = Messages.ALERT_MEMORY_SUB_TEXT, - PerfmonDefinitionName = PerfmonDefinition.ALARM_TYPE_MEMORY, + PerfmonDefinitionName = PerfmonDefinition.ALARM_TYPE_MEMORY_FREE, XapiToGuiTriggerLevel = (num => num / 1024), XapiToGuiTriggerPeriod = (num => num / 60), XapiToGuiAlertInterval = (num => num / 60), @@ -152,11 +153,28 @@ namespace XenAdmin.SettingsPanels GuiToXapiAlertInterval = (num => num * 60), }; + + dom0MemoryAlert = new AlertGroup(Dom0MemoryAlertCheckBox, Dom0MemoryUsageGroupBox, + nudDom0MemUsage, nudDom0MemoryDurationThreshold, nudAlertInterval, + new[] { dom0MemoryMinutesLabel, dom0MemoryPercentLabel, Dom0MemoryUsagePercentLabel, Dom0MemoryDurationThresholdLabel }) + { + AlertEnablementChanged = SetAlertIntervalEnablement, + SubTextFormat = Messages.ALERT_DOM0_MEMORY_SUB_TEXT, + PerfmonDefinitionName = PerfmonDefinition.ALARM_TYPE_MEMORY_DOM0_USAGE, + 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(); diskAlert.ToggleAlertGroupEnablement(); memoryAlert.ToggleAlertGroupEnablement(); srAlert.ToggleAlertGroupEnablement(); + dom0MemoryAlert.ToggleAlertGroupEnablement(); } public string SubText @@ -189,6 +207,7 @@ namespace XenAdmin.SettingsPanels diskAlert.Show(isVm); memoryAlert.Show(isHost && Helpers.ClearwaterOrGreater(_XenObject.Connection)); srAlert.Show(isSr && Helpers.ClearwaterOrGreater(_XenObject.Connection)); + dom0MemoryAlert.Show(isHost && Helpers.CreedenceOrGreater(_XenObject.Connection)); if (isHost) { @@ -223,6 +242,8 @@ namespace XenAdmin.SettingsPanels memoryAlert.Populate(perfmonDefinition); else if (perfmonDefinition.IsSrUsage) srAlert.Populate(perfmonDefinition); + else if (perfmonDefinition.IsDom0MemoryUsage) + dom0MemoryAlert.Populate(perfmonDefinition); } } catch { } @@ -241,7 +262,7 @@ namespace XenAdmin.SettingsPanels if (_XenObject is VM) return cpuAlert.HasChanged || netAlert.HasChanged || diskAlert.HasChanged; - return cpuAlert.HasChanged || netAlert.HasChanged || memoryAlert.HasChanged; + return cpuAlert.HasChanged || netAlert.HasChanged || memoryAlert.HasChanged || dom0MemoryAlert.HasChanged; } } @@ -298,13 +319,16 @@ namespace XenAdmin.SettingsPanels if (_XenObject is SR && srAlert.Enabled) perfmonDefinitions.Add(srAlert.AlertDefinition); + if (_XenObject is Host && dom0MemoryAlert.Enabled) + perfmonDefinitions.Add(dom0MemoryAlert.AlertDefinition); + return new PerfmonDefinitionAction(_XenObject, perfmonDefinitions, true); } private void SetAlertIntervalEnablement() { bool enable = cpuAlert.Enabled || netAlert.Enabled || diskAlert.Enabled - || memoryAlert.Enabled || srAlert.Enabled; + || memoryAlert.Enabled || srAlert.Enabled || dom0MemoryAlert.Enabled; nudAlertInterval.Enabled = enable; AlertIntervalMinutesLabel.Enabled = enable; diff --git a/XenAdmin/SettingsPanels/PerfmonAlertEditPage.resx b/XenAdmin/SettingsPanels/PerfmonAlertEditPage.resx index 7187a2a67..8f8964aed 100644 --- a/XenAdmin/SettingsPanels/PerfmonAlertEditPage.resx +++ b/XenAdmin/SettingsPanels/PerfmonAlertEditPage.resx @@ -112,22 +112,22 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + True - + NoControl - + - 9, 64 + 6, 58 3, 3, 15, 3 @@ -148,7 +148,7 @@ AlertIntervalLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this @@ -163,7 +163,7 @@ NoControl - 240, 64 + 380, 58 3, 3, 3, 3 @@ -181,7 +181,7 @@ AlertIntervalMinutesLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this @@ -198,6 +198,237 @@ 1 + + 290, 22 + + + 75, 20 + + + 7 + + + nudDom0MemUsage + + + XenAdmin.SettingsPanels.AlertNumericUpDown, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + Dom0MemoryUsageGroupBox + + + 0 + + + True + + + NoControl + + + 372, 50 + + + 43, 13 + + + 6 + + + minutes + + + Dom0MemoryDurationThresholdLabel + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Dom0MemoryUsageGroupBox + + + 1 + + + 290, 48 + + + 3, 3, 3, 0 + + + 75, 20 + + + 5 + + + nudDom0MemoryDurationThreshold + + + XenAdmin.SettingsPanels.AlertNumericUpDown, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + Dom0MemoryUsageGroupBox + + + 2 + + + True + + + NoControl + + + 372, 24 + + + 15, 13 + + + 3 + + + % + + + Dom0MemoryUsagePercentLabel + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Dom0MemoryUsageGroupBox + + + 3 + + + True + + + NoControl + + + 6, 0 + + + 3, 0, 0, 0 + + + 244, 17 + + + 0 + + + Generate &control domain memory usage alerts + + + Dom0MemoryAlertCheckBox + + + XenAdmin.SettingsPanels.AlertCheckBox, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + Dom0MemoryUsageGroupBox + + + 4 + + + True + + + NoControl + + + 12, 50 + + + 81, 13 + + + 4 + + + For longer &than: + + + MiddleLeft + + + dom0MemoryMinutesLabel + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Dom0MemoryUsageGroupBox + + + 5 + + + True + + + NoControl + + + 12, 24 + + + 225, 13 + + + 1 + + + When control domain memory usage exceeds: + + + MiddleLeft + + + dom0MemoryPercentLabel + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Dom0MemoryUsageGroupBox + + + 6 + + + 3, 423 + + + 3, 3, 3, 0 + + + 445, 78 + + + 7 + + + + + + Dom0MemoryUsageGroupBox + + + XenAdmin.Controls.DecentGroupBox, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + tableLayoutPanel1 + + + 0 + True @@ -205,7 +436,7 @@ NoControl - 272, 58 + 372, 50 43, 13 @@ -220,7 +451,7 @@ memoryMinutesLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 MemoryGroupBox @@ -229,7 +460,7 @@ 0 - 190, 56 + 290, 48 3, 3, 3, 0 @@ -259,7 +490,7 @@ NoControl - 272, 32 + 372, 24 23, 13 @@ -274,7 +505,7 @@ memoryUnitsLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 MemoryGroupBox @@ -283,7 +514,7 @@ 2 - 190, 30 + 290, 22 75, 20 @@ -312,8 +543,11 @@ 6, 0 + + 3, 0, 0, 0 + - 169, 17 + 172, 17 0 @@ -340,7 +574,7 @@ NoControl - 12, 56 + 12, 50 81, 13 @@ -358,7 +592,7 @@ memoryDurationThresholdLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 MemoryGroupBox @@ -373,7 +607,7 @@ NoControl - 12, 30 + 12, 24 151, 13 @@ -391,7 +625,7 @@ memoryUsageLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 MemoryGroupBox @@ -400,13 +634,13 @@ 6 - 3, 283 + 3, 255 3, 3, 3, 0 - 420, 89 + 445, 78 3 @@ -424,7 +658,7 @@ tableLayoutPanel1 - 0 + 1 True @@ -433,7 +667,7 @@ NoControl - 337, 58 + 372, 50 43, 13 @@ -448,7 +682,7 @@ srMinutesLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 SrGroupBox @@ -457,7 +691,7 @@ 0 - 255, 56 + 290, 48 3, 3, 3, 0 @@ -487,7 +721,7 @@ NoControl - 337, 32 + 372, 24 31, 13 @@ -502,7 +736,7 @@ srUnitsLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 SrGroupBox @@ -511,7 +745,7 @@ 2 - 255, 30 + 290, 22 75, 20 @@ -540,8 +774,11 @@ 6, 0 + + 3, 0, 0, 0 + - 190, 17 + 193, 17 0 @@ -568,7 +805,7 @@ NoControl - 12, 56 + 12, 50 81, 13 @@ -586,7 +823,7 @@ SrDurationThresholdLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 SrGroupBox @@ -601,7 +838,7 @@ NoControl - 12, 30 + 12, 24 212, 13 @@ -619,7 +856,7 @@ SrUsageLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 SrGroupBox @@ -628,13 +865,13 @@ 6 - 3, 378 + 3, 339 3, 3, 3, 0 - 420, 89 + 445, 78 4 @@ -652,7 +889,7 @@ tableLayoutPanel1 - 1 + 2 True @@ -661,7 +898,7 @@ NoControl - 272, 58 + 372, 50 43, 13 @@ -676,7 +913,7 @@ DiskMinutesLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 DiskGroupBox @@ -685,7 +922,7 @@ 0 - 190, 56 + 290, 48 3, 3, 3, 0 @@ -715,7 +952,7 @@ NoControl - 272, 32 + 372, 24 31, 13 @@ -730,7 +967,7 @@ DiskPercentLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 DiskGroupBox @@ -739,7 +976,7 @@ 2 - 190, 30 + 290, 22 75, 20 @@ -768,8 +1005,11 @@ 6, 0 + + 3, 0, 0, 0 + - 152, 17 + 155, 17 0 @@ -796,7 +1036,7 @@ NoControl - 12, 56 + 12, 48 81, 13 @@ -814,7 +1054,7 @@ DiskDurationThresholdLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 DiskGroupBox @@ -829,7 +1069,7 @@ NoControl - 12, 30 + 12, 24 136, 13 @@ -847,7 +1087,7 @@ DiskUsagePercentLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 DiskGroupBox @@ -856,13 +1096,13 @@ 6 - 3, 188 + 3, 171 3, 3, 3, 0 - 420, 89 + 445, 78 2 @@ -880,7 +1120,7 @@ tableLayoutPanel1 - 2 + 3 True @@ -889,7 +1129,7 @@ NoControl - 271, 30 + 372, 24 31, 13 @@ -904,7 +1144,7 @@ NetPercentLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 NetGroupBox @@ -913,7 +1153,7 @@ 0 - 190, 28 + 290, 22 75, 20 @@ -940,7 +1180,7 @@ NoControl - 269, 56 + 372, 50 43, 13 @@ -955,7 +1195,7 @@ NetMinutesLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 NetGroupBox @@ -964,7 +1204,7 @@ 2 - 190, 54 + 290, 48 3, 3, 3, 0 @@ -996,8 +1236,11 @@ 6, 0 + + 3, 0, 0, 0 + - 171, 17 + 174, 17 0 @@ -1024,7 +1267,7 @@ NoControl - 12, 56 + 12, 50 81, 13 @@ -1042,7 +1285,7 @@ NetDurationThresholdLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 NetGroupBox @@ -1057,7 +1300,7 @@ NoControl - 12, 30 + 12, 24 155, 13 @@ -1075,7 +1318,7 @@ NetUsagePercentLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 NetGroupBox @@ -1084,13 +1327,13 @@ 6 - 3, 95 + 3, 87 3, 3, 3, 0 - 420, 87 + 445, 78 1 @@ -1105,7 +1348,7 @@ tableLayoutPanel1 - 3 + 4 True @@ -1114,7 +1357,7 @@ NoControl - 272, 24 + 372, 24 15, 13 @@ -1129,7 +1372,7 @@ cpuPercentLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 CpuGroupBox @@ -1138,7 +1381,7 @@ 0 - 190, 22 + 290, 22 75, 20 @@ -1165,7 +1408,7 @@ NoControl - 271, 55 + 372, 50 43, 13 @@ -1180,7 +1423,7 @@ cpuMinutesLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 CpuGroupBox @@ -1189,7 +1432,7 @@ 2 - 190, 53 + 290, 48 3, 3, 3, 0 @@ -1224,8 +1467,11 @@ 3, 3, 3, 7 + + 3, 0, 0, 0 + - 155, 17 + 158, 17 0 @@ -1270,7 +1516,7 @@ CPUUsagePercentLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 CpuGroupBox @@ -1285,7 +1531,7 @@ NoControl - 12, 55 + 12, 50 81, 13 @@ -1303,7 +1549,7 @@ CPUDurationThresholdLabel - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 CpuGroupBox @@ -1318,7 +1564,7 @@ 3, 3, 3, 0 - 420, 86 + 445, 78 0 @@ -1333,19 +1579,19 @@ tableLayoutPanel1 - 4 + 5 - 6, 95 + 6, 83 3, 10, 3, 3 - 4 + 6 - 426, 470 + 451, 504 4 @@ -1354,7 +1600,7 @@ tableLayoutPanel1 - System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this @@ -1363,7 +1609,7 @@ 4 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="MemoryGroupBox" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="SrGroupBox" Row="3" 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,Absolute,20" /></TableLayoutSettings> + <?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> Top, Left, Right @@ -1390,7 +1636,7 @@ label1 - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this @@ -1399,7 +1645,7 @@ 0 - 155, 62 + 230, 56 75, 20 @@ -1419,7 +1665,7 @@ 2 - + True @@ -1438,6 +1684,6 @@ PerfmonAlertEditPage - System.Windows.Forms.UserControl, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff --git a/XenModel/Alerts/PerfmonDefinition.cs b/XenModel/Alerts/PerfmonDefinition.cs index d1504a704..650a41a30 100644 --- a/XenModel/Alerts/PerfmonDefinition.cs +++ b/XenModel/Alerts/PerfmonDefinition.cs @@ -61,7 +61,8 @@ namespace XenAdmin.Alerts public const string ALARM_TYPE_NETWORK = "network_usage"; public const string ALARM_TYPE_DISK = "disk_usage"; public const string ALARM_TYPE_FILESYSTEM = "fs_usage"; - public const string ALARM_TYPE_MEMORY = "memory_free_kib"; + public const string ALARM_TYPE_MEMORY_FREE = "memory_free_kib"; + public const string ALARM_TYPE_MEMORY_DOM0_USAGE = "mem_usage"; /// /// This is the name that will be stored in the SR's other-config:perfmon key /// @@ -103,7 +104,12 @@ namespace XenAdmin.Alerts public bool IsMemoryUsage { - get { return name.Equals(ALARM_TYPE_MEMORY); } + get { return name.Equals(ALARM_TYPE_MEMORY_FREE); } + } + + public bool IsDom0MemoryUsage + { + get { return name.Equals(ALARM_TYPE_MEMORY_DOM0_USAGE); } } public bool IsSrUsage diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index 625811fcd..5b8a96a5e 100644 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18444 +// Runtime Version:4.0.30319.34209 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -3855,6 +3855,34 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Control Domain Memory Usage. + /// + public static string ALERT_ALARM_DOM0_MEMORY { + get { + return ResourceManager.GetString("ALERT_ALARM_DOM0_MEMORY", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Control Domain Memory Demand Alarm. + /// + public static string ALERT_ALARM_DOM0_MEMORY_DEMAND { + get { + return ResourceManager.GetString("ALERT_ALARM_DOM0_MEMORY_DEMAND", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The memory demand on {0} is about {1} of the physical memory of the domain. Occasional performance degradation can be expected when memory swapping is forced to happen. + ///This alarm is set to be triggered when the ratio of the memory demand to the physical memory is beyond {2}.. + /// + public static string ALERT_ALARM_DOM0_MEMORY_DEMAND_DESCRIPTION { + get { + return ResourceManager.GetString("ALERT_ALARM_DOM0_MEMORY_DEMAND_DESCRIPTION", resourceCulture); + } + } + /// /// Looks up a localized string similar to File System on Control Domain Full. /// @@ -4007,6 +4035,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to When control domain memory usage exceeds {0} for {1} min(s). + /// + public static string ALERT_DOM0_MEMORY_SUB_TEXT { + get { + return ResourceManager.GetString("ALERT_DOM0_MEMORY_SUB_TEXT", resourceCulture); + } + } + /// /// Looks up a localized string similar to Export &all. /// diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index a5be644f0..0f2ebfee0 100644 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -1436,6 +1436,16 @@ This alarm is set to be triggered when CPU usage is more than {3}. Disk usage on {0} has been on average {1} for the last {2}. This alarm is set to be triggered when disk usage is more than {3}. + + + Control Domain Memory Usage + + + Control Domain Memory Demand Alarm + + + The memory demand on {0} is about {1} of the physical memory of the domain. Occasional performance degradation can be expected when memory swapping is forced to happen. +This alarm is set to be triggered when the ratio of the memory demand to the physical memory is beyond {2}. File System on Control Domain Full @@ -1493,6 +1503,9 @@ Note that if RBAC is enabled, only alerts which you have privileges to dismiss w Note that if RBAC is enabled, only alerts which you have privileges to dismiss will be affected. + + When control domain memory usage exceeds {0} for {1} min(s) + Export &all From bf1bf99bddd871711654eceb060959913c96023e Mon Sep 17 00:00:00 2001 From: Gabor Apati-Nagy Date: Thu, 7 Aug 2014 13:22:45 +0100 Subject: [PATCH 2/3] CP-9092: XenCenter work for Dom0 memory usage alert -Fixing ALERT_ALARM_DOM0_MEMORY_DEMAND_DESCRIPTION string.Format parameters Signed-off-by: Gabor Apati-Nagy --- XenAdmin/Alerts/Types/AlarmMessageAlert.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/XenAdmin/Alerts/Types/AlarmMessageAlert.cs b/XenAdmin/Alerts/Types/AlarmMessageAlert.cs index a00209b56..37de18e8e 100644 --- a/XenAdmin/Alerts/Types/AlarmMessageAlert.cs +++ b/XenAdmin/Alerts/Types/AlarmMessageAlert.cs @@ -190,7 +190,8 @@ namespace XenAdmin.Alerts case AlarmType.Dom0MemoryDemand: return string.Format(Messages.ALERT_ALARM_DOM0_MEMORY_DEMAND_DESCRIPTION, Helpers.GetNameAndObject(XenObject), - Util.PercentageString(CurrentValue)); + Util.PercentageString(CurrentValue), + Util.PercentageString(TriggerLevel)); case AlarmType.Storage: return string.Format(Messages.ALERT_ALARM_STORAGE_DESCRIPTION, Helpers.GetNameAndObject(XenObject), From 04b54b2d15120e8d24cd7727924c25d934f6d0f6 Mon Sep 17 00:00:00 2001 From: Gabor Apati-Nagy Date: Thu, 7 Aug 2014 13:32:54 +0100 Subject: [PATCH 3/3] CP-9092: XenCenter work for Dom0 memory usage alert -Fixing tab order Signed-off-by: Gabor Apati-Nagy --- XenAdmin/SettingsPanels/PerfmonAlertEditPage.resx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/XenAdmin/SettingsPanels/PerfmonAlertEditPage.resx b/XenAdmin/SettingsPanels/PerfmonAlertEditPage.resx index 8f8964aed..05ad43a88 100644 --- a/XenAdmin/SettingsPanels/PerfmonAlertEditPage.resx +++ b/XenAdmin/SettingsPanels/PerfmonAlertEditPage.resx @@ -163,7 +163,7 @@ NoControl - 380, 58 + 218, 58 3, 3, 3, 3 @@ -205,7 +205,7 @@ 75, 20 - 7 + 6 nudDom0MemUsage @@ -259,7 +259,7 @@ 75, 20 - 5 + 7 nudDom0MemoryDurationThreshold @@ -1645,7 +1645,7 @@ 0 - 230, 56 + 137, 56 75, 20