Vitor de Lima has uploaded a new change for review. Change subject: core, engine: Avoid migration in ppc64 ......................................................................
core, engine: Avoid migration in ppc64 This patch forces every ppc64 VM to be pinned to a host and every ppc64 cluster to have the "Do not migrate" resilience policy. Change-Id: I4808f3e91ccf37462727a28d35f9f9faae1dfd6c Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1057178 Signed-off-by: Vitor de Lima <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommandTest.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVmCommandTest.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java M frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties M frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties 12 files changed, 91 insertions(+), 6 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/46/25046/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java index 6f5e667..7383524 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java @@ -6,8 +6,10 @@ import org.ovirt.engine.core.bll.utils.PermissionSubject; import org.ovirt.engine.core.bll.utils.VersionSupport; import org.ovirt.engine.core.common.AuditLogType; +import org.ovirt.engine.core.common.FeatureSupported; import org.ovirt.engine.core.common.VdcObjectType; import org.ovirt.engine.core.common.action.VdsGroupOperationParameters; +import org.ovirt.engine.core.common.businessentities.MigrateOnErrorOptions; import org.ovirt.engine.core.common.businessentities.StoragePool; import org.ovirt.engine.core.common.businessentities.network.Network; import org.ovirt.engine.core.common.businessentities.network.NetworkCluster; @@ -154,6 +156,11 @@ result = false; } + if (!FeatureSupported.isMigrationSupported(getArchitecture(), getVdsGroup().getcompatibility_version()) + && getVdsGroup().getMigrateOnError() != MigrateOnErrorOptions.NO) { + return failCanDoAction(VdcBllMessages.MIGRATION_ON_ERROR_IS_NOT_SUPPORTED); + } + if (result) { result = validateClusterPolicy(); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java index 5964183..e98d6d0 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java @@ -489,6 +489,11 @@ return false; } + if (!FeatureSupported.isMigrationSupported(getVdsGroup().getArchitecture(), getVdsGroup().getcompatibility_version()) + && vmFromParams.getMigrationSupport() != MigrationSupport.PINNED_TO_HOST) { + return failCanDoAction(VdcBllMessages.VM_MIGRATION_IS_NOT_SUPPORTED); + } + // check cpuPinning if the check haven't failed yet if (!isCpuPinningValid(vmFromParams.getCpuPinning(), vmFromParams.getStaticData())) { return false; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java index 56c5cb0..39f63b3 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java @@ -305,6 +305,10 @@ return false; } + if (!FeatureSupported.isMigrationSupported(getVdsGroup().getArchitecture(), getVdsGroup().getcompatibility_version())) { + return failCanDoAction(VdcBllMessages.MIGRATION_IS_NOT_SUPPORTED); + } + // If VM is pinned to host, no migration can occur if (vm.getMigrationSupport() == MigrationSupport.PINNED_TO_HOST) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_PINNED_TO_HOST); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java index 6fe0134..e6bfc94 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java @@ -7,12 +7,14 @@ import org.apache.commons.lang.StringUtils; import org.ovirt.engine.core.bll.utils.VersionSupport; import org.ovirt.engine.core.common.AuditLogType; +import org.ovirt.engine.core.common.FeatureSupported; import org.ovirt.engine.core.common.VdcObjectType; import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.action.VdcReturnValueBase; import org.ovirt.engine.core.common.action.VdsActionParameters; import org.ovirt.engine.core.common.action.VdsGroupOperationParameters; import org.ovirt.engine.core.common.businessentities.ArchitectureType; +import org.ovirt.engine.core.common.businessentities.MigrateOnErrorOptions; import org.ovirt.engine.core.common.businessentities.StoragePool; import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VDSGroup; @@ -352,6 +354,13 @@ addCanDoActionMessage(VdcBllMessages.VDS_GROUP_CANNOT_SET_TRUSTED_ATTESTATION_SERVER_NOT_CONFIGURED); result = false; } + + if (result + && !FeatureSupported.isMigrationSupported(getArchitecture(), getVdsGroup().getcompatibility_version()) + && getVdsGroup().getMigrateOnError() != MigrateOnErrorOptions.NO) { + return failCanDoAction(VdcBllMessages.MIGRATION_ON_ERROR_IS_NOT_SUPPORTED); + } + if (result) { result = validateClusterPolicy(); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java index 9cfa278..bcddc26 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java @@ -374,6 +374,11 @@ return false; } + if (!FeatureSupported.isMigrationSupported(getVdsGroup().getArchitecture(), getVdsGroup().getcompatibility_version()) + && vmFromParams.getMigrationSupport() != MigrationSupport.PINNED_TO_HOST) { + return failCanDoAction(VdcBllMessages.VM_MIGRATION_IS_NOT_SUPPORTED); + } + // check cpuPinning if (!isCpuPinningValid(vmFromParams.getCpuPinning(), vmFromParams.getStaticData())) { return false; diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommandTest.java index d061f82..285b40d 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommandTest.java @@ -8,13 +8,17 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; +import static org.ovirt.engine.core.utils.MockConfigRule.mockConfig; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; +import org.apache.commons.lang.StringUtils; import org.junit.ClassRule; import org.junit.Test; import org.junit.runner.RunWith; @@ -42,14 +46,27 @@ @RunWith(MockitoJUnitRunner.class) public class UpdateVdsGroupCommandTest { - @ClassRule - public static MockConfigRule mcr = new MockConfigRule(); - private static final Version VERSION_1_0 = new Version(1, 0); private static final Version VERSION_1_1 = new Version(1, 1); private static final Version VERSION_1_2 = new Version(1, 2); private static final Guid STORAGE_POOL_ID = Guid.newGuid(); private static final Guid DEFAULT_VDS_GROUP_ID = new Guid("99408929-82CF-4DC7-A532-9D998063FA95"); + + private static final Map<String, String> migrationMap = new HashMap<>(); + + static { + migrationMap.put("undefined", "true"); + migrationMap.put("x86_64", "true"); + migrationMap.put("ppc64", "false"); + } + + @ClassRule + public static MockConfigRule mcr = new MockConfigRule( + mockConfig(ConfigValues.IsMigrationSupported, VERSION_1_0.getValue(), migrationMap), + mockConfig(ConfigValues.IsMigrationSupported, VERSION_1_1.getValue(), migrationMap), + mockConfig(ConfigValues.IsMigrationSupported, VERSION_1_2.getValue(), migrationMap) + ); + @Mock private VdsGroupDAO vdsGroupDAO; @Mock @@ -336,6 +353,12 @@ doReturn(vmDao).when(cmd).getVmDAO(); doReturn(true).when(cmd).validateClusterPolicy(); + if (StringUtils.isEmpty(group.getcpu_name())) { + doReturn(ArchitectureType.undefined).when(cmd).getArchitecture(); + } else { + doReturn(ArchitectureType.x86_64).when(cmd).getArchitecture(); + } + when(vdsGroupDAO.get(any(Guid.class))).thenReturn(createDefaultVdsGroup()); when(vdsGroupDAO.getByName(anyString())).thenReturn(createDefaultVdsGroup()); List<VDSGroup> vdsGroupList = new ArrayList<VDSGroup>(); @@ -350,6 +373,7 @@ private static VDSGroup createVdsGroupWithDifferentName() { VDSGroup group = new VDSGroup(); group.setName("BadName"); + group.setcompatibility_version(VERSION_1_1); return group; } @@ -511,7 +535,7 @@ } private void architectureIsNotUpdatable() { - doReturn(ArchitectureType.ppc64).when(cmd).getArchitecture(); + doReturn(false).when(cmd).isArchitectureUpdatable(); } private static void setValidCpuVersionMap() { diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVmCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVmCommandTest.java index 5da8d7a..5d9cba5 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVmCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVmCommandTest.java @@ -25,10 +25,10 @@ import org.mockito.runners.MockitoJUnitRunner; import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.action.VmManagementParametersBase; +import org.ovirt.engine.core.common.businessentities.ArchitectureType; import org.ovirt.engine.core.common.businessentities.Disk; import org.ovirt.engine.core.common.businessentities.DiskImage; import org.ovirt.engine.core.common.businessentities.DiskInterface; -import org.ovirt.engine.core.common.businessentities.ArchitectureType; import org.ovirt.engine.core.common.businessentities.DisplayType; import org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum; import org.ovirt.engine.core.common.businessentities.VDS; @@ -73,6 +73,14 @@ @Mock OsRepository osRepository; + private static final Map<String, String> migrationMap = new HashMap<>(); + + static { + migrationMap.put("undefined", "true"); + migrationMap.put("x86_64", "true"); + migrationMap.put("ppc64", "false"); + } + @ClassRule public static MockConfigRule mcr = new MockConfigRule( mockConfig(ConfigValues.MaxVmNameLengthWindows, 15), @@ -93,7 +101,9 @@ mockConfig(ConfigValues.MaxNumOfVmCpus, "3.3", 16), mockConfig(ConfigValues.MaxNumOfVmSockets, "3.3", 16), mockConfig(ConfigValues.MaxNumOfCpuPerSocket, "3.3", 16), - mockConfig(ConfigValues.VirtIoScsiEnabled, Version.v3_3.toString(), true) + mockConfig(ConfigValues.VirtIoScsiEnabled, Version.v3_3.toString(), true), + mockConfig(ConfigValues.IsMigrationSupported, Version.v3_0.toString(), migrationMap), + mockConfig(ConfigValues.IsMigrationSupported, Version.v3_3.toString(), migrationMap) ); @Before diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java index 9f85ca3..69f92b1 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java @@ -649,6 +649,9 @@ VM_PINNED_TO_HOST_CANNOT_RUN_ON_THE_DEFAULT_VDS(ErrorType.CONFLICT), HOST_NAME_NOT_AVAILABLE(ErrorType.BAD_PARAMETERS), VM_HOSTCPU_MUST_BE_PINNED_TO_HOST(ErrorType.CONFLICT), + MIGRATION_IS_NOT_SUPPORTED(ErrorType.NOT_SUPPORTED), + MIGRATION_ON_ERROR_IS_NOT_SUPPORTED(ErrorType.CONFLICT), + VM_MIGRATION_IS_NOT_SUPPORTED(ErrorType.CONFLICT), ACTION_TYPE_FAILED_STORAGE_POOL_IS_NOT_LOCAL(ErrorType.BAD_PARAMETERS), RHEVH_LOCALFS_WRONG_PATH_LOCATION(ErrorType.BAD_PARAMETERS), diff --git a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties index 1677f56..1094e7d 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -181,6 +181,9 @@ VM_PINNED_TO_HOST_CANNOT_RUN_ON_THE_DEFAULT_VDS=Note: The VM is pinned to Host '${VdsName}' but cannot run on it. HOST_NAME_NOT_AVAILABLE=$VdsName [N/A] VM_HOSTCPU_MUST_BE_PINNED_TO_HOST=Cannot ${action} ${type}. VM with host cpu flags must be pinned to host. +MIGRATION_IS_NOT_SUPPORTED=Cannot ${action} ${type}. Migration is not supported in this CPU architecture. +MIGRATION_ON_ERROR_IS_NOT_SUPPORTED=Cannot ${action} ${type}. This resilience policy is not supported in this CPU architecture. +VM_MIGRATION_IS_NOT_SUPPORTED=Cannot ${action} ${type}. Migration option is not supported in this CPU architecture. ACTION_TYPE_FAILED_VM_NOT_EXIST=Cannot ${action} ${type}. VM doesn't exist. ACTION_TYPE_FAILED_VM_CANNOT_BE_HIGHLY_AVAILABLE_AND_PINNED_TO_HOST=Cannot ${action} ${type}. A highly available VM cannot be pinned to a specific Host ACTION_TYPE_FAILED_VM_GUID_ALREADY_EXIST=Cannot ${action} ${type}. VM with the same identifier already exists. diff --git a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java index bc2aa81..c997330 100644 --- a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java +++ b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java @@ -466,6 +466,15 @@ @DefaultStringValue("$VdsName [N/A]") String HOST_NAME_NOT_AVAILABLE(); + @DefaultStringValue("Cannot ${action} ${type}. Migration is not supported in this CPU architecture.") + String MIGRATION_IS_NOT_SUPPORTED(); + + @DefaultStringValue("Cannot ${action} ${type}. This resilience policy is not supported in this CPU architecture.") + String MIGRATION_ON_ERROR_IS_NOT_SUPPORTED(); + + @DefaultStringValue("Cannot ${action} ${type}. Migration option is not supported in this CPU architecture.") + String VM_MIGRATION_IS_NOT_SUPPORTED(); + @DefaultStringValue("CPU pinning format invalid.") String VM_PINNING_FORMAT_INVALID(); diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index f2c13d0..9d1bf47 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -174,6 +174,9 @@ VM_PINNED_TO_HOST_CANNOT_RUN_ON_THE_DEFAULT_VDS=Note: The VM is pinned to Host '${VdsName}' but cannot run on it. HOST_NAME_NOT_AVAILABLE=$VdsName [N/A] VM_HOSTCPU_MUST_BE_PINNED_TO_HOST=Cannot ${action} ${type}. VM with host cpu flags must be pinned to host. +MIGRATION_IS_NOT_SUPPORTED=Cannot ${action} ${type}. Migration is not supported in this CPU architecture. +MIGRATION_ON_ERROR_IS_NOT_SUPPORTED=Cannot ${action} ${type}. This resilience policy is not supported in this CPU architecture. +VM_MIGRATION_IS_NOT_SUPPORTED=Cannot ${action} ${type}. Migration option is not supported in this CPU architecture. ACTION_TYPE_FAILED_VM_NOT_EXIST=Cannot ${action} ${type}. VM doesn't exist. ACTION_TYPE_FAILED_VM_CANNOT_BE_HIGHLY_AVAILABLE_AND_PINNED_TO_HOST=Cannot ${action} ${type}. A highly available VM cannot be pinned to a specific Host ACTION_TYPE_FAILED_VM_CANNOT_BE_PINNED_TO_CPU_AND_MIGRATABLE=Migratable VM's cannot be pinned to CPU. diff --git a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index ae979d3..0c38160 100644 --- a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -178,6 +178,9 @@ VM_PINNED_TO_HOST_CANNOT_RUN_ON_THE_DEFAULT_VDS=Note: The VM is pinned to Host '${VdsName}' but cannot run on it. HOST_NAME_NOT_AVAILABLE=$VdsName [N/A] VM_HOSTCPU_MUST_BE_PINNED_TO_HOST=Cannot ${action} ${type}. VM with host cpu flags must be pinned to host. +MIGRATION_IS_NOT_SUPPORTED=Cannot ${action} ${type}. Migration is not supported in this CPU architecture. +MIGRATION_ON_ERROR_IS_NOT_SUPPORTED=Cannot ${action} ${type}. This resilience policy is not supported in this CPU architecture. +VM_MIGRATION_IS_NOT_SUPPORTED=Cannot ${action} ${type}. Migration option is not supported in this CPU architecture. ACTION_TYPE_FAILED_VM_NOT_EXIST=Cannot ${action} ${type}. VM doesn't exist. ACTION_TYPE_FAILED_VM_CANNOT_BE_HIGHLY_AVAILABLE_AND_PINNED_TO_HOST=Cannot ${action} ${type}. A highly available VM cannot be pinned to a specific Host ACTION_TYPE_FAILED_VM_GUID_ALREADY_EXIST=Cannot ${action} ${type}. VM with the same identifier already exists. -- To view, visit http://gerrit.ovirt.org/25046 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4808f3e91ccf37462727a28d35f9f9faae1dfd6c Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.4 Gerrit-Owner: Vitor de Lima <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
