CAR-2146: Added new column for Quiesce support

Signed-off-by: Koushik Chakravarty <Koushik.Chakravarty@citrix.com>
This commit is contained in:
Koushik Chakravarty 2016-01-28 10:30:23 +05:30
parent 034063a708
commit f3d8941b81
5 changed files with 105 additions and 112 deletions

View File

@ -177,6 +177,7 @@ namespace XenAdmin.Wizards.GenericPages
private DataGridViewTextBoxCell _nameCell = new DataGridViewTextBoxCell();
private DataGridViewTextBoxCell _descriptionCell = new DataGridViewTextBoxCell();
private DataGridViewTextBoxCell _currentGroupCell = new DataGridViewTextBoxCell();
private DataGridViewTextBoxCell _quiesce_supported;
public readonly VM Vm;
public VMDataGridViewRow(bool selected, VM vm)
{
@ -185,6 +186,11 @@ namespace XenAdmin.Wizards.GenericPages
Cells.Add(_nameCell);
Cells.Add(_descriptionCell);
Cells.Add(_currentGroupCell);
if(typeof(T) == typeof(VMSS))
{
_quiesce_supported = new DataGridViewTextBoxCell();
Cells.Add(_quiesce_supported);
}
Refresh(selected);
}
@ -195,12 +201,27 @@ namespace XenAdmin.Wizards.GenericPages
_descriptionCell.Value = Vm.Description;
T group = Vm.Connection.Resolve(VMGroup<T>.VmToGroup(Vm));
_currentGroupCell.Value = group == null ? Messages.NONE : group.Name;
if(typeof(T) == typeof(VMSS))
{
if (Vm.allowed_operations.Contains((vm_operations.snapshot_with_quiesce)) && !Helpers.FeatureForbidden(Vm, Host.RestrictVss))
{
_quiesce_supported.Value = Messages.YES;
}
else
{
_quiesce_supported.Value = Messages.NO;
}
}
}
}
public override void PageLoaded(PageLoadedDirection direction)
{
base.PageLoaded(direction);
if(typeof(T) == typeof(VMPP))
{
this.dataGridView1.Columns["ColumnQuiesceSupported"].Visible = false;
}
RefreshTab(null);
}

View File

@ -41,6 +41,7 @@
this.ColumnName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnDescription = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnCurrentGroup = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnQuiesceSupported = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
@ -80,12 +81,13 @@
this.ColumnCheckBox,
this.ColumnName,
this.ColumnDescription,
this.ColumnCurrentGroup});
this.ColumnCurrentGroup,
this.ColumnQuiesceSupported});
this.tableLayoutPanel1.SetColumnSpan(this.dataGridView1, 3);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
this.dataGridView1.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellValueChanged);
this.dataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellClick);
this.dataGridView1.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellValueChanged);
this.dataGridView1.RowStateChanged += new System.Windows.Forms.DataGridViewRowStateChangedEventHandler(this.dataGridView1_RowStateChanged);
//
// searchTextBox1
@ -142,6 +144,13 @@
this.ColumnCurrentGroup.Name = "ColumnCurrentGroup";
this.ColumnCurrentGroup.ReadOnly = true;
//
// ColumnQuiesceSupported
//
this.ColumnQuiesceSupported.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
resources.ApplyResources(this.ColumnQuiesceSupported, "ColumnQuiesceSupported");
this.ColumnQuiesceSupported.Name = "ColumnQuiesceSupported";
this.ColumnQuiesceSupported.ReadOnly = true;
//
// NewVMGroupVMsPageBase
//
resources.ApplyResources(this, "$this");
@ -169,5 +178,6 @@
protected System.Windows.Forms.DataGridViewTextBoxColumn ColumnName;
protected System.Windows.Forms.DataGridViewTextBoxColumn ColumnDescription;
protected System.Windows.Forms.DataGridViewTextBoxColumn ColumnCurrentGroup;
protected System.Windows.Forms.DataGridViewTextBoxColumn ColumnQuiesceSupported;
}
}

View File

