Vitor de Lima has uploaded a new change for review. Change subject: core, engine, userportal, webadmin: Block floppy support on PPC64 ......................................................................
core, engine, userportal, webadmin: Block floppy support on PPC64 The ppc64 architecture does not support floopy devices, this change blocks the use of such devices in VMs that do not support them. A additional property in the osinfo (devices.floppySupport) was created to indicate if the guest OS supports floppy devices. The RunVmCommand was changed to validate if the selected VM can use the attached floppy image and the frontend was changed to hide floppy-related options if the VM does not support it. Change-Id: I8fb783bbafa3c6a18e327e4e02aac3d71b6f110b Signed-off-by: Vitor de Lima <vitor.l...@eldorado.org.br> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OsRepositoryQuery.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VmValidationUtils.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepository.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/OsQueryParameters.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/OsRepositoryImpl.java M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.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 M packaging/conf/osinfo-defaults.properties 14 files changed, 86 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/66/24966/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OsRepositoryQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OsRepositoryQuery.java index a362e82..78085a7 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OsRepositoryQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OsRepositoryQuery.java @@ -49,7 +49,11 @@ setReturnValue(osRepository.getDisplayTypes()); break; case HasNicHotplugSupport: - setReturnValue(osRepository.hasNicHotplugSupport(getParameters().getOsId(), getParameters().getVersion())); + setReturnValue(Boolean.valueOf(osRepository.hasNicHotplugSupport(getParameters().getOsId(), + getParameters().getVersion()))); + break; + case GetFloppySupport: + setReturnValue(osRepository.isFloppySupported(getParameters().getOsId(), getParameters().getVersion())); break; case GetDiskInterfaces: setReturnValue(osRepository.getDiskInterfaces(getParameters().getOsId(), getParameters().getVersion())); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java index 971ef2c..0e4e2a0 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java @@ -112,12 +112,23 @@ validate(validateIsoPath(vm, runVmParam.getDiskPath(), runVmParam.getFloppyPath()), messages) && validate(vmDuringInitialization(vm), messages) && validate(validateStatelessVm(vm, getVmDisks(), runVmParam.getRunAsStateless()), messages) && + validate(validateFloppy(), messages) && validate(validateStorageDomains(vm, isInternalExecution, getVmImageDisks()), messages) && validate(validateImagesForRunVm(vm, getVmImageDisks()), messages) && SchedulingManager.getInstance().canSchedule( vdsGroup, vm, vdsBlackList, vdsWhiteList, destVds, messages); } + public ValidationResult validateFloppy() { + + if (StringUtils.isNotEmpty(runVmParam.getFloppyPath()) && !VmValidationUtils.isFloppySupported(vm.getOs(), + vm.getVdsGroupCompatibilityVersion())) { + return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_FLOPPY_IS_NOT_SUPPORTED_BY_OS); + } + + return ValidationResult.VALID; + } + /** * @return true if all VM network interfaces are valid */ diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VmValidationUtils.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VmValidationUtils.java index 1138fa3..636762d 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VmValidationUtils.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VmValidationUtils.java @@ -37,11 +37,28 @@ } /** + * Check if the OS type supports floppy devices + * + * @param osId + * The OS identifier. + * @param clusterVersion + * The cluster version. + * + * @return If the floppy device is supported by the OS type. + */ + public static boolean isFloppySupported(int osId, Version clusterVersion) { + return getOsRepository().isFloppySupported(osId, clusterVersion); + } + + /** * Check if the OS type support the disk interface * - * @param osId The OS identifier. - * @param clusterVersion The cluster version. - * @param diskInterface The disk interface. + * @param osId + * The OS identifier. + * @param clusterVersion + * The cluster version. + * @param diskInterface + * The disk interface. * * @return If the disk interface is supported by the OS type. */ 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..bff135a 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 @@ -246,6 +246,7 @@ ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_IS_NOT_SUPPORTED_BY_ARCHITECTURE_TYPE(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_ILLEGAL_WATCHDOG_MODEL_IS_NOT_SUPPORTED_BY_OS(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_ILLEGAL_VM_DISPLAY_TYPE_IS_NOT_SUPPORTED_BY_OS(ErrorType.BAD_PARAMETERS), + ACTION_TYPE_FAILED_ILLEGAL_FLOPPY_IS_NOT_SUPPORTED_BY_OS(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_DOES_NOT_SUPPORT_VIRTIO_SCSI(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_OS_TYPE(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_INCOMPATIBLE_VERSION(ErrorType.BAD_PARAMETERS), diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepository.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepository.java index 6363423..69c4d83 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepository.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepository.java @@ -215,6 +215,13 @@ String getCdInterface(int osId, Version version); /** + * @param osId + * @param version + * @return if there is floppy support in the given os + */ + boolean isFloppySupported(int osId, Version version); + + /** * early windows versions require a numeric identifier for sysprep to tell * the timezone. In later versions this was rectified and they use a universal name. * @param osId diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/OsQueryParameters.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/OsQueryParameters.java index cdaf5cc..514898c 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/OsQueryParameters.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/OsQueryParameters.java @@ -46,6 +46,7 @@ GetOsIds, GetMinimumOsRam, GetMaxOsRam, + GetFloppySupport, GetDiskInterfaces, GetNetworkDevices, GetDiskHotpluggableInterfaces, 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..674ac1a 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -623,6 +623,7 @@ ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_IS_NOT_SUPPORTED_BY_ARCHITECTURE_TYPE=Cannot ${action} ${type}. Selected operating system is not supported by the architecture. ACTION_TYPE_FAILED_ILLEGAL_WATCHDOG_MODEL_IS_NOT_SUPPORTED_BY_OS=Cannot ${action} ${type}. Selected watchdog model is not supported by the operating system. ACTION_TYPE_FAILED_ILLEGAL_VM_DISPLAY_TYPE_IS_NOT_SUPPORTED_BY_OS=Cannot ${action} ${type}. Selected display type is not supported by the operating system. +ACTION_TYPE_FAILED_ILLEGAL_FLOPPY_IS_NOT_SUPPORTED_BY_OS=Cannot ${action} ${type}. Floppy devices are not supported by the operating system. ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_DOES_NOT_SUPPORT_VIRTIO_SCSI=Cannot ${action} ${type}. Selected operation system does not support VirtIO-SCSI. Please disable VirtIO-SCSI for the VM. ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_INCOMPATIBLE_VERSION=Cannot ${action} ${type}. Cluster does not support Single Qxl Pci devices. ACTION_TYPE_FAILED_ILLEGAL_DOMAIN_NAME=Cannot ${action} ${type}. Illegal Domain name: ${Domain}. Domain name has unsupported special character ${Char}. diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OsRepositoryImpl.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OsRepositoryImpl.java index 7e40127..d51ae7e 100644 --- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OsRepositoryImpl.java +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OsRepositoryImpl.java @@ -377,6 +377,11 @@ } @Override + public boolean isFloppySupported(int osId, Version version) { + return getBoolean(getValueByVersion(idToUnameLookup.get(osId), "devices.floppySupport", version), false); + } + + @Override public boolean isTimezoneValueInteger(int osId, Version version) { return getBoolean(getValueByVersion(idToUnameLookup.get(osId), "isTimezoneTypeInteger", version), false); } 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..c8cbe3a 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 @@ -1702,6 +1702,9 @@ @DefaultStringValue("Cannot ${action} ${type}. Selected display type is not supported by the operating system.") String ACTION_TYPE_FAILED_ILLEGAL_VM_DISPLAY_TYPE_IS_NOT_SUPPORTED_BY_OS(); + @DefaultStringValue("Cannot ${action} ${type}. Floppy devices are not supported by the operating system.") + String ACTION_TYPE_FAILED_ILLEGAL_FLOPPY_IS_NOT_SUPPORTED_BY_OS(); + @DefaultStringValue("Cannot ${action} ${type}. Selected operation system does not support VirtIO-SCSI. Please disable VirtIO-SCSI for the VM.") String ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_DOES_NOT_SUPPORT_VIRTIO_SCSI(); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java index 56376e6..352fac2 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java @@ -313,6 +313,19 @@ return diskInterfaces; } + public static void isFloppySupported(AsyncQuery aQuery, Integer osId, Version version) { + aQuery.converterCallback = new IAsyncConverter<Boolean>() { + @Override + public Boolean Convert(Object source, AsyncQuery _asyncQuery) + { + return source != null ? (Boolean) source : Boolean.FALSE; + } + }; + OsQueryParameters params = new OsQueryParameters(OsRepositoryVerb.GetFloppySupport, osId, version); + + Frontend.getInstance().runQuery(VdcQueryType.OsRepository, params, aQuery); + } + public static void getDomainListViaPublic(AsyncQuery aQuery, boolean filterInternalDomain) { aQuery.converterCallback = new IAsyncConverter() { @Override diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java index b9d9085..937fbc1 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/RunOnceModel.java @@ -676,6 +676,21 @@ getDisplayProtocol().setItems(Arrays.asList(vncProtocol, qxlProtocol)); getDisplayProtocol().setSelectedItem(vm.getDefaultDisplayType() == DisplayType.vnc ? vncProtocol : qxlProtocol); + + AsyncDataProvider.isFloppySupported(new AsyncQuery(this, new INewAsyncCallback() { + @Override + public void onSuccess(Object target, Object returnValue) { + RunOnceModel model = (RunOnceModel) target; + + Boolean isFloppySupported = (Boolean) returnValue; + + if (!isFloppySupported.booleanValue()) { + getAttachFloppy().setIsAvailable(false); + getFloppyImage().setIsAvailable(false); + } + + } + }), vm.getOs(), vm.getVdsGroupCompatibilityVersion()); } private void initVmInitEnabled(VmInit vmInit, boolean isInitialized) { 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..99e165b 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 @@ -602,6 +602,7 @@ ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_IS_NOT_SUPPORTED_BY_ARCHITECTURE_TYPE=Cannot ${action} ${type}. Selected operating system is not supported by the architecture. ACTION_TYPE_FAILED_ILLEGAL_WATCHDOG_MODEL_IS_NOT_SUPPORTED_BY_OS=Cannot ${action} ${type}. Selected watchdog model is not supported by the operating system. ACTION_TYPE_FAILED_ILLEGAL_VM_DISPLAY_TYPE_IS_NOT_SUPPORTED_BY_OS=Cannot ${action} ${type}. Selected display type is not supported by the operating system. +ACTION_TYPE_FAILED_ILLEGAL_FLOPPY_IS_NOT_SUPPORTED_BY_OS=Cannot ${action} ${type}. Floppy devices are not supported by the operating system. ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_DOES_NOT_SUPPORT_VIRTIO_SCSI=Cannot ${action} ${type}. Selected operation system does not support VirtIO-SCSI. Please disable VirtIO-SCSI for the VM. ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_INCOMPATIBLE_VERSION=Cannot ${action} ${type}. Cluster does not support Single Qxl Pci devices. ACTION_TYPE_FAILED_ILLEGAL_DOMAIN_NAME=Cannot ${action} ${type}. Illegal Domain name: ${Domain}. Domain name has unsupported special character ${Char}. 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..2d0e940 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 @@ -623,6 +623,7 @@ ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_IS_NOT_SUPPORTED_BY_ARCHITECTURE_TYPE=Cannot ${action} ${type}. Selected operating system is not supported by the architecture. ACTION_TYPE_FAILED_ILLEGAL_WATCHDOG_MODEL_IS_NOT_SUPPORTED_BY_OS=Cannot ${action} ${type}. Selected watchdog model is not supported by the operating system. ACTION_TYPE_FAILED_ILLEGAL_VM_DISPLAY_TYPE_IS_NOT_SUPPORTED_BY_OS=Cannot ${action} ${type}. Selected display type is not supported by the operating system. +ACTION_TYPE_FAILED_ILLEGAL_FLOPPY_IS_NOT_SUPPORTED_BY_OS=Cannot ${action} ${type}. Floppy devices are not supported by the operating system. ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_DOES_NOT_SUPPORT_VIRTIO_SCSI=Cannot ${action} ${type}. Selected operation system does not support VirtIO-SCSI. Please disable VirtIO-SCSI for the VM. ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_INCOMPATIBLE_VERSION=Cannot ${action} ${type}. Cluster does not support Single Qxl Pci devices. ACTION_TYPE_FAILED_ILLEGAL_DOMAIN_NAME=Cannot ${action} ${type}. Illegal Domain name: ${Domain}. Domain name has unsupported special character ${Char}. diff --git a/packaging/conf/osinfo-defaults.properties b/packaging/conf/osinfo-defaults.properties index 6a4ce6f..4a2030a 100644 --- a/packaging/conf/osinfo-defaults.properties +++ b/packaging/conf/osinfo-defaults.properties @@ -64,6 +64,7 @@ os.other.devices.network.hotplugSupport.value.3.0 = false os.other.devices.cdInterface.value = ide +os.other.devices.floppySupport.value = true os.other.devices.diskInterfaces.value = IDE, VirtIO os.other.devices.diskInterfaces.value.3.3 = IDE, VirtIO_SCSI, VirtIO os.other.devices.diskInterfaces.value.3.4 = IDE, VirtIO_SCSI, VirtIO @@ -268,6 +269,7 @@ os.other_ppc64.bus.value = 64 os.other_ppc64.devices.network.value = pv, spaprVlan, e1000, rtl8139 os.other_ppc64.devices.cdInterface.value = scsi +os.other_ppc64.devices.floppySupport.value = false os.other_ppc64.devices.diskInterfaces.value.3.3 = VirtIO, VirtIO_SCSI, SPAPR_VSCSI os.other_ppc64.devices.diskInterfaces.value.3.4 = VirtIO, VirtIO_SCSI, SPAPR_VSCSI os.other_ppc64.devices.disk.hotpluggableInterfaces.value.3.3 = VirtIO_SCSI, SPAPR_VSCSI -- To view, visit http://gerrit.ovirt.org/24966 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8fb783bbafa3c6a18e327e4e02aac3d71b6f110b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.4 Gerrit-Owner: Vitor de Lima <vitor.l...@eldorado.org.br> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches