Merge pull request #634 from agimofcarmen/CP-13174

CP 13174: Agree and update units used for initial/subsequent allocation
This commit is contained in:
Mihaela Stoica 2015-08-25 15:19:13 +01:00
commit 094f346208
9 changed files with 408 additions and 100 deletions

View File

@ -36,19 +36,23 @@ namespace XenAdmin.SettingsPanels
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.sizeValueROLabel = new System.Windows.Forms.Label();
this.labelLocationValueRO = new System.Windows.Forms.Label();
this.pictureBoxError = new System.Windows.Forms.PictureBox();
this.labelError = new System.Windows.Forms.Label();
this.panelShutDownHint = new System.Windows.Forms.Panel();
this.labelShutDownWarning = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.pictureBoxError = new System.Windows.Forms.PictureBox();
this.labelError = new System.Windows.Forms.Label();
this.initial_allocation_label = new System.Windows.Forms.Label();
this.incremental_allocation_label = new System.Windows.Forms.Label();
this.initial_alloc_value = new System.Windows.Forms.Label();
this.incr_alloc_value = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.sizeNUD)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxError)).BeginInit();
this.panelShutDownHint.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.tableLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxError)).BeginInit();
this.SuspendLayout();
//
// SizeLabel
@ -87,13 +91,17 @@ namespace XenAdmin.SettingsPanels
//
resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1");
this.tableLayoutPanel1.Controls.Add(this.sizeValue, 3, 0);
this.tableLayoutPanel1.Controls.Add(this.locationLabel, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.locationLabel, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.SizeLabel, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.sizeNUD, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.sizeValueROLabel, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.labelLocationValueRO, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.labelLocationValueRO, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.pictureBoxError, 4, 0);
this.tableLayoutPanel1.Controls.Add(this.labelError, 5, 0);
this.tableLayoutPanel1.Controls.Add(this.initial_allocation_label, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.incremental_allocation_label, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.initial_alloc_value, 2, 2);
this.tableLayoutPanel1.Controls.Add(this.incr_alloc_value, 2, 3);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
//
// sizeValueROLabel
@ -107,6 +115,19 @@ namespace XenAdmin.SettingsPanels
this.tableLayoutPanel1.SetColumnSpan(this.labelLocationValueRO, 5);
this.labelLocationValueRO.Name = "labelLocationValueRO";
//
// pictureBoxError
//
resources.ApplyResources(this.pictureBoxError, "pictureBoxError");
this.pictureBoxError.Image = global::XenAdmin.Properties.Resources._000_error_h32bit_16;
this.pictureBoxError.Name = "pictureBoxError";
this.pictureBoxError.TabStop = false;
//
// labelError
//
resources.ApplyResources(this.labelError, "labelError");
this.labelError.ForeColor = System.Drawing.Color.Red;
this.labelError.Name = "labelError";
//
// panelShutDownHint
//
this.panelShutDownHint.Controls.Add(this.labelShutDownWarning);
@ -123,7 +144,6 @@ namespace XenAdmin.SettingsPanels
//
resources.ApplyResources(this.pictureBox1, "pictureBox1");
this.pictureBox1.Image = global::XenAdmin.Properties.Resources._000_Alert2_h32bit_16;
this.pictureBox1.MinimumSize = new System.Drawing.Size(16, 16);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.TabStop = false;
//
@ -138,19 +158,25 @@ namespace XenAdmin.SettingsPanels
this.tableLayoutPanel2.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
//
// pictureBoxError
// initial_allocation_label
//
resources.ApplyResources(this.pictureBoxError, "pictureBoxError");
this.pictureBoxError.Image = global::XenAdmin.Properties.Resources._000_error_h32bit_16;
this.pictureBoxError.Name = "pictureBoxError";
this.pictureBoxError.TabStop = false;
resources.ApplyResources(this.initial_allocation_label, "initial_allocation_label");
this.initial_allocation_label.Name = "initial_allocation_label";
//
// labelError
// incremental_allocation_label
//
resources.ApplyResources(this.labelError, "labelError");
this.labelError.ForeColor = System.Drawing.Color.Red;
this.labelError.Name = "labelError";
this.tableLayoutPanel1.SetRowSpan(this.labelError, 2);
resources.ApplyResources(this.incremental_allocation_label, "incremental_allocation_label");
this.incremental_allocation_label.Name = "incremental_allocation_label";
//
// initial_alloc_value
//
resources.ApplyResources(this.initial_alloc_value, "initial_alloc_value");
this.initial_alloc_value.Name = "initial_alloc_value";
//
// incr_alloc_value
//
resources.ApplyResources(this.incr_alloc_value, "incr_alloc_value");
this.incr_alloc_value.Name = "incr_alloc_value";
//
// VDISizeLocationPage
//
@ -165,11 +191,11 @@ namespace XenAdmin.SettingsPanels
((System.ComponentModel.ISupportInitialize)(this.sizeNUD)).EndInit();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxError)).EndInit();
this.panelShutDownHint.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxError)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -191,6 +217,10 @@ namespace XenAdmin.SettingsPanels
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.PictureBox pictureBoxError;
private System.Windows.Forms.Label labelError;
private System.Windows.Forms.Label initial_allocation_label;
private System.Windows.Forms.Label incremental_allocation_label;
private System.Windows.Forms.Label initial_alloc_value;
private System.Windows.Forms.Label incr_alloc_value;
}
}