@ -112,20 +112,20 @@
<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="labelCounterVMs.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="labelCounterVMs.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="labelCounterVMs.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 318</value>
</data>
@ -148,7 +148,7 @@
<value>labelCounterVMs</value>
</data>
<data name="&gt;&gt;labelCounterVMs.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;labelCounterVMs.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
@ -178,7 +178,7 @@
<value>buttonSelectAll</value>
</data>
<data name="&gt;&gt;buttonSelectAll.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;buttonSelectAll.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
@ -208,7 +208,7 @@
<value>buttonClearAll</value>
</data>
<data name="&gt;&gt;buttonClearAll.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;buttonClearAll.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
@ -250,7 +250,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>tableLayoutPanel1</value>
@ -261,7 +261,7 @@
<data name="dataGridView1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Bottom, Left, Right</value>
</data>
<metadata name="ColumnCheckBox.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="ColumnCheckBox.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="ColumnCheckBox.HeaderText" xml:space="preserve">
@ -273,7 +273,7 @@
<data name="ColumnCheckBox.Width" type="System.Int32, mscorlib">
<value>20</value>
</data>
<metadata name="ColumnName.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="ColumnName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="ColumnName.HeaderText" xml:space="preserve">
@ -282,7 +282,7 @@
<data name="ColumnName.MinimumWidth" type="System.Int32, mscorlib">
<value>50</value>
</data>
<metadata name="ColumnDescription.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="ColumnDescription.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="ColumnDescription.HeaderText" xml:space="preserve">
@ -291,7 +291,7 @@
<data name="ColumnDescription.MinimumWidth" type="System.Int32, mscorlib">
<value>90</value>
</data>
<metadata name="ColumnCurrentGroup.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="ColumnCurrentGroup.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="ColumnCurrentGroup.HeaderText" xml:space="preserve">
@ -300,6 +300,15 @@
<data name="ColumnCurrentGroup.MinimumWidth" type="System.Int32, mscorlib">
<value>120</value>
</data>
<metadata name="ColumnQuiesceSupported.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="ColumnQuiesceSupported.HeaderText" xml:space="preserve">
<value>Quiescing Supported</value>
</data>
<data name="ColumnQuiesceSupported.MinimumWidth" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="tableLayoutPanel1.ColumnCount" type="System.Int32, mscorlib">
<value>3</value>
</data>
@ -334,7 +343,7 @@
<value>label2</value>
</data>
<data name="&gt;&gt;label2.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;label2.Parent" xml:space="preserve">
<value>tableLayoutPanel1</value>
@ -391,7 +400,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>
@ -423,7 +432,7 @@
<data name="&gt;&gt;dataGridView1.ZOrder" xml:space="preserve">
<value>4</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">
@ -436,25 +445,31 @@
<value>ColumnCheckBox</value>
</data>
<data name="&gt;&gt;ColumnCheckBox.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewCheckBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.DataGridViewCheckBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;ColumnName.Name" xml:space="preserve">
<value>ColumnName</value>
</data>
<data name="&gt;&gt;ColumnName.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;ColumnDescription.Name" xml:space="preserve">
<value>ColumnDescription</value>
</data>
<data name="&gt;&gt;ColumnDescription.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;ColumnCurrentGroup.Name" xml:space="preserve">
<value>ColumnCurrentGroup</value>
</data>
<data name="&gt;&gt;ColumnCurrentGroup.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;ColumnQuiesceSupported.Name" xml:space="preserve">
<value>ColumnQuiesceSupported</value>
</data>
<data name="&gt;&gt;ColumnQuiesceSupported.Type" xml:space="preserve">
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>NewVMGroupVMsPageBase</value>

View File

