CP-32431: Remove the CPU feature compatibility check from XenCenter

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2019-11-11 16:32:24 +00:00 committed by Konstantina Chremmou
parent e56a6e5d66
commit b73f5c9beb
4 changed files with 9 additions and 15 deletions

View File

@ -82,7 +82,7 @@ namespace XenAdmin.Commands
}
}
if (targetHost != draggedVMHome && VMOperationHostCommand.VmCpuFeaturesIncompatibleWithHost(targetHost, draggedVM))
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,7 +132,7 @@ namespace XenAdmin.Commands
if (draggedVM.allowed_operations == null || !draggedVM.allowed_operations.Contains(vm_operations.migrate_send))
return false;
if (VMOperationHostCommand.VmCpuFeaturesIncompatibleWithHost(targetHost, draggedVM))
if (VMOperationHostCommand.VmCpuIncompatibleWithHost(targetHost, draggedVM))
{
// target host does not offer some of the CPU features that the VM currently sees
return false;

View File

@ -91,7 +91,7 @@ namespace XenAdmin.Commands
}
}
if (targetHost != draggedVMHome && VMOperationHostCommand.VmCpuFeaturesIncompatibleWithHost(targetHost, draggedVM))
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,7 +181,7 @@ namespace XenAdmin.Commands
return false;
}
if (VMOperationHostCommand.VmCpuFeaturesIncompatibleWithHost(targetHost, draggedVM))
if (VMOperationHostCommand.VmCpuIncompatibleWithHost(targetHost, draggedVM))
{
// target host does not offer some of the CPU features that the VM currently sees
return false;

View File

@ -252,7 +252,7 @@ namespace XenAdmin.Commands
foreach (Host host in connection.Cache.Hosts)
{
reasons[host] = string.Empty;
if (!isStart && VMOperationHostCommand.VmCpuFeaturesIncompatibleWithHost(host, vm))
if (!isStart && VMOperationHostCommand.VmCpuIncompatibleWithHost(host, vm))
{
reasons[host] = FriendlyErrorNames.VM_INCOMPATIBLE_WITH_THIS_HOST;
continue;

View File

@ -125,7 +125,7 @@ namespace XenAdmin.Commands
if (vm.power_state == vm_power_state.Running && residentHost != null && host.opaque_ref == residentHost.opaque_ref)
return Messages.HOST_MENU_CURRENT_SERVER;
if ((operation == vm_operations.pool_migrate || operation == vm_operations.resume_on) && VmCpuFeaturesIncompatibleWithHost(host, vm))
if ((operation == vm_operations.pool_migrate || operation == vm_operations.resume_on) && VmCpuIncompatibleWithHost(host, vm))
{
return FriendlyErrorNames.VM_INCOMPATIBLE_WITH_THIS_HOST;
}
@ -168,9 +168,9 @@ namespace XenAdmin.Commands
return base.GetCantExecuteReasonCore(item);
}
public static bool VmCpuFeaturesIncompatibleWithHost(Host targetHost, VM vm)
public static bool VmCpuIncompatibleWithHost(Host targetHost, VM vm)
{
// check the CPU feature compatibility for Dundee and higher hosts
// check the CPU compatibility for Dundee and higher hosts
if (!Helpers.DundeeOrGreater(targetHost))
return false;
@ -185,19 +185,13 @@ namespace XenAdmin.Commands
if (vm.power_state != vm_power_state.Running && vm.power_state != vm_power_state.Suspended)
return false;
if (vm.last_boot_CPU_flags == null || !vm.last_boot_CPU_flags.ContainsKey("vendor") || !vm.last_boot_CPU_flags.ContainsKey("features")
if (vm.last_boot_CPU_flags == null || !vm.last_boot_CPU_flags.ContainsKey("vendor")
|| targetHost.cpu_info == null || !targetHost.cpu_info.ContainsKey("vendor"))
return false;
if (vm.last_boot_CPU_flags["vendor"] != targetHost.cpu_info["vendor"])
return true;
if (vm.IsHVM() && targetHost.cpu_info.ContainsKey("features_hvm"))
return PoolJoinRules.FewerFeatures(targetHost.cpu_info["features_hvm"], vm.last_boot_CPU_flags["features"]);
if (!vm.IsHVM() && targetHost.cpu_info.ContainsKey("features_pv"))
return PoolJoinRules.FewerFeatures(targetHost.cpu_info["features_pv"], vm.last_boot_CPU_flags["features"]);
return false;
}
}