View File

@ -93,8 +93,18 @@ namespace XenAdmin.SettingsPanels
{
if(vdi == null)
return;
SR sr = vdi.Connection.Resolve<SR>(vdi.SR);
labelLocationValueRO.Text = string.Format("'{0}'", sr.NameWithoutHost);
labelLocationValueRO.Text = string.Format("'{0}'", vdi.Connection.Resolve<SR>(vdi.SR).NameWithoutHost);
initial_alloc_value.Visible = incr_alloc_value.Visible
= initial_allocation_label.Visible
= incremental_allocation_label.Visible = sr.IsThinProvisioned;
if(sr.IsThinProvisioned && vdi.sm_config.ContainsKey("initial_allocation") && vdi.sm_config.ContainsKey("allocation_quantum"))
{
initial_alloc_value.Text = Util.MemorySizeStringSuitableUnits(Convert.ToDouble(vdi.sm_config["initial_allocation"]) * Util.BINARY_MEGA, true);
incr_alloc_value.Text = Util.MemorySizeStringSuitableUnits(Convert.ToDouble(vdi.sm_config["allocation_quantum"]) * Util.BINARY_MEGA, true);
}
if (vdi.allowed_operations.Contains(vdi_operations.resize) ||
vdi.allowed_operations.Contains(vdi_operations.resize_online))

View File

@ -112,23 +112,23 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="SizeLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="SizeLabel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="SizeLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="SizeLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
@ -136,7 +136,7 @@
<value>0, 0, 3, 0</value>
</data>
<data name="SizeLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>51, 26</value>
<value>113, 35</value>
</data>
<data name="SizeLabel.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
@ -151,7 +151,7 @@
<value>SizeLabel</value>
</data>
<data name="&gt;&gt;SizeLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;SizeLabel.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
@ -166,7 +166,7 @@
<value>NoControl</value>
</data>
<data name="locationLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 38</value>
<value>0, 47</value>
</data>
<data name="locationLabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 12, 3, 0</value>
@ -187,7 +187,7 @@
<value>locationLabel</value>
</data>
<data name="&gt;&gt;locationLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;locationLabel.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
@ -199,7 +199,7 @@
<value>Fill</value>
</data>
<data name="sizeNUD.Location" type="System.Drawing.Point, System.Drawing">
<value>54, 3</value>
<value>116, 3</value>
</data>
<data name="sizeNUD.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 3, 3, 3</value>
@ -217,7 +217,7 @@
<value>sizeNUD</value>
</data>
<data name="&gt;&gt;sizeNUD.Type" xml:space="preserve">
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;sizeNUD.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
@ -235,10 +235,10 @@
<value>NoControl</value>
</data>
<data name="sizeValue.Location" type="System.Drawing.Point, System.Drawing">
<value>221, 0</value>
<value>283, 0</value>
</data>
<data name="sizeValue.Size" type="System.Drawing.Size, System.Drawing">
<value>22, 26</value>
<value>22, 35</value>
</data>
<data name="sizeValue.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
@ -253,7 +253,7 @@
<value>sizeValue</value>
</data>
<data name="&gt;&gt;sizeValue.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;sizeValue.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
@ -274,13 +274,13 @@
<value>NoControl</value>
</data>
<data name="sizeValueROLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>54, 0</value>
<value>116, 0</value>
</data>
<data name="sizeValueROLabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 0</value>
</data>
<data name="sizeValueROLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>1, 26</value>
<value>1, 35</value>
</data>
<data name="sizeValueROLabel.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
@ -295,7 +295,7 @@
<value>sizeValueROLabel</value>
</data>
<data name="&gt;&gt;sizeValueROLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;sizeValueROLabel.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
@ -313,13 +313,13 @@
<value>NoControl</value>
</data>
<data name="labelLocationValueRO.Location" type="System.Drawing.Point, System.Drawing">
<value>54, 38</value>
<value>116, 47</value>
</data>
<data name="labelLocationValueRO.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 12, 3, 0</value>
</data>
<data name="labelLocationValueRO.Size" type="System.Drawing.Size, System.Drawing">
<value>501, 13</value>
<value>439, 13</value>
</data>
<data name="labelLocationValueRO.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
@ -331,7 +331,7 @@
<value>labelLocationValueRO</value>
</data>
<data name="&gt;&gt;labelLocationValueRO.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;labelLocationValueRO.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
@ -346,7 +346,7 @@
<value>NoControl</value>
</data>
<data name="pictureBoxError.Location" type="System.Drawing.Point, System.Drawing">
<value>249, 5</value>
<value>311, 5</value>
</data>
<data name="pictureBoxError.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 5, 3, 3</value>
@ -367,7 +367,7 @@
<value>pictureBoxError</value>
</data>
<data name="&gt;&gt;pictureBoxError.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBoxError.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
@ -385,13 +385,13 @@
<value>NoControl</value>
</data>
<data name="labelError.Location" type="System.Drawing.Point, System.Drawing">
<value>268, 5</value>
<value>330, 5</value>
</data>
<data name="labelError.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 5, 3, 0</value>
</data>
<data name="labelError.Size" type="System.Drawing.Size, System.Drawing">
<value>259, 15</value>
<value>216, 30</value>
</data>
<data name="labelError.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
@ -406,7 +406,7 @@
<value>labelError</value>
</data>
<data name="&gt;&gt;labelError.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;labelError.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
@ -414,6 +414,132 @@
<data name="&gt;&gt;labelError.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="initial_allocation_label.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left</value>
</data>
<data name="initial_allocation_label.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="initial_allocation_label.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 68</value>
</data>
<data name="initial_allocation_label.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 3, 0</value>
</data>
<data name="initial_allocation_label.Size" type="System.Drawing.Size, System.Drawing">
<value>82, 13</value>
</data>
<data name="initial_allocation_label.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="initial_allocation_label.Text" xml:space="preserve">
<value>Initial allocation:</value>
</data>
<data name="initial_allocation_label.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="&gt;&gt;initial_allocation_label.Name" xml:space="preserve">
<value>initial_allocation_label</value>
</data>
<data name="&gt;&gt;initial_allocation_label.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;initial_allocation_label.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;initial_allocation_label.ZOrder" xml:space="preserve">
<value>8</value>
</data>
<data name="incremental_allocation_label.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="incremental_allocation_label.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 90</value>
</data>
<data name="incremental_allocation_label.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 3, 0</value>
</data>
<data name="incremental_allocation_label.Size" type="System.Drawing.Size, System.Drawing">
<value>113, 13</value>
</data>
<data name="incremental_allocation_label.TabIndex" type="System.Int32, mscorlib">
<value>12</value>
</data>
<data name="incremental_allocation_label.Text" xml:space="preserve">
<value>Incremental allocation:</value>
</data>
<data name="incremental_allocation_label.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="&gt;&gt;incremental_allocation_label.Name" xml:space="preserve">
<value>incremental_allocation_label</value>
</data>
<data name="&gt;&gt;incremental_allocation_label.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;incremental_allocation_label.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;incremental_allocation_label.ZOrder" xml:space="preserve">
<value>9</value>
</data>
<data name="initial_alloc_value.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Left</value>
</data>
<data name="initial_alloc_value.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="initial_alloc_value.Location" type="System.Drawing.Point, System.Drawing">
<value>119, 68</value>
</data>
<data name="initial_alloc_value.Size" type="System.Drawing.Size, System.Drawing">
<value>90, 13</value>
</data>
<data name="initial_alloc_value.TabIndex" type="System.Int32, mscorlib">
<value>13</value>
</data>
<data name="initial_alloc_value.Text" xml:space="preserve">
<value>initial_alloc_value</value>
</data>
<data name="&gt;&gt;initial_alloc_value.Name" xml:space="preserve">
<value>initial_alloc_value</value>
</data>
<data name="&gt;&gt;initial_alloc_value.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;initial_alloc_value.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;initial_alloc_value.ZOrder" xml:space="preserve">
<value>10</value>
</data>
<data name="incr_alloc_value.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="incr_alloc_value.Location" type="System.Drawing.Point, System.Drawing">
<value>119, 90</value>
</data>
<data name="incr_alloc_value.Size" type="System.Drawing.Size, System.Drawing">
<value>84, 13</value>
</data>
<data name="incr_alloc_value.TabIndex" type="System.Int32, mscorlib">
<value>14</value>
</data>
<data name="incr_alloc_value.Text" xml:space="preserve">
<value>incr_alloc_value</value>
</data>
<data name="&gt;&gt;incr_alloc_value.Name" xml:space="preserve">
<value>incr_alloc_value</value>
</data>
<data name="&gt;&gt;incr_alloc_value.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;incr_alloc_value.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;incr_alloc_value.ZOrder" xml:space="preserve">
<value>11</value>
</data>
<data name="tableLayoutPanel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
@ -433,7 +559,7 @@
<value>tableLayoutPanel1</value>
</data>
<data name="&gt;&gt;tableLayoutPanel1.Type" xml:space="preserve">
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tableLayoutPanel1.Parent" xml:space="preserve">
<value>$this</value>
@ -442,37 +568,13 @@
<value>0</value>
</data>
<data name="tableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="sizeValue" Row="0" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="locationLabel" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="SizeLabel" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="sizeNUD" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="sizeValueROLabel" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="labelLocationValueRO" Row="2" RowSpan="1" Column="1" ColumnSpan="5" /&gt;&lt;Control Name="pictureBoxError" Row="0" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="labelError" Row="0" RowSpan="2" Column="5" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,Percent,50,Absolute,20" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="labelShutDownWarning.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="labelShutDownWarning.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="labelShutDownWarning.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 0</value>
</data>
<data name="labelShutDownWarning.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>2, 0, 0, 0</value>
</data>
<data name="labelShutDownWarning.Size" type="System.Drawing.Size, System.Drawing">
<value>542, 39</value>
</data>
<data name="labelShutDownWarning.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="labelShutDownWarning.Text" xml:space="preserve">
<value>The disk size cannot be altered as the disk is already being updated or is in use by a running VM.</value>
</data>
<data name="labelShutDownWarning.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="sizeValue" Row="0" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="locationLabel" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="SizeLabel" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="sizeNUD" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="sizeValueROLabel" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="labelLocationValueRO" Row="1" RowSpan="1" Column="1" ColumnSpan="5" /&gt;&lt;Control Name="pictureBoxError" Row="0" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="labelError" Row="0" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;Control Name="initial_allocation_label" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="incremental_allocation_label" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="initial_alloc_value" Row="2" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="incr_alloc_value" Row="3" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100" /&gt;&lt;Rows Styles="AutoSize,0,AutoSize,0,Absolute,30,Absolute,50" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="&gt;&gt;labelShutDownWarning.Name" xml:space="preserve">
<value>labelShutDownWarning</value>
</data>
<data name="&gt;&gt;labelShutDownWarning.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;labelShutDownWarning.Parent" xml:space="preserve">
<value>panelShutDownHint</value>
@ -480,32 +582,11 @@
<data name="&gt;&gt;labelShutDownWarning.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="pictureBox1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Left</value>
</data>
<data name="pictureBox1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="pictureBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="pictureBox1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 0</value>
</data>
<data name="pictureBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>16, 39</value>
</data>
<data name="pictureBox1.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
<value>CenterImage</value>
</data>
<data name="pictureBox1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;pictureBox1.Name" xml:space="preserve">
<value>pictureBox1</value>
</data>
<data name="&gt;&gt;pictureBox1.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBox1.Parent" xml:space="preserve">
<value>panelShutDownHint</value>
@ -535,7 +616,7 @@
<value>panelShutDownHint</value>
</data>
<data name="&gt;&gt;panelShutDownHint.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;panelShutDownHint.Parent" xml:space="preserve">
<value>$this</value>
@ -543,6 +624,78 @@
<data name="&gt;&gt;panelShutDownHint.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="labelShutDownWarning.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="labelShutDownWarning.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="labelShutDownWarning.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 0</value>
</data>
<data name="labelShutDownWarning.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>2, 0, 0, 0</value>
</data>
<data name="labelShutDownWarning.Size" type="System.Drawing.Size, System.Drawing">
<value>542, 39</value>
</data>
<data name="labelShutDownWarning.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="labelShutDownWarning.Text" xml:space="preserve">
<value>The disk size cannot be altered as the disk is already being updated or is in use by a running VM.</value>
</data>
<data name="labelShutDownWarning.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleLeft</value>
</data>
<data name="&gt;&gt;labelShutDownWarning.Name" xml:space="preserve">
<value>labelShutDownWarning</value>
</data>
<data name="&gt;&gt;labelShutDownWarning.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;labelShutDownWarning.Parent" xml:space="preserve">
<value>panelShutDownHint</value>
</data>
<data name="&gt;&gt;labelShutDownWarning.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="pictureBox1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Left</value>
</data>
<data name="pictureBox1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="pictureBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="pictureBox1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 0</value>
</data>
<data name="pictureBox1.MinimumSize" type="System.Drawing.Size, System.Drawing">
<value>16, 16</value>
</data>
<data name="pictureBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>16, 39</value>
</data>
<data name="pictureBox1.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
<value>CenterImage</value>
</data>
<data name="pictureBox1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;pictureBox1.Name" xml:space="preserve">
<value>pictureBox1</value>
</data>
<data name="&gt;&gt;pictureBox1.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBox1.Parent" xml:space="preserve">
<value>panelShutDownHint</value>
</data>
<data name="&gt;&gt;pictureBox1.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
@ -571,7 +724,7 @@
<value>label1</value>
</data>
<data name="&gt;&gt;label1.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label1.Parent" xml:space="preserve">
<value>tableLayoutPanel2</value>
@ -604,7 +757,7 @@
<value>tableLayoutPanel2</value>
</data>
<data name="&gt;&gt;tableLayoutPanel2.Type" xml:space="preserve">
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tableLayoutPanel2.Parent" xml:space="preserve">
<value>$this</value>
@ -615,7 +768,7 @@
<data name="tableLayoutPanel2.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="label1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,50" /&gt;&lt;Rows Styles="Percent,50" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
@ -631,6 +784,6 @@
<value>VDISizeLocationPage</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

View File

@ -1244,6 +1244,11 @@ namespace XenAdmin.TabPages
{
s.AddEntry(FriendlyName("SR.size"), sr.SizeString);
s.AddEntry(FriendlyName("SR.provisioning"), sr.IsThinProvisioned ? Messages.SR_THIN_PROVISIONING : Messages.SR_THICK_PROVISIONING);
if(sr.IsThinProvisioned && sr.sm_config.ContainsKey("initial_allocation") && sr.sm_config.ContainsKey("allocation_quantum"))
{
s.AddEntry(FriendlyName("SR.disk-space-allocations"),
Helpers.GetAllocationProperties(sr.sm_config["initial_allocation"], sr.sm_config["allocation_quantum"]));
}
}
if (sr.GetScsiID() != null)

View File

@ -2481,6 +2481,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Disk space allocations.
/// </summary>
public static string Label_SR_disk_space_allocations {
get {
return ResourceManager.GetString("Label-SR.disk-space-allocations", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Provisioning.
/// </summary>

View File

@ -1775,4 +1775,7 @@
<data name="Label-SR.provisioning" xml:space="preserve">
<value>Provisioning</value>
</data>
<data name="Label-SR.disk-space-allocations" xml:space="preserve">
<value>Disk space allocations</value>
</data>
</root>

View File

@ -30051,6 +30051,17 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Initial allocation: {0}
///
///Incremental allocation: {1}.
/// </summary>
public static string SR_DISK_SPACE_ALLOCATION {
get {
return ResourceManager.GetString("SR_DISK_SPACE_ALLOCATION", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to This SR does not need to be upgraded..
/// </summary>
@ -33744,7 +33755,7 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to {0:0} GB.
/// Looks up a localized string similar to {0:F1} GB.
/// </summary>
public static string VAL_GB_ONE_DECIMAL {
get {

View File

@ -10465,6 +10465,11 @@ Do you want to connect to the pool master '{1}'?</value>
<data name="SR_DETACHED" xml:space="preserve">
<value>The SR is currently detached.</value>
</data>
<data name="SR_DISK_SPACE_ALLOCATION" xml:space="preserve">
<value>Initial allocation: {0}
Incremental allocation: {1}</value>
</data>
<data name="SR_DOES_NOT_NEED_UPGRADE" xml:space="preserve">
<value>This SR does not need to be upgraded.</value>
</data>

View File

@ -49,10 +49,14 @@ namespace XenAdmin.Core
public static class Helpers
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private const long XLVHD_MIN_ALLOCATION_QUANTUM_DIVISOR = 50000;
private const long XLVHD_DEF_ALLOCATION_QUANTUM_DIVISOR = 10000;
private const long XLVHD_MAX_ALLOCATION_QUANTUM_DIVISOR = 4000;
private const long XLVHD_MIN_ALLOCATION_QUANTUM = 16777216; // 16 MB
public const int DEFAULT_NAME_TRIM_LENGTH = 50;
public const string GuiTempObjectPrefix = "__gui__";
public const int CUSTOM_BUILD_NUMBER = 6666;
@ -547,6 +551,77 @@ namespace XenAdmin.Core
return (p != null && !String.IsNullOrEmpty(p.wlb_url));
}
#region AllocationBoundsStructAndMethods
public struct AllocationBounds
{
public decimal min;
public decimal max;
public decimal defaultValue;
public AllocationBounds(decimal min, decimal max, decimal defaultValue)
{
this.min = min;
this.max = max;
this.defaultValue = defaultValue;
}
public string SuitableUnits()
{
if (defaultValue >= Util.BINARY_GIGA)
{
defaultValue /= Util.BINARY_GIGA;
min /= Util.BINARY_GIGA;
max /= Util.BINARY_GIGA;
return Messages.VAL_GIGB;
}
else
{
defaultValue /= Util.BINARY_MEGA;
min /= Util.BINARY_MEGA;
max /= Util.BINARY_MEGA;
return Messages.VAL_MEGB;
}
}
}
public static AllocationBounds SRIncrementalAllocationBounds(long SRSize)
{
decimal min = Math.Max(SRSize / XLVHD_MIN_ALLOCATION_QUANTUM_DIVISOR , XLVHD_MIN_ALLOCATION_QUANTUM);
decimal max = SRSize / XLVHD_MAX_ALLOCATION_QUANTUM_DIVISOR;
decimal defaultValue = Math.Max(SRSize / XLVHD_DEF_ALLOCATION_QUANTUM_DIVISOR, min);
return new AllocationBounds(min, max, defaultValue);
}
public static AllocationBounds VDIIncrementalAllocationBounds(long SRSize, long SRIncrAllocation)
{
decimal min = SRIncrAllocation;
decimal max = SRSize / XLVHD_MAX_ALLOCATION_QUANTUM_DIVISOR;
decimal defaultValue = SRIncrAllocation;
return new AllocationBounds(min, max, defaultValue);
}
public static AllocationBounds SRInitialAllocation(long SRSize)
{
decimal min = 0;
decimal max = SRSize;
decimal defaultValue = 0;
return new AllocationBounds(min, max, defaultValue);
}
public static AllocationBounds VDIInitialAllocation(long VDISize, long SRInitialAllocation)
{
decimal min = 0;
decimal max = VDISize;
decimal defaultValue = Math.Min(SRInitialAllocation, max);
return new AllocationBounds(min, max, defaultValue);
}
#endregion
/// <summary>
/// Determines whether two lists contain the same elements (but not necessarily in the same order).
/// Compares list elements using reference equality.
@ -759,6 +834,13 @@ namespace XenAdmin.Core
string.Format(Messages.GENERAL_CPU_SPEED, cpu.speed));
}
public static string GetAllocationProperties(string initial_allocation, string quantum_allocation)
{
return string.Format(Messages.SR_DISK_SPACE_ALLOCATION,
Util.MemorySizeStringSuitableUnits(Convert.ToDouble(initial_allocation) * Util.BINARY_MEGA, true),
Util.MemorySizeStringSuitableUnits(Convert.ToDouble(quantum_allocation) * Util.BINARY_MEGA, true));
}
public static string GetHostRestrictions(Host host)
{
string output = "";