@ -50,7 +50,7 @@ namespace XenAdmin.Wizards.NewPolicyWizard
// http://connect.microsoft.com/VisualStudio/feedback/details/115397/component-resource-manager-doesnt-work-with-generic-form-classes
// (or search on Google for [ComponentResourceManager generic]).
public partial class NewPolicySnapshotTypePage : XenTabPage, IEditPage
public abstract partial class NewPolicySnapshotTypePage : XenTabPage, IEditPage
{
protected List<VM> _selectedVMs;
public List<VM> SelectedVMs
@ -61,10 +61,11 @@ namespace XenAdmin.Wizards.NewPolicyWizard
_selectedVMs = value;
}
}
protected virtual void doSave() { }
protected virtual bool doHasChanged() { return true; }
protected virtual void doSetXenObjects(IXenObject orig, IXenObject clone) { }
protected virtual string doGetSubText() { return null; }
public abstract AsyncAction SaveSettings();
public abstract string SubText { get; }
public abstract bool HasChanged { get; }
public abstract void SetXenObjects(IXenObject orig, IXenObject clone);
public NewPolicySnapshotTypePage()
{
@ -77,56 +78,6 @@ namespace XenAdmin.Wizards.NewPolicyWizard
SelectedVMs = selectedVMS;
}
public AsyncAction SaveSettings()
{
this.doSave();
return null;
}
/*
public override string Text
{
get
{
return Messages.SNAPSHOT_TYPE;
}
}
public override string HelpID
{
get { return "Snapshottype"; }
}
public override string PageTitle
{
get
{
return Messages.SNAPSHOT_TYPE_TITLE;
}
}
public override void PageLoaded(PageLoadedDirection direction)
{
base.PageLoaded(direction);
if (direction == PageLoadedDirection.Forward)
EnableShapshotTypes(Connection);
}
private void EnableShapshotTypes(IXenConnection connection)
{
radioButtonDiskAndMemory.Enabled = label3.Enabled = !Helpers.FeatureForbidden(connection, Host.RestrictCheckpoint);
checkpointInfoPictureBox.Visible = !radioButtonDiskAndMemory.Enabled;
pictureBoxWarning.Visible = labelWarning.Visible = radioButtonDiskAndMemory.Enabled;
}
*/
public string SubText
{
get { return doGetSubText(); }
}
public Image Image
{
get { return Properties.Resources._000_VMSession_h32bit_16; }
@ -147,16 +98,6 @@ namespace XenAdmin.Wizards.NewPolicyWizard
radioButtonDiskOnly.Checked = true;
}
public bool HasChanged
{
get { return doHasChanged(); }
}
public void SetXenObjects(IXenObject orig, IXenObject clone)
{
doSetXenObjects(orig, clone);
}
private void checkpointInfoPictureBox_Click(object sender, System.EventArgs e)
{
toolTip.Show(Messages.FIELD_DISABLED, checkpointInfoPictureBox, 20, 0);

View File

@ -82,28 +82,29 @@ namespace XenAdmin.Wizards.NewPolicyWizard
}
protected override string doGetSubText()
public override string SubText
{
if (typeof(T) == typeof(VMPP))
get
{
if (BackupType == vmpp_backup_type.snapshot)
return Messages.DISKS_ONLY;
if (typeof(T) == typeof(VMPP))
{
if (BackupType == vmpp_backup_type.snapshot)
return Messages.DISKS_ONLY;
else
{
return Messages.DISKS_AND_MEMORY;
}
}
else
{
return Messages.DISKS_AND_MEMORY;
if (BackupTypeVMSS == vmss_backup_type.snapshot)
return Messages.DISKS_ONLY;
else if (BackupTypeVMSS == vmss_backup_type.snapshot_with_quiesce)
return Messages.QUIESCED_SNAPSHOTS;
else
return Messages.DISKS_AND_MEMORY;
}
}
else
{
if (BackupTypeVMSS == vmss_backup_type.snapshot)
return Messages.DISKS_ONLY;
else if (BackupTypeVMSS == vmss_backup_type.snapshot_with_quiesce)
return Messages.QUIESCED_SNAPSHOTS;
else
return Messages.DISKS_AND_MEMORY;
}
}
@ -206,7 +207,6 @@ namespace XenAdmin.Wizards.NewPolicyWizard
if (typeof(T) == typeof(VMSS))
{
this.quiesceCheckBox.Visible = true;
this.pictureBoxVSS.Visible = !this.quiesceCheckBox.Enabled;
if (this._selectedVMs != null)
{
foreach (VM vm in this._selectedVMs)
@ -222,6 +222,7 @@ namespace XenAdmin.Wizards.NewPolicyWizard
{
this.quiesceCheckBox.Enabled = false;
}
this.pictureBoxVSS.Visible = !this.quiesceCheckBox.Enabled;
}
else
{
@ -231,18 +232,20 @@ namespace XenAdmin.Wizards.NewPolicyWizard
}
protected override void doSave()
public override AsyncAction SaveSettings()
{
if (typeof(T) == typeof(VMPP))
_clone.backup_type = BackupType;
else
_cloneVMSS.backup_type = BackupTypeVMSS;
return null;
}
private VMPP _clone;
private VMSS _cloneVMSS;
protected override void doSetXenObjects(IXenObject orig, IXenObject clone)
public override void SetXenObjects(IXenObject orig, IXenObject clone)
{
if (typeof(T) == typeof(VMPP))
{
@ -256,12 +259,15 @@ namespace XenAdmin.Wizards.NewPolicyWizard
}
}
protected override bool doHasChanged()
public override bool HasChanged
{
if (typeof(T) == typeof (VMPP))
return BackupType != _clone.backup_type;
else
return BackupTypeVMSS != _cloneVMSS.backup_type;
get
{
if (typeof(T) == typeof(VMPP))
return BackupType != _clone.backup_type;
else
return BackupTypeVMSS != _cloneVMSS.backup_type;
}
}