mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-12-23 08:56:02 +01:00
Merge pull request #1077 from geosharath/VMSS
CA-213498: [VMSS] XC create new VMSS Policy wizard disables "quiesce" option when no VMs are selected in policy
This commit is contained in:
commit
d1c114d7be
@ -95,7 +95,7 @@ namespace XenAdmin.Wizards.NewPolicyWizard
|
|||||||
{
|
{
|
||||||
base.PageLoaded(direction);
|
base.PageLoaded(direction);
|
||||||
if (direction == PageLoadedDirection.Forward)
|
if (direction == PageLoadedDirection.Forward)
|
||||||
EnableShapshotTypes(Connection);
|
EnableShapshotTypes(Connection, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Image Image
|
public override Image Image
|
||||||
@ -166,6 +166,12 @@ namespace XenAdmin.Wizards.NewPolicyWizard
|
|||||||
|
|
||||||
private void RefreshTab(IVMPolicy policy)
|
private void RefreshTab(IVMPolicy policy)
|
||||||
{
|
{
|
||||||
|
/* when a policy does not have any VMs, irrespective of
|
||||||
|
* the snapshot type, enable Quiesce
|
||||||
|
*/
|
||||||
|
|
||||||
|
quiesceCheckBox.Enabled = (policy.VMs.Count == 0);
|
||||||
|
|
||||||
switch (policy.policy_type)
|
switch (policy.policy_type)
|
||||||
{
|
{
|
||||||
case policy_backup_type.checkpoint:
|
case policy_backup_type.checkpoint:
|
||||||
@ -174,18 +180,22 @@ namespace XenAdmin.Wizards.NewPolicyWizard
|
|||||||
break;
|
break;
|
||||||
case policy_backup_type.snapshot:
|
case policy_backup_type.snapshot:
|
||||||
radioButtonDiskOnly.Checked = true;
|
radioButtonDiskOnly.Checked = true;
|
||||||
quiesceCheckBox.Enabled = true;
|
|
||||||
break;
|
break;
|
||||||
case policy_backup_type.snapshot_with_quiesce:
|
case policy_backup_type.snapshot_with_quiesce:
|
||||||
radioButtonDiskOnly.Checked = true;
|
radioButtonDiskOnly.Checked = true;
|
||||||
|
|
||||||
|
/* when the snapshot type itself is quiesce then we need to
|
||||||
|
* enable it irrespective of the number of VMs ( > 1 condition)
|
||||||
|
*/
|
||||||
|
|
||||||
quiesceCheckBox.Enabled = true;
|
quiesceCheckBox.Enabled = true;
|
||||||
quiesceCheckBox.Checked = true;
|
quiesceCheckBox.Checked = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
EnableShapshotTypes(policy.Connection);
|
EnableShapshotTypes(policy.Connection, quiesceCheckBox.Enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EnableShapshotTypes(IXenConnection connection)
|
private void EnableShapshotTypes(IXenConnection connection, bool isQuiesceEnabled)
|
||||||
{
|
{
|
||||||
radioButtonDiskAndMemory.Enabled = label3.Enabled = !Helpers.FeatureForbidden(connection, Host.RestrictCheckpoint);
|
radioButtonDiskAndMemory.Enabled = label3.Enabled = !Helpers.FeatureForbidden(connection, Host.RestrictCheckpoint);
|
||||||
checkpointInfoPictureBox.Visible = !radioButtonDiskAndMemory.Enabled;
|
checkpointInfoPictureBox.Visible = !radioButtonDiskAndMemory.Enabled;
|
||||||
@ -195,21 +205,26 @@ namespace XenAdmin.Wizards.NewPolicyWizard
|
|||||||
if (VMGroup<T>.isQuescingSupported)
|
if (VMGroup<T>.isQuescingSupported)
|
||||||
{
|
{
|
||||||
this.quiesceCheckBox.Visible = true;
|
this.quiesceCheckBox.Visible = true;
|
||||||
if (this._selectedVMs != null && this._selectedVMs.Count > 0)
|
if (this._selectedVMs != null)
|
||||||
{
|
{
|
||||||
foreach (VM vm in this._selectedVMs)
|
if (this._selectedVMs.Count > 0)
|
||||||
{
|
{
|
||||||
if (!vm.allowed_operations.Contains(vm_operations.snapshot_with_quiesce) || Helpers.FeatureForbidden(vm, Host.RestrictVss))
|
foreach (VM vm in this._selectedVMs)
|
||||||
{
|
{
|
||||||
this.quiesceCheckBox.Enabled = false;
|
if (!vm.allowed_operations.Contains(vm_operations.snapshot_with_quiesce) || Helpers.FeatureForbidden(vm, Host.RestrictVss))
|
||||||
break;
|
{
|
||||||
|
this.quiesceCheckBox.Enabled = false;
|
||||||
|
this.quiesceCheckBox.Checked = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else /* we enter this block only when we are editing a policy, in that case the decision has already been taken in RefreshTab function */
|
||||||
{
|
{
|
||||||
if (!this.quiesceCheckBox.Checked)
|
this.quiesceCheckBox.Enabled = isQuiesceEnabled;
|
||||||
this.quiesceCheckBox.Enabled = false;
|
|
||||||
}
|
}
|
||||||
this.pictureBoxVSS.Visible = !this.quiesceCheckBox.Enabled;
|
this.pictureBoxVSS.Visible = !this.quiesceCheckBox.Enabled;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user