mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CA-280329: Fix CrossPoolMigrateDestinationPage with Current Server showing (#1931)
* CA-280329: Fix CrossPoolMigrateDestinationPage with Current Server showing Signed-off-by: Kun Ma <kun.ma@citrix.com> * CA-280329: Refine usage of CreateTargetServerFilterList Signed-off-by: Kun Ma <kun.ma@citrix.com>
This commit is contained in:
parent
95471eaac5
commit
f0f37d9690
14
XenAdmin/Wizards/CrossPoolMigrateWizard/CrossPoolMigrateDestinationPage.cs
Normal file → Executable file
14
XenAdmin/Wizards/CrossPoolMigrateWizard/CrossPoolMigrateDestinationPage.cs
Normal file → Executable file
@ -148,15 +148,19 @@ namespace XenAdmin.Wizards.CrossPoolMigrateWizard
|
||||
return new DelayLoadingOptionComboBoxItem(xenItem, filters);
|
||||
}
|
||||
|
||||
protected override List<ReasoningFilter> CreateTargetServerFilterList(IEnableableXenObjectComboBoxItem selectedItem)
|
||||
protected override List<ReasoningFilter> CreateTargetServerFilterList(IEnableableXenObjectComboBoxItem selectedItem, List<string> vmOpaqueRefs)
|
||||
{
|
||||
var filters = new List<ReasoningFilter>();
|
||||
|
||||
if(selectedItem != null)
|
||||
if(selectedItem != null && vmOpaqueRefs != null && selectedVMs != null)
|
||||
{
|
||||
filters.Add(new ResidentHostIsSameAsSelectionFilter(selectedItem.Item, selectedVMs));
|
||||
filters.Add(new CrossPoolMigrateCanMigrateFilter(selectedItem.Item, selectedVMs, wizardMode));
|
||||
filters.Add(new WlbEnabledFilter(selectedItem.Item, selectedVMs));
|
||||
List<VM> vmList = new List<VM>();
|
||||
foreach (string opaqueRef in vmOpaqueRefs)
|
||||
vmList.Add(selectedVMs.Find(vm => vm.opaque_ref == opaqueRef));
|
||||
|
||||
filters.Add(new ResidentHostIsSameAsSelectionFilter(selectedItem.Item, vmList));
|
||||
filters.Add(new CrossPoolMigrateCanMigrateFilter(selectedItem.Item, vmList, wizardMode));
|
||||
filters.Add(new WlbEnabledFilter(selectedItem.Item, vmList));
|
||||
}
|
||||
|
||||
return filters;
|
||||
|
14
XenAdmin/Wizards/GenericPages/SelectMultipleVMDestinationPage.cs
Normal file → Executable file
14
XenAdmin/Wizards/GenericPages/SelectMultipleVMDestinationPage.cs
Normal file → Executable file
@ -360,7 +360,7 @@ namespace XenAdmin.Wizards.GenericPages
|
||||
|
||||
private bool updatingHomeServerList;
|
||||
|
||||
private void PopulateDataGridView(List<ReasoningFilter> homeserverFilters)
|
||||
private void PopulateDataGridView(IEnableableXenObjectComboBoxItem selectedItem)
|
||||
{
|
||||
Program.AssertOnEventThread();
|
||||
|
||||
@ -383,6 +383,9 @@ namespace XenAdmin.Wizards.GenericPages
|
||||
{
|
||||
var tb = new DataGridViewTextBoxCell {Value = kvp.Value.VmNameLabel, Tag = kvp.Key};
|
||||
var cb = new DataGridViewEnableableComboBoxCell{FlatStyle = FlatStyle.Flat};
|
||||
List<ReasoningFilter> homeserverFilters = CreateTargetServerFilterList(
|
||||
selectedItem,
|
||||
new List<String> { kvp.Key });
|
||||
|
||||
if (Connection != null)
|
||||
{
|
||||
@ -407,8 +410,8 @@ namespace XenAdmin.Wizards.GenericPages
|
||||
item.LoadAndWait();
|
||||
cb.Items.Add(item);
|
||||
|
||||
if ((m_selectedObject != null && m_selectedObject.opaque_ref == host.opaque_ref) ||
|
||||
(target != null && target.Item.opaque_ref == host.opaque_ref))
|
||||
if (item.Enabled && ((m_selectedObject != null && m_selectedObject.opaque_ref == host.opaque_ref) ||
|
||||
(target != null && target.Item.opaque_ref == host.opaque_ref)))
|
||||
cb.Value = item;
|
||||
}
|
||||
}
|
||||
@ -570,7 +573,7 @@ namespace XenAdmin.Wizards.GenericPages
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
ChosenItem = item == null ? null : item.Item;
|
||||
Program.Invoke(Program.MainWindow, ()=> PopulateDataGridView(CreateTargetServerFilterList(item)));
|
||||
Program.Invoke(Program.MainWindow, ()=> PopulateDataGridView(item));
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -585,8 +588,9 @@ namespace XenAdmin.Wizards.GenericPages
|
||||
/// Create a set of filters for the homeserver combo box selection
|
||||
/// </summary>
|
||||
/// <param name="item">selected item from the host combobox</param>
|
||||
/// <param name="vmOpaqueRefs">OpaqRefs of VMs which need to apply those filters</param>
|
||||
/// <returns></returns>
|
||||
protected virtual List<ReasoningFilter> CreateTargetServerFilterList(IEnableableXenObjectComboBoxItem item)
|
||||
protected virtual List<ReasoningFilter> CreateTargetServerFilterList(IEnableableXenObjectComboBoxItem item, List<string> vmOpaqueRefs)
|
||||
{
|
||||
return new List<ReasoningFilter>();
|
||||
}
|
||||
|
2
XenAdmin/Wizards/ImportWizard/ImportSelectHostPage.cs
Normal file → Executable file
2
XenAdmin/Wizards/ImportWizard/ImportSelectHostPage.cs
Normal file → Executable file
@ -157,7 +157,7 @@ namespace XenAdmin.Wizards.ImportWizard
|
||||
return new DelayLoadingOptionComboBoxItem(xenItem, filters);
|
||||
}
|
||||
|
||||
protected override List<ReasoningFilter> CreateTargetServerFilterList(IEnableableXenObjectComboBoxItem item)
|
||||
protected override List<ReasoningFilter> CreateTargetServerFilterList(IEnableableXenObjectComboBoxItem item, List<string> vmOpaqueRefs)
|
||||
{
|
||||
var filters = new List<ReasoningFilter>();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user