Fixed regression whereby the vm-host mapping was lost when proceeding to the next page and returning to the destination selection page.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2018-05-29 17:56:05 +01:00 committed by Mihaela Stoica
parent 355621f183
commit 621fce4d70
3 changed files with 40 additions and 39 deletions

View File

@ -64,11 +64,6 @@ namespace XenAdmin.Wizards.CrossPoolMigrateWizard
InitializeText();
}
protected override void PageLoadedCore(PageLoadedDirection direction)
{
PopulateComboBox();
}
public override bool EnableNext()
{
return DestinationHasBeenSelected() && base.EnableNext();

View File

@ -52,12 +52,14 @@ namespace XenAdmin.Wizards.GenericPages
private Dictionary<string, VmMapping> m_vmMappings;
private IXenObject m_selectedObject;
private bool updatingDestinationCombobox;
private bool restoreGridHomeServerSelection;
private bool updatingHomeServerList;
private bool m_buttonNextEnabled;
protected List<IXenConnection> ignoredConnections = new List<IXenConnection>();
private readonly CollectionChangeEventHandler Host_CollectionChangedWithInvoke;
/// <summary>
/// Combobox item that can executes a command but also be an IEnableableComboBoxItem
/// Combobox item that can execute a command but also be an IEnableableComboBoxItem
/// </summary>
private class AddHostExecutingComboBoxItem : IEnableableComboBoxItem
{
@ -171,7 +173,8 @@ namespace XenAdmin.Wizards.GenericPages
protected override void PageLoadedCore(PageLoadedDirection direction)
{
ChosenItem = null;
restoreGridHomeServerSelection = (direction == PageLoadedDirection.Back);
restoreGridHomeServerSelection = direction == PageLoadedDirection.Back;
PopulateComboBox();
}
public override void SelectDefaultControl()
@ -262,7 +265,7 @@ namespace XenAdmin.Wizards.GenericPages
m_dataGridView.Refresh();
}
protected void PopulateComboBox()
private void PopulateComboBox()
{
Program.AssertOnEventThread();
@ -333,8 +336,6 @@ namespace XenAdmin.Wizards.GenericPages
return false;
}
private bool restoreGridHomeServerSelection;
private void RestoreGridHomeServerSelectionFromMapping()
{
foreach (DataGridViewRow row in m_dataGridView.Rows)
@ -356,9 +357,7 @@ namespace XenAdmin.Wizards.GenericPages
}
}
}
private bool updatingHomeServerList;
private void PopulateDataGridView(IEnableableXenObjectComboBoxItem selectedItem)
{
Program.AssertOnEventThread();

View File

@ -48,13 +48,18 @@ namespace XenAdmin.Wizards.ImportWizard
{
class ImportSelectHostPage : SelectMultipleVMDestinationPage
{
public EnvelopeType SelectedOvfEnvelope { private get; set; }
private EnvelopeType _selectedOvfEnvelope;
private List<Xen_ConfigurationSettingData_Type> vgpuSettings = new List<Xen_ConfigurationSettingData_Type>();
private List<Xen_ConfigurationSettingData_Type> hardwarePlatformSettings = new List<Xen_ConfigurationSettingData_Type>();
private List<Xen_ConfigurationSettingData_Type> vendorDeviceSettings = new List<Xen_ConfigurationSettingData_Type>();
public event Action<IXenConnection> ConnectionSelectionChanged;
public ImportSelectHostPage()
{
ShowWarning(null);
}
#region XenTabPage overrides
/// <summary>
@ -72,43 +77,45 @@ namespace XenAdmin.Wizards.ImportWizard
return true;
}
protected override void PageLoadedCore(PageLoadedDirection direction)
{
if (direction == PageLoadedDirection.Forward)
{
ShowWarning(null);
#endregion
public EnvelopeType SelectedOvfEnvelope
{
private get
{
return _selectedOvfEnvelope;
}
set
{
_selectedOvfEnvelope = value;
vgpuSettings.Clear();
hardwarePlatformSettings.Clear();
vendorDeviceSettings.Clear();
if (SelectedOvfEnvelope != null)
if (_selectedOvfEnvelope == null)
return;
foreach (var vsType in ((VirtualSystemCollection_Type)SelectedOvfEnvelope.Item).Content)
{
foreach (var vsType in ((VirtualSystemCollection_Type)SelectedOvfEnvelope.Item).Content)
{
var vhs = OVF.FindVirtualHardwareSectionByAffinity(SelectedOvfEnvelope, vsType.id, "xen");
var data = vhs.VirtualSystemOtherConfigurationData;
if (data == null)
continue;
var vhs = OVF.FindVirtualHardwareSectionByAffinity(SelectedOvfEnvelope, vsType.id, "xen");
var data = vhs.VirtualSystemOtherConfigurationData;
if (data == null)
continue;
foreach (var s in data)
{
if (s.Name == "vgpu")
vgpuSettings.Add(s);
else if (s.Name == "hardware_platform_version")
hardwarePlatformSettings.Add(s);
else if (s.Name == "VM_has_vendor_device")
vendorDeviceSettings.Add(s);
}
foreach (var s in data)
{
if (s.Name == "vgpu")
vgpuSettings.Add(s);
else if (s.Name == "hardware_platform_version")
hardwarePlatformSettings.Add(s);
else if (s.Name == "VM_has_vendor_device")
vendorDeviceSettings.Add(s);
}
}
}
PopulateComboBox();
}
#endregion
protected override string InstructionText { get { return Messages.IMPORT_WIZARD_DESTINATION_INSTRUCTIONS; } }
protected override string TargetServerText { get { return Messages.IMPORT_WIZARD_DESTINATION_DESTINATION; } }