mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
CP-32431: Add version check to the drag and drop commands
Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
parent
c1dc88a203
commit
aca8be2939
@ -29,19 +29,13 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using XenAdmin.Controls;
|
||||
using XenAPI;
|
||||
using XenAdmin.Core;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Forms;
|
||||
using XenAdmin.Actions;
|
||||
using XenAdmin.Dialogs;
|
||||
using System.Drawing;
|
||||
using XenAdmin.Actions.VMActions;
|
||||
|
||||
|
||||
namespace XenAdmin.Commands
|
||||
@ -66,7 +60,6 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
foreach (VM draggedVM in GetDraggedItemsAsXenObjects<VM>())
|
||||
{
|
||||
Pool draggedVMPool = Helpers.GetPool(draggedVM.Connection);
|
||||
Host draggedVMHome = draggedVM.Home();
|
||||
|
||||
if(!LiveMigrateAllowedInVersion(targetHost, draggedVM))
|
||||
@ -81,12 +74,12 @@ namespace XenAdmin.Commands
|
||||
return Messages.MIGRATION_NOT_ALLOWED_NO_SHARED_STORAGE;
|
||||
}
|
||||
}
|
||||
|
||||
if (Helpers.productVersionCompare(Helpers.HostProductVersion(targetHost), Helpers.HostProductVersion(draggedVMHome ?? Helpers.GetMaster(draggedVM.Connection))) < 0)
|
||||
return Messages.OLDER_THAN_CURRENT_SERVER;
|
||||
|
||||
if (targetHost != draggedVMHome && VMOperationHostCommand.VmCpuIncompatibleWithHost(targetHost, draggedVM))
|
||||
{
|
||||
// target host does not offer some of the CPU features that the VM currently sees
|
||||
return Messages.MIGRATION_NOT_ALLOWED_CPU_FEATURES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -132,11 +125,11 @@ namespace XenAdmin.Commands
|
||||
if (draggedVM.allowed_operations == null || !draggedVM.allowed_operations.Contains(vm_operations.migrate_send))
|
||||
return false;
|
||||
|
||||
if (VMOperationHostCommand.VmCpuIncompatibleWithHost(targetHost, draggedVM))
|
||||
{
|
||||
// target host does not offer some of the CPU features that the VM currently sees
|
||||
if (Helpers.productVersionCompare(Helpers.HostProductVersion(targetHost), Helpers.HostProductVersion(draggedVMHome ?? Helpers.GetMaster(draggedVM.Connection))) < 0)
|
||||
return false;
|
||||
|
||||
if (VMOperationHostCommand.VmCpuIncompatibleWithHost(targetHost, draggedVM))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -29,16 +29,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using XenAdmin.Controls;
|
||||
using XenAPI;
|
||||
using XenAdmin.Core;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Forms;
|
||||
using XenAdmin.Actions;
|
||||
using XenAdmin.Dialogs;
|
||||
using System.Drawing;
|
||||
using XenAdmin.Actions.VMActions;
|
||||
@ -91,11 +87,11 @@ namespace XenAdmin.Commands
|
||||
}
|
||||
}
|
||||
|
||||
if (Helpers.productVersionCompare(Helpers.HostProductVersion(targetHost), Helpers.HostProductVersion(draggedVMHome)) < 0)
|
||||
return Messages.OLDER_THAN_CURRENT_SERVER;
|
||||
|
||||
if (targetHost != draggedVMHome && VMOperationHostCommand.VmCpuIncompatibleWithHost(targetHost, draggedVM))
|
||||
{
|
||||
// target host does not offer some of the CPU features that the VM currently sees
|
||||
return Messages.MIGRATION_NOT_ALLOWED_CPU_FEATURES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -181,11 +177,11 @@ namespace XenAdmin.Commands
|
||||
return false;
|
||||
}
|
||||
|
||||
if (VMOperationHostCommand.VmCpuIncompatibleWithHost(targetHost, draggedVM))
|
||||
{
|
||||
// target host does not offer some of the CPU features that the VM currently sees
|
||||
if (Helpers.productVersionCompare(Helpers.HostProductVersion(targetHost), Helpers.HostProductVersion(draggedVMHome)) < 0)
|
||||
return false;
|
||||
|
||||
if (VMOperationHostCommand.VmCpuIncompatibleWithHost(targetHost, draggedVM))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user