Eldan Shachar has uploaded a new change for review. Change subject: core: Add migration options to OVF ......................................................................
core: Add migration options to OVF Most migration options were not saved in OVF, this caused a problem when changing those options while VM was running (due to the "next run" snapshot OVF). - Added support for the options: MIGRATION_SUPPORT, DEDICATED_VM_FOR_VDS and USE_HOST_CPU in the OVF reader\writer. - Added verification for the DEDICATED_VM_FOR_VDS option - makes sure host exists in the current cluster. Added in: import vm, import template, snapshot manager. Change-Id: I5f0025e5ac59dac0a1569729c2fef8186e0885db Bug-Url: https://bugzilla.redhat.com/1124449 Signed-off-by: Eldan Shachar <[email protected]> --- 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/ImportVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmTemplateCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsManager.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetVmChangedFieldsForNextRunQueryTest.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/businessentities/VmStatic.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 backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfProperties.java M backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfReader.java M backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java M backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmWriter.java M backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfWriter.java 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 20 files changed, 112 insertions(+), 48 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/57/36757/1 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 e72ad45..0f7ce8c 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 @@ -305,7 +305,8 @@ return false; } } - return isDedicatedVdsOnSameCluster(vmStaticFromParams); + return VmHandler.validateDedicatedVdsExistOnSameCluster(vmStaticFromParams, + getReturnValue().getCanDoActionMessages()); } protected boolean shouldCheckSpaceInStorageDomains() { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java index fae5721..8f0593f 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java @@ -1065,6 +1065,11 @@ getVm().getStaticData().setMinAllocatedMem(computeMinAllocatedMem()); getVm().getStaticData().setQuotaId(getParameters().getQuotaId()); + // if "run on host" field points to a non existent vds (in the current cluster) -> remove field and continue + if (!VmHandler.validateDedicatedVdsExistOnSameCluster(getVm().getStaticData(), null)) { + getVm().setDedicatedVmForVds(null); + } + if (getVm().getOriginalTemplateGuid() != null && !VmTemplateHandler.BLANK_VM_TEMPLATE_ID.equals(getVm().getOriginalTemplateGuid())) { // no need to check this for blank VmTemplate originalTemplate = getVmTemplateDAO().get(getVm().getOriginalTemplateGuid()); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmTemplateCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmTemplateCommand.java index cdbffe3..26c88d0 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmTemplateCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmTemplateCommand.java @@ -392,6 +392,12 @@ protected void addVmTemplateToDb() { getVmTemplate().setVdsGroupId(getParameters().getVdsGroupId()); + + // if "run on host" field points to a non existent vds (in the current cluster) -> remove field and continue + if(!VmHandler.validateDedicatedVdsExistOnSameCluster(getVmTemplate(), null)){ + getVmTemplate().setDedicatedVmForVds(null); + } + getVmTemplate().setStatus(VmTemplateStatus.Locked); getVmTemplate().setQuotaId(getParameters().getQuotaId()); VmHandler.updateImportedVmUsbPolicy(getVmTemplate()); 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 dca2e19..8d2ae81 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 @@ -43,6 +43,7 @@ import org.ovirt.engine.core.common.businessentities.Snapshot; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VMStatus; +import org.ovirt.engine.core.common.businessentities.VmBase; import org.ovirt.engine.core.common.businessentities.VmDevice; import org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType; import org.ovirt.engine.core.common.businessentities.VmDeviceId; @@ -506,7 +507,7 @@ return failCanDoAction(VdcBllMessages.VM_CANNOT_UPDATE_CLUSTER); } - if (!isDedicatedVdsOnSameCluster(vmFromParams.getStaticData())) { + if (!isDedicatedVdsExistOnSameCluster(vmFromParams.getStaticData(), getReturnValue().getCanDoActionMessages())) { return false; } @@ -638,6 +639,11 @@ return true; } + protected boolean isDedicatedVdsExistOnSameCluster(VmBase vm, + ArrayList<String> canDoActionMessages) { + return VmHandler.validateDedicatedVdsExistOnSameCluster(vm, canDoActionMessages); + } + protected boolean isValidPciAndIdeLimit(VM vmFromParams) { List<Disk> allDisks = getDbFacade().getDiskDao().getAllForVm(getVmId()); List<VmNic> interfaces = getVmNicDao().getAllForVm(getVmId()); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java index 9f55a125..91f3709 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java @@ -8,6 +8,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import org.apache.commons.collections.CollectionUtils; @@ -39,6 +40,7 @@ import org.ovirt.engine.core.common.businessentities.StorageDomainStatus; import org.ovirt.engine.core.common.businessentities.StorageType; import org.ovirt.engine.core.common.businessentities.UsbPolicy; +import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VMStatus; @@ -907,4 +909,33 @@ permissionList.add(new PermissionSubject(clusterId, VdcObjectType.VdsGroups, ActionGroup.CREATE_VM)); return permissionList; } + + /** + * Checks that dedicated host exists on the same cluster as the VM + * + * @param vm - the VM to check + * @param canDoActionMessages - Action messages - used for error reporting. null value indicates that no error messages are required. + * @return + */ + public static boolean validateDedicatedVdsExistOnSameCluster(VmBase vm, ArrayList<String> canDoActionMessages) { + boolean result = true; + if (vm.getDedicatedVmForVds() != null) { + // get dedicated host id + Guid vdsId = vm.getDedicatedVmForVds(); + // get dedicated host, checks if exists and compare its cluster to the VM cluster + VDS vds = DbFacade.getInstance().getVdsDao().get(vdsId); + if (vds == null) { + if (canDoActionMessages != null) { + canDoActionMessages.add(VdcBllMessages.ACTION_TYPE_FAILED_DEDICATED_VDS_DOES_NOT_EXIST.toString()); + } + result = false; + } else if (!Objects.equals(vm.getVdsGroupId(), vds.getVdsGroupId())) { + if (canDoActionMessages != null) { + canDoActionMessages.add(VdcBllMessages.ACTION_TYPE_FAILED_DEDICATED_VDS_NOT_IN_SAME_CLUSTER.toString()); + } + result = false; + } + } + return result; + } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java index 9719c9c..c2999c7 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java @@ -4,7 +4,6 @@ import java.util.HashSet; import java.util.LinkedList; import java.util.List; -import java.util.Objects; import java.util.regex.Pattern; import org.apache.commons.lang.StringUtils; @@ -62,29 +61,6 @@ instanceType = getVmTemplateDAO().getInstanceType(getInstanceTypeId()); } return instanceType; - } - - /** - * Checks that dedicated host is on the same cluster as the VM - * - * @param vm - * - the VM to check - * @return - */ - protected boolean isDedicatedVdsOnSameCluster(VmStatic vm) { - boolean result = true; - if (vm.getDedicatedVmForVds() != null) { - // get dedicated host id - Guid guid = vm.getDedicatedVmForVds(); - // get dedicated host cluster and comparing it to VM cluster - VDS vds = getVdsDAO().get(guid); - result = vds != null && (Objects.equals(vm.getVdsGroupId(), vds.getVdsGroupId())); - } - if (!result) { - getReturnValue().getCanDoActionMessages() - .add(VdcBllMessages.ACTION_TYPE_FAILED_DEDICATED_VDS_NOT_IN_SAME_CLUSTER.toString()); - } - return result; } private final static Pattern cpuPinningPattern = diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsManager.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsManager.java index 80cf143..ac4042f 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsManager.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsManager.java @@ -9,6 +9,7 @@ import org.apache.commons.lang.StringUtils; import org.ovirt.engine.core.bll.ImagesHandler; +import org.ovirt.engine.core.bll.VmHandler; import org.ovirt.engine.core.bll.context.CompensationContext; import org.ovirt.engine.core.bll.memory.MemoryUtils; import org.ovirt.engine.core.bll.network.VmInterfaceManager; @@ -541,7 +542,6 @@ vm.setInterfaces(interfaces); // These fields are not saved in the OVF, so get them from the current VM. - vm.setDedicatedVmForVds(oldVmStatic.getDedicatedVmForVds()); vm.setIsoPath(oldVmStatic.getIsoPath()); vm.setVdsGroupId(oldVmStatic.getVdsGroupId()); // The VM configuration does not hold the vds group Id. @@ -556,6 +556,10 @@ vm.setVdsGroupCpuName(vdsGroup.getcpu_name()); } } + // if the required dedicated host is invalid -> use current VM dedicated host + if (!VmHandler.validateDedicatedVdsExistOnSameCluster(vm.getStaticData(), null)) { + vm.setDedicatedVmForVds(oldVmStatic.getDedicatedVmForVds()); + } validateQuota(vm); return true; } catch (OvfReaderException e) { diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetVmChangedFieldsForNextRunQueryTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetVmChangedFieldsForNextRunQueryTest.java index 5bf300f..8ff9bdd 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetVmChangedFieldsForNextRunQueryTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetVmChangedFieldsForNextRunQueryTest.java @@ -82,8 +82,6 @@ VM srcVm = createEmptyVm(); VM dstVm = createEmptyVm(); // field that should not count - srcVm.setUseHostCpuFlags(true); - dstVm.setUseHostCpuFlags(false); srcVm.setUseLatestVersion(false); dstVm.setUseLatestVersion(true); srcVm.setName("a"); @@ -102,6 +100,8 @@ dstVm.setUsbPolicy(UsbPolicy.ENABLED_LEGACY); srcVm.setStateless(true); dstVm.setStateless(false); + srcVm.setUseHostCpuFlags(true); + dstVm.setUseHostCpuFlags(false); when(getQueryParameters().getOriginal()).thenReturn(srcVm); when(getQueryParameters().getUpdated()).thenReturn(dstVm); @@ -116,8 +116,6 @@ VM srcVm = createEmptyVm(); VM dstVm = createEmptyVm(); // field that should not count - srcVm.setUseHostCpuFlags(true); - dstVm.setUseHostCpuFlags(false); srcVm.setUseLatestVersion(false); dstVm.setUseLatestVersion(true); srcVm.setName("a"); @@ -136,6 +134,8 @@ dstVm.setUsbPolicy(UsbPolicy.ENABLED_LEGACY); srcVm.setStateless(true); dstVm.setStateless(true); + srcVm.setUseHostCpuFlags(true); + dstVm.setUseHostCpuFlags(true); when(getQueryParameters().getOriginal()).thenReturn(srcVm); when(getQueryParameters().getUpdated()).thenReturn(dstVm); 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 d35fce4..be328f6 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 @@ -38,6 +38,7 @@ import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VMStatus; +import org.ovirt.engine.core.common.businessentities.VmBase; import org.ovirt.engine.core.common.businessentities.VmStatic; import org.ovirt.engine.core.common.config.ConfigValues; import org.ovirt.engine.core.common.errors.VdcBllMessages; @@ -205,30 +206,16 @@ } @Test - public void testDedicatedHostNotExist() { + public void testDedicatedHostNotExistOrNotSameCluster() { prepareVmToPassCanDoAction(); // this will cause null to return when getting vds from vdsDAO doReturn(vdsDAO).when(command).getVdsDAO(); + doReturn(false).when(command).isDedicatedVdsExistOnSameCluster(any(VmBase.class), any(ArrayList.class)); vmStatic.setDedicatedVmForVds(Guid.newGuid()); assertFalse("canDoAction should have failed with invalid dedicated host.", command.canDoAction()); - assertCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DEDICATED_VDS_NOT_IN_SAME_CLUSTER); - } - - @Test - public void testDedicatedHostNotInSameCluster() { - prepareVmToPassCanDoAction(); - - VDS vds = new VDS(); - vds.setVdsGroupId(Guid.newGuid()); - doReturn(vdsDAO).when(command).getVdsDAO(); - when(vdsDAO.get(any(Guid.class))).thenReturn(vds); - vmStatic.setDedicatedVmForVds(Guid.newGuid()); - - assertFalse("canDoAction should have failed with invalid dedicated host.", command.canDoAction()); - assertCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DEDICATED_VDS_NOT_IN_SAME_CLUSTER); } @Test @@ -239,6 +226,7 @@ vds.setVdsGroupId(group.getId()); doReturn(vdsDAO).when(command).getVdsDAO(); when(vdsDAO.get(any(Guid.class))).thenReturn(vds); + doReturn(true).when(command).isDedicatedVdsExistOnSameCluster(any(VmBase.class), any(ArrayList.class)); vmStatic.setDedicatedVmForVds(Guid.newGuid()); assertTrue("canDoAction should have passed.", command.canDoAction()); diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatic.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatic.java index 2084627..7d6968b 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatic.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmStatic.java @@ -32,7 +32,7 @@ @Size(max = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE) private String cpuPinning; - @EditableField + @EditableOnVmStatusField private boolean useHostCpuFlags; @EditableField 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 02f18eb..fa0e199 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 @@ -198,6 +198,7 @@ ACTION_TYPE_FAILED_SPM_CHANGED(ErrorType.CONFLICT), ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN(ErrorType.CONFLICT), ACTION_TYPE_FAILED_DEDICATED_VDS_NOT_IN_SAME_CLUSTER(ErrorType.CONFLICT), + ACTION_TYPE_FAILED_DEDICATED_VDS_DOES_NOT_EXIST(ErrorType.CONFLICT), ACTION_TYPE_FAILED_DISK_MAX_SIZE_EXCEEDED(ErrorType.CONFLICT), ACTION_TYPE_FAILED_DISK_CONFIGURATION_NOT_SUPPORTED(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED(ErrorType.CONFLICT), 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 b6fa476..b7ded7b 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -211,6 +211,7 @@ ACTION_TYPE_FAILED_SPM_CHANGED=Cannot ${action} ${type}. The Data Center's Storage Pool Manager has changed. ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN=Cannot ${action} ${type}. Low disk space on Storage Domain ${storageName}. ACTION_TYPE_FAILED_DEDICATED_VDS_NOT_IN_SAME_CLUSTER=Cannot ${action} ${type}. VM is pinned to a specific host. The host's cluster must be the same as the selected VM cluster. +ACTION_TYPE_FAILED_DEDICATED_VDS_DOES_NOT_EXIST=Cannot ${action} ${type}. VM is pinned to a specific host. The required host doesn't exist. ACTION_TYPE_FAILED_DISK_CONFIGURATION_NOT_SUPPORTED=Cannot ${action} ${type}. Disk configuration (${volumeFormat} ${volumeType}) is incompatible with the storage domain type. ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED=Cannot ${action} ${type}. The OVF configuration could not be parsed. ACTION_TYPE_FAILED_DISK_LUN_IS_ALREADY_IN_USE=Cannot ${action} ${type}. The provided lun is used by another disk. diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfProperties.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfProperties.java index 8a013b2..4d85f14 100644 --- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfProperties.java +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfProperties.java @@ -69,4 +69,7 @@ final static String IS_SPICE_FILE_TRANSFER_ENABLED = "IsSpiceFileTransferEnabled"; final static String IS_SPICE_COPY_PASTE_ENABLED = "IsSpiceCopyPasteEnabled"; final static String COMMENT = "Comment"; + final static String MIGRATION_SUPPORT = "MigrationSupport"; + final static String DEDICATED_VM_FOR_VDS = "DedicatedVmForVds"; + final static String USE_HOST_CPU = "UseHostCpu"; } diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfReader.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfReader.java index 72a624c..7fc4482 100644 --- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfReader.java +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfReader.java @@ -13,6 +13,7 @@ import org.ovirt.engine.core.common.businessentities.DiskInterface; import org.ovirt.engine.core.common.businessentities.DisplayType; import org.ovirt.engine.core.common.businessentities.ImageStatus; +import org.ovirt.engine.core.common.businessentities.MigrationSupport; import org.ovirt.engine.core.common.businessentities.OriginType; import org.ovirt.engine.core.common.businessentities.SerialNumberPolicy; import org.ovirt.engine.core.common.businessentities.SsoMethod; @@ -529,6 +530,21 @@ } } + node = content.SelectSingleNode(OvfProperties.MIGRATION_SUPPORT); + if (node != null) { + if (StringUtils.isNotEmpty(node.innerText)) { + MigrationSupport migrationSupport = MigrationSupport.forValue(Integer.parseInt(node.innerText)); + vmBase.setMigrationSupport(migrationSupport); + } + } + + node = content.SelectSingleNode(OvfProperties.DEDICATED_VM_FOR_VDS); + if (node != null) { + if (StringUtils.isNotEmpty(node.innerText)) { + vmBase.setDedicatedVmForVds(Guid.createGuidFromString(node.innerText)); + } + } + node = content.SelectSingleNode(OvfProperties.SERIAL_NUMBER_POLICY); if (node != null) { if (StringUtils.isNotEmpty(node.innerText)) { diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java index 83dce82..7652eae 100644 --- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java @@ -312,6 +312,11 @@ if (node != null) { _vm.setUseLatestVersion(Boolean.parseBoolean(node.innerText)); } + + node = content.SelectSingleNode(OvfProperties.USE_HOST_CPU); + if (node != null) { + _vm.setUseHostCpuFlags(Boolean.parseBoolean(node.innerText)); + } } @Override diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmWriter.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmWriter.java index 97bd737..35b629a 100644 --- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmWriter.java +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmWriter.java @@ -86,6 +86,10 @@ _writer.WriteEndElement(); } + _writer.WriteStartElement(OvfProperties.USE_HOST_CPU); + _writer.WriteRaw(String.valueOf(_vm.getStaticData().isUseHostCpuFlags())); + _writer.WriteEndElement(); + _writer.WriteStartElement(OvfProperties.USE_LATEST_VERSION); _writer.WriteRaw(String.valueOf(_vm.isUseLatestVersion())); _writer.WriteEndElement(); diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfWriter.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfWriter.java index bbb4c60..5a48c5a 100644 --- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfWriter.java +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfWriter.java @@ -350,6 +350,18 @@ } writeVmInit(); + if (vmBase.getMigrationSupport() != null) { + _writer.WriteStartElement(OvfProperties.MIGRATION_SUPPORT); + _writer.WriteRaw(String.valueOf(vmBase.getMigrationSupport().getValue())); + _writer.WriteEndElement(); + } + + if (vmBase.getDedicatedVmForVds() != null) { + _writer.WriteStartElement(OvfProperties.DEDICATED_VM_FOR_VDS); + _writer.WriteRaw(String.valueOf(vmBase.getDedicatedVmForVds())); + _writer.WriteEndElement(); + } + if (vmBase.getSerialNumberPolicy() != null) { _writer.WriteStartElement(OvfProperties.SERIAL_NUMBER_POLICY); _writer.WriteRaw(String.valueOf(vmBase.getSerialNumberPolicy().getValue())); 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 a531218..ef89427 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 @@ -568,6 +568,9 @@ @DefaultStringValue("Cannot ${action} ${type}. VM is pinned to a specific host. The host's cluster must be the same as the selected VM cluster.") String ACTION_TYPE_FAILED_DEDICATED_VDS_NOT_IN_SAME_CLUSTER(); + @DefaultStringValue("Cannot ${action} ${type}. VM is pinned to a specific host. The required host doesn't exist.") + String ACTION_TYPE_FAILED_DEDICATED_VDS_DOES_NOT_EXIST(); + @DefaultStringValue("Cannot ${action} ${type}. Disk configuration (${volumeFormat} ${volumeType}) is incompatible with the storage domain type.") String ACTION_TYPE_FAILED_DISK_CONFIGURATION_NOT_SUPPORTED(); 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 d1b3742..21d77f7 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 @@ -203,6 +203,7 @@ ACTION_TYPE_FAILED_SPM_CHANGED=Cannot ${action} ${type}. The Data Center's Storage Pool Manager has changed. ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN=Cannot ${action} ${type}. Low disk space on Storage Domain ${storageName}. ACTION_TYPE_FAILED_DEDICATED_VDS_NOT_IN_SAME_CLUSTER=Cannot ${action} ${type}. VM is pinned to a specific host. The host's cluster must be the same as the selected VM cluster. +ACTION_TYPE_FAILED_DEDICATED_VDS_DOES_NOT_EXIST=Cannot ${action} ${type}. VM is pinned to a specific host. The required host doesn't exist. ACTION_TYPE_FAILED_DISK_CONFIGURATION_NOT_SUPPORTED=Cannot ${action} ${type}. Disk configuration (${volumeFormat} ${volumeType}) is incompatible with the storage domain type. ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED=Cannot ${action} ${type}. The OVF configuration could not be parsed. ACTION_TYPE_FAILED_DISK_LUN_IS_ALREADY_IN_USE=Cannot ${action} ${type}. The provided lun is used by another disk. 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 ce1f525..f5b07b0 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 @@ -209,6 +209,7 @@ ACTION_TYPE_FAILED_SPM_CHANGED=Cannot ${action} ${type}. The Data Center's Storage Pool Manager has changed. ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN=Cannot ${action} ${type}. Low disk space on Storage Domain ${storageName}. ACTION_TYPE_FAILED_DEDICATED_VDS_NOT_IN_SAME_CLUSTER=Cannot ${action} ${type}. VM is pinned to a specific host. The host's cluster must be the same as the selected VM cluster. +ACTION_TYPE_FAILED_DEDICATED_VDS_DOES_NOT_EXIST=Cannot ${action} ${type}. VM is pinned to a specific host. The required host doesn't exist. ACTION_TYPE_FAILED_DISK_CONFIGURATION_NOT_SUPPORTED=Cannot ${action} ${type}. Disk configuration (${volumeFormat} ${volumeType}) is incompatible with the storage domain type. ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED=Cannot ${action} ${type}. The OVF configuration could not be parsed. ACTION_TYPE_FAILED_DISK_LUN_HAS_NO_VALID_TYPE=Cannot ${action} ${type}. The provided lun has no valid lun type. -- To view, visit http://gerrit.ovirt.org/36757 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5f0025e5ac59dac0a1569729c2fef8186e0885db Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Eldan Shachar <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
