From ac3f2180cbda9c27d42b2b7326fc4aef02c6000b Mon Sep 17 00:00:00 2001 From: Jasper Berton Date: Tue, 17 Dec 2024 13:06:10 +0100 Subject: [PATCH] checkstyle: update code for parenpad and indentation validation Altered code base so no new conflicts arise for newer checkstyle rules Signed-off-by: Jasper Berton --- .../engine/exttool/aaa/AAAServiceImpl.java | 619 ++++---- .../engine/exttool/core/InfoServiceImpl.java | 150 +- .../exttool/logger/LoggerServiceImpl.java | 79 +- .../org/ovirt/engine/core/aaa/AcctUtils.java | 5 +- .../core/aaa/filters/NegotiationFilter.java | 44 +- .../aaa/filters/RestApiSessionMgmtFilter.java | 2 +- .../core/aaa/servlet/SsoPostLoginServlet.java | 2 +- .../engine/core/bll/ActivateVdsCommand.java | 64 +- .../core/bll/AddInternalJobCommand.java | 2 +- .../engine/core/bll/AddPermissionCommand.java | 2 +- .../ovirt/engine/core/bll/AddStepCommand.java | 24 +- .../ovirt/engine/core/bll/AddVmCommand.java | 16 +- .../core/bll/AddVmFromSnapshotCommand.java | 2 +- .../core/bll/AddVmFromTemplateCommand.java | 16 +- .../AttachUserToVmFromPoolAndRunCommand.java | 16 +- .../engine/core/bll/AutoRecoveryManager.java | 2 +- .../org/ovirt/engine/core/bll/Backend.java | 48 +- .../core/bll/ChildCommandsCallbackBase.java | 56 +- .../ovirt/engine/core/bll/CommandBase.java | 4 +- .../engine/core/bll/CommandCompensator.java | 46 +- .../engine/core/bll/CommandsFactory.java | 82 +- .../engine/core/bll/CommonVmPoolCommand.java | 2 +- .../core/bll/CpuFlagsManagerHandler.java | 14 +- .../engine/core/bll/CreateOvaCommand.java | 88 +- .../bll/EventSubscriptionCommandBase.java | 22 +- .../GetAllVmsForUserAndActionGroupQuery.java | 4 +- .../bll/GetArchitectureCapabilitiesQuery.java | 16 +- .../core/bll/GetEventSubscriptionQuery.java | 2 +- .../bll/GetFenceConfigurationValueQuery.java | 2 +- .../bll/GetGraphicsDevicesMultipleQuery.java | 2 +- .../core/bll/GetSystemStatisticsQuery.java | 2 +- .../core/bll/GetVmFromConfigurationQuery.java | 36 +- .../GetVmTemplateFromConfigurationQuery.java | 36 +- .../engine/core/bll/HibernateVmCommand.java | 24 +- .../core/bll/HostMaintenanceCallback.java | 63 +- .../bll/MultipleActionsRunnersFactory.java | 106 +- .../engine/core/bll/ObjectCompensation.java | 16 +- .../ovirt/engine/core/bll/QosQueryBase.java | 22 +- .../engine/core/bll/ReduceImageCommand.java | 16 +- .../core/bll/ReloadConfigurationsCommand.java | 2 +- .../core/bll/RemoveVmTemplateCommand.java | 12 +- .../ovirt/engine/core/bll/ResetVmCommand.java | 4 +- .../ovirt/engine/core/bll/RunVmCommand.java | 180 +-- .../engine/core/bll/RunVmCommandBase.java | 14 +- .../ovirt/engine/core/bll/SearchQuery.java | 154 +- .../core/bll/SetNonOperationalVdsCommand.java | 98 +- .../ovirt/engine/core/bll/StopVmCommand.java | 14 +- .../engine/core/bll/StopVmCommandBase.java | 20 +- .../engine/core/bll/UpdateVmCommand.java | 2 +- .../core/bll/UpdateVmTemplateCommand.java | 18 +- .../engine/core/bll/VdsEventListener.java | 2 +- .../ovirt/engine/core/bll/VdsValidator.java | 20 +- .../org/ovirt/engine/core/bll/VmCommand.java | 18 +- .../org/ovirt/engine/core/bll/VmHandler.java | 68 +- .../engine/core/bll/VmSlaPolicyCommand.java | 8 +- .../core/bll/aaa/SessionDataContainer.java | 4 +- .../bll/eventqueue/EventQueueMonitor.java | 46 +- .../bll/exportimport/ConvertVmCallback.java | 38 +- .../bll/exportimport/ExportVmCommand.java | 48 +- .../exportimport/ExportVmTemplateCommand.java | 16 +- .../ExportVmTemplateToOvaCommand.java | 24 +- .../exportimport/ExportVmToOvaCommand.java | 42 +- .../bll/exportimport/ImportVmCommandBase.java | 20 +- .../ImportVmFromExternalProviderCommand.java | 34 +- .../ImportVmFromExternalUrlCommand.java | 40 +- .../ImportVmTemplateCommandBase.java | 16 +- .../ImportVmTemplateFromOvaCommand.java | 24 +- .../exportimport/vnics/MapVnicContext.java | 2 +- .../bll/gluster/AddGlusterHookCommand.java | 2 +- .../core/bll/gluster/CreateBrickCommand.java | 2 +- .../gluster/CreateGlusterVolumeCommand.java | 82 +- .../CreateGlusterVolumeSnapshotCommand.java | 6 +- .../gluster/GetAddedGlusterServersQuery.java | 2 +- ...etGeoRepSessionsForStorageDomainQuery.java | 2 +- .../GetGlusterVolumeProfileInfoQuery.java | 2 +- .../bll/gluster/GlusterGeoRepSyncJob.java | 4 +- .../GlusterHookStatusChangeCommand.java | 6 +- .../core/bll/gluster/GlusterHookSyncJob.java | 2 +- .../core/bll/gluster/GlusterSyncJob.java | 8 +- .../core/bll/gluster/GlusterTasksSyncJob.java | 56 +- .../bll/gluster/GlusterThinDeviceService.java | 4 +- .../bll/gluster/RemoveGlusterHookCommand.java | 27 +- .../bll/gluster/UpdateGlusterHookCommand.java | 27 +- .../bll/gluster/tasks/GlusterTaskUtils.java | 48 +- .../core/bll/hostdeploy/AddVdsCommand.java | 2 +- .../bll/hostdeploy/HostUpgradeCallback.java | 110 +- .../hostdeploy/HostUpgradeCheckCallback.java | 28 +- .../core/bll/hostdeploy/RegisterVdsQuery.java | 62 +- .../core/bll/kubevirt/KubevirtMonitoring.java | 6 +- .../cluster/ExternalNetworkSyncService.java | 2 +- .../bll/network/cluster/NetworkHelper.java | 10 +- .../bll/network/dc/AddNetworkCommand.java | 20 +- .../bll/network/dc/RemoveNetworkCommand.java | 22 +- .../bll/network/dc/UpdateNetworkCommand.java | 20 +- ...tHostsWithMissingFlagsForClusterQuery.java | 2 +- .../host/UnmanagedNetworkValidator.java | 4 +- .../host/UpdateHostNicVfsConfigCommand.java | 4 +- .../bll/network/host/VfSchedulerImpl.java | 2 +- .../vm/ActivateDeactivateVmNicCommand.java | 34 +- .../network/vm/UpdateVmInterfaceCommand.java | 22 +- .../core/bll/numa/vm/NumaValidator.java | 2 +- .../core/bll/pm/FenceAgentExecutor.java | 16 +- .../core/bll/provider/BaseProviderProxy.java | 2 +- .../bll/provider/ProviderProxyFactory.java | 46 +- .../openstack/BaseNetworkProviderProxy.java | 2 +- .../bll/qos/UpdateHostNetworkQosCommand.java | 4 +- .../core/bll/quota/RemoveQuotaCommand.java | 8 +- .../OvirtGlusterSchedulingService.java | 4 +- .../bll/scheduling/SchedulingManager.java | 86 +- .../ExternalSchedulerDiscoveryResult.java | 46 +- .../policyunits/CpuOverloadPolicyUnit.java | 4 +- .../EvenDistributionBalancePolicyUnit.java | 10 +- ...venGuestDistributionBalancePolicyUnit.java | 6 +- .../PowerSavingBalancePolicyUnit.java | 14 +- .../PowerSavingMemoryWeightPolicyUnit.java | 4 +- .../VmToHostAffinityFilterPolicyUnit.java | 2 +- .../snapshots/CreateSnapshotForVmCommand.java | 14 +- .../snapshots/RemoveDiskSnapshotsCommand.java | 16 +- .../bll/snapshots/RemoveSnapshotCommand.java | 14 +- .../RemoveSnapshotSingleDiskLiveCommand.java | 96 +- .../snapshots/RestoreAllSnapshotsCommand.java | 168 +-- .../snapshots/RestoreFromSnapshotCommand.java | 20 +- .../core/bll/snapshots/SnapshotsManager.java | 2 +- .../TryBackToAllSnapshotsOfVmCommand.java | 18 +- .../bll/storage/FenceVdsManualyCommand.java | 30 +- .../backup/CreateScratchDiskCommand.java | 2 +- .../backup/DbEntityCleanupManager.java | 4 +- ...orageConnectionToStorageDomainCommand.java | 2 +- .../connection/CINDERStorageHelper.java | 2 +- .../ConnectStorageToVdsCommand.java | 2 +- .../connection/DiscoverSendTargetsQuery.java | 2 +- .../RemoveStorageServerConnectionCommand.java | 33 +- .../UpdateStorageServerConnectionCommand.java | 51 +- .../storage/disk/AbstractDiskVmCommand.java | 78 +- .../core/bll/storage/disk/AddDiskCommand.java | 36 +- .../disk/HotUnPlugDiskFromVmCommand.java | 4 +- .../storage/disk/MoveOrCopyDiskCommand.java | 39 +- .../bll/storage/disk/RemoveDiskCommand.java | 100 +- .../storage/disk/SparsifyImageCommand.java | 16 +- .../bll/storage/disk/UpdateDiskCommand.java | 14 +- .../cinder/AddCinderDiskCommandCallback.java | 12 +- .../CloneSingleCinderDiskCommandCallback.java | 12 +- .../CreateCinderSnapshotCommandCallback.java | 12 +- .../ExtendCinderDiskCommandCallback.java | 12 +- ...RemoveCinderDiskVolumeCommandCallback.java | 6 +- .../RemoveCinderSnapshotCommandCallback.java | 6 +- .../image/AmendImageGroupVolumesCommand.java | 16 +- .../disk/image/CopyImageGroupCommand.java | 48 +- .../image/CopyImageGroupWithDataCommand.java | 6 +- .../image/CopyManagedBlockDiskCommand.java | 31 +- .../bll/storage/disk/image/DisksFilter.java | 2 +- .../disk/image/ExtendImageSizeCommand.java | 2 +- .../bll/storage/disk/image/ImagesHandler.java | 12 +- .../disk/image/RemoveImageCommand.java | 16 +- .../disk/image/TransferDiskImageCommand.java | 54 +- .../domain/AddSANStorageDomainCommand.java | 2 +- ...vateStorageDomainWithOvfUpdateCommand.java | 36 +- ...tUnregisteredBlockStorageDomainsQuery.java | 2 +- ...mportHostedEngineStorageDomainCommand.java | 24 +- .../domain/IsoDomainListSynchronizer.java | 22 +- .../ReduceSANStorageDomainDevicesCommand.java | 14 +- .../domain/RefreshLunsSizeCommand.java | 6 +- ...moveDeviceFromSANStorageDomainCommand.java | 12 +- .../domain/RemoveStorageDomainCommand.java | 4 +- .../dr/GlusterStorageGeoRepSyncCallback.java | 24 +- .../storage/dr/GlusterStorageSyncCommand.java | 42 +- .../storage/lsm/LiveMigrateDiskCommand.java | 4 +- .../ovfstore/OvfUpdateProcessHelper.java | 2 +- .../repoimage/ExportRepoImageCommand.java | 2 +- .../core/bll/tasks/CommandAsyncTask.java | 30 +- .../bll/tasks/CommandCallbacksPoller.java | 2 +- .../bll/tasks/CommandCoordinatorUtil.java | 4 +- .../engine/core/bll/tasks/CommandHelper.java | 10 +- .../core/bll/tasks/CommandsRepository.java | 2 +- .../engine/core/bll/tasks/SPMAsyncTask.java | 38 +- .../core/bll/utils/CompensationUtils.java | 14 +- .../engine/core/bll/utils/GlusterUtil.java | 50 +- .../engine/core/bll/utils/VmDeviceUtils.java | 12 +- .../core/bll/validator/VmValidator.java | 20 +- .../storage/DiskImagesValidator.java | 14 +- .../MultipleStorageDomainsValidator.java | 2 +- .../storage/StorageDomainValidator.java | 2 +- .../common/utils/InternalThreadExecutor.java | 12 +- .../common/utils/ansible/AnsibleExecutor.java | 14 +- .../AddRoleWithActionGroupsCommandTest.java | 3 +- .../core/bll/AddUnmanagedVmsCommandTest.java | 8 +- .../AddUserProfilePropertyCommandTest.java | 10 +- .../bll/AddVmFromSnapshotCommandTest.java | 3 +- .../bll/AddVmFromTemplateCommandTest.java | 4 +- .../engine/core/bll/CommandEnumTestUtils.java | 2 +- .../ovirt/engine/core/bll/CtorsTestBase.java | 2 +- .../UpdateUserProfilePropertyCommandTest.java | 10 +- .../engine/core/bll/UpdateVmCommandTest.java | 3 +- .../engine/core/bll/ValidateTestUtils.java | 6 +- .../exportimport/vnics/MapVnicFlowTest.java | 2 +- .../exportimport/vnics/MapVnicsFlowTest.java | 8 +- .../vnics/MatchUserMappingToOvfVnicTest.java | 2 +- ...GlusterVolumeGeoRepSessionCommandTest.java | 7 +- .../GetGlusterVolumeBricksQueryTest.java | 2 +- .../bll/gluster/GlusterHookCommandTest.java | 6 +- .../bll/gluster/GlusterHookSyncJobTest.java | 2 +- .../bll/gluster/GlusterTasksSyncJobTest.java | 2 +- ...GlusterVolumeGeoRepSessionCommandTest.java | 2 +- .../gluster/RemoveGlusterHookCommandTest.java | 2 +- .../ResetGlusterVolumeOptionsCommandTest.java | 2 +- .../gluster/UpdateGlusterHookCommandTest.java | 2 +- .../RefreshHostDevicesCommandTest.java | 72 +- .../AutodefineExternalNetworkCommandTest.java | 3 +- .../host/CopyHostNetworksHelperTest.java | 46 +- .../host/GetTlvsByHostNicIdQueryTest.java | 2 +- .../host/HostSetupNetworksValidatorTest.java | 2 +- ...ingMacsInUpdateVmInterfaceCommandTest.java | 6 +- .../SingleAgentFenceActionExecutorTest.java | 110 +- .../bll/profiles/DiskProfileHelperTest.java | 6 +- .../SyncNetworkProviderCommandTest.java | 2 +- .../core/bll/quota/QuotaDependencyTest.java | 24 +- .../core/bll/scheduling/CommonTestMocks.java | 6 +- .../arem/AffinityRulesEnforcerTest.java | 2 +- .../VmToHostAffinityFilterPolicyUnitTest.java | 3 +- .../CreateSnapshotForVmCommandTest.java | 30 +- .../RestoreAllSnapshotsCommandTest.java | 8 +- ...AddStorageServerConnectionCommandTest.java | 12 +- ...rConnectionToStorageDomainCommandTest.java | 54 +- ...oveStorageServerConnectionCommandTest.java | 2 +- ...ateStorageServerConnectionCommandTest.java | 52 +- ...AbstractGetDisksAndSnapshotsQueryTest.java | 96 +- .../bll/storage/disk/AddDiskCommandTest.java | 25 +- .../disk/HotPlugDiskToVmCommandTest.java | 6 +- .../storage/disk/UpdateDiskCommandTest.java | 8 +- .../AmendImageGroupVolumesCommandTest.java | 3 +- .../storage/disk/image/DisksFilterTest.java | 38 +- ...torageForUnregisteredDisksCommandTest.java | 2 +- .../disk/lun/GetLunsByVgIdQueryTest.java | 6 +- .../ActivateStorageDomainCommandTest.java | 5 +- .../domain/AddStorageDomainCommonTest.java | 43 +- .../RemoveStorageDomainCommandTest.java | 4 +- .../domain/StorageDomainCommandBaseTest.java | 4 +- .../pool/CleanFinishedTasksCommandTest.java | 20 +- .../pool/ForceSelectSPMCommandTest.java | 29 +- .../SwitchMasterStorageDomainCommandTest.java | 37 +- .../pool/UpdateStoragePoolCommandTest.java | 2 +- ...StorageDiscardFunctionalityHelperTest.java | 10 +- .../engine/core/bll/utils/NumaTestUtils.java | 4 +- .../validator/storage/DiskValidatorTest.java | 4 +- .../StorageDomainValidatorFreeSpaceTest.java | 6 +- .../engine/core/branding/BrandingTheme.java | 8 +- .../core/branding/BrandingThemeTest.java | 10 +- .../aaa/builtin/internal/InternalAuthn.java | 2 +- .../aaa/builtin/internal/InternalAuthz.java | 6 +- .../common/action/RemoveVdsParameters.java | 4 +- .../SyncGlusterStorageDevicesParameter.java | 4 +- .../asynctasks/gluster/GlusterTaskType.java | 16 +- .../core/common/businessentities/Cluster.java | 12 +- .../businessentities/ClusterHostsAndVMs.java | 4 +- .../core/common/businessentities/Label.java | 4 +- .../core/common/businessentities/Role.java | 2 +- .../businessentities/StorageDomainStatic.java | 2 +- .../core/common/businessentities/VDS.java | 22 +- .../common/businessentities/VMStatus.java | 40 +- .../common/businessentities/VdsDynamic.java | 4 +- .../common/businessentities/VdsStatic.java | 6 +- .../core/common/businessentities/VmBase.java | 6 +- .../core/common/businessentities/VmPool.java | 2 +- .../common/businessentities/VmTemplate.java | 2 +- .../VmWithStatusForExclusiveLock.java | 4 +- .../gluster/GlusterBrickEntity.java | 4 +- .../gluster/GlusterHookConflictFlags.java | 2 +- .../gluster/GlusterLocalVolumeInfo.java | 2 +- .../gluster/GlusterServerHook.java | 10 +- .../gluster/GlusterVolumeEntity.java | 2 +- .../businessentities/gluster/MallInfo.java | 2 +- .../gluster/StorageSyncSchedule.java | 48 +- .../network/ExternalVnicProfileMapping.java | 2 +- .../businessentities/network/VmNic.java | 34 +- .../profiles/ProfileBase.java | 2 +- .../core/common/flow/AbstractHandler.java | 32 +- .../core/common/queries/VmIconIdSizePair.java | 2 +- .../core/common/utils/IPAddressConverter.java | 6 +- .../core/common/utils/LocationInfoHelper.java | 12 +- .../common/utils/MapNetworkAttachments.java | 2 +- .../core/common/utils/NetworkCommonUtils.java | 12 +- .../core/common/utils/RpmVersionUtils.java | 18 +- .../core/common/utils/ToStringBuilder.java | 18 +- .../core/common/utils/VmCommonUtils.java | 18 +- .../common/utils/VmDeviceCommonUtils.java | 152 +- .../validation/ConfiguredRangeValidator.java | 2 +- .../VmActionByVmOriginTypeValidator.java | 4 +- .../MigrateStatusVDSCommandParameters.java | 2 +- .../common/businessentities/EntitiesTest.java | 8 +- .../core/common/utils/CidrAnnotationTest.java | 8 +- .../common/utils/IPAddressConverterTest.java | 32 +- .../common/utils/IPAddressPatternTest.java | 76 +- .../NetworkLabelFormatValidatorTest.java | 16 +- .../common/utils/NumaPinningHelperTest.java | 36 +- .../common/utils/ValidNameValidatorTest.java | 20 +- .../common/utils/ValidationUtilsTest.java | 4 +- .../pm/FenceProxySourceTypeHelperTest.java | 10 +- .../validation/IPv4MaskValidatorTest.java | 2 +- .../engine/core/compat/RegexOptions.java | 2 +- .../org/ovirt/engine/core/compat/Version.java | 32 +- .../auditloghandling/AuditLogDirector.java | 22 +- .../auditloghandling/MessageResolver.java | 16 +- .../ovirt/engine/core/dao/DiskDaoImpl.java | 10 +- .../ovirt/engine/core/dao/DiskImageDao.java | 2 +- .../org/ovirt/engine/core/dao/StepDao.java | 2 +- .../core/dao/StorageDomainDRDaoImpl.java | 10 +- .../ovirt/engine/core/dao/VdsDynamicDao.java | 2 +- .../engine/core/dao/VdsSpmIdMapDaoImpl.java | 2 +- .../engine/core/dao/VmDeviceDaoImpl.java | 4 +- .../ovirt/engine/core/dao/VmJobDaoImpl.java | 24 +- .../core/dao/gluster/GlusterDBUtils.java | 16 +- .../core/dao/gluster/GlusterGeoRepDao.java | 2 +- .../core/dao/gluster/GlusterHooksDaoImpl.java | 2 +- .../core/dao/gluster/StorageDeviceDao.java | 2 +- .../core/dao/network/InterfaceDaoImpl.java | 52 +- .../core/dao/provider/ProviderDaoImpl.java | 100 +- .../core/dao/qos/AllQosBaseDaoImpl.java | 22 +- .../core/dao/BaseGenericDaoTestCase.java | 2 +- .../engine/core/dao/BaseReadDaoTestCase.java | 2 +- .../dao/BusinessEntitySnapshotDaoTest.java | 2 +- .../dao/ImageStorageDomainMapDaoTest.java | 3 +- .../engine/core/dao/MultiThreadedDaoTest.java | 6 +- .../engine/core/dao/StorageDomainDaoTest.java | 10 +- .../core/dao/StoragePoolIsoMapDaoTest.java | 2 +- .../dao/StorageServerConnectionDaoTest.java | 12 +- .../engine/core/dao/VmStaticDaoTest.java | 4 +- .../engine/core/dao/VmTemplateDaoTest.java | 4 +- .../gluster/GlusterClusterServiceDaoTest.java | 16 +- .../dao/network/InterfaceDaoImplTest.java | 2 +- .../core/sso/api/AuthenticationException.java | 2 +- .../ovirt/engine/core/sso/api/SsoContext.java | 2 +- .../ovirt/engine/core/sso/api/SsoSession.java | 4 +- .../core/sso/service/ExternalOIDCService.java | 2 +- .../sso/service/NegotiateAuthService.java | 124 +- .../InteractiveNegotiateAuthServlet.java | 24 +- .../core/sso/servlets/OAuthTokenServlet.java | 40 +- .../sso/servlets/OpenIdAuthorizeServlet.java | 22 +- .../core/extensions/mgr/ExtensionProxy.java | 44 +- .../extensions/mgr/ExtensionsManager.java | 16 +- .../org/ovirt/engine/api/rsdl/ParamData.java | 2 +- .../ovirt/engine/api/rsdl/RsdlBuilder.java | 10 +- .../ovirt/engine/api/rsdl/RsdlManager.java | 8 +- .../ovirt/engine/api/rsdl/SchemaBuilder.java | 2 +- .../ovirt/engine/api/utils/ArrayUtils.java | 2 +- .../api/utils/InvalidValueException.java | 2 +- .../ovirt/engine/api/utils/LinkCreator.java | 10 +- .../api/restapi/invocation/CurrentFilter.java | 28 +- .../AbstractBackendActionableResource.java | 26 +- .../resource/AbstractBackendResource.java | 2 +- ...tBackendStorageDomainContentsResource.java | 18 +- .../restapi/resource/BackendApiResource.java | 2 +- .../BackendAssignedPermissionsResource.java | 6 +- .../BackendClusterFeaturesResource.java | 2 +- .../BackendClusterLevelsResource.java | 6 +- .../resource/BackendClusterResource.java | 2 +- .../resource/BackendDataCenterResource.java | 2 +- .../restapi/resource/BackendHostResource.java | 26 +- .../BackendImageTransferResource.java | 3 +- ...dInstanceTypeGraphicsConsolesResource.java | 2 +- .../restapi/resource/BackendJobResource.java | 4 +- .../restapi/resource/BackendQosResource.java | 20 +- .../restapi/resource/BackendQossResource.java | 40 +- .../api/restapi/resource/BackendResource.java | 2 +- .../restapi/resource/BackendStepResource.java | 42 +- .../resource/BackendStepsResource.java | 2 +- ...endStorageDomainDiskSnapshotsResource.java | 4 +- .../BackendStorageDomainResource.java | 14 +- .../BackendStorageDomainTemplateResource.java | 14 +- .../BackendStorageDomainVmResource.java | 14 +- .../BackendStorageDomainsResource.java | 100 +- ...ackendStorageServerConnectionResource.java | 2 +- ...ckendStorageServerConnectionsResource.java | 34 +- .../BackendTemplateCdromResource.java | 10 +- ...ckendTemplateGraphicsConsolesResource.java | 2 +- .../resource/BackendVmBackupDiskResource.java | 2 +- .../BackendVmCheckpointDiskResource.java | 2 +- .../restapi/resource/BackendVmResource.java | 2 +- .../resource/BackendVmSessionsResource.java | 6 +- .../resource/BrickStatisticalQuery.java | 2 +- .../resource/DiskStatisticalQuery.java | 6 +- .../resource/HostStatisticalQuery.java | 8 +- .../restapi/resource/VmStatisticalQuery.java | 26 +- .../resource/VolumeStatisticalQuery.java | 2 +- .../resource/aaa/BackendDomainResource.java | 2 +- .../resource/aaa/BackendGroupsResource.java | 2 +- .../resource/aaa/BackendUserResource.java | 30 +- .../resource/aaa/BackendUsersResource.java | 22 +- .../gluster/BackendGlusterHookResource.java | 14 +- .../resource/validation/UsageFinder.java | 20 +- .../api/restapi/util/ErrorMessageHelper.java | 44 +- .../api/restapi/util/VersionHelper.java | 16 +- .../restapi/util/links/EntityLocationMap.java | 2 +- .../xml/JAXBValidationEventHandler.java | 10 +- .../resource/AbstractBackendBaseTest.java | 16 +- .../AbstractBackendNetworksResourceTest.java | 2 +- .../resource/BackendApiResourceTest.java | 60 +- ...BackendAssignedCpuProfileResourceTest.java | 3 +- ...endAttachedStorageDomainsResourceTest.java | 6 +- .../BackendClusterNetworkResourceTest.java | 2 +- .../resource/BackendEventsResourceTest.java | 2 +- .../BackendExportDomainDiskResourceTest.java | 44 +- .../BackendExportDomainDisksResourceTest.java | 48 +- ...ndExternalTemplateImportsResourceTest.java | 20 +- .../resource/BackendHostNicResourceTest.java | 14 +- .../resource/BackendHostResourceTest.java | 14 +- .../resource/BackendHostsResourceTest.java | 2 +- .../resource/BackendIconsResourceTest.java | 10 +- .../resource/BackendNetworksResourceTest.java | 2 +- .../resource/BackendQuotasResourceTest.java | 6 +- .../resource/BackendStepsResourceTest.java | 7 +- ...ackendStorageDomainImagesResourceTest.java | 2 +- ...geDomainServerConnectionsResourceTest.java | 8 +- ...kendStorageDomainTemplateResourceTest.java | 80 +- ...endStorageDomainTemplatesResourceTest.java | 36 +- .../BackendStorageDomainVmResourceTest.java | 68 +- .../BackendStorageDomainVmsResourceTest.java | 24 +- .../BackendStorageDomainsResourceTest.java | 26 +- ...ndStorageServerConnectionResourceTest.java | 8 +- ...dStorageServerConnectionsResourceTest.java | 10 +- .../BackendTemplateDiskResourceTest.java | 8 +- .../BackendTemplateDisksResourceTest.java | 2 +- .../BackendTemplatesResourceTest.java | 66 +- .../resource/BackendVmCdromResourceTest.java | 2 +- .../resource/BackendVmDiskResourceTest.java | 2 +- .../resource/BackendVmResourceTest.java | 14 +- .../resource/BackendVmsResourceTest.java | 40 +- .../BackendVnicProfileResourceTest.java | 4 +- .../aaa/BackendDomainGroupResourceTest.java | 2 +- .../resource/validation/UsageFinderTest.java | 2 +- .../restapi/util/FenceOptionsParserTest.java | 2 +- .../engine/api/restapi/types/CPUMapper.java | 40 +- .../api/restapi/types/ClusterMapper.java | 36 +- .../api/restapi/types/DataCenterMapper.java | 62 +- .../engine/api/restapi/types/DiskMapper.java | 274 ++-- .../engine/api/restapi/types/EventMapper.java | 40 +- .../types/EventSubscriptionMapper.java | 1276 ++++++++--------- .../restapi/types/ExternalStatusMapper.java | 48 +- .../api/restapi/types/GlusterBrickMapper.java | 18 +- .../api/restapi/types/GlusterHookMapper.java | 42 +- .../restapi/types/GlusterVolumeMapper.java | 148 +- .../engine/api/restapi/types/HostMapper.java | 136 +- .../api/restapi/types/HostNicMapper.java | 18 +- .../engine/api/restapi/types/ImageMapper.java | 26 +- .../restapi/types/ImageTransferMapper.java | 12 +- .../restapi/types/InitializationMapper.java | 24 +- .../restapi/types/Ipv4BootProtocolMapper.java | 44 +- .../restapi/types/Ipv6BootProtocolMapper.java | 48 +- .../engine/api/restapi/types/JobMapper.java | 40 +- .../api/restapi/types/MappingLocator.java | 14 +- .../restapi/types/MigrationOptionsMapper.java | 68 +- .../api/restapi/types/NetworkMapper.java | 12 +- .../engine/api/restapi/types/NicMapper.java | 64 +- .../engine/api/restapi/types/NumaMapper.java | 32 +- .../api/restapi/types/PermissionMapper.java | 72 +- .../api/restapi/types/PolicyUnitMapper.java | 36 +- .../engine/api/restapi/types/QosMapper.java | 76 +- .../api/restapi/types/QosTypeMapper.java | 13 +- .../engine/api/restapi/types/QuotaMapper.java | 2 +- .../restapi/types/ReportedDeviceMapper.java | 16 +- .../api/restapi/types/SerialNumberMapper.java | 24 +- .../api/restapi/types/SnapshotMapper.java | 36 +- .../engine/api/restapi/types/StepMapper.java | 52 +- .../restapi/types/StorageDomainMapper.java | 482 +++---- .../restapi/types/StorageFormatMapper.java | 50 +- .../types/StorageLogicalUnitMapper.java | 16 +- .../api/restapi/types/SwitchTypeMapper.java | 24 +- .../api/restapi/types/TemplateMapper.java | 16 +- .../api/restapi/types/TpmSupportMapper.java | 16 +- .../api/restapi/types/VmBackupMapper.java | 38 +- .../api/restapi/types/VmBaseMapper.java | 84 +- .../engine/api/restapi/types/VmMapper.java | 334 ++--- .../api/restapi/types/WatchdogMapper.java | 72 +- .../OpenStackNetworkProviderMapper.java | 16 +- ...penStackVolumeAuthenticationKeyMapper.java | 16 +- .../api/restapi/utils/aaa/AuthzUtils.java | 8 +- .../types/GlusterBrickDetailMapperTest.java | 30 +- .../api/restapi/types/MappingTestHelper.java | 4 +- .../core/searchbackend/ADSyntaxChecker.java | 362 ++--- .../AuditCrossRefAutoCompleter.java | 14 +- .../BaseConditionFieldAutoCompleter.java | 48 +- .../searchbackend/SqlInjectionChecker.java | 42 +- .../StorageDomainCrossRefAutoCompleter.java | 13 +- .../StoragePoolCrossRefAutoCompleter.java | 8 +- .../core/searchbackend/SyntaxChecker.java | 906 ++++++------ .../TemplateCrossRefAutoCompleter.java | 25 +- .../TimeConditionRelationAutoCompleter.java | 2 +- .../UserCrossRefAutoCompleter.java | 21 +- .../VdcUserConditionFieldAutoCompleter.java | 2 +- .../VdsCrossRefAutoCompleter.java | 20 +- .../VmCrossRefAutoCompleter.java | 25 +- ...sterVolumeConditionFieldAutoCompleter.java | 36 +- .../searchbackend/SyntaxContainerTest.java | 20 +- .../engine/core/services/RegisterServlet.java | 5 +- .../engine/core/utils/MemoizingSupplier.java | 12 +- .../engine/core/utils/ObjectDescriptor.java | 2 +- .../engine/core/utils/OsRepositoryImpl.java | 22 +- .../core/utils/db/StandaloneDataSource.java | 12 +- .../engine/core/utils/kubevirt/Units.java | 22 +- .../engine/core/utils/log/LoggedUtils.java | 66 +- .../engine/core/utils/ovf/OvfOvaReader.java | 130 +- .../engine/core/utils/ovf/OvfOvaVmWriter.java | 4 +- .../engine/core/utils/ovf/OvfOvaWriter.java | 162 +-- .../engine/core/utils/ovf/OvfOvirtReader.java | 12 +- .../engine/core/utils/ovf/OvfOvirtWriter.java | 20 +- .../engine/core/utils/ovf/OvfReader.java | 104 +- .../core/utils/ovf/OvfReaderWriterUtils.java | 44 +- .../engine/core/utils/ovf/OvfVmWriter.java | 4 +- .../engine/core/utils/ovf/OvfWriter.java | 24 +- .../core/utils/pm/FenceConfigHelper.java | 66 +- .../utils/transaction/TransactionSupport.java | 16 +- .../core/utils/vdshooks/VdsHooksParser.java | 92 +- ...workInSyncWithVdsNetworkInterfaceTest.java | 2 +- .../ovirt/engine/core/utils/OSParserTest.java | 2 +- .../json/JsonObjectSerializerTest.java | 10 +- .../core/utils/servlet/ServletUtilsTest.java | 188 +-- .../uutils/cli/parser/ArgumentsParser.java | 4 +- .../core/uutils/config/ShellLikeConfd.java | 10 +- .../core/uutils/net/HttpClientBuilder.java | 2 +- .../uutils/net/HttpURLConnectionBuilder.java | 2 +- .../core/uutils/servlet/ProxyServletBase.java | 2 +- .../core/uutils/ssh/OpenSSHUtilsTest.java | 352 ++--- .../ovirt/engine/core/uutils/ssh/SSHD.java | 6 +- .../IsVmDuringInitiatingVDSCommand.java | 2 +- .../core/vdsbroker/ResourceManager.java | 18 +- .../engine/core/vdsbroker/VdsManager.java | 124 +- .../builder/vminfo/LibvirtVmXmlBuilder.java | 874 +++++------ .../builder/vminfo/VmInfoBuildUtils.java | 166 +-- .../gluster/AbstractGlusterBrokerCommand.java | 224 +-- .../gluster/AddGlusterHookVDSCommand.java | 2 +- .../GetGlusterHookContentVDSCommand.java | 2 +- .../gluster/RemoveGlusterHookVDSCommand.java | 2 +- .../ResetGlusterVolumeBrickVDSCommand.java | 2 +- .../gluster/UpdateGlusterHookVDSCommand.java | 2 +- .../CloneImageGroupStructureVDSCommand.java | 2 +- .../ExtendStorageDomainVDSCommand.java | 14 +- .../irsbroker/GetVolumesListVDSCommand.java | 14 +- .../vdsbroker/irsbroker/IrsProxyImpl.java | 48 +- .../irsbroker/RemoveVMVDSCommand.java | 14 +- .../irsbroker/UpdateVMVDSCommand.java | 14 +- .../vdsbroker/jsonrpc/JsonRpcVdsServer.java | 64 +- .../core/vdsbroker/libvirt/VmConverter.java | 56 +- .../vdsbroker/monitoring/HostMonitoring.java | 2 +- .../MultipleServicesMonitoringStrategy.java | 12 +- .../monitoring/PollVmStatsRefresher.java | 14 +- .../monitoring/RefresherFactory.java | 16 +- .../core/vdsbroker/monitoring/VmAnalyzer.java | 276 ++-- .../monitoring/VmDevicesMonitoring.java | 22 +- .../kubevirt/KubevirtVmStatsRefresher.java | 28 +- .../vdsbroker/BrokerCommandBase.java | 318 ++-- .../vdsbroker/CancelMigrateVDSCommand.java | 16 +- .../ConnectStoragePoolVDSCommand.java | 36 +- .../ConnectStorageServerVDSCommand.java | 20 +- .../vdsbroker/ConvertOvaVDSCommand.java | 6 +- .../vdsbroker/ConvertVmVDSCommand.java | 6 +- .../vdsbroker/CreateBrokerVDSCommand.java | 76 +- .../CreateStoragePoolVDSCommand.java | 24 +- .../vdsbroker/DestroyVDSCommand.java | 27 +- .../vdsbroker/HSMClearTaskVDSCommand.java | 14 +- .../vdsbroker/HSMGetTaskStatusVDSCommand.java | 16 +- .../vdsbroker/HSMRevertTaskVDSCommand.java | 6 +- .../vdsbroker/HotPlugNicVDSCommand.java | 64 +- .../vdsbroker/vdsbroker/IgnitionHandler.java | 8 +- .../vdsbroker/MultipathHealthHandler.java | 6 +- .../vdsbroker/SpmStatusVDSCommand.java | 14 +- .../vdsbroker/SpmStopVDSCommand.java | 24 +- .../vdsbroker/VdsBrokerObjectsBuilder.java | 92 +- .../VerifyUntrustedVolumeVDSCommand.java | 4 +- .../monitoring/LunDisksMonitoringTest.java | 18 +- .../monitoring/VmJobsMonitoringTest.java | 6 +- .../HostNetworkAttachmentsPersisterTest.java | 2 +- .../vdsbroker/VmSerialNumberBuilderTest.java | 2 +- .../org/ovirt/engine/core/WelcomeServlet.java | 2 +- .../ssoreg/db/StandaloneDataSource.java | 12 +- .../engine/core/config/EngineConfigLogic.java | 54 +- .../engine/core/config/entity/ConfigKey.java | 2 +- .../core/config/entity/ConfigKeyFactory.java | 2 +- .../helper/CustomPropertiesValueHelper.java | 20 +- .../entity/helper/DoubleValueHelper.java | 14 +- .../entity/helper/PasswordValueHelper.java | 6 +- .../core/config/validation/GetValidator.java | 6 +- .../ovirt/engine/core/cryptotool/Main.java | 97 +- .../core/notifier/NotificationService.java | 4 +- .../utils/NotificationProperties.java | 8 +- .../core/notifier/utils/ShutdownHook.java | 2 +- .../filter/FirstMatchSimpleFilterTest.java | 8 +- .../ovirt/engine/ui/frontend/Frontend.java | 260 ++-- .../GWTRPCCommunicationProvider.java | 164 +-- .../frontend/server/dashboard/Dashboard.java | 4 +- .../dashboard/DashboardDataServlet.java | 18 +- .../ui/frontend/utils/GlusterVolumeUtils.java | 26 +- .../ui/frontend/ConstantsWithLookupTest.java | 2 +- .../GWTRPCCommunicationProviderTest.java | 96 +- ...AbstractGwtDynamicHostPageServletTest.java | 2 +- .../common/editor/UiCommonEditorVisitor.java | 2 +- .../presenter/AbstractSubTabPresenter.java | 2 +- .../OvirtBreadCrumbsPresenterWidget.java | 2 +- ...stractPermissionsPopupPresenterWidget.java | 4 +- .../ui/common/system/BaseApplicationInit.java | 2 +- .../ui/common/system/ClientStorageImpl.java | 28 +- .../engine/ui/common/uicommon/NoVncImpl.java | 20 +- .../uicommon/WebClientConsoleInvoker.java | 4 +- .../ui/common/utils/ConsoleUtilsImpl.java | 20 +- .../AbstractModelBoundWidgetPopupView.java | 2 +- .../common/view/popup/ConsolePopupView.java | 62 +- .../engine/ui/common/widget/MenuBar.java | 26 +- .../engine/ui/common/widget/SliderBar.java | 194 +-- .../widget/editor/DaysOfMonthSelector.java | 4 +- .../widget/editor/EntityModelCellTable.java | 20 +- .../ui/common/widget/editor/RadioGroup.java | 2 +- .../editor/generic/ListModelSearchBox.java | 2 +- .../widget/label/ResiliencePolicyLabel.java | 16 +- .../widget/table/AbstractActionTable.java | 4 +- .../widget/table/ColumnResizeCellTable.java | 2 +- .../widget/table/SimpleActionTable.java | 2 +- .../table/column/AuditLogSeverityColumn.java | 18 +- .../table/column/DiskImageStatusColumn.java | 16 +- .../column/DiskTransferProgressColumn.java | 120 +- .../table/column/PermissionTypeColumn.java | 12 +- .../table/column/SnapshotStatusColumn.java | 16 +- .../column/VmDeviceGeneralTypeColumn.java | 132 +- .../common/widget/tooltip/OvirtPopover.java | 2 +- .../widget/tree/AbstractSubTabTree.java | 2 +- .../disks/DisksContentTypeSelectionList.java | 2 +- .../uicommon/disks/DisksViewColumns.java | 2 +- .../permissions/PermissionListModelTable.java | 18 +- .../uicommon/popup/AbstractVmPopupWidget.java | 28 +- .../popup/vm/VmDiskAttachPopupWidget.java | 12 +- .../VmHighPerformanceConfigurationWidget.java | 2 +- .../vm/VmNextRunConfigurationWidget.java | 2 +- .../VmSnapshotCustomPreviewPopupWidget.java | 2 +- .../uicommon/storage/IscsiStorageView.java | 16 +- .../widget/uicommon/tasks/TaskWidget.java | 20 +- .../uicommon/tasks/ToastNotification.java | 18 +- .../TemplateInterfaceListModelTable.java | 46 +- .../uicommon/vm/VmGeneralModelForm.java | 2 +- .../uicommon/vm/VmSnapshotListViewItem.java | 16 +- .../binding/ElementIdTypeParserTest.java | 10 +- .../java/util/StringTokenizer.java | 3 +- .../engine/core/compat/FormatterJava.java | 565 ++++---- .../engine/ui/uicommonweb/HtmlParameters.java | 2 +- .../MigrationsModelToEntityBuilder.java | 16 +- .../dataprovider/AsyncDataProvider.java | 42 +- .../models/ApplySearchStringEvent.java | 112 +- .../ui/uicommonweb/models/ListModel.java | 28 +- .../models/OvirtSelectionModel.java | 50 +- .../models/SearchableListModel.java | 4 +- .../ui/uicommonweb/models/VmConsoles.java | 2 +- .../autocomplete/SearchSuggestModel.java | 2 +- .../models/clusters/ClusterGeneralModel.java | 15 +- .../models/clusters/ClusterGuideModel.java | 4 +- .../models/clusters/ClusterListModel.java | 38 +- .../models/clusters/ClusterModel.java | 90 +- .../clusters/ClusterNetworkListModel.java | 6 +- .../clusters/ClusterNetworkManageModel.java | 6 +- .../labels/model/AffinityLabelModel.java | 6 +- .../configure/roles_ui/RoleListModel.java | 26 +- .../configure/roles_ui/RoleTreeView.java | 2 +- .../scheduling/NewClusterPolicyModel.java | 2 +- .../model/AffinityGroupModel.java | 6 +- .../datacenters/ClusterNewNetworkModel.java | 6 +- .../datacenters/DataCenterGuideModel.java | 2 +- .../models/datacenters/DataCenterModel.java | 8 +- .../NetworkQosParametersModel.java | 18 +- .../models/datacenters/NewNetworkModel.java | 2 +- .../qos/CpuQosParametersModel.java | 7 +- .../qos/StorageQosMetricParametersModel.java | 6 +- .../models/disks/DiskListModel.java | 2 +- .../DnsConfigurationModel.java | 2 +- .../models/events/AlertListModel.java | 2 +- .../models/gluster/CreateBrickModel.java | 7 +- .../gluster/GlusterVolumeSnapshotModel.java | 2 +- .../models/gluster/VolumeBrickListModel.java | 90 +- .../models/gluster/VolumeBrickModel.java | 102 +- .../models/gluster/VolumeGeoRepListModel.java | 20 +- .../models/gluster/VolumeModel.java | 2 +- .../models/hosts/FenceAgentListModel.java | 2 +- .../models/hosts/HostInterfaceListModel.java | 12 +- .../uicommonweb/models/hosts/HostModel.java | 12 +- .../models/hosts/HostSetupNetworksModel.java | 66 +- .../models/hosts/NetworkAttachmentModel.java | 20 +- .../models/hosts/SetupNetworksBondModel.java | 8 +- .../models/hosts/VfsConfigModel.java | 2 +- .../models/pools/PoolListModel.java | 2 +- .../models/profiles/ProfileListModel.java | 12 +- .../models/profiles/VnicProfileModel.java | 19 +- .../models/providers/KVMPropertiesModel.java | 10 +- .../models/providers/ProviderModel.java | 48 +- .../providers/VmwarePropertiesModel.java | 18 +- .../models/providers/XENPropertiesModel.java | 4 +- .../models/quota/QuotaTemplateListModel.java | 6 +- .../models/quota/QuotaVmListModel.java | 6 +- .../models/storage/DiskOperationsHelper.java | 2 +- .../models/storage/DisksAllocationModel.java | 6 +- .../ImportExportRepoImageBaseModel.java | 2 +- .../models/storage/ImportRepoImageModel.java | 4 +- .../models/storage/ManageBackupModel.java | 12 +- .../models/storage/MoveOrCopyDiskModel.java | 2 +- .../models/storage/NfsStorageModel.java | 4 +- .../models/storage/RegisterEntityModel.java | 8 +- .../storage/StorageDataCenterListModel.java | 4 +- .../models/storage/StorageListModel.java | 64 +- .../models/storage/StorageModel.java | 14 +- .../models/storage/TemplateBackupModel.java | 78 +- .../models/storage/UploadImageModel.java | 38 +- .../models/storage/VmBackupModel.java | 12 +- .../templates/ImportTemplateFromOvaModel.java | 32 +- .../templates/ImportTemplatesModel.java | 64 +- .../models/templates/TemplateListModel.java | 26 +- .../models/vms/AbstractDiskModel.java | 16 +- .../models/vms/AbstractGeneralModel.java | 24 +- .../models/vms/AttachDiskModel.java | 42 +- .../uicommonweb/models/vms/CloneVmModel.java | 6 +- .../uicommonweb/models/vms/EditDiskModel.java | 6 +- .../ImportVmFromExternalProviderModel.java | 16 +- .../uicommonweb/models/vms/ImportVmModel.java | 36 +- .../models/vms/ImportVmsModel.java | 189 +-- .../models/vms/InstanceImagesModel.java | 2 +- .../uicommonweb/models/vms/NewDiskModel.java | 42 +- .../vms/NewTemplateVmModelBehavior.java | 2 +- .../models/vms/PoolModelBehaviorBase.java | 14 +- .../models/vms/PreviewSnapshotModel.java | 2 +- .../uicommonweb/models/vms/RunOnceModel.java | 12 +- .../uicommonweb/models/vms/SnapshotModel.java | 54 +- .../models/vms/SpiceConsoleModel.java | 19 +- .../uicommonweb/models/vms/UnitVmModel.java | 36 +- .../models/vms/VmDevicesListModel.java | 2 +- .../models/vms/VmGeneralModel.java | 2 +- .../vms/VmInterfaceCreatingManager.java | 2 +- .../models/vms/VmInterfaceModel.java | 2 +- .../uicommonweb/models/vms/VmListModel.java | 88 +- .../models/vms/VmModelBehaviorBase.java | 85 +- .../uicommonweb/models/vms/VmModelHelper.java | 54 +- .../models/vms/VmMonitorModel.java | 10 +- .../models/vms/VmSnapshotListModel.java | 2 +- .../ExistingNonClusterModelBehavior.java | 20 +- .../models/volumes/VolumeListModel.java | 130 +- .../validation/IconValidation.java | 8 +- .../ovirt/engine/ui/uicommonweb/UriTest.java | 40 +- .../uicommonweb/action/SyncUiActionTest.java | 32 +- .../org/ovirt/engine/ui/uicompat/Event.java | 3 +- .../webadmin/gin/uicommon/ClusterModule.java | 60 +- .../gin/uicommon/DataCenterModule.java | 36 +- .../ui/webadmin/gin/uicommon/EventModule.java | 18 +- .../ui/webadmin/gin/uicommon/HostModule.java | 24 +- .../webadmin/gin/uicommon/StorageModule.java | 44 +- .../webadmin/gin/uicommon/TemplateModule.java | 6 +- .../ui/webadmin/gin/uicommon/UserModule.java | 8 +- .../gin/uicommon/VirtualMachineModule.java | 23 +- .../gin/uicommon/VnicProfileModule.java | 6 +- .../webadmin/gin/uicommon/VolumeModule.java | 168 +-- .../webadmin/place/WebAdminPlaceManager.java | 12 +- .../AbstractMainWithDetailsPresenter.java | 22 +- .../main/presenter/HeaderPresenterWidget.java | 4 +- .../presenter/MainEngineErrataPresenter.java | 2 +- .../overlay/TasksPresenterWidget.java | 24 +- ...taListWithDetailsPopupPresenterWidget.java | 2 +- .../tab/VolumeActionPanelPresenterWidget.java | 36 +- .../section/main/view/MainNetworkView.java | 106 +- .../section/main/view/MainProviderView.java | 30 +- .../section/main/view/MainQuotaView.java | 6 +- .../section/main/view/MainStorageView.java | 30 +- .../section/main/view/MainTemplateView.java | 44 +- .../main/view/MainVnicProfileView.java | 62 +- .../section/main/view/MainVolumeView.java | 61 +- .../webadmin/section/main/view/MenuView.java | 40 +- .../ClusterManageNetworkPopupView.java | 2 +- .../main/view/popup/configure/RoleView.java | 2 +- ...lumeSnapshotConfigureOptionsPopupView.java | 12 +- .../GlusterVolumeSnapshotCreatePopupView.java | 2 +- .../popup/gluster/ResetBrickPopupView.java | 2 +- .../popup/host/MultipleHostsPopupView.java | 6 +- .../host/panels/NetworkOutOfSyncPanel.java | 72 +- .../main/view/popup/host/panels/NicPanel.java | 16 +- .../popup/provider/ProviderPopupView.java | 12 +- .../storage/AbstractFindDcPopupView.java | 2 +- .../storage/ManagedBlockStorageView.java | 4 +- .../popup/storage/StorageDRPopupView.java | 2 +- .../view/popup/storage/StoragePopupView.java | 4 +- .../ImportVmFromExportDomainPopupView.java | 51 +- .../tab/AbstractSubTabAffinityGroupsView.java | 12 +- .../tab/cluster/SubTabClusterNetworkView.java | 32 +- .../SubTabDataCenterNetworkView.java | 28 +- .../SubTabDataCenterStorageView.java | 16 +- .../tab/gluster/SubTabVolumeBrickView.java | 2 +- .../tab/gluster/SubTabVolumeGeoRepView.java | 5 +- .../view/tab/host/SubTabHostBrickView.java | 2 +- .../SubTabHostGlusterStorageDevicesView.java | 64 +- .../tab/network/SubTabNetworkClusterView.java | 74 +- .../SubTabNetworkExternalSubnetView.java | 36 +- .../tab/network/SubTabNetworkHostView.java | 30 +- .../tab/network/SubTabNetworkProfileView.java | 26 +- .../view/tab/network/SubTabNetworkVmView.java | 72 +- .../storage/SubTabStorageDataCenterView.java | 24 +- .../tab/storage/SubTabStorageGeneralView.java | 2 +- .../model/InstanceTypeModelProvider.java | 12 +- .../widget/alert/DrawerNotification.java | 30 +- .../widget/alert/NotificationListWidget.java | 2 +- .../widget/autocomplete/SearchSuggestBox.java | 18 +- .../widget/host/InterfaceStatusImage.java | 12 +- .../renderer/HumanReadableTimeRenderer.java | 8 +- .../widget/table/cell/BrickStatusCell.java | 22 +- .../cell/GlusterVolumeSnapshotStatusCell.java | 22 +- .../widget/table/cell/HostStatusCell.java | 80 +- .../widget/table/cell/VmStatusIconCell.java | 96 +- .../table/cell/VolumeActivityStatusCell.java | 68 +- .../widget/table/cell/VolumeStatusCell.java | 16 +- .../table/column/BrickStatusColumn.java | 22 +- .../column/ClusterAdditionalStatusColumn.java | 4 +- .../column/ClusterUpgradeStatusColumn.java | 12 +- .../widget/table/column/DcStatusColumn.java | 26 +- .../column/EntityAdditionalStatusColumn.java | 20 +- .../table/column/GlusterCapacityCell.java | 2 +- .../GlusterVolumeSnapshotStatusColumn.java | 22 +- .../column/NetworkClusterStatusColumn.java | 2 +- .../table/column/NetworkStatusColumn.java | 12 +- .../table/column/QuotaDcStatusColumn.java | 16 +- .../widget/table/column/RoleTypeColumn.java | 8 +- .../column/StorageDomainStatusColumn.java | 42 +- .../widget/table/column/TaskStatusColumn.java | 24 +- .../table/column/VmStatusIconColumn.java | 2 +- .../widget/table/column/VmTypeColumn.java | 4 +- .../column/VolumeActivityStatusColumn.java | 68 +- .../table/column/VolumeStatusColumn.java | 28 +- 823 files changed, 12641 insertions(+), 12749 deletions(-) diff --git a/backend/manager/extensions-tool/src/main/java/org/ovirt/engine/exttool/aaa/AAAServiceImpl.java b/backend/manager/extensions-tool/src/main/java/org/ovirt/engine/exttool/aaa/AAAServiceImpl.java index 697646aa0ae..12d783c9a82 100644 --- a/backend/manager/extensions-tool/src/main/java/org/ovirt/engine/exttool/aaa/AAAServiceImpl.java +++ b/backend/manager/extensions-tool/src/main/java/org/ovirt/engine/exttool/aaa/AAAServiceImpl.java @@ -43,345 +43,325 @@ private interface Logic { } private enum Action { - AUTHZ_FETCH_PRINCIPAL_RECORD( - module -> { - ExtensionProxy authzExtension = module.getExtensionsManager().getExtensionByName((String) module.argMap.get("extension-name")); + AUTHZ_FETCH_PRINCIPAL_RECORD(module -> { + ExtensionProxy authzExtension = module.getExtensionsManager().getExtensionByName((String) module.argMap.get("extension-name")); - log.info("API: -->Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD principal='{}'", module.argMap.get("principal-name")); - ExtMap outMap = authzExtension.invoke( - new ExtMap().mput( - Authz.InvokeKeys.PRINCIPAL, - module.argMap.get("principal-name") - ).mput( - Base.InvokeKeys.COMMAND, - Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD - ).mput( - Authz.InvokeKeys.QUERY_FLAGS, - getAuthzFlags((List) module.argMap.get("authz-flag")) - ) - ); - log.info( - "API: <--Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD status={}", - getFieldNameByValue(Authz.Status.class, outMap. get(Authz.InvokeKeys.STATUS)) - ); - - if (outMap. get(Authz.InvokeKeys.STATUS) != Authz.Status.SUCCESS) { - throw new RuntimeException( - String.format( - "Authz.Status code is: %1$s", - getFieldNameByValue(Authz.Status.class, outMap. get(Authz.InvokeKeys.STATUS)) - ) - ); - } - - Dump.PRINCIPAL_RECORD.dump(module, outMap.get(Authz.InvokeKeys.PRINCIPAL_RECORD)); - } - ), - AUTHN_AUTHENTICATE_CREDENTIALS( - module -> { - ExtensionProxy authnExtension = module.getExtensionsManager().getExtensionByName((String) module.argMap.get("extension-name")); + log.info("API: -->Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD principal='{}'", module.argMap.get("principal-name")); + ExtMap outMap = authzExtension.invoke( + new ExtMap().mput( + Authz.InvokeKeys.PRINCIPAL, + module.argMap.get("principal-name") + ).mput( + Base.InvokeKeys.COMMAND, + Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD + ).mput( + Authz.InvokeKeys.QUERY_FLAGS, + getAuthzFlags((List) module.argMap.get("authz-flag")) + ) + ); + log.info( + "API: <--Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD status={}", + getFieldNameByValue(Authz.Status.class, outMap. get(Authz.InvokeKeys.STATUS)) + ); - log.info("API: -->Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS user='{}'", module.argMap.get("user-name")); - ExtMap outMap = authnExtension.invoke( - new ExtMap().mput( - Base.InvokeKeys.COMMAND, - Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS - ).mput( - Authn.InvokeKeys.USER, - module.argMap.get("user-name") - ).mput( - Authn.InvokeKeys.CREDENTIALS, - getPassword((String) module.argMap.get("password")) - ) - ); - log.info( - "API: <--Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS result={}", - getFieldNameByValue(Authn.AuthResult.class, outMap. get(Authn.InvokeKeys.RESULT)) - ); + if (outMap. get(Authz.InvokeKeys.STATUS) != Authz.Status.SUCCESS) { + throw new RuntimeException(String.format( + "Authz.Status code is: %1$s", + getFieldNameByValue(Authz.Status.class, outMap. get(Authz.InvokeKeys.STATUS)) + )); + } - Dump.AUTH_RECORD.dump(module, outMap.get(Authn.InvokeKeys.AUTH_RECORD)); + Dump.PRINCIPAL_RECORD.dump(module, outMap.get(Authz.InvokeKeys.PRINCIPAL_RECORD)); + }), + AUTHN_AUTHENTICATE_CREDENTIALS(module -> { + ExtensionProxy authnExtension = module.getExtensionsManager().getExtensionByName((String) module.argMap.get("extension-name")); - if (outMap. get(Authn.InvokeKeys.RESULT) != Authn.AuthResult.SUCCESS) { - throw new RuntimeException( - String.format( - "Authn.Result code is: %1$s", - getFieldNameByValue(Authn.AuthResult.class, outMap. get(Authn.InvokeKeys.RESULT)) - ) - ); - } - } - ), - CHANGE_CREDENTIALS( - module -> { - AAAProfile aaaprofile = module.new AAAProfile((String) module.argMap.get("profile")); - if ((aaaprofile.getAuthnExtension().getContext().get(Authn.ContextKeys.CAPABILITIES, 0L) & Authn.Capabilities.CREDENTIALS_CHANGE) == 0 && - !(Boolean) module.argMap.get("ignore-capabilities")) { - throw new IllegalArgumentException("Unsupported operation: CREDENTIALS_CHANGE"); - } + log.info("API: -->Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS user='{}'", module.argMap.get("user-name")); + ExtMap outMap = authnExtension.invoke( + new ExtMap().mput( + Base.InvokeKeys.COMMAND, + Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS + ).mput( + Authn.InvokeKeys.USER, + module.argMap.get("user-name") + ).mput( + Authn.InvokeKeys.CREDENTIALS, + getPassword((String) module.argMap.get("password")) + ) + ); + log.info( + "API: <--Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS result={}", + getFieldNameByValue(Authn.AuthResult.class, outMap. get(Authn.InvokeKeys.RESULT)) + ); - String user = aaaprofile.mapUser((String) module.argMap.get("user-name")); - log.info("API: -->Authn.InvokeCommands.CREDENTIALS_CHANGES profile='{}' user='{}'", aaaprofile.getProfile(), user); - ExtMap outMap = aaaprofile.getAuthnExtension().invoke( - new ExtMap().mput( - Base.InvokeKeys.COMMAND, - Authn.InvokeCommands.CREDENTIALS_CHANGE - ).mput( - Authn.InvokeKeys.USER, - user - ).mput( - Authn.InvokeKeys.CREDENTIALS, - getPassword((String) module.argMap.get("password")) - ).mput( - Authn.InvokeKeys.CREDENTIALS_NEW, - getPassword((String) module.argMap.get("password-new"), "New password: ") - ) - ); - log.info( - "API: <--Authn.InvokeCommands.CREDENTIALS_CHANGES profile='{}' result={}", - aaaprofile.getProfile(), - getFieldNameByValue(Authn.AuthResult.class, outMap. get(Authn.InvokeKeys.RESULT)) - ); + Dump.AUTH_RECORD.dump(module, outMap.get(Authn.InvokeKeys.AUTH_RECORD)); - if (outMap.get(Base.InvokeKeys.RESULT) != Base.InvokeResult.SUCCESS || - outMap.get(Authn.InvokeKeys.RESULT) != Authn.AuthResult.SUCCESS) { - throw new RuntimeException("Password change failed"); - } - log.info("Password successfully changed"); - } - ), - LOGIN_USER( - module -> { - AAAProfile aaaprofile = module.new AAAProfile((String) module.argMap.get("profile")); - String user = aaaprofile.mapUser((String) module.argMap.get("user-name")); - log.info("API: -->Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS profile='{}' user='{}'", aaaprofile.getProfile(), user); - ExtMap outMap = aaaprofile.getAuthnExtension().invoke( - new ExtMap().mput( - Base.InvokeKeys.COMMAND, - Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS - ).mput( - Authn.InvokeKeys.USER, - user - ).mput( - Authn.InvokeKeys.CREDENTIALS, - getPassword((String) module.argMap.get("password")) - ) - ); - log.info( - "API: <--Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS profile='{}' result={}", - aaaprofile.getProfile(), + if (outMap. get(Authn.InvokeKeys.RESULT) != Authn.AuthResult.SUCCESS) { + throw new RuntimeException( + String.format("Authn.Result code is: %1$s", getFieldNameByValue(Authn.AuthResult.class, outMap. get(Authn.InvokeKeys.RESULT)) - ); + )); + } + }), + CHANGE_CREDENTIALS(module -> { + AAAProfile aaaprofile = module.new AAAProfile((String) module.argMap.get("profile")); + if ((aaaprofile.getAuthnExtension().getContext().get(Authn.ContextKeys.CAPABILITIES, 0L) & Authn.Capabilities.CREDENTIALS_CHANGE) == 0 && + !(Boolean) module.argMap.get("ignore-capabilities")) { + throw new IllegalArgumentException("Unsupported operation: CREDENTIALS_CHANGE"); + } - ExtMap authRecord = outMap.get(Authn.InvokeKeys.AUTH_RECORD); - Dump.AUTH_RECORD.dump(module, authRecord); - - if (outMap. get(Authn.InvokeKeys.RESULT) != Authn.AuthResult.SUCCESS) { - module.acctReport( - Acct.ReportReason.PRINCIPAL_LOGIN_FAILED, - aaaprofile.getAuthzName(), - authRecord, - null, - user, - "User '%1$s' could not login" - ); - throw new RuntimeException( - String.format( - "Authn.Result code is: %1$s", - getFieldNameByValue(Authn.AuthResult.class, outMap. get(Authn.InvokeKeys.RESULT)) - ) - ); - } + String user = aaaprofile.mapUser((String) module.argMap.get("user-name")); + log.info("API: -->Authn.InvokeCommands.CREDENTIALS_CHANGES profile='{}' user='{}'", aaaprofile.getProfile(), user); + ExtMap outMap = aaaprofile.getAuthnExtension().invoke( + new ExtMap().mput( + Base.InvokeKeys.COMMAND, + Authn.InvokeCommands.CREDENTIALS_CHANGE + ).mput( + Authn.InvokeKeys.USER, + user + ).mput( + Authn.InvokeKeys.CREDENTIALS, + getPassword((String) module.argMap.get("password")) + ).mput( + Authn.InvokeKeys.CREDENTIALS_NEW, + getPassword((String) module.argMap.get("password-new"), "New password: ") + )); + log.info( + "API: <--Authn.InvokeCommands.CREDENTIALS_CHANGES profile='{}' result={}", + aaaprofile.getProfile(), + getFieldNameByValue(Authn.AuthResult.class, outMap. get(Authn.InvokeKeys.RESULT)) + ); - if (aaaprofile.getMappingExtension() != null) { - log.info("API: -->Mapping.InvokeCommands.MAP_AUTH_RECORD"); - Dump.AUTH_RECORD.dump(module, authRecord); - authRecord = aaaprofile.getMappingExtension().invoke( - new ExtMap().mput( - Base.InvokeKeys.COMMAND, - Mapping.InvokeCommands.MAP_AUTH_RECORD - ).mput( - Authn.InvokeKeys.AUTH_RECORD, - authRecord - ), - true - ).get( - Authn.InvokeKeys.AUTH_RECORD, - authRecord - ); - log.info("API: <--Mapping.InvokeCommands.MAP_AUTH_RECORD"); - Dump.AUTH_RECORD.dump(module, authRecord); - } + if (outMap.get(Base.InvokeKeys.RESULT) != Base.InvokeResult.SUCCESS || + outMap.get(Authn.InvokeKeys.RESULT) != Authn.AuthResult.SUCCESS) { + throw new RuntimeException("Password change failed"); + } + log.info("Password successfully changed"); + }), + LOGIN_USER(module -> { + AAAProfile aaaprofile = module.new AAAProfile((String) module.argMap.get("profile")); + String user = aaaprofile.mapUser((String) module.argMap.get("user-name")); + log.info("API: -->Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS profile='{}' user='{}'", aaaprofile.getProfile(), user); + ExtMap outMap = aaaprofile.getAuthnExtension().invoke( + new ExtMap().mput( + Base.InvokeKeys.COMMAND, + Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS + ).mput( + Authn.InvokeKeys.USER, + user + ).mput( + Authn.InvokeKeys.CREDENTIALS, + getPassword((String) module.argMap.get("password")) + )); + log.info( + "API: <--Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS profile='{}' result={}", + aaaprofile.getProfile(), + getFieldNameByValue(Authn.AuthResult.class, outMap. get(Authn.InvokeKeys.RESULT)) + ); - log.info( - "API: -->Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD principal='{}'", - (Object) authRecord.get(Authn.AuthRecord.PRINCIPAL) - ); - outMap = module.getExtensionsManager().getExtensionByName(aaaprofile.getAuthzName()).invoke( - new ExtMap(). - mput( - Base.InvokeKeys.COMMAND, - Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD - ).mput( - Authn.InvokeKeys.AUTH_RECORD, - authRecord - ).mput( - Authz.InvokeKeys.QUERY_FLAGS, - Authz.QueryFlags.RESOLVE_GROUPS | Authz.QueryFlags.RESOLVE_GROUPS_RECURSIVE - ) - ); - log.info( - "API: <--Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD status={}", - getFieldNameByValue(Authz.Status.class, outMap. get(Authz.InvokeKeys.STATUS)) - ); + ExtMap authRecord = outMap.get(Authn.InvokeKeys.AUTH_RECORD); + Dump.AUTH_RECORD.dump(module, authRecord); + + if (outMap. get(Authn.InvokeKeys.RESULT) != Authn.AuthResult.SUCCESS) { + module.acctReport( + Acct.ReportReason.PRINCIPAL_LOGIN_FAILED, + aaaprofile.getAuthzName(), + authRecord, + null, + user, + "User '%1$s' could not login" + ); + throw new RuntimeException( + String.format( + "Authn.Result code is: %1$s", + getFieldNameByValue(Authn.AuthResult.class, outMap. get(Authn.InvokeKeys.RESULT)) + ) + ); + } - ExtMap principalRecord = outMap.get(Authz.InvokeKeys.PRINCIPAL_RECORD); - Dump.PRINCIPAL_RECORD.dump(module, principalRecord); - - if (outMap. get(Authz.InvokeKeys.STATUS) != Authz.Status.SUCCESS) { - if (principalRecord == null) { - module.acctReport( - Acct.ReportReason.PRINCIPAL_NOT_FOUND, - aaaprofile.getAuthzName(), - authRecord, - null, - user, - "User '%1$s' could not be found" - ); - } else { - module.acctReport( - Acct.ReportReason.PRINCIPAL_LOGIN_FAILED, - aaaprofile.getAuthzName(), - authRecord, - principalRecord, - user, - "User '%1$s' could not be found" - ); - } + if (aaaprofile.getMappingExtension() != null) { + log.info("API: -->Mapping.InvokeCommands.MAP_AUTH_RECORD"); + Dump.AUTH_RECORD.dump(module, authRecord); + authRecord = aaaprofile.getMappingExtension().invoke( + new ExtMap().mput( + Base.InvokeKeys.COMMAND, + Mapping.InvokeCommands.MAP_AUTH_RECORD + ).mput( + Authn.InvokeKeys.AUTH_RECORD, + authRecord + ), + true + ).get( + Authn.InvokeKeys.AUTH_RECORD, + authRecord + ); + log.info("API: <--Mapping.InvokeCommands.MAP_AUTH_RECORD"); + Dump.AUTH_RECORD.dump(module, authRecord); + } - throw new RuntimeException( - String.format( - "Authz.Status code is: %1$s", - getFieldNameByValue(Authz.Status.class, outMap. get(Authz.InvokeKeys.STATUS)) - ) - ); - } + log.info( + "API: -->Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD principal='{}'", + (Object) authRecord.get(Authn.AuthRecord.PRINCIPAL) + ); + outMap = module.getExtensionsManager().getExtensionByName(aaaprofile.getAuthzName()).invoke( + new ExtMap(). + mput( + Base.InvokeKeys.COMMAND, + Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD + ).mput( + Authn.InvokeKeys.AUTH_RECORD, + authRecord + ).mput( + Authz.InvokeKeys.QUERY_FLAGS, + Authz.QueryFlags.RESOLVE_GROUPS | Authz.QueryFlags.RESOLVE_GROUPS_RECURSIVE + ) + ); + log.info( + "API: <--Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD status={}", + getFieldNameByValue(Authz.Status.class, outMap. get(Authz.InvokeKeys.STATUS)) + ); + ExtMap principalRecord = outMap.get(Authz.InvokeKeys.PRINCIPAL_RECORD); + Dump.PRINCIPAL_RECORD.dump(module, principalRecord); + + if (outMap. get(Authz.InvokeKeys.STATUS) != Authz.Status.SUCCESS) { + if (principalRecord == null) { module.acctReport( - Acct.ReportReason.PRINCIPAL_LOGIN_CREDENTIALS, + Acct.ReportReason.PRINCIPAL_NOT_FOUND, aaaprofile.getAuthzName(), authRecord, - principalRecord, + null, user, - "Principal '%1$s' logged in" + "User '%1$s' could not be found" ); - - if ((aaaprofile.getAuthnExtension().getContext(). get(Authn.ContextKeys.CAPABILITIES) & Authn.Capabilities.LOGOUT) != 0) { - log.info("API: -->Authn.InvokeCommands.LOGOUT principal='{}'", authRecord. get(Authn.AuthRecord.PRINCIPAL)); - aaaprofile.getAuthnExtension().invoke( - new ExtMap().mput( - Base.InvokeKeys.COMMAND, - Authn.InvokeCommands.LOGOUT - ).mput( - Authn.InvokeKeys.AUTH_RECORD, - authRecord - ) - ); - log.info("API: <--Authn.InvokeCommands.LOGOUT"); - } - + } else { module.acctReport( - Acct.ReportReason.PRINCIPAL_LOGOUT, + Acct.ReportReason.PRINCIPAL_LOGIN_FAILED, aaaprofile.getAuthzName(), authRecord, principalRecord, user, - "Principal '%1$s' logged out" + "User '%1$s' could not be found" ); } - ), - SEARCH( - module -> { - ExtensionProxy authzExtension = module.getExtensionsManager().getExtensionByName((String) module.argMap.get("extension-name")); - ExtUUID entity = getQueryEntity((String) module.argMap.get("entity")); - ExtMap filter = createQueryFilter(entity, module.argMap); - Dump.QUERY_FILTER_RECORD.dump(module, filter, ""); - - Collection namespaces = authzExtension.getContext().get( - Authz.ContextKeys.AVAILABLE_NAMESPACES, - Collections.emptyList() - ); - if (module.argMap.get("namespace") != null) { - namespaces = (Collection) module.argMap.get("namespace"); - } - for (String namespace : namespaces) { - log.info("API: -->Authz.InvokeCommands.QUERY_OPEN namespace='{}'", namespace); - ExtMap outMap = authzExtension.invoke( - new ExtMap().mput( - Base.InvokeKeys.COMMAND, - Authz.InvokeCommands.QUERY_OPEN - ).mput( - Authz.InvokeKeys.QUERY_ENTITY, - entity - ).mput( - Authz.InvokeKeys.QUERY_FLAGS, - getAuthzFlags((List) module.argMap.get("authz-flag")) - ).mput( - Authz.InvokeKeys.QUERY_FILTER, - filter - ).mput( - Authz.InvokeKeys.NAMESPACE, - namespace - ) - ); - log.info("API: <--Authz.InvokeCommands.QUERY_OPEN"); - - Object opaque = outMap.get(Authz.InvokeKeys.QUERY_OPAQUE); - boolean done = false; - while (!done) { - log.info("API: -->Authz.InvokeCommands.QUERY_EXECUTE"); - outMap = authzExtension.invoke( - new ExtMap().mput( - Base.InvokeKeys.COMMAND, - Authz.InvokeCommands.QUERY_EXECUTE - ).mput( - Authz.InvokeKeys.QUERY_OPAQUE, - opaque - ).mput( - Authz.InvokeKeys.PAGE_SIZE, - module.argMap.get("page-size") - ) - ); - Collection results = outMap.get(Authz.InvokeKeys.QUERY_RESULT); - log.info("API: <--Authz.InvokeCommands.QUERY_EXECUTE count={}", results == null ? "END" : results.size()); - - if (results == null) { - done = true; - } else { - for (ExtMap result : results) { - if (Authz.QueryEntity.PRINCIPAL.equals(entity)) { - Dump.PRINCIPAL_RECORD.dump(module, result); - } else if (Authz.QueryEntity.GROUP.equals(entity)) { - Dump.GROUP_RECORD.dump(module, result); - } - } + throw new RuntimeException( + String.format( + "Authz.Status code is: %1$s", + getFieldNameByValue(Authz.Status.class, outMap. get(Authz.InvokeKeys.STATUS)) + )); + } + + module.acctReport( + Acct.ReportReason.PRINCIPAL_LOGIN_CREDENTIALS, + aaaprofile.getAuthzName(), + authRecord, + principalRecord, + user, + "Principal '%1$s' logged in" + ); + + if ((aaaprofile.getAuthnExtension().getContext(). get(Authn.ContextKeys.CAPABILITIES) & Authn.Capabilities.LOGOUT) != 0) { + log.info("API: -->Authn.InvokeCommands.LOGOUT principal='{}'", authRecord. get(Authn.AuthRecord.PRINCIPAL)); + aaaprofile.getAuthnExtension().invoke( + new ExtMap().mput( + Base.InvokeKeys.COMMAND, + Authn.InvokeCommands.LOGOUT + ).mput( + Authn.InvokeKeys.AUTH_RECORD, + authRecord + )); + log.info("API: <--Authn.InvokeCommands.LOGOUT"); + } + + module.acctReport( + Acct.ReportReason.PRINCIPAL_LOGOUT, + aaaprofile.getAuthzName(), + authRecord, + principalRecord, + user, + "Principal '%1$s' logged out" + ); + }), + SEARCH(module -> { + ExtensionProxy authzExtension = module.getExtensionsManager().getExtensionByName((String) module.argMap.get("extension-name")); + ExtUUID entity = getQueryEntity((String) module.argMap.get("entity")); + ExtMap filter = createQueryFilter(entity, module.argMap); + Dump.QUERY_FILTER_RECORD.dump(module, filter, ""); + + Collection namespaces = authzExtension.getContext().get( + Authz.ContextKeys.AVAILABLE_NAMESPACES, + Collections.emptyList() + ); + if (module.argMap.get("namespace") != null) { + namespaces = (Collection) module.argMap.get("namespace"); + } + + for (String namespace : namespaces) { + log.info("API: -->Authz.InvokeCommands.QUERY_OPEN namespace='{}'", namespace); + ExtMap outMap = authzExtension.invoke( + new ExtMap().mput( + Base.InvokeKeys.COMMAND, + Authz.InvokeCommands.QUERY_OPEN + ).mput( + Authz.InvokeKeys.QUERY_ENTITY, + entity + ).mput( + Authz.InvokeKeys.QUERY_FLAGS, + getAuthzFlags((List) module.argMap.get("authz-flag")) + ).mput( + Authz.InvokeKeys.QUERY_FILTER, + filter + ).mput( + Authz.InvokeKeys.NAMESPACE, + namespace + ) + ); + log.info("API: <--Authz.InvokeCommands.QUERY_OPEN"); + + Object opaque = outMap.get(Authz.InvokeKeys.QUERY_OPAQUE); + boolean done = false; + while (!done) { + log.info("API: -->Authz.InvokeCommands.QUERY_EXECUTE"); + outMap = authzExtension.invoke( + new ExtMap().mput( + Base.InvokeKeys.COMMAND, + Authz.InvokeCommands.QUERY_EXECUTE + ).mput( + Authz.InvokeKeys.QUERY_OPAQUE, + opaque + ).mput( + Authz.InvokeKeys.PAGE_SIZE, + module.argMap.get("page-size") + )); + Collection results = outMap.get(Authz.InvokeKeys.QUERY_RESULT); + log.info("API: <--Authz.InvokeCommands.QUERY_EXECUTE count={}", results == null ? "END" : results.size()); + + if (results == null) { + done = true; + } else { + for (ExtMap result : results) { + if (Authz.QueryEntity.PRINCIPAL.equals(entity)) { + Dump.PRINCIPAL_RECORD.dump(module, result); + } else if (Authz.QueryEntity.GROUP.equals(entity)) { + Dump.GROUP_RECORD.dump(module, result); } } - - log.info("API: -->Authz.InvokeCommands.QUERY_CLOSE"); - authzExtension.invoke( - new ExtMap().mput( - Base.InvokeKeys.COMMAND, - Authz.InvokeCommands.QUERY_CLOSE - ).mput( - Authz.InvokeKeys.QUERY_OPAQUE, - opaque - ) - ); - log.info("API: <--Authz.InvokeCommands.QUERY_CLOSE"); } } - ); + + log.info("API: -->Authz.InvokeCommands.QUERY_CLOSE"); + authzExtension.invoke( + new ExtMap().mput( + Base.InvokeKeys.COMMAND, + Authz.InvokeCommands.QUERY_CLOSE + ).mput( + Authz.InvokeKeys.QUERY_OPAQUE, + opaque + )); + log.info("API: <--Authz.InvokeCommands.QUERY_CLOSE"); + } + }); private Logic logic; @@ -424,15 +404,13 @@ private interface DumpFormat { } private enum Dump { - AUTH_RECORD( - (module, map, indent) -> { - if (map != null) { - log.info("--- Begin AuthRecord ---"); - dumpRecord(module, map, Collections.emptySet(), "AuthRecord", ""); - log.info("--- End AuthRecord ---"); - } - } - ), + AUTH_RECORD((module, map, indent) -> { + if (map != null) { + log.info("--- Begin AuthRecord ---"); + dumpRecord(module, map, Collections.emptySet(), "AuthRecord", ""); + log.info("--- End AuthRecord ---"); + } + }), PRINCIPAL_RECORD( new DumpFormat() { @Override @@ -448,8 +426,7 @@ public void dump(AAAServiceImpl module, ExtMap map, String indent) { } } ), - GROUP_RECORD( - (module, map, indent) -> dumpGroups(module, map, indent, new HashSet<>()) + GROUP_RECORD((module, map, indent) -> dumpGroups(module, map, indent, new HashSet<>()) ), QUERY_FILTER_RECORD( new DumpFormat() { @@ -474,7 +451,7 @@ private Dump(DumpFormat dumpFormat) { } private static void dumpGroups(AAAServiceImpl module, ExtMap map, String indent, Set loopPrevention) { - if (map != null ) { + if (map != null) { loopPrevention.add(map.get(Authz.GroupRecord.ID)); log.info("{}--- Begin GroupRecord ---", indent); dumpRecord(module, map, Collections.singleton(Authz.GroupRecord.GROUPS), "GroupRecord", indent); diff --git a/backend/manager/extensions-tool/src/main/java/org/ovirt/engine/exttool/core/InfoServiceImpl.java b/backend/manager/extensions-tool/src/main/java/org/ovirt/engine/exttool/core/InfoServiceImpl.java index de7e30b104e..9871b6154ac 100644 --- a/backend/manager/extensions-tool/src/main/java/org/ovirt/engine/exttool/core/InfoServiceImpl.java +++ b/backend/manager/extensions-tool/src/main/java/org/ovirt/engine/exttool/core/InfoServiceImpl.java @@ -37,93 +37,87 @@ private interface Logic { } private enum Action { - CONFIGURATION( - module -> { - ExtensionProxy extension = module.getExtensionsManager().getExtensionByName((String) module.argMap.get("extension-name")); - Collection sensitive = extension.getContext().get(Base.ContextKeys.CONFIGURATION_SENSITIVE_KEYS); + CONFIGURATION(module -> { + ExtensionProxy extension = module.getExtensionsManager().getExtensionByName((String) module.argMap.get("extension-name")); + Collection sensitive = extension.getContext().get(Base.ContextKeys.CONFIGURATION_SENSITIVE_KEYS); - Map config = extension.getContext().get(Base.ContextKeys.CONFIGURATION); - Collection keys = new HashSet<>(config.keySet()); - if (module.argMap.get("key") != null) { - keys.retainAll((List) module.argMap.get("key")); - } + Map config = extension.getContext().get(Base.ContextKeys.CONFIGURATION); + Collection keys = new HashSet<>(config.keySet()); + if (module.argMap.get("key") != null) { + keys.retainAll((List) module.argMap.get("key")); + } - for (Object key : keys) { - module.output( - ((String) module.argMap.get("format")).replace( - "{key}", - String.format("%s", key) - ).replace( - "{value}", - sensitive.contains(key) ? "***" : String.format("%s", config.get(key)) - ), - " " - ); + for (Object key : keys) { + module.output( + ((String) module.argMap.get("format")).replace( + "{key}", + String.format("%s", key) + ).replace( + "{value}", + sensitive.contains(key) ? "***" : String.format("%s", config.get(key)) + ), + " " + ); + } + }), + CONTEXT(module -> { + ExtensionProxy extension = module.getExtensionsManager().getExtensionByName((String) module.argMap.get("extension-name")); + Collection keys = new HashSet<>(extension.getContext().keySet()); + if (module.argMap.get("key") != null) { + Collection k = new HashSet<>(); + for (String uuid : (List) module.argMap.get("key")) { + k.add(new ExtKey("Unknown", Object.class, uuid)); } + keys.retainAll(k); } - ), - CONTEXT( - module -> { - ExtensionProxy extension = module.getExtensionsManager().getExtensionByName((String) module.argMap.get("extension-name")); - Collection keys = new HashSet<>(extension.getContext().keySet()); - if (module.argMap.get("key") != null) { - Collection k = new HashSet<>(); - for (String uuid : (List) module.argMap.get("key")) { - k.add(new ExtKey("Unknown", Object.class, uuid)); - } - keys.retainAll(k); + for (ExtKey key : keys) { + if (CONTEXT_IGNORE_KEYS.contains(key)) { + continue; } - for (ExtKey key : keys) { - if (CONTEXT_IGNORE_KEYS.contains(key)) { - continue; - } - if ((key.getFlags() & ExtKey.Flags.SKIP_DUMP) != 0) { - continue; - } - - module.output( - ((String) module.argMap.get("format")).replace( - "{key}", - key.getUuid().getUuid().toString() - ).replace( - "{name}", - key.getUuid().getName() - ).replace( - "{value}", - (key.getFlags() & ExtKey.Flags.SENSITIVE) != 0 ? "***" : extension.getContext().get(key).toString() - ), - " " - ); + if ((key.getFlags() & ExtKey.Flags.SKIP_DUMP) != 0) { + continue; } + + module.output( + ((String) module.argMap.get("format")).replace( + "{key}", + key.getUuid().getUuid().toString() + ).replace( + "{name}", + key.getUuid().getName() + ).replace( + "{value}", + (key.getFlags() & ExtKey.Flags.SENSITIVE) != 0 ? "***" : extension.getContext().get(key).toString() + ), + " " + ); } - ), - LIST_EXTENSIONS( - module -> { - for (ExtensionProxy extension : module.getExtensionsManager().getExtensions()) { - ExtMap extContext = extension.getContext(); - module.output( - ((String) module.argMap.get("format")).replace( - "{instance}", - extContext.get(Base.ContextKeys.INSTANCE_NAME, "") - ).replace( - "{name}", - extContext.get(Base.ContextKeys.EXTENSION_NAME, "") - ).replace( - "{version}", - extContext.get(Base.ContextKeys.VERSION, "") - ).replace( - "{license}", - extContext.get(Base.ContextKeys.LICENSE, "") - ).replace( - "{notes}", - extContext.get(Base.ContextKeys.EXTENSION_NOTES, "") - ), - "" - ); - } + }), + LIST_EXTENSIONS(module -> { + for (ExtensionProxy extension : module.getExtensionsManager().getExtensions()) { + ExtMap extContext = extension.getContext(); + module.output( + ((String) module.argMap.get("format")).replace( + "{instance}", + extContext.get(Base.ContextKeys.INSTANCE_NAME, "") + ).replace( + "{name}", + extContext.get(Base.ContextKeys.EXTENSION_NAME, "") + ).replace( + "{version}", + extContext.get(Base.ContextKeys.VERSION, "") + ).replace( + "{license}", + extContext.get(Base.ContextKeys.LICENSE, "") + ).replace( + "{notes}", + extContext.get(Base.ContextKeys.EXTENSION_NOTES, "") + ), + "" + ); } - ); + }); private Logic logic; diff --git a/backend/manager/extensions-tool/src/main/java/org/ovirt/engine/exttool/logger/LoggerServiceImpl.java b/backend/manager/extensions-tool/src/main/java/org/ovirt/engine/exttool/logger/LoggerServiceImpl.java index 0e6ce043bc0..77e5d04b0a4 100644 --- a/backend/manager/extensions-tool/src/main/java/org/ovirt/engine/exttool/logger/LoggerServiceImpl.java +++ b/backend/manager/extensions-tool/src/main/java/org/ovirt/engine/exttool/logger/LoggerServiceImpl.java @@ -30,47 +30,44 @@ private interface Logic { } private enum Action { - LOG_RECORD( - module -> { - ExtensionProxy proxy = module.getExtensionsManager().getExtensionByName((String) module.argMap.get("extension-name")); - - LogRecord logRecord = new LogRecord( - (Level) module.argMap.get("level"), - (String) module.argMap.get("message") - ); - logRecord.setLoggerName((String) module.argMap.get("logger-name")); - - log.info("API: -->Logger.InvokeCommands.PUBLISH level={}, name={}", logRecord.getLevel(), logRecord.getLoggerName()); - proxy.invoke( - new ExtMap().mput( - Base.InvokeKeys.COMMAND, - Logger.InvokeCommands.PUBLISH - ).mput( - Logger.InvokeKeys.LOG_RECORD, - logRecord - ) - ); - log.info("API: <--Logger.InvokeCommands.PUBLISH"); - - log.info("API: -->Logger.InvokeCommands.FLUSH"); - proxy.invoke( - new ExtMap().mput( - Base.InvokeKeys.COMMAND, - Logger.InvokeCommands.FLUSH - ) - ); - log.info("API: <--Logger.InvokeCommands.FLUSH"); - - log.info("API: -->Logger.InvokeCommands.CLOSE"); - proxy.invoke( - new ExtMap().mput( - Base.InvokeKeys.COMMAND, - Logger.InvokeCommands.CLOSE - ) - ); - log.info("API: <--Logger.InvokeCommands.CLOSE"); - } - ); + LOG_RECORD(module -> { + ExtensionProxy proxy = module.getExtensionsManager().getExtensionByName((String) module.argMap.get("extension-name")); + + LogRecord logRecord = new LogRecord( + (Level) module.argMap.get("level"), + (String) module.argMap.get("message") + ); + logRecord.setLoggerName((String) module.argMap.get("logger-name")); + + log.info("API: -->Logger.InvokeCommands.PUBLISH level={}, name={}", logRecord.getLevel(), logRecord.getLoggerName()); + proxy.invoke( + new ExtMap().mput( + Base.InvokeKeys.COMMAND, + Logger.InvokeCommands.PUBLISH + ).mput( + Logger.InvokeKeys.LOG_RECORD, + logRecord + ) + ); + log.info("API: <--Logger.InvokeCommands.PUBLISH"); + + log.info("API: -->Logger.InvokeCommands.FLUSH"); + proxy.invoke( + new ExtMap().mput( + Base.InvokeKeys.COMMAND, + Logger.InvokeCommands.FLUSH + ) + ); + log.info("API: <--Logger.InvokeCommands.FLUSH"); + + log.info("API: -->Logger.InvokeCommands.CLOSE"); + proxy.invoke( + new ExtMap().mput( + Base.InvokeKeys.COMMAND, + Logger.InvokeCommands.CLOSE + )); + log.info("API: <--Logger.InvokeCommands.CLOSE"); + }); private Logic logic; diff --git a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/AcctUtils.java b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/AcctUtils.java index b1f7fc95ad2..d4c75a5012a 100644 --- a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/AcctUtils.java +++ b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/AcctUtils.java @@ -37,8 +37,7 @@ public static void reportRecords( String authzName, String user, String message, - Object... msgArgs - ) { + Object... msgArgs) { ExtMap input = new ExtMap(); input.put(Acct.InvokeKeys.REASON, reportReason); input.put(Acct.InvokeKeys.PRINCIPAL_RECORD, @@ -52,7 +51,7 @@ public static void reportRecords( Acct.InvokeKeys.MESSAGE, String.format(message, msgArgs) ) - ); + ); report(input); } diff --git a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/filters/NegotiationFilter.java b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/filters/NegotiationFilter.java index a3488eec9b6..64ab3aa5bde 100644 --- a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/filters/NegotiationFilter.java +++ b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/filters/NegotiationFilter.java @@ -138,28 +138,28 @@ private void doAuth(HttpServletRequest req, HttpServletResponse rsp, Deque get(Authn.InvokeKeys.RESULT)) { - case Authn.AuthResult.SUCCESS: - req.setAttribute(FiltersHelper.Constants.REQUEST_AUTH_RECORD_KEY, - output. get(Authn.InvokeKeys.AUTH_RECORD)); - req.setAttribute(FiltersHelper.Constants.REQUEST_AUTH_TYPE_KEY, - AuthType.NEGOTIATION); - req.setAttribute(FiltersHelper.Constants.REQUEST_PROFILE_KEY, profile.getName()); - stack.clear(); - break; - - case Authn.AuthResult.NEGOTIATION_UNAUTHORIZED: - stack.pop(); - break; - - case Authn.AuthResult.NEGOTIATION_INCOMPLETE: - stop = true; - break; - - default: - log.error("Unexpected authentication result. AuthResult code is {}", - output. get(Authn.InvokeKeys.RESULT)); - stack.pop(); - break; + case Authn.AuthResult.SUCCESS: + req.setAttribute(FiltersHelper.Constants.REQUEST_AUTH_RECORD_KEY, + output. get(Authn.InvokeKeys.AUTH_RECORD)); + req.setAttribute(FiltersHelper.Constants.REQUEST_AUTH_TYPE_KEY, + AuthType.NEGOTIATION); + req.setAttribute(FiltersHelper.Constants.REQUEST_PROFILE_KEY, profile.getName()); + stack.clear(); + break; + + case Authn.AuthResult.NEGOTIATION_UNAUTHORIZED: + stack.pop(); + break; + + case Authn.AuthResult.NEGOTIATION_INCOMPLETE: + stop = true; + break; + + default: + log.error("Unexpected authentication result. AuthResult code is {}", + output. get(Authn.InvokeKeys.RESULT)); + stack.pop(); + break; } } } diff --git a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/filters/RestApiSessionMgmtFilter.java b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/filters/RestApiSessionMgmtFilter.java index 0d293c7ac8b..92b1f370e9b 100644 --- a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/filters/RestApiSessionMgmtFilter.java +++ b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/filters/RestApiSessionMgmtFilter.java @@ -86,7 +86,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha FiltersHelper.getBackend(ctx).runAction( ActionType.LogoutSession, new ActionParametersBase(engineSessionId) - ); + ); HttpSession session = req.getSession(false); if (session != null) { try { diff --git a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/servlet/SsoPostLoginServlet.java b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/servlet/SsoPostLoginServlet.java index 707feb9d569..be65b083b21 100644 --- a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/servlet/SsoPostLoginServlet.java +++ b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/servlet/SsoPostLoginServlet.java @@ -114,7 +114,7 @@ protected void service(HttpServletRequest request, HttpServletResponse response) request.getRemoteAddr(), (Collection) payload.get("group_ids"), loginAsAdmin)); - if (!queryRetVal.getSucceeded() ) { + if (!queryRetVal.getSucceeded()) { if (queryRetVal.getActionReturnValue() == CreateUserSessionsError.NUM_OF_SESSIONS_EXCEEDED) { throw new RuntimeException(String.format( "Unable to login user %s@%s with profile [%s]" + diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ActivateVdsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ActivateVdsCommand.java index c36a837f2a8..0fbcb455522 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ActivateVdsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ActivateVdsCommand.java @@ -79,43 +79,43 @@ protected void executeCommand() { // Check gluster service running status GlusterStatus isGlusterRunning = glusterUtil.isGlusterRunning(vds.getId()); switch (isGlusterRunning) { - case DOWN: - log.info("Gluster service on host '{}' is down, starting it", - vds.getHostName()); - runVdsCommand(VDSCommandType.ManageGlusterService, - new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "start")); - break; - case UP: - log.debug("Gluster service on host '{}' is up, continuing", - vds.getHostName()); - break; - case UNKNOWN: - log.warn("Gluster service on host '{}' has some issues, trying to restart it", - vds.getHostName()); - runVdsCommand(VDSCommandType.ManageGlusterService, - new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "restart")); - break; + case DOWN: + log.info("Gluster service on host '{}' is down, starting it", + vds.getHostName()); + runVdsCommand(VDSCommandType.ManageGlusterService, + new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "start")); + break; + case UP: + log.debug("Gluster service on host '{}' is up, continuing", + vds.getHostName()); + break; + case UNKNOWN: + log.warn("Gluster service on host '{}' has some issues, trying to restart it", + vds.getHostName()); + runVdsCommand(VDSCommandType.ManageGlusterService, + new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "restart")); + break; } // starting vdo service GlusterStatus isRunning = glusterUtil.isVDORunning(vds.getId()); switch (isRunning) { - case DOWN: - log.info("VDO service is down in host : '{}' with id '{}', starting VDO service", - vds.getHostName(), - vds.getId()); - startVDOService(vds); - break; - case UP: - log.info("VDO service is up in host : '{}' with id '{}', skipping starting of VDO service", - vds.getHostName(), - vds.getId()); - break; - case UNKNOWN: - log.info("VDO service is not installed host : '{}' with id '{}', ignoring to start VDO service", - vds.getHostName(), - vds.getId()); - break; + case DOWN: + log.info("VDO service is down in host : '{}' with id '{}', starting VDO service", + vds.getHostName(), + vds.getId()); + startVDOService(vds); + break; + case UP: + log.info("VDO service is up in host : '{}' with id '{}', skipping starting of VDO service", + vds.getHostName(), + vds.getId()); + break; + case UNKNOWN: + log.info("VDO service is not installed host : '{}' with id '{}', ignoring to start VDO service", + vds.getHostName(), + vds.getId()); + break; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddInternalJobCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddInternalJobCommand.java index 4a9a4ea805f..9d1bf16d7db 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddInternalJobCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddInternalJobCommand.java @@ -53,4 +53,4 @@ public List getPermissionCheckSubjects() { return permissionList; } - } +} diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddPermissionCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddPermissionCommand.java index 899c59bea73..976379a430e 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddPermissionCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddPermissionCommand.java @@ -232,7 +232,7 @@ public List getPermissionCheckSubjects() { // user from the directory service if (getParameters().getUser() != null && dbUser == null || getParameters().getGroup() != null && dbGroup == null) { - permissionsSubject.add(new PermissionSubject(permission.getObjectId(), + permissionsSubject.add(new PermissionSubject(permission.getObjectId(), permission.getObjectType(), ActionGroup.ADD_USERS_AND_GROUPS_FROM_DIRECTORY)); } return permissionsSubject; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddStepCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddStepCommand.java index e402199ba05..b5ba6753f98 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddStepCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddStepCommand.java @@ -54,19 +54,19 @@ protected void executeCommand() { ExecutionContext context = new ExecutionContext(); context.setMonitored(true); if (parentStep == null) { // A step that is directly under a job - context.setJob(job); - context.setExecutionMethod(ExecutionMethod.AsJob); - jobRepository.loadJobSteps(job); - Step step = executionHandler.addStep(context, getParameters().getStepType(), getParameters().getDescription(), true); - setActionReturnValue(step.getId()); - setSucceeded(true); + context.setJob(job); + context.setExecutionMethod(ExecutionMethod.AsJob); + jobRepository.loadJobSteps(job); + Step step = executionHandler.addStep(context, getParameters().getStepType(), getParameters().getDescription(), true); + setActionReturnValue(step.getId()); + setSucceeded(true); } else { // this is a sub-step - context.setStep(parentStep); - context.setExecutionMethod(ExecutionMethod.AsStep); - jobRepository.loadParentStepSteps(parentStep); - Step step = executionHandler.addSubStep(context, parentStep, getParameters().getStepType(), getParameters().getDescription(), true); - setActionReturnValue(step.getId()); - setSucceeded(true); + context.setStep(parentStep); + context.setExecutionMethod(ExecutionMethod.AsStep); + jobRepository.loadParentStepSteps(parentStep); + Step step = executionHandler.addSubStep(context, parentStep, getParameters().getStepType(), getParameters().getDescription(), true); + setActionReturnValue(step.getId()); + setSucceeded(true); } } } 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 8a6b15c1b80..2fa099749b3 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 @@ -1502,16 +1502,16 @@ private boolean addVmToPool() { @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { - case EXECUTE: - return getSucceeded() ? !getReturnValue().getVdsmTaskIdList().isEmpty() ? AuditLogType.USER_ADD_VM_STARTED - : AuditLogType.USER_ADD_VM : AuditLogType.USER_FAILED_ADD_VM; + case EXECUTE: + return getSucceeded() ? !getReturnValue().getVdsmTaskIdList().isEmpty() ? AuditLogType.USER_ADD_VM_STARTED + : AuditLogType.USER_ADD_VM : AuditLogType.USER_FAILED_ADD_VM; - case END_SUCCESS: - return getSucceeded() ? AuditLogType.USER_ADD_VM_FINISHED_SUCCESS - : AuditLogType.USER_ADD_VM_FINISHED_FAILURE; + case END_SUCCESS: + return getSucceeded() ? AuditLogType.USER_ADD_VM_FINISHED_SUCCESS + : AuditLogType.USER_ADD_VM_FINISHED_FAILURE; - default: - return AuditLogType.USER_ADD_VM_FINISHED_FAILURE; + default: + return AuditLogType.USER_ADD_VM_FINISHED_FAILURE; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromSnapshotCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromSnapshotCommand.java index fa8b30178e6..9f42e2c9847 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromSnapshotCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromSnapshotCommand.java @@ -141,7 +141,7 @@ protected Collection getSourceDisks() { private void adjustDisksImageConfiguration(Collection diskImages) { for (DiskImage diskImage : diskImages) { // Adjust disk image configuration if needed. - if ( diskImage.getVolumeType().equals(VolumeType.Sparse) && diskImage.getVolumeFormat().equals(VolumeFormat.RAW) && + if (diskImage.getVolumeType().equals(VolumeType.Sparse) && diskImage.getVolumeFormat().equals(VolumeFormat.RAW) && getDestintationDomainTypeFromDisk(diskImage).isBlockDomain()) { diskImage.setVolumeFormat(VolumeFormat.COW); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromTemplateCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromTemplateCommand.java index eca025e318f..1143ba6374f 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromTemplateCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromTemplateCommand.java @@ -201,7 +201,7 @@ protected boolean verifySourceDomains() { } private static Map> findDomainsInApplicableStatusForDisks - (List diskImages, Map storageDomains) { + (List diskImages, Map storageDomains) { return diskImages .stream() .collect(Collectors.toMap( @@ -254,15 +254,15 @@ protected boolean isVirtioScsiEnabled() { @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { - case EXECUTE: - return AuditLogType.USER_ADD_VM_STARTED; + case EXECUTE: + return AuditLogType.USER_ADD_VM_STARTED; - case END_SUCCESS: - return getSucceeded() ? AuditLogType.USER_ADD_VM_FINISHED_SUCCESS - : AuditLogType.USER_ADD_VM_FINISHED_FAILURE; + case END_SUCCESS: + return getSucceeded() ? AuditLogType.USER_ADD_VM_FINISHED_SUCCESS + : AuditLogType.USER_ADD_VM_FINISHED_FAILURE; - default: - return AuditLogType.USER_ADD_VM_FINISHED_FAILURE; + default: + return AuditLogType.USER_ADD_VM_FINISHED_FAILURE; } } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachUserToVmFromPoolAndRunCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachUserToVmFromPoolAndRunCommand.java index 83773fb4397..d7c1c62526f 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachUserToVmFromPoolAndRunCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachUserToVmFromPoolAndRunCommand.java @@ -286,16 +286,16 @@ protected void endWithFailure() { @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { - case EXECUTE: - return getSucceeded() ? AuditLogType.USER_ATTACH_USER_TO_VM_FROM_POOL - : AuditLogType.USER_ATTACH_USER_TO_VM_FROM_POOL_FAILED; + case EXECUTE: + return getSucceeded() ? AuditLogType.USER_ATTACH_USER_TO_VM_FROM_POOL + : AuditLogType.USER_ATTACH_USER_TO_VM_FROM_POOL_FAILED; - case END_SUCCESS: - return getSucceeded() ? AuditLogType.USER_ATTACH_USER_TO_VM_FROM_POOL_FINISHED_SUCCESS - : AuditLogType.USER_ATTACH_USER_TO_VM_FROM_POOL_FINISHED_FAILURE; + case END_SUCCESS: + return getSucceeded() ? AuditLogType.USER_ATTACH_USER_TO_VM_FROM_POOL_FINISHED_SUCCESS + : AuditLogType.USER_ATTACH_USER_TO_VM_FROM_POOL_FINISHED_FAILURE; - default: - return AuditLogType.USER_ATTACH_USER_TO_VM_FROM_POOL_FINISHED_FAILURE; + default: + return AuditLogType.USER_ATTACH_USER_TO_VM_FROM_POOL_FINISHED_FAILURE; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AutoRecoveryManager.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AutoRecoveryManager.java index f099ac4fdd4..e6147e9f1ac 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AutoRecoveryManager.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AutoRecoveryManager.java @@ -161,7 +161,7 @@ public void recoverImpl() { filtered.add(vds); } return filtered; - }, "hosts"); + }, "hosts"); check(storageDomainDao, ActionType.ConnectDomainToStorage, arg -> { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java index 8ddcd295ad4..9ff36cfde53 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java @@ -599,32 +599,32 @@ public ActionReturnValue logoff(ActionParametersBase parameters) { public QueryReturnValue runPublicQuery(QueryType actionType, QueryParametersBase parameters) { parameters.setRefresh(false); switch (actionType) { - case GetAAAProfileList: - case RegisterVds: - case CheckDBConnection: - case GetDbUserBySession: - case GetEngineSessionIdForSsoToken: - case ValidateSession: - case GetDefaultAllowedOrigins: - return runQueryImpl(actionType, parameters, false); - case GetConfigurationValue: - GetConfigurationValueParameters configParameters = (GetConfigurationValueParameters) parameters; - switch (configParameters.getConfigValue()) { - case VdcVersion: - case ProductRPMVersion: - case ApplicationMode: - case UserSessionTimeOutInterval: - case CORSSupport: - case CORSAllowedOrigins: - case CORSAllowDefaultOrigins: - case CORSDefaultOriginSuffixes: + case GetAAAProfileList: + case RegisterVds: + case CheckDBConnection: + case GetDbUserBySession: + case GetEngineSessionIdForSsoToken: + case ValidateSession: + case GetDefaultAllowedOrigins: return runQueryImpl(actionType, parameters, false); + case GetConfigurationValue: + GetConfigurationValueParameters configParameters = (GetConfigurationValueParameters) parameters; + switch (configParameters.getConfigValue()) { + case VdcVersion: + case ProductRPMVersion: + case ApplicationMode: + case UserSessionTimeOutInterval: + case CORSSupport: + case CORSAllowedOrigins: + case CORSAllowDefaultOrigins: + case CORSDefaultOriginSuffixes: + return runQueryImpl(actionType, parameters, false); + default: + break; + } + default: break; - } - - default: - break; } return getErrorQueryReturnValue(EngineMessage.USER_CANNOT_RUN_QUERY_NOT_PUBLIC); @@ -693,7 +693,7 @@ private void logExecution(String sessionId, String details) { user == null ? "." : String.format(" for user %s@%s.", user.getLoginName(), user.getDomain())); } - @Override + @Override public CommandBase createAction(ActionType actionType, ActionParametersBase parameters, CommandContext context) { return CommandsFactory.createCommand(actionType, parameters, context); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChildCommandsCallbackBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChildCommandsCallbackBase.java index 080d07f98d8..a769e4fa89a 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChildCommandsCallbackBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChildCommandsCallbackBase.java @@ -44,36 +44,36 @@ public void doPolling(Guid cmdId, List childCmdIds) { for (Guid childCmdId : childCmdIds) { CommandBase child = getCommand(childCmdId); switch (commandCoordinatorUtil.getCommandStatus(childCmdId)) { - case NOT_STARTED: - case ACTIVE: - logWaitingForChildCommand(child, command); - return; - case EXECUTION_FAILED: - if (shouldExecuteEndMethod(child)) { + case NOT_STARTED: + case ACTIVE: logWaitingForChildCommand(child, command); return; - } - logChildCommandFailed(cmdId, childCmdId, CommandStatus.EXECUTION_FAILED); - anyFailed = true; - break; - case FAILED: - if (shouldWaitForEndMethodsCompletion(child, command)) { - return; - } - logChildCommandFailed(cmdId, childCmdId, CommandStatus.FAILED); - anyFailed = true; - break; - case ENDED_WITH_FAILURE: - case UNKNOWN: - logChildCommandFailed(cmdId, childCmdId, CommandStatus.UNKNOWN); - anyFailed = true; - break; - case SUCCEEDED: - if (shouldWaitForEndMethodsCompletion(child, command)) { - return; - } - default: - ++completedChildren; + case EXECUTION_FAILED: + if (shouldExecuteEndMethod(child)) { + logWaitingForChildCommand(child, command); + return; + } + logChildCommandFailed(cmdId, childCmdId, CommandStatus.EXECUTION_FAILED); + anyFailed = true; + break; + case FAILED: + if (shouldWaitForEndMethodsCompletion(child, command)) { + return; + } + logChildCommandFailed(cmdId, childCmdId, CommandStatus.FAILED); + anyFailed = true; + break; + case ENDED_WITH_FAILURE: + case UNKNOWN: + logChildCommandFailed(cmdId, childCmdId, CommandStatus.UNKNOWN); + anyFailed = true; + break; + case SUCCEEDED: + if (shouldWaitForEndMethodsCompletion(child, command)) { + return; + } + default: + ++completedChildren; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java index 6a5c494d8ba..401272a44cd 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java @@ -310,8 +310,8 @@ protected ActionReturnValue checkAndPerformRollbackUsingCommand(ActionType comma * @return true if it is possible to run rollback using command */ protected boolean canPerformRollbackUsingCommand - (ActionType commandType, - ActionParametersBase params) { + (ActionType commandType, + ActionParametersBase params) { return true; } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandCompensator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandCompensator.java index 9558a400592..faa5213d083 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandCompensator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandCompensator.java @@ -92,29 +92,29 @@ public void compensate(Guid commandId, String commandType, CompensationContext c (Class>) ReflectionUtils.getClassFor(snapshot.getEntityType()); switch (snapshot.getSnapshotType()) { - case CHANGED_STATUS_ONLY: - BusinessEntitySnapshot.EntityStatusSnapshot entityStatusSnapshot = - (BusinessEntitySnapshot.EntityStatusSnapshot) snapshotData; - ((StatusAwareDao>) getDaoForEntity(entityClass)).updateStatus( - entityStatusSnapshot.getId(), entityStatusSnapshot.getStatus()); - break; - case DELETED_OR_UPDATED_ENTITY: - deletedOrUpdateEntity(entityClass, (BusinessEntity) snapshotData); - break; - case UPDATED_ONLY_ENTITY: - getDaoForEntity(entityClass).update((BusinessEntity) snapshotData); - break; - case NEW_ENTITY_ID: - getDaoForEntity(entityClass).remove(snapshotData); - break; - case TRANSIENT_ENTITY: - objectCompensation.compensate(commandType, (TransientCompensationBusinessEntity) snapshotData); - break; - default: - throw new IllegalArgumentException(String.format( - "Unknown %s value, unable to compensate value %s.", - BusinessEntitySnapshot.SnapshotType.class.getName(), - snapshot.getSnapshotType())); + case CHANGED_STATUS_ONLY: + BusinessEntitySnapshot.EntityStatusSnapshot entityStatusSnapshot = + (BusinessEntitySnapshot.EntityStatusSnapshot) snapshotData; + ((StatusAwareDao>) getDaoForEntity(entityClass)).updateStatus( + entityStatusSnapshot.getId(), entityStatusSnapshot.getStatus()); + break; + case DELETED_OR_UPDATED_ENTITY: + deletedOrUpdateEntity(entityClass, (BusinessEntity) snapshotData); + break; + case UPDATED_ONLY_ENTITY: + getDaoForEntity(entityClass).update((BusinessEntity) snapshotData); + break; + case NEW_ENTITY_ID: + getDaoForEntity(entityClass).remove(snapshotData); + break; + case TRANSIENT_ENTITY: + objectCompensation.compensate(commandType, (TransientCompensationBusinessEntity) snapshotData); + break; + default: + throw new IllegalArgumentException(String.format( + "Unknown %s value, unable to compensate value %s.", + BusinessEntitySnapshot.SnapshotType.class.getName(), + snapshot.getSnapshotType())); } } if (compensationContext == null) { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandsFactory.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandsFactory.java index bc1a057d172..fc8cb4ac8cc 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandsFactory.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandsFactory.java @@ -32,47 +32,47 @@ public final class CommandsFactory { "Can't find constructor for type {} with parameter types: {}"; private static final String[] COMMAND_PACKAGES = new String[] { - "org.ovirt.engine.core.bll", - "org.ovirt.engine.core.bll.aaa", - "org.ovirt.engine.core.bll.exportimport", - "org.ovirt.engine.core.bll.gluster", - "org.ovirt.engine.core.bll.hostdeploy", - "org.ovirt.engine.core.bll.hostdev", - "org.ovirt.engine.core.bll.network", - "org.ovirt.engine.core.bll.network.cluster", - "org.ovirt.engine.core.bll.network.dc", - "org.ovirt.engine.core.bll.network.host", - "org.ovirt.engine.core.bll.network.template", - "org.ovirt.engine.core.bll.network.vm", - "org.ovirt.engine.core.bll.numa.host", - "org.ovirt.engine.core.bll.numa.vm", - "org.ovirt.engine.core.bll.pm", - "org.ovirt.engine.core.bll.profiles", - "org.ovirt.engine.core.bll.provider", - "org.ovirt.engine.core.bll.provider.network", - "org.ovirt.engine.core.bll.provider.storage", - "org.ovirt.engine.core.bll.qos", - "org.ovirt.engine.core.bll.quota", - "org.ovirt.engine.core.bll.scheduling.commands", - "org.ovirt.engine.core.bll.scheduling.queries", - "org.ovirt.engine.core.bll.snapshots", - "org.ovirt.engine.core.bll.storage", - "org.ovirt.engine.core.bll.storage.backup", - "org.ovirt.engine.core.bll.storage.connection", - "org.ovirt.engine.core.bll.storage.connection.iscsibond", - "org.ovirt.engine.core.bll.storage.disk", - "org.ovirt.engine.core.bll.storage.disk.cinder", - "org.ovirt.engine.core.bll.storage.disk.image", - "org.ovirt.engine.core.bll.storage.disk.lun", - "org.ovirt.engine.core.bll.storage.disk.managedblock", - "org.ovirt.engine.core.bll.storage.domain", - "org.ovirt.engine.core.bll.storage.dr", - "org.ovirt.engine.core.bll.storage.export", - "org.ovirt.engine.core.bll.storage.lease", - "org.ovirt.engine.core.bll.storage.lsm", - "org.ovirt.engine.core.bll.storage.ovfstore", - "org.ovirt.engine.core.bll.storage.pool", - "org.ovirt.engine.core.bll.storage.repoimage" + "org.ovirt.engine.core.bll", + "org.ovirt.engine.core.bll.aaa", + "org.ovirt.engine.core.bll.exportimport", + "org.ovirt.engine.core.bll.gluster", + "org.ovirt.engine.core.bll.hostdeploy", + "org.ovirt.engine.core.bll.hostdev", + "org.ovirt.engine.core.bll.network", + "org.ovirt.engine.core.bll.network.cluster", + "org.ovirt.engine.core.bll.network.dc", + "org.ovirt.engine.core.bll.network.host", + "org.ovirt.engine.core.bll.network.template", + "org.ovirt.engine.core.bll.network.vm", + "org.ovirt.engine.core.bll.numa.host", + "org.ovirt.engine.core.bll.numa.vm", + "org.ovirt.engine.core.bll.pm", + "org.ovirt.engine.core.bll.profiles", + "org.ovirt.engine.core.bll.provider", + "org.ovirt.engine.core.bll.provider.network", + "org.ovirt.engine.core.bll.provider.storage", + "org.ovirt.engine.core.bll.qos", + "org.ovirt.engine.core.bll.quota", + "org.ovirt.engine.core.bll.scheduling.commands", + "org.ovirt.engine.core.bll.scheduling.queries", + "org.ovirt.engine.core.bll.snapshots", + "org.ovirt.engine.core.bll.storage", + "org.ovirt.engine.core.bll.storage.backup", + "org.ovirt.engine.core.bll.storage.connection", + "org.ovirt.engine.core.bll.storage.connection.iscsibond", + "org.ovirt.engine.core.bll.storage.disk", + "org.ovirt.engine.core.bll.storage.disk.cinder", + "org.ovirt.engine.core.bll.storage.disk.image", + "org.ovirt.engine.core.bll.storage.disk.lun", + "org.ovirt.engine.core.bll.storage.disk.managedblock", + "org.ovirt.engine.core.bll.storage.domain", + "org.ovirt.engine.core.bll.storage.dr", + "org.ovirt.engine.core.bll.storage.export", + "org.ovirt.engine.core.bll.storage.lease", + "org.ovirt.engine.core.bll.storage.lsm", + "org.ovirt.engine.core.bll.storage.ovfstore", + "org.ovirt.engine.core.bll.storage.pool", + "org.ovirt.engine.core.bll.storage.repoimage" }; protected static String[] getCommandPackages() { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolCommand.java index 43cedc10494..c79800ba86a 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolCommand.java @@ -424,7 +424,7 @@ && getCluster().getArchitecture() != getVmTemplate().getClusterArch()) { } if (getParameters().getVmPool().getPrestartedVms() > - getParameters().getVmPool().getAssignedVmsCount() + getParameters().getVmsCount()) { + getParameters().getVmPool().getAssignedVmsCount() + getParameters().getVmsCount()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_PRESTARTED_VMS_CANNOT_EXCEED_VMS_COUNT); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CpuFlagsManagerHandler.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CpuFlagsManagerHandler.java index ed3756a4bc9..179cfd83c07 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CpuFlagsManagerHandler.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CpuFlagsManagerHandler.java @@ -38,7 +38,7 @@ public void initDictionaries() { for (Version ver : Config.> getValue(ConfigValues.SupportedClusterLevels)) { managersDictionary.put(ver, new CpuFlagsManager(ver)); } - log.info("Finished initializing dictionaries"); + log.info("Finished initializing dictionaries"); } public String getCpuId(String name, Version ver) { @@ -341,7 +341,7 @@ public List missingServerCpuFlags(String clusterCpuName, String serverFl : new HashSet<>(parseFlags(serverFlags)); // first find cluster cpu - if ( StringUtils.isNotEmpty(clusterCpuName) + if (StringUtils.isNotEmpty(clusterCpuName) && ((clusterCpu = intelCpuByNameDictionary.get(clusterCpuName)) != null || (clusterCpu = amdCpuByNameDictionary.get(clusterCpuName)) != null || (clusterCpu = ibmCpuByNameDictionary.get(clusterCpuName)) != null @@ -461,11 +461,11 @@ public List getSupportedServerCpuList(String maxCpuName) { supportedCpus.add(intelCpuList.get(i)); } } else if (ibmCpuByNameDictionary.containsKey(maxCpuName)) { - ServerCpu selected = ibmCpuByNameDictionary.get(maxCpuName); - int selectedCpuIndex = ibmCpuList.indexOf(selected); - for (int i = 0; i <= selectedCpuIndex; i++) { - supportedCpus.add(ibmCpuList.get(i)); - } + ServerCpu selected = ibmCpuByNameDictionary.get(maxCpuName); + int selectedCpuIndex = ibmCpuList.indexOf(selected); + for (int i = 0; i <= selectedCpuIndex; i++) { + supportedCpus.add(ibmCpuList.get(i)); + } } else if (amdCpuByNameDictionary.containsKey(maxCpuName)) { ServerCpu selected = amdCpuByNameDictionary.get(maxCpuName); int selectedCpuIndex = amdCpuList.indexOf(selected); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateOvaCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateOvaCommand.java index bd0fae251f9..61dc066a68c 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateOvaCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateOvaCommand.java @@ -99,32 +99,32 @@ protected void executeCommand() { private Pair createOvf(Collection disks) { switch (getParameters().getEntityType()) { - case TEMPLATE: - VmTemplate template = vmTemplateDao.get(getParameters().getEntityId()); - vmHandler.updateVmInitFromDB(template, true); - vmDeviceUtils.setVmDevices(template); - template.setVmExternalData(getVmExternalData()); - List interfaces = vmNetworkInterfaceDao.getAllForTemplate(template.getId()); - template.setInterfaces(interfaces); - FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(template); - fullEntityOvfData.setDiskImages(new ArrayList<>(disks)); - fullEntityOvfData.setInterfaces(interfaces); - return new Pair<>(ovfManager.exportOva(template, fullEntityOvfData, template.getCompatibilityVersion()), - template.getCompatibilityVersion()); - - default: - VM vm = vmDao.get(getParameters().getEntityId()); - vmHandler.updateVmInitFromDB(vm.getStaticData(), true); - vmHandler.updateNumaNodesFromDb(vm); - vm.setVmExternalData(getVmExternalData()); - interfaces = vmNetworkInterfaceDao.getAllForVm(vm.getId()); - vm.setInterfaces(interfaces); - vmDeviceUtils.setVmDevices(vm.getStaticData()); - fullEntityOvfData = new FullEntityOvfData(vm); - fullEntityOvfData.setDiskImages(new ArrayList<>(disks)); - fullEntityOvfData.setInterfaces(interfaces); - return new Pair<>(ovfManager.exportOva(vm, fullEntityOvfData, vm.getCompatibilityVersion()), - vm.getCompatibilityVersion()); + case TEMPLATE: + VmTemplate template = vmTemplateDao.get(getParameters().getEntityId()); + vmHandler.updateVmInitFromDB(template, true); + vmDeviceUtils.setVmDevices(template); + template.setVmExternalData(getVmExternalData()); + List interfaces = vmNetworkInterfaceDao.getAllForTemplate(template.getId()); + template.setInterfaces(interfaces); + FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(template); + fullEntityOvfData.setDiskImages(new ArrayList<>(disks)); + fullEntityOvfData.setInterfaces(interfaces); + return new Pair<>(ovfManager.exportOva(template, fullEntityOvfData, template.getCompatibilityVersion()), + template.getCompatibilityVersion()); + + default: + VM vm = vmDao.get(getParameters().getEntityId()); + vmHandler.updateVmInitFromDB(vm.getStaticData(), true); + vmHandler.updateNumaNodesFromDb(vm); + vm.setVmExternalData(getVmExternalData()); + interfaces = vmNetworkInterfaceDao.getAllForVm(vm.getId()); + vm.setInterfaces(interfaces); + vmDeviceUtils.setVmDevices(vm.getStaticData()); + fullEntityOvfData = new FullEntityOvfData(vm); + fullEntityOvfData.setDiskImages(new ArrayList<>(disks)); + fullEntityOvfData.setInterfaces(interfaces); + return new Pair<>(ovfManager.exportOva(vm, fullEntityOvfData, vm.getCompatibilityVersion()), + vm.getCompatibilityVersion()); } } @@ -300,18 +300,18 @@ private void teardown() { @Override public boolean performNextOperation(int completedChildCount) { switch (getParameters().getPhase()) { - case MEASURE: - getParameters().setPhase(CreateOvaParameters.Phase.PACK_OVA); - break; + case MEASURE: + getParameters().setPhase(CreateOvaParameters.Phase.PACK_OVA); + break; - case PACK_OVA: - getParameters().setPhase(CreateOvaParameters.Phase.TEARDOWN); - break; + case PACK_OVA: + getParameters().setPhase(CreateOvaParameters.Phase.TEARDOWN); + break; - case TEARDOWN: - return false; + case TEARDOWN: + return false; - default: + default: } persistCommandIfNeeded(); @@ -321,17 +321,17 @@ public boolean performNextOperation(int completedChildCount) { private void executeNextOperation() { switch (getParameters().getPhase()) { - case MEASURE: - fillDiskApparentSize(getParameters().getDisks(), getParameters().getDiskIdToPath()); - break; + case MEASURE: + fillDiskApparentSize(getParameters().getDisks(), getParameters().getDiskIdToPath()); + break; - case PACK_OVA: - packOva(); - break; + case PACK_OVA: + packOva(); + break; - case TEARDOWN: - teardown(); - break; + case TEARDOWN: + teardown(); + break; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/EventSubscriptionCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/EventSubscriptionCommandBase.java index f54c09d03b9..4b2ee827dbb 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/EventSubscriptionCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/EventSubscriptionCommandBase.java @@ -62,19 +62,19 @@ protected boolean validateNotificationMethod(EventNotificationMethod eventNotifi boolean retValue = true; switch (eventNotificationMethod) { - case SMTP: - String mailAddress = StringUtils.isEmpty(eventSubscriber.getMethodAddress()) ? user.getEmail() - : eventSubscriber.getMethodAddress(); + case SMTP: + String mailAddress = StringUtils.isEmpty(eventSubscriber.getMethodAddress()) ? user.getEmail() + : eventSubscriber.getMethodAddress(); - if (!isEmailValid(mailAddress)) { - addValidationMessage(EngineMessage.USER_DOES_NOT_HAVE_A_VALID_EMAIL); + if (!isEmailValid(mailAddress)) { + addValidationMessage(EngineMessage.USER_DOES_NOT_HAVE_A_VALID_EMAIL); + retValue = false; + } + break; + default: + addValidationMessage(EngineMessage.EN_UNKNOWN_NOTIFICATION_METHOD); retValue = false; - } - break; - default: - addValidationMessage(EngineMessage.EN_UNKNOWN_NOTIFICATION_METHOD); - retValue = false; - break; + break; } return retValue; } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAllVmsForUserAndActionGroupQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAllVmsForUserAndActionGroupQuery.java index b6a76de876c..90383e49b21 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAllVmsForUserAndActionGroupQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAllVmsForUserAndActionGroupQuery.java @@ -19,7 +19,7 @@ public GetAllVmsForUserAndActionGroupQuery(P parameters, EngineContext engineCon @Override protected void executeQueryCommand() { - List vms = vmDynamicDao.getAllRunningForUserAndActionGroup(getUserID(), getParameters().getActionGroup()); - getQueryReturnValue().setReturnValue(vms); + List vms = vmDynamicDao.getAllRunningForUserAndActionGroup(getUserID(), getParameters().getActionGroup()); + getQueryReturnValue().setReturnValue(vms); } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetArchitectureCapabilitiesQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetArchitectureCapabilitiesQuery.java index 83b6c4c444f..6083e3c15c7 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetArchitectureCapabilitiesQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetArchitectureCapabilitiesQuery.java @@ -56,14 +56,14 @@ private static boolean isSupported(ArchCapabilitiesVerb archCapabilitiesVerb, ArchitectureType architecture, Version version) { switch (archCapabilitiesVerb) { - case GetMigrationSupport: - return FeatureSupported.isMigrationSupported(architecture, version); - case GetSuspendSupport: - return FeatureSupported.isSuspendSupportedByArchitecture(architecture, version); - case GetMemoryHotUnplugSupport: - return FeatureSupported.hotUnplugMemory(version, architecture); - case GetTpmDeviceSupport: - return FeatureSupported.isTpmDeviceSupported(version, architecture); + case GetMigrationSupport: + return FeatureSupported.isMigrationSupported(architecture, version); + case GetSuspendSupport: + return FeatureSupported.isSuspendSupportedByArchitecture(architecture, version); + case GetMemoryHotUnplugSupport: + return FeatureSupported.hotUnplugMemory(version, architecture); + case GetTpmDeviceSupport: + return FeatureSupported.isTpmDeviceSupported(version, architecture); } return false; } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetEventSubscriptionQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetEventSubscriptionQuery.java index b4a9f9159a4..f7555a09593 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetEventSubscriptionQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetEventSubscriptionQuery.java @@ -13,7 +13,7 @@ * This query returns the event-subscription for the specified user and event. */ public class GetEventSubscriptionQuery

-extends QueriesCommandBase

{ + extends QueriesCommandBase

{ @Inject private EventDao eventDao; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetFenceConfigurationValueQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetFenceConfigurationValueQuery.java index 99a58cd1b44..af0634275be 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetFenceConfigurationValueQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetFenceConfigurationValueQuery.java @@ -25,7 +25,7 @@ protected void executeQueryCommand() { } getQueryReturnValue().setReturnValue(FenceConfigHelper.getFenceConfigurationValue(getParameters().getConfigValue().toString(), version)); } catch (Exception e) { - log.error("Unable to return config parameter {}: {}", getParameters(), e.getMessage() ); + log.error("Unable to return config parameter {}: {}", getParameters(), e.getMessage()); log.debug("Exception", e); } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetGraphicsDevicesMultipleQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetGraphicsDevicesMultipleQuery.java index 9dd06985c22..0bed81ff6a6 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetGraphicsDevicesMultipleQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetGraphicsDevicesMultipleQuery.java @@ -28,7 +28,7 @@ public GetGraphicsDevicesMultipleQuery(P parameters, EngineContext context) { protected void executeQueryCommand() { Map> result = new HashMap<>(); - mapDevices(result, VmDeviceType.SPICE, getParameters().getIds() ); + mapDevices(result, VmDeviceType.SPICE, getParameters().getIds()); mapDevices(result, VmDeviceType.VNC, getParameters().getIds()); setReturnValue(result); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetSystemStatisticsQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetSystemStatisticsQuery.java index 8f29b8efdad..0cc26ed3ac2 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetSystemStatisticsQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetSystemStatisticsQuery.java @@ -85,7 +85,7 @@ private int getTotalHostsStat() { private int getActiveHostsStat() { String[] activeVdsStatuses = - {String.valueOf(VDSStatus.Up.getValue()), + {String.valueOf(VDSStatus.Up.getValue()), String.valueOf(VDSStatus.PreparingForMaintenance.getValue())}; return systemStatisticsDao.getSystemStatisticsValue(HOST_ENTITY_NAME, StringUtils.join(activeVdsStatuses, COMMA_DELIMITER)); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetVmFromConfigurationQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetVmFromConfigurationQuery.java index 1acec2f5a73..96d8faec1c2 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetVmFromConfigurationQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetVmFromConfigurationQuery.java @@ -25,25 +25,25 @@ protected void executeQueryCommand() { } switch (getParameters().getConfigurationType()) { - case OVF: - try { - getQueryReturnValue().setReturnValue(ovfHelper.readVmFromOvf(getParameters().getVmConfiguration()).getVm()); - } catch (OvfReaderException e) { - log.warn("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); - getQueryReturnValue().setSucceeded(false); - getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); - } - break; + case OVF: + try { + getQueryReturnValue().setReturnValue(ovfHelper.readVmFromOvf(getParameters().getVmConfiguration()).getVm()); + } catch (OvfReaderException e) { + log.warn("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); + getQueryReturnValue().setSucceeded(false); + getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); + } + break; - case OVA: - try { - getQueryReturnValue().setReturnValue(ovfHelper.readVmFromOva(getParameters().getVmConfiguration())); - } catch (OvfReaderException e) { - log.warn("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); - getQueryReturnValue().setSucceeded(false); - getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); - } - break; + case OVA: + try { + getQueryReturnValue().setReturnValue(ovfHelper.readVmFromOva(getParameters().getVmConfiguration())); + } catch (OvfReaderException e) { + log.warn("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); + getQueryReturnValue().setSucceeded(false); + getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); + } + break; } } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetVmTemplateFromConfigurationQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetVmTemplateFromConfigurationQuery.java index 8559b783317..25ec09334d8 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetVmTemplateFromConfigurationQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetVmTemplateFromConfigurationQuery.java @@ -25,25 +25,25 @@ protected void executeQueryCommand() { } switch (getParameters().getConfigurationType()) { - case OVF: - try { - getQueryReturnValue().setReturnValue(ovfHelper.readVmTemplateFromOvf(getParameters().getVmConfiguration()).getVm()); - } catch (OvfReaderException e) { - log.warn("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); - getQueryReturnValue().setSucceeded(false); - getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); - } - break; + case OVF: + try { + getQueryReturnValue().setReturnValue(ovfHelper.readVmTemplateFromOvf(getParameters().getVmConfiguration()).getVm()); + } catch (OvfReaderException e) { + log.warn("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); + getQueryReturnValue().setSucceeded(false); + getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); + } + break; - case OVA: - try { - getQueryReturnValue().setReturnValue(ovfHelper.readVmTemplateFromOva(getParameters().getVmConfiguration())); - } catch (OvfReaderException e) { - log.warn("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); - getQueryReturnValue().setSucceeded(false); - getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); - } - break; + case OVA: + try { + getQueryReturnValue().setReturnValue(ovfHelper.readVmTemplateFromOva(getParameters().getVmConfiguration())); + } catch (OvfReaderException e) { + log.warn("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); + getQueryReturnValue().setSucceeded(false); + getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); + } + break; } } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java index d8324a9afdb..89b1542803d 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HibernateVmCommand.java @@ -161,17 +161,17 @@ protected AsyncTaskType getTaskType() { @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { - case EXECUTE: - return getSucceeded() ? AuditLogType.USER_SUSPEND_VM : AuditLogType.USER_FAILED_SUSPEND_VM; - case END_SUCCESS: - if (getSucceeded()) { - // no event should be displayed if the command ended successfully, the monitoring will log it - return AuditLogType.UNASSIGNED; - } - case END_FAILURE: - default: - return hibernateVdsProblematic ? AuditLogType.USER_SUSPEND_VM_FINISH_FAILURE_WILL_TRY_AGAIN - : AuditLogType.USER_SUSPEND_VM_FINISH_FAILURE; + case EXECUTE: + return getSucceeded() ? AuditLogType.USER_SUSPEND_VM : AuditLogType.USER_FAILED_SUSPEND_VM; + case END_SUCCESS: + if (getSucceeded()) { + // no event should be displayed if the command ended successfully, the monitoring will log it + return AuditLogType.UNASSIGNED; + } + case END_FAILURE: + default: + return hibernateVdsProblematic ? AuditLogType.USER_SUSPEND_VM_FINISH_FAILURE_WILL_TRY_AGAIN + : AuditLogType.USER_SUSPEND_VM_FINISH_FAILURE; } } @@ -188,7 +188,7 @@ protected boolean validate() { } if (!canRunActionOnNonManagedVm()) { - return false; + return false; } VMStatus vmStatus = getVm().getStatus(); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HostMaintenanceCallback.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HostMaintenanceCallback.java index 88a02175f73..a1a3e7ccd57 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HostMaintenanceCallback.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HostMaintenanceCallback.java @@ -94,42 +94,41 @@ private void evaluateMaintenanceHostCommandProgress( switch (host.getStatus()) { - // Wait till moving to maintenance ends - case PreparingForMaintenance: - break; - - // Stop Gluster processes - case Maintenance: - log.info("Host '{}' is on maintenance mode. Stoping all gluster services.", - getHostName(parameters.getVdsId())); - stopGlusterServices(parameters.getVdsId()); - GlusterStatus isRunning = glusterUtil.isVDORunning(parameters.getVdsId()); - switch (isRunning) { - case DOWN: - log.info("VDO service is down in host : '{}' , skipping stopping of VDO service", - parameters.getVdsId()); + // Wait till moving to maintenance ends + case PreparingForMaintenance: break; - case UP: - log.info("VDO service is up in host : '{}' , stopping VDO service", parameters.getVdsId()); - stopVDOService(parameters.getVdsId()); - break; - case UNKNOWN: - log.info("VDO service is not installed host : '{}' , ignoring stop VDO service", - parameters.getVdsId()); - break; - } - maintenanceCommand.setCommandStatus(CommandStatus.SUCCEEDED); - break; - // Any other status implies maintenance action failed, and the callback cannot proceed with stopping gluster's services - default: - if (isMaintenanceCommandExecuted(maintenanceCommand)) { - log.info("Host '{}' failed to move to maintenance mode. Could not stop Gluster services.", + // Stop Gluster processes + case Maintenance: + log.info("Host '{}' is on maintenance mode. Stoping all gluster services.", getHostName(parameters.getVdsId())); - maintenanceCommand.setCommandStatus(CommandStatus.FAILED); - } + stopGlusterServices(parameters.getVdsId()); + GlusterStatus isRunning = glusterUtil.isVDORunning(parameters.getVdsId()); + switch (isRunning) { + case DOWN: + log.info("VDO service is down in host : '{}' , skipping stopping of VDO service", + parameters.getVdsId()); + break; + case UP: + log.info("VDO service is up in host : '{}' , stopping VDO service", parameters.getVdsId()); + stopVDOService(parameters.getVdsId()); + break; + case UNKNOWN: + log.info("VDO service is not installed host : '{}' , ignoring stop VDO service", + parameters.getVdsId()); + break; + } + maintenanceCommand.setCommandStatus(CommandStatus.SUCCEEDED); + break; - break; + // Any other status implies maintenance action failed, and the callback cannot proceed with stopping gluster's services + default: + if (isMaintenanceCommandExecuted(maintenanceCommand)) { + log.info("Host '{}' failed to move to maintenance mode. Could not stop Gluster services.", + getHostName(parameters.getVdsId())); + maintenanceCommand.setCommandStatus(CommandStatus.FAILED); + } + break; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunnersFactory.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunnersFactory.java index bf42d3bf62a..995d5fd3bc3 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunnersFactory.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunnersFactory.java @@ -34,62 +34,62 @@ public MultipleActionsRunner createMultipleActionsRunner(ActionType actionType, boolean isInternal, CommandContext commandContext) { MultipleActionsRunner runner; switch (actionType) { - case DeactivateStorageDomainWithOvfUpdate: - runner = new DeactivateStorageDomainsMultipleActionRunner(actionType, parameters, commandContext, isInternal); - break; - case AttachStorageDomainToPool: - runner = new AttachStorageDomainsMultipleActionRunner(actionType, parameters, commandContext, isInternal); - break; - case RunVm: - runner = new RunVMActionRunner(actionType, parameters, commandContext, isInternal); - break; - case MigrateVm: - runner = new MigrateVMActionRunner(actionType, parameters, commandContext, isInternal); - break; - case RemoveVmFromPool: - runner = new RemoveVmFromPoolRunner(actionType, parameters, commandContext, isInternal); - break; - case StartGlusterVolume: - case StopGlusterVolume: - case DeleteGlusterVolume: - case SetGlusterVolumeOption: - case ResetGlusterVolumeOptions: - case AddVds: // AddVds is called with multiple actions *only* in case of gluster clusters - case RemoveGlusterServer: - case EnableGlusterHook: - case DisableGlusterHook: - case DeleteGlusterVolumeSnapshot: - runner = new GlusterMultipleActionsRunner(actionType, parameters, commandContext, isInternal); - break; - case RemoveVds: - if (containsGlusterServer(parameters)) { + case DeactivateStorageDomainWithOvfUpdate: + runner = new DeactivateStorageDomainsMultipleActionRunner(actionType, parameters, commandContext, isInternal); + break; + case AttachStorageDomainToPool: + runner = new AttachStorageDomainsMultipleActionRunner(actionType, parameters, commandContext, isInternal); + break; + case RunVm: + runner = new RunVMActionRunner(actionType, parameters, commandContext, isInternal); + break; + case MigrateVm: + runner = new MigrateVMActionRunner(actionType, parameters, commandContext, isInternal); + break; + case RemoveVmFromPool: + runner = new RemoveVmFromPoolRunner(actionType, parameters, commandContext, isInternal); + break; + case StartGlusterVolume: + case StopGlusterVolume: + case DeleteGlusterVolume: + case SetGlusterVolumeOption: + case ResetGlusterVolumeOptions: + case AddVds: // AddVds is called with multiple actions *only* in case of gluster clusters + case RemoveGlusterServer: + case EnableGlusterHook: + case DisableGlusterHook: + case DeleteGlusterVolumeSnapshot: runner = new GlusterMultipleActionsRunner(actionType, parameters, commandContext, isInternal); - } else { - runner = new PrevalidatingMultipleActionsRunner(actionType, parameters, commandContext, isInternal); - } + break; + case RemoveVds: + if (containsGlusterServer(parameters)) { + runner = new GlusterMultipleActionsRunner(actionType, parameters, commandContext, isInternal); + } else { + runner = new PrevalidatingMultipleActionsRunner(actionType, parameters, commandContext, isInternal); + } - break; - case PersistentHostSetupNetworks: - case SyncAllHostNetworks: - runner = new ParallelMultipleActionsRunner(actionType, parameters, commandContext, isInternal); - break; - case AttachNetworkToCluster: - case DetachNetworkToCluster: - case UpdateNetworkOnCluster: - throw new UnsupportedOperationException("Multiple network attachments/detachments/updates should be run through ManageNetworkClustersCommand!"); + break; + case PersistentHostSetupNetworks: + case SyncAllHostNetworks: + runner = new ParallelMultipleActionsRunner(actionType, parameters, commandContext, isInternal); + break; + case AttachNetworkToCluster: + case DetachNetworkToCluster: + case UpdateNetworkOnCluster: + throw new UnsupportedOperationException("Multiple network attachments/detachments/updates should be run through ManageNetworkClustersCommand!"); - case AddNetworkAttachment: - case UpdateNetworkAttachment: - case RemoveNetworkAttachment: - throw new UnsupportedOperationException("AddNetworkAttachment, UpdateNetworkAttachment, and RemoveNetworkAttachment cannot be run using MultipleActionsRunner"); - case RemoveDiskProfile: - case RemoveCpuProfile: - case RemoveNetwork: - runner = new SequentialMultipleActionsRunner(actionType, parameters, commandContext, isInternal); - break; - default: - runner = new PrevalidatingMultipleActionsRunner(actionType, parameters, commandContext, isInternal); - break; + case AddNetworkAttachment: + case UpdateNetworkAttachment: + case RemoveNetworkAttachment: + throw new UnsupportedOperationException("AddNetworkAttachment, UpdateNetworkAttachment, and RemoveNetworkAttachment cannot be run using MultipleActionsRunner"); + case RemoveDiskProfile: + case RemoveCpuProfile: + case RemoveNetwork: + runner = new SequentialMultipleActionsRunner(actionType, parameters, commandContext, isInternal); + break; + default: + runner = new PrevalidatingMultipleActionsRunner(actionType, parameters, commandContext, isInternal); + break; } return Injector.injectMembers(runner); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ObjectCompensation.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ObjectCompensation.java index c78be5f3be1..2d197f5977f 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ObjectCompensation.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ObjectCompensation.java @@ -16,14 +16,14 @@ public class ObjectCompensation { public void compensate(String commandType, TransientCompensationBusinessEntity entity) { switch (entity.getTransientEntityType()) { - case RELEASE_MACS: - handleReleaseMacsCompensation((ReleaseMacsTransientCompensation) entity); - break; - default: - throw new IllegalArgumentException(String.format( - "Unable to compensate type %s, please handle this compensation in command %s.", - BusinessEntitySnapshot.SnapshotType.TRANSIENT_ENTITY, - commandType)); + case RELEASE_MACS: + handleReleaseMacsCompensation((ReleaseMacsTransientCompensation) entity); + break; + default: + throw new IllegalArgumentException(String.format( + "Unable to compensate type %s, please handle this compensation in command %s.", + BusinessEntitySnapshot.SnapshotType.TRANSIENT_ENTITY, + commandType)); } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/QosQueryBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/QosQueryBase.java index 06c1cc0881a..1553d30d4a0 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/QosQueryBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/QosQueryBase.java @@ -38,17 +38,17 @@ protected QosDao getQosDao() { return qosBaseDao; } switch (qosType) { - case STORAGE: - return storageQosDao; - case CPU: - return cpuQosDao; - case NETWORK: - return networkQoSDao; - case HOSTNETWORK: - return hostNetworkQosDao; - default: - log.debug("Not handled QoS type: '{}'", qosType); - break; + case STORAGE: + return storageQosDao; + case CPU: + return cpuQosDao; + case NETWORK: + return networkQoSDao; + case HOSTNETWORK: + return hostNetworkQosDao; + default: + log.debug("Not handled QoS type: '{}'", qosType); + break; } return null; } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ReduceImageCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ReduceImageCommand.java index 6a4528110c1..719134ef97d 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ReduceImageCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ReduceImageCommand.java @@ -270,14 +270,14 @@ protected Map> getSharedLocks() { public AuditLogType getAuditLogTypeValue() { addAuditLogCustomValues(); switch (getActionState()) { - case EXECUTE: - return getSucceeded() ? - AuditLogType.UNASSIGNED - : AuditLogType.USER_REDUCE_DISK_FINISHED_FAILURE; - default: - return getSucceeded() ? - AuditLogType.USER_REDUCE_DISK_FINISHED_SUCCESS - : AuditLogType.USER_REDUCE_DISK_FINISHED_FAILURE; + case EXECUTE: + return getSucceeded() ? + AuditLogType.UNASSIGNED + : AuditLogType.USER_REDUCE_DISK_FINISHED_FAILURE; + default: + return getSucceeded() ? + AuditLogType.USER_REDUCE_DISK_FINISHED_SUCCESS + : AuditLogType.USER_REDUCE_DISK_FINISHED_FAILURE; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ReloadConfigurationsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ReloadConfigurationsCommand.java index 698060df38f..7ffc2a388d0 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ReloadConfigurationsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ReloadConfigurationsCommand.java @@ -32,6 +32,6 @@ public List getPermissionCheckSubjects() { @Override public AuditLogType getAuditLogTypeValue() { - return getSucceeded() ? AuditLogType.RELOAD_CONFIGURATIONS_SUCCESS : AuditLogType.RELOAD_CONFIGURATIONS_FAILURE; + return getSucceeded() ? AuditLogType.RELOAD_CONFIGURATIONS_SUCCESS : AuditLogType.RELOAD_CONFIGURATIONS_FAILURE; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmTemplateCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmTemplateCommand.java index 9ea3cd88c61..d9a044fd2de 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmTemplateCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmTemplateCommand.java @@ -405,12 +405,12 @@ protected boolean removeVmTemplateImages() { @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { - case EXECUTE: - return getSucceeded() ? AuditLogType.USER_REMOVE_VM_TEMPLATE : AuditLogType.USER_FAILED_REMOVE_VM_TEMPLATE; - case END_FAILURE: - case END_SUCCESS: - default: - return AuditLogType.USER_REMOVE_VM_TEMPLATE_FINISHED; + case EXECUTE: + return getSucceeded() ? AuditLogType.USER_REMOVE_VM_TEMPLATE : AuditLogType.USER_FAILED_REMOVE_VM_TEMPLATE; + case END_FAILURE: + case END_SUCCESS: + default: + return AuditLogType.USER_REMOVE_VM_TEMPLATE_FINISHED; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ResetVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ResetVmCommand.java index c0585ef00a5..a9f7c2e28eb 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ResetVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ResetVmCommand.java @@ -33,8 +33,8 @@ protected void setActionMessageParameters() { protected void perform() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.ResetVm, new VdsAndVmIDVDSParametersBase(getVdsId(), getVmId())); - setActionReturnValue(returnValue.getReturnValue()); - setSucceeded(returnValue.getSucceeded()); + setActionReturnValue(returnValue.getReturnValue()); + setSucceeded(returnValue.getSucceeded()); } @Override diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java index 037da4421d8..5ab7d95a3cf 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java @@ -307,19 +307,19 @@ vmHandler, getVds())) { // if the returned exception is such that shoudn't trigger the re-run process, // re-throw it. otherwise, continue (the vm will be down and a re-run will be triggered) switch (e.getErrorCode()) { - case Done: // should never get here with errorCode = 'Done' though - case exist: - cleanupPassthroughVnics(); - reportCompleted(); - throw e; - case VDS_NETWORK_ERROR: // probably wrong xml format sent. - case PROVIDER_FAILURE: - case HOST_DEVICES_TAKEN_BY_OTHER_VM: - case INVALID_HA_VM_LEASE: - runningFailed(); - throw e; - default: - log.warn("Failed to run VM '{}': {}", getVmName(), e.getMessage()); + case Done: // should never get here with errorCode = 'Done' though + case exist: + cleanupPassthroughVnics(); + reportCompleted(); + throw e; + case VDS_NETWORK_ERROR: // probably wrong xml format sent. + case PROVIDER_FAILURE: + case HOST_DEVICES_TAKEN_BY_OTHER_VM: + case INVALID_HA_VM_LEASE: + runningFailed(); + throw e; + default: + log.warn("Failed to run VM '{}': {}", getVmName(), e.getMessage()); } } finally { @@ -384,14 +384,14 @@ private void releaseHostDevicesLock() { @Override protected void executeVmCommand() { switch (getVm().getOrigin()) { - case KUBEVIRT: - runKubevirtVm(); - break; - default: - getVmManager().setPowerOffTimeout(System.nanoTime()); - setActionReturnValue(VMStatus.Down); - initVm(); - perform(); + case KUBEVIRT: + runKubevirtVm(); + break; + default: + getVmManager().setPowerOffTimeout(System.nanoTime()); + setActionReturnValue(VMStatus.Down); + initVm(); + perform(); } } @@ -428,13 +428,13 @@ protected RunVmFlow getFlow() { } switch (getVm().getStatus()) { - case Paused: - return setFlow(RunVmFlow.RESUME_PAUSE); + case Paused: + return setFlow(RunVmFlow.RESUME_PAUSE); - case Suspended: - return setFlow(RunVmFlow.RESUME_HIBERNATE); + case Suspended: + return setFlow(RunVmFlow.RESUME_HIBERNATE); - default: + default: } if (isRunAsStateless()) { @@ -460,22 +460,22 @@ && isStatelessSnapshotExistsForVm() protected void perform() { switch (getFlow()) { - case RESUME_PAUSE: - resumeVm(); - break; + case RESUME_PAUSE: + resumeVm(); + break; - case REMOVE_STATELESS_IMAGES: - removeStatlessSnapshot(); - break; + case REMOVE_STATELESS_IMAGES: + removeStatlessSnapshot(); + break; - case CREATE_STATELESS_IMAGES: - createStatelessSnapshot(); - break; + case CREATE_STATELESS_IMAGES: + createStatelessSnapshot(); + break; - case RESUME_HIBERNATE: - case RUN: - default: - runVm(); + case RESUME_HIBERNATE: + case RUN: + default: + runVm(); } } @@ -683,61 +683,61 @@ protected Map flushPassthroughVnicToVfMap() { @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { - case EXECUTE: - if (getFlow() == RunVmFlow.REMOVE_STATELESS_IMAGES) { - return AuditLogType.USER_RUN_VM_FAILURE_STATELESS_SNAPSHOT_LEFT; - } - if (getFlow() == RunVmFlow.RESUME_PAUSE) { - return getSucceeded() ? AuditLogType.USER_RESUME_VM : AuditLogType.USER_FAILED_RESUME_VM; - } else if (isInternalExecution()) { - if (getSucceeded()) { - boolean isStateless = isStatelessSnapshotExistsForVm(); - if (isStateless) { - return AuditLogType.VDS_INITIATED_RUN_VM_AS_STATELESS; - } else if (getFlow() == RunVmFlow.CREATE_STATELESS_IMAGES) { - return AuditLogType.VDS_INITIATED_RUN_AS_STATELESS_VM_NOT_YET_RUNNING; - } else { - return AuditLogType.VDS_INITIATED_RUN_VM; + case EXECUTE: + if (getFlow() == RunVmFlow.REMOVE_STATELESS_IMAGES) { + return AuditLogType.USER_RUN_VM_FAILURE_STATELESS_SNAPSHOT_LEFT; + } + if (getFlow() == RunVmFlow.RESUME_PAUSE) { + return getSucceeded() ? AuditLogType.USER_RESUME_VM : AuditLogType.USER_FAILED_RESUME_VM; + } else if (isInternalExecution()) { + if (getSucceeded()) { + boolean isStateless = isStatelessSnapshotExistsForVm(); + if (isStateless) { + return AuditLogType.VDS_INITIATED_RUN_VM_AS_STATELESS; + } else if (getFlow() == RunVmFlow.CREATE_STATELESS_IMAGES) { + return AuditLogType.VDS_INITIATED_RUN_AS_STATELESS_VM_NOT_YET_RUNNING; + } else { + return AuditLogType.VDS_INITIATED_RUN_VM; + } } + + return AuditLogType.VDS_INITIATED_RUN_VM_FAILED; + } else { + addCustomValue("DueToError", " "); + return getSucceeded() ? + getActionReturnValue() == VMStatus.Up ? + isVmRunningOnNonDefaultVds() ? + AuditLogType.USER_RUN_VM_ON_NON_DEFAULT_VDS + : isStatelessSnapshotExistsForVm() ? + AuditLogType.USER_RUN_VM_AS_STATELESS + : AuditLogType.USER_RUN_VM + : _isRerun ? + AuditLogType.VDS_INITIATED_RUN_VM + : getVm().isRunAndPause() ? + AuditLogType.USER_INITIATED_RUN_VM_AND_PAUSE + : getFlow() == RunVmFlow.CREATE_STATELESS_IMAGES ? + AuditLogType.USER_INITIATED_RUN_VM + : AuditLogType.USER_STARTED_VM + : _isRerun ? AuditLogType.USER_INITIATED_RUN_VM_FAILED : AuditLogType.USER_FAILED_RUN_VM; } - return AuditLogType.VDS_INITIATED_RUN_VM_FAILED; - } else { - addCustomValue("DueToError", " "); - return getSucceeded() ? - getActionReturnValue() == VMStatus.Up ? - isVmRunningOnNonDefaultVds() ? - AuditLogType.USER_RUN_VM_ON_NON_DEFAULT_VDS - : isStatelessSnapshotExistsForVm() ? - AuditLogType.USER_RUN_VM_AS_STATELESS - : AuditLogType.USER_RUN_VM - : _isRerun ? - AuditLogType.VDS_INITIATED_RUN_VM - : getVm().isRunAndPause() ? - AuditLogType.USER_INITIATED_RUN_VM_AND_PAUSE - : getFlow() == RunVmFlow.CREATE_STATELESS_IMAGES ? - AuditLogType.USER_INITIATED_RUN_VM - : AuditLogType.USER_STARTED_VM - : _isRerun ? AuditLogType.USER_INITIATED_RUN_VM_FAILED : AuditLogType.USER_FAILED_RUN_VM; - } + case END_SUCCESS: + // if not running as stateless, or if succeeded running as + // stateless, + // command should be with 'CommandShouldBeLogged = false': + return isStatelessSnapshotExistsForVm() && !getSucceeded() ? + AuditLogType.USER_RUN_VM_AS_STATELESS_FINISHED_FAILURE : AuditLogType.UNASSIGNED; - case END_SUCCESS: - // if not running as stateless, or if succeeded running as - // stateless, - // command should be with 'CommandShouldBeLogged = false': - return isStatelessSnapshotExistsForVm() && !getSucceeded() ? - AuditLogType.USER_RUN_VM_AS_STATELESS_FINISHED_FAILURE : AuditLogType.UNASSIGNED; - - case END_FAILURE: - // if not running as stateless, command should - // be with 'CommandShouldBeLogged = false': - return isStatelessSnapshotExistsForVm() ? - AuditLogType.USER_RUN_VM_AS_STATELESS_FINISHED_FAILURE : AuditLogType.UNASSIGNED; - - default: - // all other cases should be with 'CommandShouldBeLogged = - // false': - return AuditLogType.UNASSIGNED; + case END_FAILURE: + // if not running as stateless, command should + // be with 'CommandShouldBeLogged = false': + return isStatelessSnapshotExistsForVm() ? + AuditLogType.USER_RUN_VM_AS_STATELESS_FINISHED_FAILURE : AuditLogType.UNASSIGNED; + + default: + // all other cases should be with 'CommandShouldBeLogged = + // false': + return AuditLogType.UNASSIGNED; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java index d93ea53deaf..7123bc993e4 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java @@ -265,13 +265,13 @@ public void reportCompleted() { protected void endExecutionMonitoring() { ExecutionContext executionContext = getExecutionContext(); switch (executionContext.getExecutionMethod()) { - case AsJob: - executionHandler.endJob(executionContext, false); - break; - case AsStep: - executionHandler.endStep(executionContext, executionContext.getStep(), false); - break; - default: + case AsJob: + executionHandler.endJob(executionContext, false); + break; + case AsStep: + executionHandler.endStep(executionContext, executionContext.getStep(), false); + break; + default: } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SearchQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SearchQuery.java index b995af81558..03b78127e87 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SearchQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SearchQuery.java @@ -185,78 +185,78 @@ public SearchQuery(P parameters, EngineContext engineContext) { protected void executeQueryCommand() { List returnValue = new ArrayList<>(); switch (getParameters().getSearchTypeValue()) { - case VM: - returnValue = searchVmsFromDb(); - break; - case DirectoryGroup: - returnValue = searchDirectoryGroups(); - break; - case DirectoryUser: - returnValue = searchDirectoryUsers(); - break; - case AuditLog: - returnValue = searchAuditLogEvents(); - break; - case DBUser: - returnValue = searchDbUsers(); - break; - case DBGroup: - returnValue = searchDbGroups(); - break; - case VDS: - returnValue = searchVDSsByDb(); - break; - case VmTemplate: - returnValue = searchVmTemplates(); - break; - case VmPools: - returnValue = searchVmPools(); - break; - case Cluster: - returnValue = searchClusters(); - break; - case StoragePool: - returnValue = searchStoragePool(); - break; - case StorageDomain: - returnValue = searchStorageDomain(); - break; - case Quota: - returnValue = searchQuota(); - break; - case Disk: - returnValue = searchDisk(); - break; - case GlusterVolume: - returnValue = searchGlusterVolumes(); - break; - case Network: - returnValue = searchNetworks(); - break; - case Provider: - returnValue = searchProviders(); - break; - case InstanceType: - returnValue = searchInstanceTypes(); - break; - case ImageType: - returnValue = searchImageTypes(); - break; - case Session: - returnValue = searchSessions(); - break; - case ImageTransfer: - returnValue = searchImageTransfer(); - break; - case Job: - returnValue = searchJobs(); - break; - case VnicProfile: - returnValue = searchVnicProfiles(); - break; - default: - log.error("Search object type not handled: {}", getParameters().getSearchTypeValue()); - break; + case VM: + returnValue = searchVmsFromDb(); + break; + case DirectoryGroup: + returnValue = searchDirectoryGroups(); + break; + case DirectoryUser: + returnValue = searchDirectoryUsers(); + break; + case AuditLog: + returnValue = searchAuditLogEvents(); + break; + case DBUser: + returnValue = searchDbUsers(); + break; + case DBGroup: + returnValue = searchDbGroups(); + break; + case VDS: + returnValue = searchVDSsByDb(); + break; + case VmTemplate: + returnValue = searchVmTemplates(); + break; + case VmPools: + returnValue = searchVmPools(); + break; + case Cluster: + returnValue = searchClusters(); + break; + case StoragePool: + returnValue = searchStoragePool(); + break; + case StorageDomain: + returnValue = searchStorageDomain(); + break; + case Quota: + returnValue = searchQuota(); + break; + case Disk: + returnValue = searchDisk(); + break; + case GlusterVolume: + returnValue = searchGlusterVolumes(); + break; + case Network: + returnValue = searchNetworks(); + break; + case Provider: + returnValue = searchProviders(); + break; + case InstanceType: + returnValue = searchInstanceTypes(); + break; + case ImageType: + returnValue = searchImageTypes(); + break; + case Session: + returnValue = searchSessions(); + break; + case ImageTransfer: + returnValue = searchImageTransfer(); + break; + case Job: + returnValue = searchJobs(); + break; + case VnicProfile: + returnValue = searchVnicProfiles(); + break; + default: + log.error("Search object type not handled: {}", getParameters().getSearchTypeValue()); + break; } getQueryReturnValue().setReturnValue(returnValue); } @@ -407,7 +407,7 @@ private List searchClusters() { if (retVal.isPresent()) { clusters.forEach(cluster -> cluster.setClusterCompatibilityLevelUpgradeNeeded( retVal.get().compareTo(cluster.getCompatibilityVersion()) > 0) - ); + ); } for (Cluster cluster: clusters) { if (cluster.isManaged()) { @@ -498,10 +498,10 @@ private void injectSessionInfo(EngineSession engineSession) { } private static final String[] AD_SEARCH_TYPES = { - SearchObjects.AD_USER_OBJ_NAME, - SearchObjects.AD_USER_PLU_OBJ_NAME, - SearchObjects.AD_GROUP_OBJ_NAME, - SearchObjects.AD_GROUP_PLU_OBJ_NAME + SearchObjects.AD_USER_OBJ_NAME, + SearchObjects.AD_USER_PLU_OBJ_NAME, + SearchObjects.AD_GROUP_OBJ_NAME, + SearchObjects.AD_GROUP_PLU_OBJ_NAME }; private static final Pattern adSearchPattern = Pattern.compile( diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetNonOperationalVdsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetNonOperationalVdsCommand.java index 459c8d344c7..0378c5a399f 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetNonOperationalVdsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetNonOperationalVdsCommand.java @@ -52,14 +52,14 @@ protected void executeCommand() { ThreadPoolUtil.execute(() -> { // migrate vms according to cluster migrateOnError option switch (getCluster().getMigrateOnError()) { - case YES: - migrateAllVms(getExecutionContext()); - break; - case HA_ONLY: - migrateAllVms(getExecutionContext(), true); - break; - default: - break; + case YES: + migrateAllVms(getExecutionContext()); + break; + case HA_ONLY: + migrateAllVms(getExecutionContext(), true); + break; + default: + break; } }); } @@ -105,48 +105,48 @@ public AuditLogType getAuditLogTypeValue() { addCustomValue(e.getKey(), e.getValue()); } switch (getParameters().getNonOperationalReason()) { - case NETWORK_UNREACHABLE: - return getSucceeded() ? AuditLogType.VDS_SET_NONOPERATIONAL_NETWORK - : AuditLogType.VDS_SET_NONOPERATIONAL_FAILED; - case STORAGE_DOMAIN_UNREACHABLE: - return getSucceeded() ? AuditLogType.VDS_SET_NONOPERATIONAL_DOMAIN - : AuditLogType.VDS_SET_NONOPERATIONAL_DOMAIN_FAILED; - case TIMEOUT_RECOVERING_FROM_CRASH: - return AuditLogType.VDS_RECOVER_FAILED; - case KVM_NOT_RUNNING: - return AuditLogType.VDS_RUN_IN_NO_KVM_MODE; - case VERSION_INCOMPATIBLE_WITH_CLUSTER: - return AuditLogType.VDS_VERSION_NOT_SUPPORTED_FOR_CLUSTER; - case CLUSTER_VERSION_INCOMPATIBLE_WITH_CLUSTER: - return AuditLogType.VDS_CLUSTER_VERSION_NOT_SUPPORTED; - case CPU_TYPE_UNSUPPORTED_IN_THIS_CLUSTER_VERSION: - return AuditLogType.CPU_TYPE_UNSUPPORTED_IN_THIS_CLUSTER_VERSION; - case VM_NETWORK_IS_BRIDGELESS: - return AuditLogType.VDS_SET_NON_OPERATIONAL_VM_NETWORK_IS_BRIDGELESS; - case GLUSTER_COMMAND_FAILED: - return AuditLogType.GLUSTER_COMMAND_FAILED; - case GLUSTER_HOST_UUID_NOT_FOUND: - return AuditLogType.GLUSTER_HOST_UUID_NOT_FOUND; - case GLUSTER_HOST_UUID_ALREADY_EXISTS: - return AuditLogType.GLUSTER_HOST_UUID_ALREADY_EXISTS; - case EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER: - return AuditLogType.EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER; - case EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER_LEVEL: + case NETWORK_UNREACHABLE: + return getSucceeded() ? AuditLogType.VDS_SET_NONOPERATIONAL_NETWORK + : AuditLogType.VDS_SET_NONOPERATIONAL_FAILED; + case STORAGE_DOMAIN_UNREACHABLE: + return getSucceeded() ? AuditLogType.VDS_SET_NONOPERATIONAL_DOMAIN + : AuditLogType.VDS_SET_NONOPERATIONAL_DOMAIN_FAILED; + case TIMEOUT_RECOVERING_FROM_CRASH: + return AuditLogType.VDS_RECOVER_FAILED; + case KVM_NOT_RUNNING: + return AuditLogType.VDS_RUN_IN_NO_KVM_MODE; + case VERSION_INCOMPATIBLE_WITH_CLUSTER: + return AuditLogType.VDS_VERSION_NOT_SUPPORTED_FOR_CLUSTER; + case CLUSTER_VERSION_INCOMPATIBLE_WITH_CLUSTER: + return AuditLogType.VDS_CLUSTER_VERSION_NOT_SUPPORTED; + case CPU_TYPE_UNSUPPORTED_IN_THIS_CLUSTER_VERSION: + return AuditLogType.CPU_TYPE_UNSUPPORTED_IN_THIS_CLUSTER_VERSION; + case VM_NETWORK_IS_BRIDGELESS: + return AuditLogType.VDS_SET_NON_OPERATIONAL_VM_NETWORK_IS_BRIDGELESS; + case GLUSTER_COMMAND_FAILED: + return AuditLogType.GLUSTER_COMMAND_FAILED; + case GLUSTER_HOST_UUID_NOT_FOUND: + return AuditLogType.GLUSTER_HOST_UUID_NOT_FOUND; + case GLUSTER_HOST_UUID_ALREADY_EXISTS: + return AuditLogType.GLUSTER_HOST_UUID_ALREADY_EXISTS; + case EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER: + return AuditLogType.EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER; + case EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER_LEVEL: return AuditLogType.EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER_LEVEL; - case RNG_SOURCES_INCOMPATIBLE_WITH_CLUSTER: - return AuditLogType.RNG_SOURCES_INCOMPATIBLE_WITH_CLUSTER; - case MIXING_RHEL_VERSIONS_IN_CLUSTER: - return AuditLogType.MIXING_RHEL_VERSIONS_IN_CLUSTER; - case UNTRUSTED: - return AuditLogType.VDS_UNTRUSTED; - case HOST_FEATURES_INCOMPATIBILE_WITH_CLUSTER: - return AuditLogType.HOST_FEATURES_INCOMPATIBILE_WITH_CLUSTER; - case LIBRBD_PACKAGE_NOT_AVAILABLE: - return AuditLogType.NO_LIBRBD_PACKAGE_AVAILABLE_ON_VDS; - case VDS_CANNOT_CONNECT_TO_GLUSTERFS: - return AuditLogType.VDS_CANNOT_CONNECT_TO_GLUSTERFS; - default: - return getSucceeded() ? AuditLogType.VDS_SET_NONOPERATIONAL : AuditLogType.VDS_SET_NONOPERATIONAL_FAILED; + case RNG_SOURCES_INCOMPATIBLE_WITH_CLUSTER: + return AuditLogType.RNG_SOURCES_INCOMPATIBLE_WITH_CLUSTER; + case MIXING_RHEL_VERSIONS_IN_CLUSTER: + return AuditLogType.MIXING_RHEL_VERSIONS_IN_CLUSTER; + case UNTRUSTED: + return AuditLogType.VDS_UNTRUSTED; + case HOST_FEATURES_INCOMPATIBILE_WITH_CLUSTER: + return AuditLogType.HOST_FEATURES_INCOMPATIBILE_WITH_CLUSTER; + case LIBRBD_PACKAGE_NOT_AVAILABLE: + return AuditLogType.NO_LIBRBD_PACKAGE_AVAILABLE_ON_VDS; + case VDS_CANNOT_CONNECT_TO_GLUSTERFS: + return AuditLogType.VDS_CANNOT_CONNECT_TO_GLUSTERFS; + default: + return getSucceeded() ? AuditLogType.VDS_SET_NONOPERATIONAL : AuditLogType.VDS_SET_NONOPERATIONAL_FAILED; } } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/StopVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/StopVmCommand.java index ec1af427442..75a291f08c0 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/StopVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/StopVmCommand.java @@ -51,15 +51,15 @@ public AuditLogType getAuditLogTypeValue() { return getSucceeded() ? AuditLogType.USER_STOP_SUSPENDED_VM : AuditLogType.USER_STOP_SUSPENDED_VM_FAILED; } else { switch (getParameters().getStopVmType()) { - case NORMAL: - return getSucceeded() ? AuditLogType.USER_STOP_VM : AuditLogType.USER_FAILED_STOP_VM; + case NORMAL: + return getSucceeded() ? AuditLogType.USER_STOP_VM : AuditLogType.USER_FAILED_STOP_VM; - case CANNOT_SHUTDOWN: - return getSucceeded() ? AuditLogType.USER_STOPPED_VM_INSTEAD_OF_SHUTDOWN - : AuditLogType.USER_FAILED_STOPPING_VM_INSTEAD_OF_SHUTDOWN; + case CANNOT_SHUTDOWN: + return getSucceeded() ? AuditLogType.USER_STOPPED_VM_INSTEAD_OF_SHUTDOWN + : AuditLogType.USER_FAILED_STOPPING_VM_INSTEAD_OF_SHUTDOWN; - default: // shouldn't get here: - return AuditLogType.UNASSIGNED; + default: // shouldn't get here: + return AuditLogType.UNASSIGNED; } } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/StopVmCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/StopVmCommandBase.java index 88688a5b66b..9ce06af8994 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/StopVmCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/StopVmCommandBase.java @@ -122,10 +122,10 @@ private VDSReturnValue destroyMigratingVm() { buildDestroyVmVDSCommandParameters(getVm().getMigratingToVds())); } catch (EngineException e) { switch (e.getErrorCode()) { - case noVM: - break; - default: - throw e; + case noVM: + break; + default: + throw e; } } @@ -136,13 +136,13 @@ private VDSReturnValue destroyMigratingVm() { buildDestroyVmVDSCommandParameters(getVdsId())); } catch (EngineException e) { switch (e.getErrorCode()) { - case noVM: - if (returnValueFromDestination == null) { + case noVM: + if (returnValueFromDestination == null) { + throw e; + } + break; + default: throw e; - } - break; - default: - throw e; } } 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 4d0ae30b0ab..3da61b88300 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 @@ -1247,7 +1247,7 @@ protected boolean validate() { } } - if (isVirtioScsiEnabled()) { + if (isVirtioScsiEnabled()) { // Verify OS compatibility if (!validate(vmHandler.isOsTypeSupportedForVirtioScsi (vmFromParams.getOs(), getEffectiveCompatibilityVersion()))) { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmTemplateCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmTemplateCommand.java index 4dcd14055b3..0fb293d7157 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmTemplateCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmTemplateCommand.java @@ -508,19 +508,19 @@ public List getQuotaVdsConsumptionParameters() { @Override - public String getEntityType() { + public String getEntityType() { return VdcObjectType.VmTemplate.getVdcObjectTranslation(); - } + } - @Override - public String getEntityOldName() { + @Override + public String getEntityOldName() { return oldTemplate.getName(); - } + } - @Override - public String getEntityNewName() { - return getParameters().getVmTemplateData().getName(); - } + @Override + public String getEntityNewName() { + return getParameters().getVmTemplateData().getName(); + } @Override public void setEntityId(AuditLogable logable) { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsEventListener.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsEventListener.java index d270509a496..94211a9a510 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsEventListener.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsEventListener.java @@ -589,7 +589,7 @@ public void onMomPolicyChange(@Observes @MomPolicyUpdate final Cluster cluster) cluster.isEnableBallooning(), cluster.isEnableKsm(), cluster.isKsmMergeAcrossNumaNodes()) - ); + ); } catch (EngineException e) { log.error("Could not update MoM policy on host '{}'", vds.getName()); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsValidator.java index e1027834aa9..604a934043b 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsValidator.java @@ -39,17 +39,17 @@ public boolean shouldVdsBeFenced() { } switch (vds.getStatus()) { - case Down: - case InstallFailed: - case Maintenance: - case NonOperational: - case NonResponsive: - case Kdumping: // it should happen only after restart when host is stuck in status Kdumping - result = true; - break; + case Down: + case InstallFailed: + case Maintenance: + case NonOperational: + case NonResponsive: + case Kdumping: // it should happen only after restart when host is stuck in status Kdumping + result = true; + break; - default: - break; + default: + break; } return result; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmCommand.java index 24c468a29bd..c32de829807 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmCommand.java @@ -400,15 +400,15 @@ protected boolean isNicSupportedForPlugUnPlug() { */ protected boolean isDiskSupportedForPlugUnPlug(DiskVmElement diskVmElement, String diskAlias) { switch (diskVmElement.getDiskInterface()) { - case IDE: - addValidationMessageVariable("diskAlias", diskAlias); - addValidationMessageVariable("vmName", getVm().getName()); - return failValidation(EngineMessage.HOT_PLUG_IDE_DISK_IS_NOT_SUPPORTED); - case SPAPR_VSCSI: - addValidationMessageVariable("diskAlias", diskAlias); - addValidationMessageVariable("vmName", getVm().getName()); - return failValidation(EngineMessage.HOT_PLUG_SPAPR_VSCSI_DISK_IS_NOT_SUPPORTED); - default: + case IDE: + addValidationMessageVariable("diskAlias", diskAlias); + addValidationMessageVariable("vmName", getVm().getName()); + return failValidation(EngineMessage.HOT_PLUG_IDE_DISK_IS_NOT_SUPPORTED); + case SPAPR_VSCSI: + addValidationMessageVariable("diskAlias", diskAlias); + addValidationMessageVariable("vmName", getVm().getName()); + return failValidation(EngineMessage.HOT_PLUG_SPAPR_VSCSI_DISK_IS_NOT_SUPPORTED); + default: } Set diskHotpluggableInterfaces = osRepository.getDiskHotpluggableInterfaces(getVm().getOs(), 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 e550bdcc579..52152f45add 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 @@ -260,11 +260,11 @@ public class VmHandler implements BackendService { @PostConstruct public void init() { Class[] inspectedClassNames = new Class[] { - VmBase.class, - VM.class, - VmStatic.class, - VmDynamic.class, - VmManagementParametersBase.class }; + VmBase.class, + VM.class, + VmStatic.class, + VmDynamic.class, + VmManagementParametersBase.class }; updateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(inspectedClassNames)); @@ -584,8 +584,8 @@ public List getVmInitWithoutPasswordByIds(List ids) { List all = vmInitDao.getVmInitByIds(ids); for (VmInit vmInit: all) { - vmInit.setPasswordAlreadyStored(!StringUtils.isEmpty(vmInit.getRootPassword())); - vmInit.setRootPassword(null); + vmInit.setPasswordAlreadyStored(!StringUtils.isEmpty(vmInit.getRootPassword())); + vmInit.setRootPassword(null); } return all; } @@ -800,7 +800,7 @@ public ValidationResult isOsTypeSupported(int osId, ArchitectureType architectur * The cluster version. */ public ValidationResult isGraphicsAndDisplaySupported - (int osId, Collection graphics, DisplayType displayType, BiosType biosType, Version clusterVersion) { + (int osId, Collection graphics, DisplayType displayType, BiosType biosType, Version clusterVersion) { if (!vmValidationUtils.isGraphicsAndDisplaySupported(osId, clusterVersion, graphics, displayType)) { return new ValidationResult( EngineMessage.ACTION_TYPE_FAILED_ILLEGAL_VM_DISPLAY_TYPE_IS_NOT_SUPPORTED_BY_OS); @@ -1643,34 +1643,34 @@ public ValidationResult validateCpuPinningPolicy(VmBase vmFromParams, Version ve ValidationResult result = ValidationResult.VALID; switch (vmFromParams.getCpuPinningPolicy()) { - case MANUAL: - if (StringUtils.isBlank(vmFromParams.getCpuPinning())) { - result = new ValidationResult(EngineMessage.ACTION_TYPE_CANNOT_SET_MANUAL_PINNING); - } - break; - case RESIZE_AND_PIN_NUMA: - boolean singleCoreHostFound = vmFromParams.getDedicatedVmForVdsList() - .stream() - .map(vdsId -> vdsDynamicDao.get(vdsId)) - .anyMatch(vdsDynamic -> vdsDynamic.getCpuCores() / vdsDynamic.getCpuSockets() == 1); - if (singleCoreHostFound) { - result = new ValidationResult(EngineMessage.ACTION_TYPE_CANNOT_RESIZE_AND_PIN_SINGLE_CORE); - } - break; - case DEDICATED: - if (!FeatureSupported.isDedicatePolicySupported(version)) { - result = new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DEDICATED_IS_NOT_SUPPORTED); + case MANUAL: + if (StringUtils.isBlank(vmFromParams.getCpuPinning())) { + result = new ValidationResult(EngineMessage.ACTION_TYPE_CANNOT_SET_MANUAL_PINNING); + } break; - } + case RESIZE_AND_PIN_NUMA: + boolean singleCoreHostFound = vmFromParams.getDedicatedVmForVdsList() + .stream() + .map(vdsId -> vdsDynamicDao.get(vdsId)) + .anyMatch(vdsDynamic -> vdsDynamic.getCpuCores() / vdsDynamic.getCpuSockets() == 1); + if (singleCoreHostFound) { + result = new ValidationResult(EngineMessage.ACTION_TYPE_CANNOT_RESIZE_AND_PIN_SINGLE_CORE); + } + break; + case DEDICATED: + if (!FeatureSupported.isDedicatePolicySupported(version)) { + result = new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DEDICATED_IS_NOT_SUPPORTED); + break; + } - boolean anyNodePinned = - vmFromParams.getvNumaNodeList().stream().anyMatch(numa -> !numa.getVdsNumaNodeList().isEmpty()); - if (anyNodePinned) { - result = new ValidationResult(EngineMessage.ACTION_TYPE_CANNOT_SET_DEDICATED_PINNING_WITH_NUMA_NODES_PINNED); - } - break; - default: - break; + boolean anyNodePinned = + vmFromParams.getvNumaNodeList().stream().anyMatch(numa -> !numa.getVdsNumaNodeList().isEmpty()); + if (anyNodePinned) { + result = new ValidationResult(EngineMessage.ACTION_TYPE_CANNOT_SET_DEDICATED_PINNING_WITH_NUMA_NODES_PINNED); + } + break; + default: + break; } return result; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmSlaPolicyCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmSlaPolicyCommand.java index 6dfede49f03..a7fd0a49b6d 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmSlaPolicyCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmSlaPolicyCommand.java @@ -89,10 +89,10 @@ public AuditLogType getAuditLogTypeValue() { } final AuditLogType[] logTypes = { - AuditLogType.UNASSIGNED, // This can't happen - AuditLogType.VM_SLA_POLICY_CPU, - AuditLogType.VM_SLA_POLICY_STORAGE, - AuditLogType.VM_SLA_POLICY_CPU_STORAGE + AuditLogType.UNASSIGNED, // This can't happen + AuditLogType.VM_SLA_POLICY_CPU, + AuditLogType.VM_SLA_POLICY_STORAGE, + AuditLogType.VM_SLA_POLICY_CPU_STORAGE }; return getSucceeded() ? logTypes[logId] : AuditLogType.FAILED_VM_SLA_POLICY; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/aaa/SessionDataContainer.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/aaa/SessionDataContainer.java index 86090d2975b..864aa6d446b 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/aaa/SessionDataContainer.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/aaa/SessionDataContainer.java @@ -256,7 +256,7 @@ public final void cleanExpiredUsersSessionsImpl() { "Session has expired for principal %1$s", getUserName(entry.getKey())); if (sessionValid) { - SsoOAuthServiceUtils.revoke((String) sessionMap.get(SSO_ACCESS_TOKEN_PARAMETER_NAME), ""); + SsoOAuthServiceUtils.revoke((String) sessionMap.get(SSO_ACCESS_TOKEN_PARAMETER_NAME), ""); } } } @@ -450,7 +450,7 @@ private void removeSessionImpl(String sessionId, int reason, String message, Obj getPrincipalName(sessionId), message, msgArgs - ); + ); engineSessionDao.remove(getEngineSessionSeqId(sessionId)); sessionInfoMap.remove(sessionId); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/eventqueue/EventQueueMonitor.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/eventqueue/EventQueueMonitor.java index 1516e67f58e..42f7fecc7fb 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/eventqueue/EventQueueMonitor.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/eventqueue/EventQueueMonitor.java @@ -70,30 +70,30 @@ private FutureTask submitTaskInternal(Event event, Event currentEvent = poolCurrentEventMap.get(storagePoolId); if (currentEvent != null) { switch (currentEvent.getEventType()) { - case RECOVERY: - if (event.getEventType() == EventType.VDSCONNECTTOPOOL - || event.getEventType() == EventType.VDSCLEARCACHE - || event.getEventType() == EventType.DOMAINFAILOVER) { - task = addTaskToQueue(event, callable, storagePoolId, isEventShouldBeFirst(event)); - } else { - log.debug("Current event was skipped because of recovery is running now for pool '{}', event '{}'", - storagePoolId, event); - } - break; - case RECONSTRUCT: - if (event.getEventType() == EventType.VDSCONNECTTOPOOL - || event.getEventType() == EventType.RECOVERY - || event.getEventType() == EventType.DOMAINFAILOVER - || event.getEventType() == EventType.VDSCLEARCACHE) { + case RECOVERY: + if (event.getEventType() == EventType.VDSCONNECTTOPOOL + || event.getEventType() == EventType.VDSCLEARCACHE + || event.getEventType() == EventType.DOMAINFAILOVER) { + task = addTaskToQueue(event, callable, storagePoolId, isEventShouldBeFirst(event)); + } else { + log.debug("Current event was skipped because of recovery is running now for pool '{}', event '{}'", + storagePoolId, event); + } + break; + case RECONSTRUCT: + if (event.getEventType() == EventType.VDSCONNECTTOPOOL + || event.getEventType() == EventType.RECOVERY + || event.getEventType() == EventType.DOMAINFAILOVER + || event.getEventType() == EventType.VDSCLEARCACHE) { + task = addTaskToQueue(event, callable, storagePoolId, isEventShouldBeFirst(event)); + } else { + log.debug("Current event was skipped because of reconstruct is running now for pool '{}', event '{}'", + storagePoolId, event); + } + break; + default: task = addTaskToQueue(event, callable, storagePoolId, isEventShouldBeFirst(event)); - } else { - log.debug("Current event was skipped because of reconstruct is running now for pool '{}', event '{}'", - storagePoolId, event); - } - break; - default: - task = addTaskToQueue(event, callable, storagePoolId, isEventShouldBeFirst(event)); - break; + break; } } else { task = addTaskToQueue(event, callable, storagePoolId, false); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ConvertVmCallback.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ConvertVmCallback.java index cb35353949e..4fe09d3eec8 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ConvertVmCallback.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ConvertVmCallback.java @@ -34,25 +34,25 @@ protected ConvertVmCallback(Guid cmdId) { public void doPolling(Guid cmdId, List childCmdIds) { V2VJobInfo jobInfo = getV2VJobInfo(); switch (jobInfo.getStatus()) { - case STARTING: - case COPYING_DISK: - updateProgress(jobInfo); - break; - case DONE: - updateProgress("Finalizing", 100); - getCommand().setCommandStatus(CommandStatus.SUCCEEDED); - break; - case NOT_EXIST: - jobInfo.setDescription(JOB_DOES_NOT_EXIST_MSG); - case ERROR: - log.info("Conversion of VM from external environment failed: {}", jobInfo.getDescription()); - case ABORTED: - updateProgress("Canceling", 0); - getCommand().setCommandStatus(CommandStatus.FAILED); - break; - case UNKNOWN: - case WAIT_FOR_START: - default: + case STARTING: + case COPYING_DISK: + updateProgress(jobInfo); + break; + case DONE: + updateProgress("Finalizing", 100); + getCommand().setCommandStatus(CommandStatus.SUCCEEDED); + break; + case NOT_EXIST: + jobInfo.setDescription(JOB_DOES_NOT_EXIST_MSG); + case ERROR: + log.info("Conversion of VM from external environment failed: {}", jobInfo.getDescription()); + case ABORTED: + updateProgress("Canceling", 0); + getCommand().setCommandStatus(CommandStatus.FAILED); + break; + case UNKNOWN: + case WAIT_FOR_START: + default: } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmCommand.java index 8f5a1b99633..fd7392d568e 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmCommand.java @@ -312,23 +312,23 @@ private void updateCopyVmInSpm(Guid storagePoolId, VM vm, Guid storageDomainId) List imageGroupIds = new ArrayList<>(); for (Disk disk : getDisksBasedOnImage()) { - DiskImage diskImage = (DiskImage) disk; - diskImage.setParentId(VmTemplateHandler.BLANK_VM_TEMPLATE_ID); - diskImage.setImageTemplateId(VmTemplateHandler.BLANK_VM_TEMPLATE_ID); - diskImage.setStorageIds(new ArrayList<>(Collections.singletonList(storageDomainId))); - DiskImage diskForVolumeInfo = getDiskForVolumeInfo(diskImage); - diskImage.setVolumeFormat(diskForVolumeInfo.getVolumeFormat()); - diskImage.setVolumeType(diskForVolumeInfo.getVolumeType()); - VDSReturnValue vdsReturnValue = runVdsCommand( - VDSCommandType.GetImageInfo, - new GetImageInfoVDSCommandParameters(storagePoolId, storageDomainId, diskImage - .getId(), diskImage.getImageId())); - if (vdsReturnValue != null && vdsReturnValue.getSucceeded()) { - DiskImage fromVdsm = (DiskImage) vdsReturnValue.getReturnValue(); - diskImage.setActualSizeInBytes(fromVdsm.getActualSizeInBytes()); - } - vmImages.add(diskImage); - imageGroupIds.add(disk.getId()); + DiskImage diskImage = (DiskImage) disk; + diskImage.setParentId(VmTemplateHandler.BLANK_VM_TEMPLATE_ID); + diskImage.setImageTemplateId(VmTemplateHandler.BLANK_VM_TEMPLATE_ID); + diskImage.setStorageIds(new ArrayList<>(Collections.singletonList(storageDomainId))); + DiskImage diskForVolumeInfo = getDiskForVolumeInfo(diskImage); + diskImage.setVolumeFormat(diskForVolumeInfo.getVolumeFormat()); + diskImage.setVolumeType(diskForVolumeInfo.getVolumeType()); + VDSReturnValue vdsReturnValue = runVdsCommand( + VDSCommandType.GetImageInfo, + new GetImageInfoVDSCommandParameters(storagePoolId, storageDomainId, diskImage + .getId(), diskImage.getImageId())); + if (vdsReturnValue != null && vdsReturnValue.getSucceeded()) { + DiskImage fromVdsm = (DiskImage) vdsReturnValue.getReturnValue(); + diskImage.setActualSizeInBytes(fromVdsm.getActualSizeInBytes()); + } + vmImages.add(diskImage); + imageGroupIds.add(disk.getId()); } if (StringUtils.isEmpty(vm.getVmtName())) { @@ -498,15 +498,15 @@ protected boolean checkVmInStorageDomain() { @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { - case EXECUTE: - return getSucceeded() ? AuditLogType.IMPORTEXPORT_STARTING_EXPORT_VM - : AuditLogType.IMPORTEXPORT_EXPORT_VM_FAILED; + case EXECUTE: + return getSucceeded() ? AuditLogType.IMPORTEXPORT_STARTING_EXPORT_VM + : AuditLogType.IMPORTEXPORT_EXPORT_VM_FAILED; - case END_SUCCESS: - return getSucceeded() ? AuditLogType.IMPORTEXPORT_EXPORT_VM : AuditLogType.IMPORTEXPORT_EXPORT_VM_FAILED; + case END_SUCCESS: + return getSucceeded() ? AuditLogType.IMPORTEXPORT_EXPORT_VM : AuditLogType.IMPORTEXPORT_EXPORT_VM_FAILED; - default: - return AuditLogType.IMPORTEXPORT_EXPORT_VM_FAILED; + default: + return AuditLogType.IMPORTEXPORT_EXPORT_VM_FAILED; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmTemplateCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmTemplateCommand.java index c33e3e7afc2..08a0ead2890 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmTemplateCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmTemplateCommand.java @@ -224,16 +224,16 @@ protected void setActionMessageParameters() { @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { - case EXECUTE: - return getSucceeded() ? AuditLogType.IMPORTEXPORT_STARTING_EXPORT_TEMPLATE - : AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE_FAILED; + case EXECUTE: + return getSucceeded() ? AuditLogType.IMPORTEXPORT_STARTING_EXPORT_TEMPLATE + : AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE_FAILED; - case END_SUCCESS: - return getSucceeded() ? AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE - : AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE_FAILED; + case END_SUCCESS: + return getSucceeded() ? AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE + : AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE_FAILED; - default: - return AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE_FAILED; + default: + return AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE_FAILED; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmTemplateToOvaCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmTemplateToOvaCommand.java index 09a1d2cd079..e717459b5c0 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmTemplateToOvaCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmTemplateToOvaCommand.java @@ -94,18 +94,18 @@ private String getTemplateIsBeingExportedMessage() { @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { - case EXECUTE: - return getSucceeded() ? - AuditLogType.IMPORTEXPORT_STARTING_EXPORT_TEMPLATE_TO_OVA - : AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE_TO_OVA_FAILED; - - case END_SUCCESS: - return getSucceeded() ? - AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE_TO_OVA - : AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE_TO_OVA_FAILED; - - default: - return AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE_TO_OVA_FAILED; + case EXECUTE: + return getSucceeded() ? + AuditLogType.IMPORTEXPORT_STARTING_EXPORT_TEMPLATE_TO_OVA + : AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE_TO_OVA_FAILED; + + case END_SUCCESS: + return getSucceeded() ? + AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE_TO_OVA + : AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE_TO_OVA_FAILED; + + default: + return AuditLogType.IMPORTEXPORT_EXPORT_TEMPLATE_TO_OVA_FAILED; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmToOvaCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmToOvaCommand.java index 8e32704894b..b163a74ed77 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmToOvaCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ExportVmToOvaCommand.java @@ -158,18 +158,18 @@ private RemoveSnapshotParameters createRemoveSnapshotParameters() { @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { - case EXECUTE: - return getSucceeded() ? - AuditLogType.IMPORTEXPORT_STARTING_EXPORT_VM_TO_OVA - : AuditLogType.IMPORTEXPORT_EXPORT_VM_TO_OVA_FAILED; - - case END_SUCCESS: - return getSucceeded() ? - AuditLogType.IMPORTEXPORT_EXPORT_VM_TO_OVA - : AuditLogType.IMPORTEXPORT_EXPORT_VM_TO_OVA_FAILED; - - default: - return AuditLogType.IMPORTEXPORT_EXPORT_VM_TO_OVA_FAILED; + case EXECUTE: + return getSucceeded() ? + AuditLogType.IMPORTEXPORT_STARTING_EXPORT_VM_TO_OVA + : AuditLogType.IMPORTEXPORT_EXPORT_VM_TO_OVA_FAILED; + + case END_SUCCESS: + return getSucceeded() ? + AuditLogType.IMPORTEXPORT_EXPORT_VM_TO_OVA + : AuditLogType.IMPORTEXPORT_EXPORT_VM_TO_OVA_FAILED; + + default: + return AuditLogType.IMPORTEXPORT_EXPORT_VM_TO_OVA_FAILED; } } @@ -196,18 +196,18 @@ public CommandCallback getCallback() { @Override public boolean performNextOperation(int completedChildCount) { switch (getParameters().getPhase()) { - case CREATE_SNAPSHOT: - getParameters().setPhase(Phase.CREATE_OVA); - break; + case CREATE_SNAPSHOT: + getParameters().setPhase(Phase.CREATE_OVA); + break; - case CREATE_OVA: - getParameters().setPhase(Phase.REMOVE_SNAPSHOT); - break; + case CREATE_OVA: + getParameters().setPhase(Phase.REMOVE_SNAPSHOT); + break; - case REMOVE_SNAPSHOT: - return false; + case REMOVE_SNAPSHOT: + return false; - default: + default: } persistCommandIfNeeded(); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmCommandBase.java index 9ce3dedd43f..5fbdfb2dab0 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmCommandBase.java @@ -831,16 +831,16 @@ public Map getJobMessageProperties() { @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { - case EXECUTE: - return getSucceeded() ? - AuditLogType.IMPORTEXPORT_STARTING_IMPORT_VM - : AuditLogType.IMPORTEXPORT_IMPORT_VM_FAILED; - case END_SUCCESS: - return getSucceeded() ? - AuditLogType.IMPORTEXPORT_IMPORT_VM - : AuditLogType.IMPORTEXPORT_IMPORT_VM_FAILED; - case END_FAILURE: - return AuditLogType.IMPORTEXPORT_IMPORT_VM_FAILED; + case EXECUTE: + return getSucceeded() ? + AuditLogType.IMPORTEXPORT_STARTING_IMPORT_VM + : AuditLogType.IMPORTEXPORT_IMPORT_VM_FAILED; + case END_SUCCESS: + return getSucceeded() ? + AuditLogType.IMPORTEXPORT_IMPORT_VM + : AuditLogType.IMPORTEXPORT_IMPORT_VM_FAILED; + case END_FAILURE: + return AuditLogType.IMPORTEXPORT_IMPORT_VM_FAILED; } return super.getAuditLogTypeValue(); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmFromExternalProviderCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmFromExternalProviderCommand.java index b159cb40a7f..c3f583a7331 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmFromExternalProviderCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmFromExternalProviderCommand.java @@ -80,7 +80,7 @@ @DisableInPrepareMode @NonTransactiveCommandAttribute(forceCompensation = true, compensationPhase = CommandCompensationPhase.END_COMMAND) public class ImportVmFromExternalProviderCommand extends ImportVmCommandBase -implements SerialChildExecutingCommand, QuotaStorageDependent { + implements SerialChildExecutingCommand, QuotaStorageDependent { private static final Pattern VMWARE_DISK_NAME_PATTERN = Pattern.compile("\\[.*?\\] .*/(.*).vmdk"); private static final Pattern DISK_NAME_PATTERN = Pattern.compile(".*/([^.]+).*"); @@ -523,25 +523,21 @@ public CommandCallback getCallback() { @Override public boolean performNextOperation(int completedChildCount) { switch (getParameters().getImportPhase()) { - case CREATE_DISKS: - getParameters().setImportPhase(Phase.CONVERT); - if (getParameters().getProxyHostId() == null) { - getParameters().setProxyHostId(selectProxyHost()); - } - break; - - case CONVERT: - if (getVm().getOrigin() == OriginType.OVIRT) { + case CREATE_DISKS: + getParameters().setImportPhase(Phase.CONVERT); + if (getParameters().getProxyHostId() == null) { + getParameters().setProxyHostId(selectProxyHost()); + } + break; + case CONVERT: + if (getVm().getOrigin() == OriginType.OVIRT) { + return false; + } + getParameters().setImportPhase(Phase.POST_CONVERT); + break; + case POST_CONVERT: return false; - } - - getParameters().setImportPhase(Phase.POST_CONVERT); - break; - - case POST_CONVERT: - return false; - - default: + default: } persistCommandIfNeeded(); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmFromExternalUrlCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmFromExternalUrlCommand.java index 0654a590de3..11393e60de9 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmFromExternalUrlCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmFromExternalUrlCommand.java @@ -249,23 +249,23 @@ public ExternalOvaVmImporter() { ovaPath = getParameters().getUrl().replace("ova://", ""); } - @Override - public boolean validate() { - if (!super.validate()) { - return false; - } + @Override + public boolean validate() { + if (!super.validate()) { + return false; + } - if (getParameters().getProxyHostId() == null) { - return failValidation(EngineMessage.ACTION_TYPE_FAILED_PROXY_HOST_MUST_BE_SPECIFIED); - } + if (getParameters().getProxyHostId() == null) { + return failValidation(EngineMessage.ACTION_TYPE_FAILED_PROXY_HOST_MUST_BE_SPECIFIED); + } - return true; - } + return true; + } - @Override - protected VolumeType getAutoDetectedVolumeType(DiskImage disk) { - return disk.getVolumeType(); - } + @Override + protected VolumeType getAutoDetectedVolumeType(DiskImage disk) { + return disk.getVolumeType(); + } @Override protected ActionType getImportActionType() { @@ -299,14 +299,14 @@ private static VolumeFormat getDiskVolumeFormat(VolumeType volumeType, StorageTy return VolumeFormat.RAW; } else if (storageType.isBlockDomain()) { switch (volumeType) { - case Sparse: - return VolumeFormat.COW; + case Sparse: + return VolumeFormat.COW; - case Preallocated: - return VolumeFormat.RAW; + case Preallocated: + return VolumeFormat.RAW; - default: - return VolumeFormat.Unassigned; + default: + return VolumeFormat.Unassigned; } } else { return VolumeFormat.Unassigned; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmTemplateCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmTemplateCommandBase.java index 5568263aaa5..385d2f2dca3 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmTemplateCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmTemplateCommandBase.java @@ -470,16 +470,16 @@ protected void endWithFailure() { @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { - case EXECUTE: - return getSucceeded() ? AuditLogType.IMPORTEXPORT_STARTING_IMPORT_TEMPLATE - : AuditLogType.IMPORTEXPORT_IMPORT_TEMPLATE_FAILED; + case EXECUTE: + return getSucceeded() ? AuditLogType.IMPORTEXPORT_STARTING_IMPORT_TEMPLATE + : AuditLogType.IMPORTEXPORT_IMPORT_TEMPLATE_FAILED; - case END_SUCCESS: - return getSucceeded() ? AuditLogType.IMPORTEXPORT_IMPORT_TEMPLATE - : AuditLogType.IMPORTEXPORT_IMPORT_TEMPLATE_FAILED; + case END_SUCCESS: + return getSucceeded() ? AuditLogType.IMPORTEXPORT_IMPORT_TEMPLATE + : AuditLogType.IMPORTEXPORT_IMPORT_TEMPLATE_FAILED; - default: - return AuditLogType.IMPORTEXPORT_IMPORT_TEMPLATE_FAILED; + default: + return AuditLogType.IMPORTEXPORT_IMPORT_TEMPLATE_FAILED; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmTemplateFromOvaCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmTemplateFromOvaCommand.java index 7f3fc3780f7..4baee163255 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmTemplateFromOvaCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/ImportVmTemplateFromOvaCommand.java @@ -114,17 +114,17 @@ protected AddDiskParameters buildAddDiskParameters(DiskImage image) { @Override public boolean performNextOperation(int completedChildCount) { switch (getParameters().getImportPhase()) { - case CREATE_DISKS: - getParameters().setImportPhase(Phase.CONVERT); - if (getParameters().getProxyHostId() == null) { - getParameters().setProxyHostId(selectProxyHost()); - } - break; + case CREATE_DISKS: + getParameters().setImportPhase(Phase.CONVERT); + if (getParameters().getProxyHostId() == null) { + getParameters().setProxyHostId(selectProxyHost()); + } + break; - case CONVERT: - return false; + case CONVERT: + return false; - default: + default: } persistCommandIfNeeded(); @@ -135,9 +135,9 @@ public boolean performNextOperation(int completedChildCount) { @SuppressWarnings("incomplete-switch") private void executeNextOperation() { switch (getParameters().getImportPhase()) { - case CONVERT: - convert(); - break; + case CONVERT: + convert(); + break; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/vnics/MapVnicContext.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/vnics/MapVnicContext.java index 5c6f6e2cbc0..ff099dcab40 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/vnics/MapVnicContext.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/exportimport/vnics/MapVnicContext.java @@ -76,7 +76,7 @@ public VnicProfile getVnicProfileFoundByDao() { /** * @return the last handler of the flow */ - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") public Class getLastHandler() { return (Class) flowTrace.peek().get(1); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/AddGlusterHookCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/AddGlusterHookCommand.java index 05bbafe3091..f5165c51285 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/AddGlusterHookCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/AddGlusterHookCommand.java @@ -128,7 +128,7 @@ protected void executeCommand() { for (Pair pairResult : pairResults) { VDSReturnValue retValue = pairResult.getSecond(); - if (!retValue.getSucceeded() ) { + if (!retValue.getSucceeded()) { errors.add(retValue.getVdsError().getMessage()); } else { //hook added successfully, so remove from gluster server hooks table diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateBrickCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateBrickCommand.java index 231e8de7553..8cb4e3c9819 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateBrickCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateBrickCommand.java @@ -189,7 +189,7 @@ private void runAnsibleCreateBrickPlaybook() throws IOException, InterruptedExce .playAction("Create Brick") .playbook(AnsibleConstants.CREATE_BRICK_PLAYBOOK); - AnsibleReturnValue ansibleReturnValue = ansibleExecutor.runCommand(commandConfig); + AnsibleReturnValue ansibleReturnValue = ansibleExecutor.runCommand(commandConfig); if (ansibleReturnValue.getAnsibleReturnCode() != AnsibleReturnCode.OK) { log.error("Failed to execute Ansible create brick role. Please check logs for more details: {}", ansibleReturnValue.getLogFile()); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeCommand.java index 8adeb556f34..0b903fc8ba0 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeCommand.java @@ -200,9 +200,9 @@ protected void executeCommand() { * Sets every third brick as arbiter brick if GlusterVolume is an arbiter volume */ private void setArbiterFlag(GlusterVolumeEntity volume) { - for (int i = 2; i < volume.getBricks().size(); i += 3) { - volume.getBricks().get(i).setIsArbiter(volume.getIsArbiter()); - } + for (int i = 2; i < volume.getBricks().size(); i += 3) { + volume.getBricks().get(i).setIsArbiter(volume.getIsArbiter()); + } } private void setVolumeType(GlusterVolumeEntity createdVolume) { @@ -302,44 +302,44 @@ private boolean validateBricks(GlusterVolumeEntity volume) { } switch (volume.getVolumeType()) { - case REPLICATE: - if (brickCount != replicaCount) { - addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_INVALID_BRICK_COUNT_FOR_REPLICATE); - return false; - } - break; - case DISTRIBUTED_REPLICATE: - if (brickCount < replicaCount || Math.IEEEremainder(brickCount, replicaCount) != 0) { - addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_INVALID_BRICK_COUNT_FOR_DISTRIBUTED_REPLICATE); - return false; - } - break; - case STRIPE: - if (brickCount != stripeCount) { - addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_INVALID_BRICK_COUNT_FOR_STRIPE); - return false; - } - break; - case DISTRIBUTED_STRIPE: - if (brickCount <= stripeCount || Math.IEEEremainder(brickCount, stripeCount) != 0) { - addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_INVALID_BRICK_COUNT_FOR_DISTRIBUTED_STRIPE); - return false; - } - break; - case STRIPED_REPLICATE: - if ( Math.IEEEremainder(brickCount, stripeCount * replicaCount) != 0) { - addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_INVALID_BRICK_COUNT_FOR_STRIPED_REPLICATE); - return false; - } - break; - case DISTRIBUTED_STRIPED_REPLICATE: - if ( brickCount <= stripeCount * replicaCount || Math.IEEEremainder(brickCount, stripeCount * replicaCount) != 0) { - addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_INVALID_BRICK_COUNT_FOR_DISTRIBUTED_STRIPED_REPLICATE); - return false; - } - break; - default: - break; + case REPLICATE: + if (brickCount != replicaCount) { + addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_INVALID_BRICK_COUNT_FOR_REPLICATE); + return false; + } + break; + case DISTRIBUTED_REPLICATE: + if (brickCount < replicaCount || Math.IEEEremainder(brickCount, replicaCount) != 0) { + addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_INVALID_BRICK_COUNT_FOR_DISTRIBUTED_REPLICATE); + return false; + } + break; + case STRIPE: + if (brickCount != stripeCount) { + addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_INVALID_BRICK_COUNT_FOR_STRIPE); + return false; + } + break; + case DISTRIBUTED_STRIPE: + if (brickCount <= stripeCount || Math.IEEEremainder(brickCount, stripeCount) != 0) { + addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_INVALID_BRICK_COUNT_FOR_DISTRIBUTED_STRIPE); + return false; + } + break; + case STRIPED_REPLICATE: + if (Math.IEEEremainder(brickCount, stripeCount * replicaCount) != 0) { + addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_INVALID_BRICK_COUNT_FOR_STRIPED_REPLICATE); + return false; + } + break; + case DISTRIBUTED_STRIPED_REPLICATE: + if (brickCount <= stripeCount * replicaCount || Math.IEEEremainder(brickCount, stripeCount * replicaCount) != 0) { + addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_INVALID_BRICK_COUNT_FOR_DISTRIBUTED_STRIPED_REPLICATE); + return false; + } + break; + default: + break; } boolean ret = updateBrickServerAndInterfaceNames(bricks, true) && validateDuplicateBricks(bricks); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java index 71dc7055e5b..1fb7c7a0821 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java @@ -121,9 +121,9 @@ private boolean pauseAndCreateSnapshotForGeoRepSessions() { force)); if (!snapCreationRetVal.getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED, - snapCreationRetVal.getVdsError().getMessage()); - setSucceeded(false); - return false; + snapCreationRetVal.getVdsError().getMessage()); + setSucceeded(false); + return false; } else { // Persist the snapshot details GlusterVolumeSnapshotEntity slaveVolumeSnapshot = diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetAddedGlusterServersQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetAddedGlusterServersQuery.java index 4f21c885d21..4208e5e1d63 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetAddedGlusterServersQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetAddedGlusterServersQuery.java @@ -41,7 +41,7 @@ protected void executeQueryCommand() { Map glusterServers = new HashMap<>(); VDS upServer = glusterUtil.getUpServer(getParameters().getClusterId()); - if (upServer != null ) { + if (upServer != null) { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(upServer.getId())); glusterServers = getAddedGlusterServers((List) returnValue.getReturnValue()); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGeoRepSessionsForStorageDomainQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGeoRepSessionsForStorageDomainQuery.java index e0a90887fbe..77cc7b67467 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGeoRepSessionsForStorageDomainQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGeoRepSessionsForStorageDomainQuery.java @@ -59,7 +59,7 @@ protected void executeQueryCommand() { //retrieve the gluster volume associated with path String path = connection.getConnection(); String[] pathElements = path.split(StorageConstants.GLUSTER_VOL_SEPARATOR); - if (pathElements.length != 2 ) { + if (pathElements.length != 2) { // return empty as volume name could not be determined log.info("Volume name could not be determined from storage connection '{}' ", path); getQueryReturnValue().setSucceeded(false); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeProfileInfoQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeProfileInfoQuery.java index 67556e0697e..0f34cd4b3a4 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeProfileInfoQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeProfileInfoQuery.java @@ -33,7 +33,7 @@ protected void executeQueryCommand() { GlusterVolumeProfileInfo profileInfo = (GlusterVolumeProfileInfo) returnValue.getReturnValue(); if (!nfs) { - populateBrickNames(profileInfo); + populateBrickNames(profileInfo); } getQueryReturnValue().setReturnValue(profileInfo); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterGeoRepSyncJob.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterGeoRepSyncJob.java index c239b60725c..46077d5991b 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterGeoRepSyncJob.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterGeoRepSyncJob.java @@ -48,8 +48,8 @@ public class GlusterGeoRepSyncJob extends GlusterJob { private GlusterSchedulerDao scheduleDao; private static final GeoRepSessionStatus[] overridableStatuses = { GeoRepSessionStatus.ACTIVE, - GeoRepSessionStatus.INITIALIZING, - GeoRepSessionStatus.CREATED + GeoRepSessionStatus.INITIALIZING, + GeoRepSessionStatus.CREATED }; @Override diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterHookStatusChangeCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterHookStatusChangeCommand.java index fea5df53064..b0b712314f6 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterHookStatusChangeCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterHookStatusChangeCommand.java @@ -98,13 +98,13 @@ protected void executeCommand() { for (Pair pairResult : pairResults) { VDSReturnValue retValue = pairResult.getSecond(); - if (retValue.getSucceeded() ) { + if (retValue.getSucceeded()) { atLeastOneSuccess = true; // update status in database updateServerHookStatusInDb(getGlusterHook().getId(), pairResult.getFirst().getId(), getNewStatus()); } else { errors.add(retValue.getVdsError().getMessage()); - } + } } setSucceeded(atLeastOneSuccess); @@ -135,7 +135,7 @@ public Map getJobMessageProperties() { if (jobProperties == null) { jobProperties = super.getJobMessageProperties(); if (getGlusterHook() != null) { - jobProperties.put(GlusterConstants.HOOK_NAME, getGlusterHook().getName()); + jobProperties.put(GlusterConstants.HOOK_NAME, getGlusterHook().getName()); } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterHookSyncJob.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterHookSyncJob.java index 02fcc702863..e31625cf6f0 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterHookSyncJob.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterHookSyncJob.java @@ -91,7 +91,7 @@ public void refreshHooksInCluster(Cluster cluster, boolean throwError) { } } - private void addOrUpdateHooks(Guid clusterId, List> pairResults ) { + private void addOrUpdateHooks(Guid clusterId, List> pairResults) { try { List existingHooks = hooksDao.getByClusterId(clusterId); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterSyncJob.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterSyncJob.java index 20fa8234632..b0eae612a09 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterSyncJob.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterSyncJob.java @@ -871,13 +871,13 @@ public void updateVolumeProperties(GlusterVolumeEntity existingVolume, final Glu } if (existingVolume.getVolumeType().isReplicatedType() && - !Objects.equals(existingVolume.getReplicaCount(), fetchedVolume.getReplicaCount())) { - existingVolume.setReplicaCount(fetchedVolume.getReplicaCount()); - changed = true; + !Objects.equals(existingVolume.getReplicaCount(), fetchedVolume.getReplicaCount())) { + existingVolume.setReplicaCount(fetchedVolume.getReplicaCount()); + changed = true; } if (existingVolume.getVolumeType().isStripedType() && - !Objects.equals(existingVolume.getStripeCount(), fetchedVolume.getStripeCount())) { + !Objects.equals(existingVolume.getStripeCount(), fetchedVolume.getStripeCount())) { existingVolume.setStripeCount(fetchedVolume.getStripeCount()); changed = true; } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterTasksSyncJob.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterTasksSyncJob.java index 1e26c6757c8..027fe2b8ff9 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterTasksSyncJob.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterTasksSyncJob.java @@ -132,14 +132,14 @@ private void createJobToMonitor(Cluster cluster, GlusterAsyncTask task) { StepEnum step = task.getType().getStep(); ActionType actionType; switch (step) { - case REBALANCING_VOLUME: - actionType = ActionType.StartRebalanceGlusterVolume; - break; - case REMOVING_BRICKS: - actionType = ActionType.StartRemoveGlusterVolumeBricks; - break; - default: - actionType = ActionType.Unknown; + case REBALANCING_VOLUME: + actionType = ActionType.StartRebalanceGlusterVolume; + break; + case REMOVING_BRICKS: + actionType = ActionType.StartRemoveGlusterVolumeBricks; + break; + default: + actionType = ActionType.Unknown; } String volumeName = task.getTaskParameters().getVolumeName(); @@ -194,7 +194,7 @@ private Guid addJob(Cluster cluster, GlusterAsyncTask task, ActionType actionTyp ActionReturnValue result = backendInternal.runInternalAction(ActionType.AddInternalJob, new AddInternalJobParameters(ExecutionMessageDirector.resolveJobMessage(actionType, glusterTaskUtils.getMessageMap(cluster, task)), - actionType, true, VdcObjectType.GlusterVolume, vol.getId()) ); + actionType, true, VdcObjectType.GlusterVolume, vol.getId())); if (!result.getSucceeded()) { //log and return throw new EngineException(result.getFault().getError()); @@ -251,16 +251,16 @@ private void logTaskStartedFromCLI(Cluster cluster, GlusterAsyncTask task, Glust AuditLogType logType; switch (task.getType()) { - case REBALANCE: - logType = AuditLogType.GLUSTER_VOLUME_REBALANCE_START_DETECTED_FROM_CLI; - break; - case REMOVE_BRICK: - logType = AuditLogType.START_REMOVING_GLUSTER_VOLUME_BRICKS_DETECTED_FROM_CLI; - values.put(GlusterConstants.BRICK, StringUtils.join(task.getTaskParameters().getBricks(), ',')); - break; - default: - logType = AuditLogType.UNASSIGNED; - break; + case REBALANCE: + logType = AuditLogType.GLUSTER_VOLUME_REBALANCE_START_DETECTED_FROM_CLI; + break; + case REMOVE_BRICK: + logType = AuditLogType.START_REMOVING_GLUSTER_VOLUME_BRICKS_DETECTED_FROM_CLI; + values.put(GlusterConstants.BRICK, StringUtils.join(task.getTaskParameters().getBricks(), ',')); + break; + default: + logType = AuditLogType.UNASSIGNED; + break; } logUtil.logAuditMessage(cluster.getId(), cluster.getName(), vol, null, logType, values); } @@ -268,15 +268,15 @@ private void logTaskStartedFromCLI(Cluster cluster, GlusterAsyncTask task, Glust private void logTaskStoppedFromCLI(Step step, GlusterVolumeEntity vol) { AuditLogType logType; switch (step.getStepType()) { - case REBALANCING_VOLUME: - logType = AuditLogType.GLUSTER_VOLUME_REBALANCE_NOT_FOUND_FROM_CLI; - break; - case REMOVING_BRICKS: - logType = AuditLogType.REMOVE_GLUSTER_VOLUME_BRICKS_NOT_FOUND_FROM_CLI; - break; - default: - logType = AuditLogType.UNASSIGNED; - break; + case REBALANCING_VOLUME: + logType = AuditLogType.GLUSTER_VOLUME_REBALANCE_NOT_FOUND_FROM_CLI; + break; + case REMOVING_BRICKS: + logType = AuditLogType.REMOVE_GLUSTER_VOLUME_BRICKS_NOT_FOUND_FROM_CLI; + break; + default: + logType = AuditLogType.UNASSIGNED; + break; } logUtil.logAuditMessage(vol.getClusterId(), vol.getClusterName(), vol, null, logType, null); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterThinDeviceService.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterThinDeviceService.java index 2acbe0811d6..5dd25da81f4 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterThinDeviceService.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterThinDeviceService.java @@ -98,8 +98,8 @@ public Map getLocalVolumeInfo(Guid clusterId) { GlusterLocalVolumeInfo localVolumeInfo = new GlusterLocalVolumeInfo(); VDSReturnValue logicalVolumesResult = resourceManager.runVdsCommand( - VDSCommandType.GetGlusterLocalLogicalVolumeList, - new VdsIdVDSCommandParametersBase(vds.getId())); + VDSCommandType.GetGlusterLocalLogicalVolumeList, + new VdsIdVDSCommandParametersBase(vds.getId())); if (logicalVolumesResult.getSucceeded()) { localVolumeInfo.setLogicalVolumes((List) logicalVolumesResult.getReturnValue()); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RemoveGlusterHookCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RemoveGlusterHookCommand.java index 214b7cb0728..8005a21f432 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RemoveGlusterHookCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RemoveGlusterHookCommand.java @@ -67,8 +67,8 @@ protected boolean validate() { return false; } - for (VDS vds: getServersInCluster()) { - if (vds.getStatus() != VDSStatus.Up) { + for (VDS vds: getServersInCluster()) { + if (vds.getStatus() != VDSStatus.Up) { setVdsName(vds.getName()); addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP); addValidationMessage(String.format("$%1$s %2$s", "VdsName", vds.getName())); @@ -89,16 +89,15 @@ protected void executeCommand() { for (final VDS server : getServersInCluster()) { taskList.add(() -> { VDSReturnValue returnValue; - returnValue = - runVdsCommand( - VDSCommandType.RemoveGlusterHook, - new GlusterHookVDSParameters(server.getId(), - entity.getGlusterCommand(), - entity.getStage(), - entity.getName() - )); - return new Pair<>(server, returnValue); - + returnValue = + runVdsCommand( + VDSCommandType.RemoveGlusterHook, + new GlusterHookVDSParameters(server.getId(), + entity.getGlusterCommand(), + entity.getStage(), + entity.getName() + )); + return new Pair<>(server, returnValue); }); } @@ -107,7 +106,7 @@ protected void executeCommand() { for (Pair pairResult : pairResults) { VDSReturnValue retValue = pairResult.getSecond(); - if (!retValue.getSucceeded() ) { + if (!retValue.getSucceeded()) { errors.add(retValue.getVdsError().getMessage()); } } @@ -135,7 +134,7 @@ public Map getJobMessageProperties() { if (jobProperties == null) { jobProperties = super.getJobMessageProperties(); if (getGlusterHook() != null) { - jobProperties.put(GlusterConstants.HOOK_NAME, getGlusterHook().getName()); + jobProperties.put(GlusterConstants.HOOK_NAME, getGlusterHook().getName()); } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/UpdateGlusterHookCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/UpdateGlusterHookCommand.java index 48a9bf4eede..10cb966e080 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/UpdateGlusterHookCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/UpdateGlusterHookCommand.java @@ -151,17 +151,16 @@ protected void executeCommand() { for (final Guid serverId : serverIdsToUpdate) { taskList.add(() -> { VDSReturnValue returnValue; - returnValue = - runVdsCommand( - VDSCommandType.UpdateGlusterHook, - new GlusterHookVDSParameters(serverId, - entity.getGlusterCommand(), - entity.getStage(), - entity.getName(), - hookContent, - hookChecksum)); - return new Pair<>(serverId, returnValue); - + returnValue = + runVdsCommand( + VDSCommandType.UpdateGlusterHook, + new GlusterHookVDSParameters(serverId, + entity.getGlusterCommand(), + entity.getStage(), + entity.getName(), + hookContent, + hookChecksum)); + return new Pair<>(serverId, returnValue); }); } @@ -171,9 +170,9 @@ protected void executeCommand() { for (Pair pairResult : pairResults) { VDSReturnValue retValue = pairResult.getSecond(); - if (!retValue.getSucceeded() ) { + if (!retValue.getSucceeded()) { errors.add(retValue.getVdsError().getMessage()); - } + } } } else { setSucceeded(false); @@ -207,7 +206,7 @@ public Map getJobMessageProperties() { if (jobProperties == null) { jobProperties = super.getJobMessageProperties(); if (getGlusterHook() != null) { - jobProperties.put(GlusterConstants.HOOK_NAME, getGlusterHook().getName()); + jobProperties.put(GlusterConstants.HOOK_NAME, getGlusterHook().getName()); } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/tasks/GlusterTaskUtils.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/tasks/GlusterTaskUtils.java index 4d1a2421019..aad0a558518 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/tasks/GlusterTaskUtils.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/tasks/GlusterTaskUtils.java @@ -121,13 +121,13 @@ public void endStepJob(Step step) { public boolean isTaskSuccess(JobExecutionStatus status) { switch (status) { - case ABORTED: - case FAILED: - return false; - case FINISHED: - return true; - default: - return false; + case ABORTED: + case FAILED: + return false; + case FINISHED: + return true; + default: + return false; } } @@ -162,26 +162,26 @@ private String getJobStatusInfo(GlusterAsyncTask task) { String jobStatus = task.getStatus().toString(); if (task.getType() == GlusterTaskType.REMOVE_BRICK) { switch (task.getStatus()) { - case FINISHED: - jobStatus = REMOVE_BRICK_FINISHED; - break; - case STARTED: - jobStatus = REMOVE_BRICK_IN_PROGRESS; - break; - case FAILED: - jobStatus = REMOVE_BRICK_FAILED; - break; - default: - break; + case FINISHED: + jobStatus = REMOVE_BRICK_FINISHED; + break; + case STARTED: + jobStatus = REMOVE_BRICK_IN_PROGRESS; + break; + case FAILED: + jobStatus = REMOVE_BRICK_FAILED; + break; + default: + break; } } if (task.getType() == GlusterTaskType.REBALANCE) { switch (task.getStatus()) { - case STARTED: - jobStatus = REBALANCE_IN_PROGRESS; - break; - default: - break; + case STARTED: + jobStatus = REBALANCE_IN_PROGRESS; + break; + default: + break; } } return jobStatus; @@ -210,7 +210,7 @@ public void updateSteps(Cluster cluster, GlusterAsyncTask task, List steps public void logEventMessage(GlusterAsyncTask task, JobExecutionStatus oldStatus, Cluster cluster) { GlusterVolumeEntity volume = volumeDao.getVolumeByGlusterTask(task.getTaskId()); - if ( volume == null) { + if (volume == null) { if (task.getTaskParameters() != null) { String volName = task.getTaskParameters().getVolumeName(); volume = volumeDao.getByName(cluster.getId(), volName); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/AddVdsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/AddVdsCommand.java index df6def7f314..6726ea3d9d5 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/AddVdsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/AddVdsCommand.java @@ -439,7 +439,7 @@ private String getInstalledVdsIdIfExists(SSHClient client) { "Failed to initiate vdsm-id request on host: {} with error: {}", e.getMessage(), new String(err.toByteArray(), StandardCharsets.UTF_8) - ); + ); log.debug("Exception", e); return null; } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/HostUpgradeCallback.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/HostUpgradeCallback.java index fa164310bef..3ff83b02601 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/HostUpgradeCallback.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/HostUpgradeCallback.java @@ -94,51 +94,51 @@ private void evaluateMaintenanceHostCommandProgress(List childCmdIds, Comm switch (host.getStatus()) { - // Wait till moving to maintenance ends - case PreparingForMaintenance: - break; - - // Invoke the upgrade action - case Maintenance: - // if child command ids is empty the host is already in maintenance so no need to check for - // MaintenanceNumberOfVdssCommand status. So upgrade can be started - if (childCmdIds.isEmpty()) { - logAndinvokeHostUpgrade(rootCommand, parameters); + // Wait till moving to maintenance ends + case PreparingForMaintenance: break; - } - switch (getMaintenanceCmdStatus(childCmdIds)) { - case FAILED: - case ENDED_WITH_FAILURE: - log.info("Host '{}' is on maintenance mode. But not invoking Upgrade process because moving to " + - "maintenance completed with failure, please see logs for details.", - getHostName(parameters.getVdsId())); - handleActionFailed(rootCommand, parameters); - break; - case SUCCEEDED: - case ENDED_SUCCESSFULLY: - logAndinvokeHostUpgrade(rootCommand, parameters); - break; - case UNKNOWN: - log.info("Host '{}' is on maintenance mode. But not invoking Upgrade process because moving to " + - "maintenance command is in UNKNOWN status.", - getHostName(parameters.getVdsId())); - break; - default: - log.info("Host '{}' is on maintenance mode. But not invoking Upgrade process because moving to " + - "maintenance command is in unhandled status '{}'.", - getHostName(parameters.getVdsId()), - host.getStatus()); + + // Invoke the upgrade action + case Maintenance: + // if child command ids is empty the host is already in maintenance so no need to check for + // MaintenanceNumberOfVdssCommand status. So upgrade can be started + if (childCmdIds.isEmpty()) { + logAndinvokeHostUpgrade(rootCommand, parameters); + break; + } + switch (getMaintenanceCmdStatus(childCmdIds)) { + case FAILED: + case ENDED_WITH_FAILURE: + log.info("Host '{}' is on maintenance mode. But not invoking Upgrade process because moving to " + + "maintenance completed with failure, please see logs for details.", + getHostName(parameters.getVdsId())); + handleActionFailed(rootCommand, parameters); + break; + case SUCCEEDED: + case ENDED_SUCCESSFULLY: + logAndinvokeHostUpgrade(rootCommand, parameters); + break; + case UNKNOWN: + log.info("Host '{}' is on maintenance mode. But not invoking Upgrade process because moving to " + + "maintenance command is in UNKNOWN status.", + getHostName(parameters.getVdsId())); + break; + default: + log.info("Host '{}' is on maintenance mode. But not invoking Upgrade process because moving to " + + "maintenance command is in unhandled status '{}'.", + getHostName(parameters.getVdsId()), + host.getStatus()); + break; + } break; - } - break; - // Any other status implies maintenance action failed, and the callback cannot proceed with the upgrade - default: - if (isMaintenanceCommandExecuted(childCmdIds) || hasMaintenanceCmdFailed(childCmdIds)) { - handleActionFailed(rootCommand, parameters); - } + // Any other status implies maintenance action failed, and the callback cannot proceed with the upgrade + default: + if (isMaintenanceCommandExecuted(childCmdIds) || hasMaintenanceCmdFailed(childCmdIds)) { + handleActionFailed(rootCommand, parameters); + } - break; + break; } } @@ -172,20 +172,20 @@ private boolean evaluateHostUpgradeInternalCommandProgress(List childCmdId // upgrade command execution has started and its status should be examined switch (upgradeCommand.getCommandStatus()) { - case ACTIVE: - case NOT_STARTED: - return false; - case FAILED: - case EXECUTION_FAILED: - case ENDED_WITH_FAILURE: - case UNKNOWN: - rootCommand.setCommandStatus(CommandStatus.FAILED); - return true; - - case SUCCEEDED: - case ENDED_SUCCESSFULLY: - rootCommand.setCommandStatus(CommandStatus.SUCCEEDED); - return true; + case ACTIVE: + case NOT_STARTED: + return false; + case FAILED: + case EXECUTION_FAILED: + case ENDED_WITH_FAILURE: + case UNKNOWN: + rootCommand.setCommandStatus(CommandStatus.FAILED); + return true; + + case SUCCEEDED: + case ENDED_SUCCESSFULLY: + rootCommand.setCommandStatus(CommandStatus.SUCCEEDED); + return true; } return true; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/HostUpgradeCheckCallback.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/HostUpgradeCheckCallback.java index d5270eceae4..8efbf9d085e 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/HostUpgradeCheckCallback.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/HostUpgradeCheckCallback.java @@ -69,20 +69,20 @@ private boolean evaluateHostUpgradeCheckInternalCommandProgress(List child // upgrade check command execution has started and its status should be examined switch (upgradeCommand.getCommandStatus()) { - case ACTIVE: - case NOT_STARTED: - return false; - case FAILED: - case EXECUTION_FAILED: - case ENDED_WITH_FAILURE: - case UNKNOWN: - rootCommand.setCommandStatus(CommandStatus.FAILED); - return true; - - case SUCCEEDED: - case ENDED_SUCCESSFULLY: - rootCommand.setCommandStatus(CommandStatus.SUCCEEDED); - return true; + case ACTIVE: + case NOT_STARTED: + return false; + case FAILED: + case EXECUTION_FAILED: + case ENDED_WITH_FAILURE: + case UNKNOWN: + rootCommand.setCommandStatus(CommandStatus.FAILED); + return true; + + case SUCCEEDED: + case ENDED_SUCCESSFULLY: + rootCommand.setCommandStatus(CommandStatus.SUCCEEDED); + return true; } return true; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/RegisterVdsQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/RegisterVdsQuery.java index b3f33c09111..f040e478044 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/RegisterVdsQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdeploy/RegisterVdsQuery.java @@ -351,36 +351,36 @@ private boolean registerNewHost(Guid clusterId, boolean pending) { VDSType.VDS, null); vds.setSshKeyFingerprint(getParameters().getSSHFingerprint()); - log.debug( - "RegisterVdsQuery::register - Will try now to add VDS from scratch; Name: '{}', Hostname: '{}', Unique: '{}', VdsPort: '{}',Subnet mask: '{}', isPending: '{}' with force synchronize", - getParameters().getVdsName(), - getParameters().getVdsHostName(), - getStrippedVdsUniqueId(), - getParameters().getVdsPort(), - pending); - - AddVdsActionParameters p = new AddVdsActionParameters(vds, ""); - p.setPending(pending); - - ActionReturnValue ret = backend.runInternalAction(ActionType.AddVds, p); - - if (!ret.getSucceeded()) { - log.error( - "RegisterVdsQuery::register - Registration failed for VDS - Name: '{}', Hostname: '{}', UniqueID: '{}', Subnet mask: '{}'", - getParameters().getVdsName(), - getParameters().getVdsHostName(), - getStrippedVdsUniqueId()); - captureCommandErrorsToLogger(ret, "RegisterVdsQuery::register"); - error = AuditLogType.VDS_REGISTER_FAILED; - returnValue = false; - } else { - log.info( - "RegisterVdsQuery::register - Registered a new VDS '{}' - Name: '{}', Hostname: '{}', UniqueID: '{}'", - pending ? "pending approval" : "automatically approved", - getParameters().getVdsName(), - getParameters().getVdsHostName(), - getStrippedVdsUniqueId()); - } + log.debug( + "RegisterVdsQuery::register - Will try now to add VDS from scratch; Name: '{}', Hostname: '{}', Unique: '{}', VdsPort: '{}',Subnet mask: '{}', isPending: '{}' with force synchronize", + getParameters().getVdsName(), + getParameters().getVdsHostName(), + getStrippedVdsUniqueId(), + getParameters().getVdsPort(), + pending); + + AddVdsActionParameters p = new AddVdsActionParameters(vds, ""); + p.setPending(pending); + + ActionReturnValue ret = backend.runInternalAction(ActionType.AddVds, p); + + if (!ret.getSucceeded()) { + log.error( + "RegisterVdsQuery::register - Registration failed for VDS - Name: '{}', Hostname: '{}', UniqueID: '{}', Subnet mask: '{}'", + getParameters().getVdsName(), + getParameters().getVdsHostName(), + getStrippedVdsUniqueId()); + captureCommandErrorsToLogger(ret, "RegisterVdsQuery::register"); + error = AuditLogType.VDS_REGISTER_FAILED; + returnValue = false; + } else { + log.info( + "RegisterVdsQuery::register - Registered a new VDS '{}' - Name: '{}', Hostname: '{}', UniqueID: '{}'", + pending ? "pending approval" : "automatically approved", + getParameters().getVdsName(), + getParameters().getVdsHostName(), + getStrippedVdsUniqueId()); + } return returnValue; } @@ -401,7 +401,7 @@ private boolean handleOldVdssWithSameHostName(VDS vdsByUniqueId) { // looping foreach VDS found with similar hostnames and change to each one to available hostname if ( vdsByUniqueId == null || - !vdsByHostName.getId().equals(vdsByUniqueId.getId()) + !vdsByHostName.getId().equals(vdsByUniqueId.getId()) ) { boolean unique = false; String tryHostName = ""; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/kubevirt/KubevirtMonitoring.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/kubevirt/KubevirtMonitoring.java index 32f20ca9cdf..ee399b09e5c 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/kubevirt/KubevirtMonitoring.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/kubevirt/KubevirtMonitoring.java @@ -40,10 +40,10 @@ public void test(Provider provider) { } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } - } + } - public void register(Provider provider) { - clusterToJob.computeIfAbsent(provider.getId(), + public void register(Provider provider) { + clusterToJob.computeIfAbsent(provider.getId(), id -> Injector.injectMembers(new ClusterMonitoring(provider)).start()); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/ExternalNetworkSyncService.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/ExternalNetworkSyncService.java index 049704665d8..1f3a4e9a27e 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/ExternalNetworkSyncService.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/ExternalNetworkSyncService.java @@ -59,5 +59,5 @@ private void synchronize() { .forEach(providerId -> { backendInternal.runInternalAction(ActionType.SyncNetworkProvider, new IdParameters(providerId)); }); - } + } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkHelper.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkHelper.java index 21c89874aba..e333cf21c7f 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkHelper.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkHelper.java @@ -202,11 +202,11 @@ public ActionReturnValue attachNetworkToClusters(Guid networkId, Collection createNetworkClusters(Collection clusterIds) { return clusterIds.stream().map(clusterId -> { - final NetworkCluster networkCluster = new NetworkCluster(); - networkCluster.setClusterId(clusterId); - networkCluster.setRequired(false); - return networkCluster; - }).collect(Collectors.toList()); + final NetworkCluster networkCluster = new NetworkCluster(); + networkCluster.setClusterId(clusterId); + networkCluster.setRequired(false); + return networkCluster; + }).collect(Collectors.toList()); } public void mapPhysicalNetworkIdIfApplicable(ProviderNetwork providerNetwork, Guid dataCenterId) { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/AddNetworkCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/AddNetworkCommand.java index 6961adf216a..dbb0a5eaa2c 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/AddNetworkCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/AddNetworkCommand.java @@ -149,16 +149,16 @@ && validate(validator.externalNetworkVlanValid()) @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { - case EXECUTE: - if (!getSucceeded()) { - return NETWORK_ADD_NETWORK_START_ERROR; - } else if (skipHostSetupNetworks()) { - return NETWORK_ADD_NOTHING_TO_DO; - } else { - return NETWORK_ADD_NETWORK_STARTED; - } - case END_SUCCESS: - return NETWORK_ADD_NETWORK; + case EXECUTE: + if (!getSucceeded()) { + return NETWORK_ADD_NETWORK_START_ERROR; + } else if (skipHostSetupNetworks()) { + return NETWORK_ADD_NOTHING_TO_DO; + } else { + return NETWORK_ADD_NETWORK_STARTED; + } + case END_SUCCESS: + return NETWORK_ADD_NETWORK; } return NETWORK_ADD_NETWORK_FAILED; } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/RemoveNetworkCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/RemoveNetworkCommand.java index 655376072da..723d1197817 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/RemoveNetworkCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/RemoveNetworkCommand.java @@ -200,17 +200,17 @@ private ValidationResult getRemoveExternalNetworkValidationResult() { @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { - case EXECUTE: - if (!getSucceeded()) { - return NETWORK_REMOVE_NETWORK_START_ERROR; - } else if (skipHostSetupNetworks()) { - return NETWORK_REMOVE_NOTHING_TO_DO; - } else { - return NETWORK_REMOVE_NETWORK_STARTED; - } - case END_SUCCESS: - addCustomValues(); - return NETWORK_REMOVE_NETWORK; + case EXECUTE: + if (!getSucceeded()) { + return NETWORK_REMOVE_NETWORK_START_ERROR; + } else if (skipHostSetupNetworks()) { + return NETWORK_REMOVE_NOTHING_TO_DO; + } else { + return NETWORK_REMOVE_NETWORK_STARTED; + } + case END_SUCCESS: + addCustomValues(); + return NETWORK_REMOVE_NETWORK; } addCustomValues(); return NETWORK_REMOVE_NETWORK_FAILED; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/UpdateNetworkCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/UpdateNetworkCommand.java index 84eea8b0042..368a823928c 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/UpdateNetworkCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/dc/UpdateNetworkCommand.java @@ -229,16 +229,16 @@ private boolean oldAndNewNetworkIsNotExternal() { @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { - case EXECUTE: - if (!getSucceeded()) { - return NETWORK_UPDATE_NETWORK_START_ERROR; - } else if (skipHostSetupNetworks()) { - return NETWORK_UPDATE_NOTHING_TO_DO; - } else { - return NETWORK_UPDATE_NETWORK_STARTED; - } - case END_SUCCESS: - return NETWORK_UPDATE_NETWORK; + case EXECUTE: + if (!getSucceeded()) { + return NETWORK_UPDATE_NETWORK_START_ERROR; + } else if (skipHostSetupNetworks()) { + return NETWORK_UPDATE_NOTHING_TO_DO; + } else { + return NETWORK_UPDATE_NETWORK_STARTED; + } + case END_SUCCESS: + return NETWORK_UPDATE_NETWORK; } return NETWORK_UPDATE_NETWORK_FAILED; } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/GetHostsWithMissingFlagsForClusterQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/GetHostsWithMissingFlagsForClusterQuery.java index e07f8730351..41446ea12db 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/GetHostsWithMissingFlagsForClusterQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/GetHostsWithMissingFlagsForClusterQuery.java @@ -33,7 +33,7 @@ protected void executeQueryCommand() { .filter(vds -> vds.getStatus() == VDSStatus.Up) .filter(vds -> hasMissingServerCpuFlags(vds)) .collect(Collectors.toList()); - getQueryReturnValue().setReturnValue(hostsOutOfSync); + getQueryReturnValue().setReturnValue(hostsOutOfSync); } protected boolean hasMissingServerCpuFlags(VDS vds) { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/UnmanagedNetworkValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/UnmanagedNetworkValidator.java index 6141ab60377..c6713eae920 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/UnmanagedNetworkValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/UnmanagedNetworkValidator.java @@ -74,7 +74,7 @@ protected ValidationResult validateRemovedUnmanagedNetworks( Collection existingInterfaces, BusinessEntityMap networkBusinessEntityMap) { - for (String removedUnmanagedNetworkName : removedUnmanagedNetworks) { + for (String removedUnmanagedNetworkName : removedUnmanagedNetworks) { Network network = networkBusinessEntityMap.get(removedUnmanagedNetworkName); if (network != null) { @@ -128,7 +128,7 @@ ValidationResult validateAttachements(String nicWithUnmanagedNetwork, List filterNicsWithUnmanagedNetworks( List existingInterfaces, Collection removedUnmanagedNetworks) { + Set filterNicsWithUnmanagedNetworks(List existingInterfaces, Collection removedUnmanagedNetworks) { Set nicsWithUnmanagedNetworks = new HashSet<>(); for (VdsNetworkInterface nic : existingInterfaces) { if (nic.getNetworkImplementationDetails() != null && !nic.getNetworkImplementationDetails().isManaged()) { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/UpdateHostNicVfsConfigCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/UpdateHostNicVfsConfigCommand.java index f87d69b7317..c2eadd2855a 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/UpdateHostNicVfsConfigCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/UpdateHostNicVfsConfigCommand.java @@ -87,8 +87,8 @@ private boolean saveChangesToDb(final boolean shouldRefreshHost, } private boolean refreshHost() { - VdsActionParameters vdsActionParams = new VdsActionParameters(getVdsId()); - return runInternalAction(ActionType.RefreshHost, vdsActionParams).getSucceeded(); + VdsActionParameters vdsActionParams = new VdsActionParameters(getVdsId()); + return runInternalAction(ActionType.RefreshHost, vdsActionParams).getSucceeded(); } @Override diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/VfSchedulerImpl.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/VfSchedulerImpl.java index 590b625c334..bbcda639798 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/VfSchedulerImpl.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/host/VfSchedulerImpl.java @@ -122,7 +122,7 @@ private List getPluggedPassthroughVnics(List fetchedNics = new HashMap<>(); */ - private String findFreeVfForVnic(List vfsConfigs, + private String findFreeVfForVnic(List vfsConfigs, Map> nicToUsedVfs, Map fetchedNics, Network vnicNetwork, diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/ActivateDeactivateVmNicCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/ActivateDeactivateVmNicCommand.java index ce17b049fe8..33442281293 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/ActivateDeactivateVmNicCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/ActivateDeactivateVmNicCommand.java @@ -262,14 +262,14 @@ protected void executeVmCommand() { vmDevicesLock.lock(); try { switch (getParameters().getAction()) { - case PLUG: - plugNic(); - break; - case UNPLUG: - unplugNic(); - break; - default: - throw new RuntimeException("Coding error: unknown enum value"); + case PLUG: + plugNic(); + break; + case UNPLUG: + unplugNic(); + break; + default: + throw new RuntimeException("Coding error: unknown enum value"); } var success = handleFailoverIfNeeded(); @@ -454,7 +454,7 @@ private void unplugFromExternalNetwork() { } private Provider getProvider() { - if (provider == null ) { + if (provider == null) { Network network = getNetwork(); if (network != null && network.isExternal()) { provider = providerDao.get(network.getProvidedBy().getProviderId()); @@ -510,14 +510,14 @@ private boolean handleFailoverIfNeeded() { private void revertAfterFailoverOperationFail() { switch (getParameters().getAction()) { - case PLUG: - getParameters().setAction(PlugAction.UNPLUG); - unplugNic(); - break; - case UNPLUG: - getParameters().setAction(PlugAction.PLUG); - plugNic(); - break; + case PLUG: + getParameters().setAction(PlugAction.UNPLUG); + unplugNic(); + break; + case UNPLUG: + getParameters().setAction(PlugAction.PLUG); + plugNic(); + break; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVmInterfaceCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVmInterfaceCommand.java index fa42d522b25..2ffce05ee44 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVmInterfaceCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVmInterfaceCommand.java @@ -191,17 +191,17 @@ private boolean updateHost() { if (getRequiredAction() != null) { switch (getRequiredAction()) { - case PLUG: - return activateOrDeactivateExistingNic(getInterface(), PlugAction.PLUG); - case UNPLUG: - return activateOrDeactivateExistingNic(oldIface, PlugAction.UNPLUG); - case UPDATE_VM_DEVICE: - runVdsCommand(VDSCommandType.UpdateVmInterface, - new VmNicDeviceVDSParameters(getVdsId(), - getVm(), - vmNicDao.get(getInterface().getId()), - oldVmDevice)); - break; + case PLUG: + return activateOrDeactivateExistingNic(getInterface(), PlugAction.PLUG); + case UNPLUG: + return activateOrDeactivateExistingNic(oldIface, PlugAction.UNPLUG); + case UPDATE_VM_DEVICE: + runVdsCommand(VDSCommandType.UpdateVmInterface, + new VmNicDeviceVDSParameters(getVdsId(), + getVm(), + vmNicDao.get(getInterface().getId()), + oldVmDevice)); + break; } } return true; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/numa/vm/NumaValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/numa/vm/NumaValidator.java index a6d6d7716ed..08423f0ae86 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/numa/vm/NumaValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/numa/vm/NumaValidator.java @@ -266,7 +266,7 @@ public ValidationResult validateVmNumaConfig(final VM vm, final List * @return whether the vm can run on all pinned hosts (hostsNodesMap) or not */ public ValidationResult validateNumaCompatibility(final VM vm, final List vmNumaNodes, - final Map> hostsNumaNodesMap) { + final Map> hostsNumaNodesMap) { for (Map.Entry> entry : hostsNumaNodesMap.entrySet()) { Guid pinnedVds = entry.getKey(); List pinnedVdsNumaNodes = entry.getValue(); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/pm/FenceAgentExecutor.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/pm/FenceAgentExecutor.java index 92ba666c5d3..ae7bdfef222 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/pm/FenceAgentExecutor.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/pm/FenceAgentExecutor.java @@ -132,14 +132,14 @@ public FenceOperationResult fence(FenceActionType action, FenceAgent agent) { private Object getActionText(FenceActionType action) { switch (action) { - case START: - return "fence action: 'Start'"; - case STOP: - return "fence action: 'Stop'"; - case STATUS: - return "fence status-check"; - default: - return ""; // won't happen + case START: + return "fence action: 'Start'"; + case STOP: + return "fence action: 'Stop'"; + case STATUS: + return "fence status-check"; + default: + return ""; // won't happen } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/BaseProviderProxy.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/BaseProviderProxy.java index 7112a5c113f..aeb81e3911b 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/BaseProviderProxy.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/BaseProviderProxy.java @@ -63,7 +63,7 @@ public List getCertificateChain() { try { result = CertificateChain.completeChain( CertificateChain.getSSLPeerCertificates(url), - CertificateChain.keyStoreToTrustAnchors( ExternalTrustStoreInitializer.getTrustStore())); + CertificateChain.keyStoreToTrustAnchors(ExternalTrustStoreInitializer.getTrustStore())); } catch (IOException | GeneralSecurityException e) { log.error("Failed to communicate with external provider '{}' due to error '{}'", hostProvider.getName(), diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/ProviderProxyFactory.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/ProviderProxyFactory.java index a4a6d04bdfd..fa479221b14 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/ProviderProxyFactory.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/ProviderProxyFactory.java @@ -37,38 +37,38 @@ public class ProviderProxyFactory { @SuppressWarnings("unchecked") public

> P create(Provider provider) { switch (provider.getType()) { - case EXTERNAL_NETWORK: - if (provider.getIsUnmanaged()) { - return (P) new UnmanagedNetworkProviderProxy((Provider) provider); - } - return (P) new ExternalNetworkProviderProxy((Provider) provider); + case EXTERNAL_NETWORK: + if (provider.getIsUnmanaged()) { + return (P) new UnmanagedNetworkProviderProxy((Provider) provider); + } + return (P) new ExternalNetworkProviderProxy((Provider) provider); - case FOREMAN: - return (P) new ForemanHostProviderProxy(provider); + case FOREMAN: + return (P) new ForemanHostProviderProxy(provider); - case OPENSTACK_NETWORK: - return (P) new OpenstackNetworkProviderProxy((Provider) provider); + case OPENSTACK_NETWORK: + return (P) new OpenstackNetworkProviderProxy((Provider) provider); - case OPENSTACK_IMAGE: - return (P) new OpenStackImageProviderProxy((Provider) provider); + case OPENSTACK_IMAGE: + return (P) new OpenStackImageProviderProxy((Provider) provider); - case OPENSTACK_VOLUME: - return (P) new OpenStackVolumeProviderProxy((Provider) provider); + case OPENSTACK_VOLUME: + return (P) new OpenStackVolumeProviderProxy((Provider) provider); - case VMWARE: - return (P) Injector.injectMembers(new VmwareVmProviderProxy((Provider) provider)); + case VMWARE: + return (P) Injector.injectMembers(new VmwareVmProviderProxy((Provider) provider)); - case KVM: - return (P) Injector.injectMembers(new KVMVmProviderProxy((Provider) provider)); + case KVM: + return (P) Injector.injectMembers(new KVMVmProviderProxy((Provider) provider)); - case XEN: - return (P) Injector.injectMembers(new XENVmProviderProxy((Provider) provider)); + case XEN: + return (P) Injector.injectMembers(new XENVmProviderProxy((Provider) provider)); - case KUBEVIRT: - return (P) Injector.injectMembers(new KubevirtProviderProxy((Provider) provider)); + case KUBEVIRT: + return (P) Injector.injectMembers(new KubevirtProviderProxy((Provider) provider)); - default: - return null; + default: + return null; } } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/network/openstack/BaseNetworkProviderProxy.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/network/openstack/BaseNetworkProviderProxy.java index 2d8ec0b396b..5c338f52cd1 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/network/openstack/BaseNetworkProviderProxy.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/network/openstack/BaseNetworkProviderProxy.java @@ -110,7 +110,7 @@ protected com.woorea.openstack.quantum.model.Network createNewNetworkEntity(Netw @Override public void remove(String id) { - execute(getClient().networks().delete(id)); + execute(getClient().networks().delete(id)); } @Override diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/UpdateHostNetworkQosCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/UpdateHostNetworkQosCommand.java index 64f6494d7e9..c12aea03f9a 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/UpdateHostNetworkQosCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/UpdateHostNetworkQosCommand.java @@ -58,8 +58,8 @@ protected void executeCommand() { */ private boolean networkUpdateRequired(HostNetworkQos oldQos, HostNetworkQos newQos) { boolean noChange = Objects.equals(newQos.getOutAverageLinkshare(), oldQos.getOutAverageLinkshare()) - && Objects.equals(newQos.getOutAverageRealtime(), oldQos.getOutAverageRealtime()) - && Objects.equals(newQos.getOutAverageUpperlimit(), oldQos.getOutAverageUpperlimit()); + && Objects.equals(newQos.getOutAverageRealtime(), oldQos.getOutAverageRealtime()) + && Objects.equals(newQos.getOutAverageUpperlimit(), oldQos.getOutAverageUpperlimit()); return !noChange; } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/RemoveQuotaCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/RemoveQuotaCommand.java index 56fb55683ab..311c2c56661 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/RemoveQuotaCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/RemoveQuotaCommand.java @@ -42,10 +42,10 @@ protected boolean validate() { return false; } - if (quota.isDefault()) { - addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_QUOTA_DEFAULT_CANNOT_BE_CHANGED); - return false; - } + if (quota.isDefault()) { + addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_QUOTA_DEFAULT_CANNOT_BE_CHANGED); + return false; + } // If the quota is in use by ether VM or image - return false if (!QuotaEnforcementTypeEnum.DISABLED.equals(quota.getQuotaEnforcementType()) && quotaDao.isQuotaInUse(quota)) { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/OvirtGlusterSchedulingService.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/OvirtGlusterSchedulingService.java index bdd4792ad19..f3d4d3c1e2d 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/OvirtGlusterSchedulingService.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/OvirtGlusterSchedulingService.java @@ -82,11 +82,11 @@ public Guid schedule(String className, job.setEndDate(convertDate(endDate)); } - } catch (ParseException e) { + } catch (ParseException e) { log.error("Error while converting the date to simple date format startDate: {} endDate:{}", startDate, endDate); - } + } if (StringUtils.isNotBlank(timeZone)) { job.setTimeZone(timeZone); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java index 8bbb6d5a614..a6bce0d4be2 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java @@ -787,28 +787,28 @@ private Optional selectBestHost(List vmGroup, } switch (runnableHosts.size()) { - case 0: - // no runnable hosts found, nothing found - return Optional.empty(); - case 1: - // found single available host, in available list return it - return Optional.of(runnableHosts.get(0).getId()); - default: - // select best runnable host with scoring functions (from policy) - List> functions = policy.getFunctions(); - Guid selector = Optional.of(policy).map(ClusterPolicy::getSelector).orElse(defaultSelectorGuid); - PolicyUnitImpl selectorUnit = policyUnits.get(selector); - SelectorInstance selectorInstance = selectorUnit.selector(context.getPolicyParameters()); - - List runnableGuids = runnableHosts.stream().map(VDS::getId).collect(Collectors.toList()); - selectorInstance.init(functions, runnableGuids); - - if (!functions.isEmpty() && context.isShouldWeighClusterHosts()) { - Optional bestHostByFunctions = runFunctions(selectorInstance, runnableHosts, vmGroup, context); - if (bestHostByFunctions.isPresent()) { - return bestHostByFunctions; + case 0: + // no runnable hosts found, nothing found + return Optional.empty(); + case 1: + // found single available host, in available list return it + return Optional.of(runnableHosts.get(0).getId()); + default: + // select best runnable host with scoring functions (from policy) + List> functions = policy.getFunctions(); + Guid selector = Optional.of(policy).map(ClusterPolicy::getSelector).orElse(defaultSelectorGuid); + PolicyUnitImpl selectorUnit = policyUnits.get(selector); + SelectorInstance selectorInstance = selectorUnit.selector(context.getPolicyParameters()); + + List runnableGuids = runnableHosts.stream().map(VDS::getId).collect(Collectors.toList()); + selectorInstance.init(functions, runnableGuids); + + if (!functions.isEmpty() && context.isShouldWeighClusterHosts()) { + Optional bestHostByFunctions = runFunctions(selectorInstance, runnableHosts, vmGroup, context); + if (bestHostByFunctions.isPresent()) { + return bestHostByFunctions; + } } - } } // failed select best runnable host using scoring functions, return the first return Optional.of(runnableHosts.get(0).getId()); @@ -1407,31 +1407,31 @@ public List getClusterPoliciesNamesByPolicyUnitId(Guid policyUnitId) { if (policyUnit != null) { for (ClusterPolicy clusterPolicy : policyMap.values()) { switch (policyUnit.getPolicyUnitType()) { - case FILTER: - Collection filters = clusterPolicy.getFilters(); - if (filters != null && filters.contains(policyUnitId)) { - list.add(clusterPolicy.getName()); - } - break; - case WEIGHT: - Collection> functions = clusterPolicy.getFunctions(); - if (functions == null) { - break; - } - for (Pair pair : functions) { - if (pair.getFirst().equals(policyUnitId)) { + case FILTER: + Collection filters = clusterPolicy.getFilters(); + if (filters != null && filters.contains(policyUnitId)) { list.add(clusterPolicy.getName()); + } + break; + case WEIGHT: + Collection> functions = clusterPolicy.getFunctions(); + if (functions == null) { break; } - } - break; - case LOAD_BALANCING: - if (policyUnitId.equals(clusterPolicy.getBalance())) { - list.add(clusterPolicy.getName()); - } - break; - default: - break; + for (Pair pair : functions) { + if (pair.getFirst().equals(policyUnitId)) { + list.add(clusterPolicy.getName()); + break; + } + } + break; + case LOAD_BALANCING: + if (policyUnitId.equals(clusterPolicy.getBalance())) { + list.add(clusterPolicy.getName()); + } + break; + default: + break; } } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/external/ExternalSchedulerDiscoveryResult.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/external/ExternalSchedulerDiscoveryResult.java index 103b6904e3f..376ce018211 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/external/ExternalSchedulerDiscoveryResult.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/external/ExternalSchedulerDiscoveryResult.java @@ -28,17 +28,17 @@ public class ExternalSchedulerDiscoveryResult { public boolean populate(Object xmlRpcRawResult) { try { - if (!(xmlRpcRawResult instanceof HashMap)) { - log.error("External scheduler error, malformed discover results"); - return false; - } - @SuppressWarnings("unchecked") - Map> castedResult = (Map>) xmlRpcRawResult; + if (!(xmlRpcRawResult instanceof HashMap)) { + log.error("External scheduler error, malformed discover results"); + return false; + } + @SuppressWarnings("unchecked") + Map> castedResult = (Map>) xmlRpcRawResult; - // keys will be filter, score and balance - for (Map.Entry> entry : castedResult.entrySet()) { - String type = entry.getKey(); - Map typeMap = entry.getValue(); + // keys will be filter, score and balance + for (Map.Entry> entry : castedResult.entrySet()) { + String type = entry.getKey(); + Map typeMap = entry.getValue(); List currentList = getRelevantList(type); if (currentList == null) { log.error("External scheduler error, got unknown type"); @@ -51,10 +51,10 @@ public boolean populate(Object xmlRpcRawResult) { // check custom properties format. String customPropertiesRegex = singleModule[1].toString(); if (!StringUtils.isEmpty(customPropertiesRegex) && SimpleCustomPropertiesUtil.getInstance() - .syntaxErrorInProperties(customPropertiesRegex)) { + .syntaxErrorInProperties(customPropertiesRegex)) { log.error("Module '{}' will not be loaded, wrong custom properties format ({})", - moduleName, - customPropertiesRegex); + moduleName, + customPropertiesRegex); continue; } ExternalSchedulerDiscoveryUnit currentUnit = new ExternalSchedulerDiscoveryUnit(moduleName, @@ -62,8 +62,8 @@ public boolean populate(Object xmlRpcRawResult) { customPropertiesRegex); currentList.add(currentUnit); } - } - return true; + } + return true; } catch (Exception e) { log.error("External scheduler error, exception while parsing discovery results: {}", e.getMessage()); log.debug("Exception", e); @@ -73,14 +73,14 @@ public boolean populate(Object xmlRpcRawResult) { private List getRelevantList(String type) { switch (type) { - case FILTERS: - return filters; - case SCORES: - return scores; - case BALANCE: - return balance; - default: - return null; + case FILTERS: + return filters; + case SCORES: + return scores; + case BALANCE: + return balance; + default: + return null; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/CpuOverloadPolicyUnit.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/CpuOverloadPolicyUnit.java index 7186a1e5977..644ef655d15 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/CpuOverloadPolicyUnit.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/CpuOverloadPolicyUnit.java @@ -33,8 +33,8 @@ type = PolicyUnitType.FILTER, description = "Filters out CPU overloaded hosts.", parameters = { - PolicyUnitParameter.HIGH_UTILIZATION, - PolicyUnitParameter.CPU_OVERCOMMIT_DURATION_MINUTES + PolicyUnitParameter.HIGH_UTILIZATION, + PolicyUnitParameter.CPU_OVERCOMMIT_DURATION_MINUTES } ) public class CpuOverloadPolicyUnit extends PolicyUnitImpl { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/EvenDistributionBalancePolicyUnit.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/EvenDistributionBalancePolicyUnit.java index a7ac00aa7be..f864c85cec7 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/EvenDistributionBalancePolicyUnit.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/EvenDistributionBalancePolicyUnit.java @@ -22,11 +22,11 @@ description = "Load balancing VMs in cluster according to hosts CPU load, striving cluster's hosts CPU load to" + " be under 'HighUtilization'", parameters = { - PolicyUnitParameter.HIGH_UTILIZATION, - PolicyUnitParameter.LOW_MEMORY_LIMIT_FOR_OVER_UTILIZED, - PolicyUnitParameter.HIGH_MEMORY_LIMIT_FOR_UNDER_UTILIZED, - PolicyUnitParameter.CPU_OVERCOMMIT_DURATION_MINUTES, - PolicyUnitParameter.VCPU_TO_PHYSICAL_CPU_RATIO + PolicyUnitParameter.HIGH_UTILIZATION, + PolicyUnitParameter.LOW_MEMORY_LIMIT_FOR_OVER_UTILIZED, + PolicyUnitParameter.HIGH_MEMORY_LIMIT_FOR_UNDER_UTILIZED, + PolicyUnitParameter.CPU_OVERCOMMIT_DURATION_MINUTES, + PolicyUnitParameter.VCPU_TO_PHYSICAL_CPU_RATIO } ) public class EvenDistributionBalancePolicyUnit extends CpuAndMemoryBalancingPolicyUnit { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/EvenGuestDistributionBalancePolicyUnit.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/EvenGuestDistributionBalancePolicyUnit.java index 209e7629d59..d49d0f4d086 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/EvenGuestDistributionBalancePolicyUnit.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/EvenGuestDistributionBalancePolicyUnit.java @@ -23,9 +23,9 @@ name = "OptimalForEvenGuestDistribution", type = PolicyUnitType.LOAD_BALANCING, parameters = { - PolicyUnitParameter.SPM_VM_GRACE, - PolicyUnitParameter.HIGH_VM_COUNT, - PolicyUnitParameter.MIGRATION_THRESHOLD + PolicyUnitParameter.SPM_VM_GRACE, + PolicyUnitParameter.HIGH_VM_COUNT, + PolicyUnitParameter.MIGRATION_THRESHOLD } ) public class EvenGuestDistributionBalancePolicyUnit extends EvenDistributionBalancePolicyUnit { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/PowerSavingBalancePolicyUnit.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/PowerSavingBalancePolicyUnit.java index dfef2f6bd3a..ff5f179036d 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/PowerSavingBalancePolicyUnit.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/PowerSavingBalancePolicyUnit.java @@ -50,13 +50,13 @@ description = "Load balancing VMs in cluster according to hosts CPU load, striving cluster's hosts CPU load to" + " be over 'LowUtilization' and under 'HighUtilization'", parameters = { - PolicyUnitParameter.HIGH_UTILIZATION, - PolicyUnitParameter.LOW_MEMORY_LIMIT_FOR_OVER_UTILIZED, - PolicyUnitParameter.HIGH_MEMORY_LIMIT_FOR_UNDER_UTILIZED, - PolicyUnitParameter.CPU_OVERCOMMIT_DURATION_MINUTES, - PolicyUnitParameter.LOW_UTILIZATION, - PolicyUnitParameter.ENABLE_AUTOMATIC_HOST_POWER_MANAGEMENT, - PolicyUnitParameter.HOSTS_IN_RESERVE + PolicyUnitParameter.HIGH_UTILIZATION, + PolicyUnitParameter.LOW_MEMORY_LIMIT_FOR_OVER_UTILIZED, + PolicyUnitParameter.HIGH_MEMORY_LIMIT_FOR_UNDER_UTILIZED, + PolicyUnitParameter.CPU_OVERCOMMIT_DURATION_MINUTES, + PolicyUnitParameter.LOW_UTILIZATION, + PolicyUnitParameter.ENABLE_AUTOMATIC_HOST_POWER_MANAGEMENT, + PolicyUnitParameter.HOSTS_IN_RESERVE } ) public class PowerSavingBalancePolicyUnit extends CpuAndMemoryBalancingPolicyUnit { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/PowerSavingMemoryWeightPolicyUnit.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/PowerSavingMemoryWeightPolicyUnit.java index 652d069bbd7..060ae78483e 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/PowerSavingMemoryWeightPolicyUnit.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/PowerSavingMemoryWeightPolicyUnit.java @@ -26,8 +26,8 @@ + " more likely to be selected)", type = PolicyUnitType.WEIGHT, parameters = { - PolicyUnitParameter.LOW_MEMORY_LIMIT_FOR_OVER_UTILIZED, - PolicyUnitParameter.HIGH_MEMORY_LIMIT_FOR_UNDER_UTILIZED + PolicyUnitParameter.LOW_MEMORY_LIMIT_FOR_OVER_UTILIZED, + PolicyUnitParameter.HIGH_MEMORY_LIMIT_FOR_UNDER_UTILIZED } ) public class PowerSavingMemoryWeightPolicyUnit extends PolicyUnitImpl { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/VmToHostAffinityFilterPolicyUnit.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/VmToHostAffinityFilterPolicyUnit.java index 1b9baf660b1..eedc871ba13 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/VmToHostAffinityFilterPolicyUnit.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/VmToHostAffinityFilterPolicyUnit.java @@ -56,7 +56,7 @@ public List filter(SchedulingContext context, .filter(ag -> ag.isVdsEnforcing() && ag.isVdsAffinityEnabled()) .collect(Collectors.toList()); - if (FeatureSupported.isImplicitAffinityGroupSupported(context.getCluster().getCompatibilityVersion()) ) { + if (FeatureSupported.isImplicitAffinityGroupSupported(context.getCluster().getCompatibilityVersion())) { List

> extends AbstractUserQueryTest { - private static final int NUM_OF_SNAPSHOTS_TO_CREATE = 3; - - /** - * Active disk with snapshots for the test - */ - protected DiskImage diskWithSnapshots; - - /** - * List of all the snapshots for {@link AbstractGetDisksAndSnapshotsQueryTest#diskWithSnapshots} - */ - protected List snapshotsList; - - /** - * Active disk without snapshots for the test - */ - protected DiskImage diskWithoutSnapshots; - - /** - * OVF image for the test - */ - protected DiskImage ovfImage; - - /** - * Cinder disk for the test - */ - protected CinderDisk cinderDisk; - - /** - * LUN disk for the test - */ - protected LunDisk lunDisk; - - @Mock - protected ImagesHandler imagesHandler; - - @BeforeEach - @Override - public void setUp() throws Exception { - super.setUp(); - diskWithSnapshots = createDiskImage(null); - snapshotsList = createSnapshotsForDiskImage(diskWithSnapshots.getId()); - diskWithoutSnapshots = createDiskImage(null); - ovfImage = createDiskImage(null); - ovfImage.setContentType(DiskContentType.OVF_STORE); - cinderDisk = createCinderDisk(); - lunDisk = createLunDisk(); - setUpImagesHandlerMocks(); - } + private static final int NUM_OF_SNAPSHOTS_TO_CREATE = 3; + + /** + * Active disk with snapshots for the test + */ + protected DiskImage diskWithSnapshots; + + /** + * List of all the snapshots for {@link AbstractGetDisksAndSnapshotsQueryTest#diskWithSnapshots} + */ + protected List snapshotsList; + + /** + * Active disk without snapshots for the test + */ + protected DiskImage diskWithoutSnapshots; + + /** + * OVF image for the test + */ + protected DiskImage ovfImage; + + /** + * Cinder disk for the test + */ + protected CinderDisk cinderDisk; + + /** + * LUN disk for the test + */ + protected LunDisk lunDisk; + + @Mock + protected ImagesHandler imagesHandler; + + @BeforeEach + @Override + public void setUp() throws Exception { + super.setUp(); + diskWithSnapshots = createDiskImage(null); + snapshotsList = createSnapshotsForDiskImage(diskWithSnapshots.getId()); + diskWithoutSnapshots = createDiskImage(null); + ovfImage = createDiskImage(null); + ovfImage.setContentType(DiskContentType.OVF_STORE); + cinderDisk = createCinderDisk(); + lunDisk = createLunDisk(); + setUpImagesHandlerMocks(); + } protected void setUpImagesHandlerMocks() { List diskImagesTestParam = new ArrayList<>(snapshotsList); diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/AddDiskCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/AddDiskCommandTest.java index 1e9e935afd5..3ab9969631b 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/AddDiskCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/AddDiskCommandTest.java @@ -183,8 +183,8 @@ public void validateFailsOnDiskDomainCheckWhenEmptyStorageGuidInParams() { mockMaxPciSlots(); command.setStorageDomainId(Guid.Empty); - ValidateTestUtils.runAndAssertValidateFailure - (command, EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_SPECIFIED); + ValidateTestUtils.runAndAssertValidateFailure(command, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_SPECIFIED); } @Test @@ -225,8 +225,8 @@ public void validateFailsOnNullDiskInterface() { command.getParameters().setStorageDomainId(storageId); command.getParameters().getDiskVmElement().setDiskInterface(null); assertFalse(command.validateInputs()); - ValidateTestUtils.assertValidationMessages - ("Wrong validation method", command, EngineMessage.VALIDATION_DISK_INTERFACE_NOT_NULL); + ValidateTestUtils.assertValidationMessages("Wrong validation method", + command, EngineMessage.VALIDATION_DISK_INTERFACE_NOT_NULL); } @Test @@ -241,8 +241,8 @@ public void validateFailsOnSizeZero() { mockInterfaceList(); mockMaxPciSlots(); mockVm(); - ValidateTestUtils.runAndAssertValidateFailure - (command, EngineMessage.ACTION_TYPE_FAILED_DISK_SIZE_ZERO); + ValidateTestUtils.runAndAssertValidateFailure(command, + EngineMessage.ACTION_TYPE_FAILED_DISK_SIZE_ZERO); } @Test @@ -268,8 +268,7 @@ public void validateSpaceValidationFails() { mockVm(); doReturn(mockStorageDomainValidatorWithoutSpace()).when(command).createStorageDomainValidator(); - ValidateTestUtils.runAndAssertValidateFailure - (command, EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN); + ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN); } /** @@ -346,8 +345,8 @@ public void validateShareableDiskVolumeFormatFails() { mockMaxPciSlots(); mockVm(); - ValidateTestUtils.runAndAssertValidateFailure - (command, EngineMessage.SHAREABLE_DISK_IS_NOT_SUPPORTED_BY_VOLUME_FORMAT); + ValidateTestUtils.runAndAssertValidateFailure(command, + EngineMessage.SHAREABLE_DISK_IS_NOT_SUPPORTED_BY_VOLUME_FORMAT); } @Test @@ -363,8 +362,8 @@ public void validateShareableDiskOnGlusterFails() { mockStoragePoolIsoMap(); mockMaxPciSlots(); - ValidateTestUtils.runAndAssertValidateFailure - (command, EngineMessage.ACTION_TYPE_FAILED_SHAREABLE_DISKS_NOT_SUPPORTED_ON_GLUSTER_DOMAIN); + ValidateTestUtils.runAndAssertValidateFailure(command, + EngineMessage.ACTION_TYPE_FAILED_SHAREABLE_DISKS_NOT_SUPPORTED_ON_GLUSTER_DOMAIN); } /** @@ -930,7 +929,7 @@ public void testValidateFailsForPassDiscard() { private void clearValidationMessages() { command.getReturnValue() .getValidationMessages() - .clear(); + .clear(); } private void mockEntities(Guid storageId) { diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/HotPlugDiskToVmCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/HotPlugDiskToVmCommandTest.java index fb8ac872b34..a78c3e9ecd8 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/HotPlugDiskToVmCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/HotPlugDiskToVmCommandTest.java @@ -236,9 +236,9 @@ protected void mockVds() { protected void mockInterfaceList() { ArrayList diskInterfaces = new ArrayList<>( Arrays.asList(new String[]{ - "IDE", - "VirtIO", - "VirtIO_SCSI" + "IDE", + "VirtIO", + "VirtIO_SCSI" })); when(osRepository.getDiskInterfaces(anyInt(), any(), any())).thenReturn(diskInterfaces); diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/UpdateDiskCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/UpdateDiskCommandTest.java index db0e226740b..c337ef3bb2f 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/UpdateDiskCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/UpdateDiskCommandTest.java @@ -609,8 +609,8 @@ public void testFaultyResize() { initializeCommand(); assertFalse(command.validateCanResizeDisk()); - ValidateTestUtils.assertValidationMessages - ("wrong failure", command, EngineMessage.ACTION_TYPE_FAILED_REQUESTED_DISK_SIZE_IS_TOO_SMALL); + ValidateTestUtils.assertValidationMessages("wrong failure", + command, EngineMessage.ACTION_TYPE_FAILED_REQUESTED_DISK_SIZE_IS_TOO_SMALL); } @Test @@ -626,8 +626,8 @@ public void testFailedRoDiskResize() { vmDevice.setReadOnly(true); assertFalse(command.validateCanResizeDisk()); - ValidateTestUtils.assertValidationMessages - ("wrong failure", command, EngineMessage.ACTION_TYPE_FAILED_CANNOT_RESIZE_READ_ONLY_DISK); + ValidateTestUtils.assertValidationMessages("wrong failure", + command, EngineMessage.ACTION_TYPE_FAILED_CANNOT_RESIZE_READ_ONLY_DISK); } private void initializeCommand() { diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/image/AmendImageGroupVolumesCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/image/AmendImageGroupVolumesCommandTest.java index ed45f8aecf9..181250202fd 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/image/AmendImageGroupVolumesCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/image/AmendImageGroupVolumesCommandTest.java @@ -106,8 +106,7 @@ public void testValidationFailsStoragePoolNotExists() { @Test public void testValidationFailsStoragePoolNotUp() { storagePool.setStatus(StoragePoolStatus.NotOperational); - ValidateTestUtils.runAndAssertValidateFailure - (command, EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_STATUS_ILLEGAL); + ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_STATUS_ILLEGAL); } @Test diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/image/DisksFilterTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/image/DisksFilterTest.java index c5bfdfb219c..53050b78d77 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/image/DisksFilterTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/image/DisksFilterTest.java @@ -138,27 +138,27 @@ public void testFilterUnpluggedDisks() { } private Disk createDisk - (DiskStorageType type, boolean isActive, boolean isShareable, boolean isSnapable, boolean isPlugged) { + (DiskStorageType type, boolean isActive, boolean isShareable, boolean isSnapable, boolean isPlugged) { Disk disk = null; switch (type) { - case IMAGE: - disk = new DiskImage(); - setDiskImageProperties((DiskImage) disk, isActive, isShareable, isSnapable); - break; - case LUN: - if (isSnapable) { - throw new IllegalArgumentException("A LUN disk cannot be snapable"); - } - disk = new LunDisk(); - break; - case CINDER: - disk = new CinderDisk(); - setDiskImageProperties((DiskImage) disk, isActive, isShareable, isSnapable); - break; - case MANAGED_BLOCK_STORAGE: - disk = new ManagedBlockStorageDisk(); - setDiskImageProperties((DiskImage) disk, isActive, isShareable, isSnapable); - break; + case IMAGE: + disk = new DiskImage(); + setDiskImageProperties((DiskImage) disk, isActive, isShareable, isSnapable); + break; + case LUN: + if (isSnapable) { + throw new IllegalArgumentException("A LUN disk cannot be snapable"); + } + disk = new LunDisk(); + break; + case CINDER: + disk = new CinderDisk(); + setDiskImageProperties((DiskImage) disk, isActive, isShareable, isSnapable); + break; + case MANAGED_BLOCK_STORAGE: + disk = new ManagedBlockStorageDisk(); + setDiskImageProperties((DiskImage) disk, isActive, isShareable, isSnapable); + break; } disk.setPlugged(isPlugged); return disk; diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/image/ScanStorageForUnregisteredDisksCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/image/ScanStorageForUnregisteredDisksCommandTest.java index f1f22d2241a..dd6444a5c9b 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/image/ScanStorageForUnregisteredDisksCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/image/ScanStorageForUnregisteredDisksCommandTest.java @@ -36,7 +36,7 @@ public class ScanStorageForUnregisteredDisksCommandTest extends BaseCommandTest @InjectMocks private ScanStorageForUnregisteredDisksCommand cmd = new ScanStorageForUnregisteredDisksCommand<> - (new StorageDomainParametersBase(Guid.newGuid(), Guid.newGuid()), null); + (new StorageDomainParametersBase(Guid.newGuid(), Guid.newGuid()), null); private Guid storageId = Guid.newGuid(); diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/lun/GetLunsByVgIdQueryTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/lun/GetLunsByVgIdQueryTest.java index 2ac6940771f..a3024ccaabe 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/lun/GetLunsByVgIdQueryTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/lun/GetLunsByVgIdQueryTest.java @@ -32,9 +32,9 @@ @MockitoSettings(strictness = Strictness.LENIENT) public class GetLunsByVgIdQueryTest extends AbstractQueryTest> { private static final String[] GUIDS = { - "11111111-1111-1111-1111-111111111111", - "22222222-2222-2222-2222-222222222222", - "33333333-3333-3333-3333-333333333333" + "11111111-1111-1111-1111-111111111111", + "22222222-2222-2222-2222-222222222222", + "33333333-3333-3333-3333-333333333333" }; private static final String VG_ID = Guid.newGuid().toString(); diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/ActivateStorageDomainCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/ActivateStorageDomainCommandTest.java index a85efa2d719..11fdc619979 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/ActivateStorageDomainCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/ActivateStorageDomainCommandTest.java @@ -113,8 +113,7 @@ private void testActionAllowed() { } private void testActionDisallowed() { - ValidateTestUtils.runAndAssertValidateFailure - (cmd, EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2); + ValidateTestUtils.runAndAssertValidateFailure(cmd, EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2); } public void internalActionAllowed(StorageDomainStatus status) { @@ -162,7 +161,7 @@ private void createUpStoragePool() { private void createUpVds() { when(vdsDao.getAllForStoragePoolAndStatus(any(), eq(VDSStatus.Up))).thenReturn - (Collections.singletonList(new VDS())); + (Collections.singletonList(new VDS())); } private void createCommand() { diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/AddStorageDomainCommonTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/AddStorageDomainCommonTest.java index 2c403a86cc5..89f03428ed7 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/AddStorageDomainCommonTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/AddStorageDomainCommonTest.java @@ -135,23 +135,22 @@ public void validateSucceedsInitFormatExportDomain() { @Test public void validateFailsNameExists() { when(sdsDao.getByName(sd.getName())).thenReturn(new StorageDomainStatic()); - ValidateTestUtils.runAndAssertValidateFailure - (cmd, EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NAME_ALREADY_EXIST); + ValidateTestUtils.runAndAssertValidateFailure(cmd, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NAME_ALREADY_EXIST); } @Test public void validateFailsLongName() { sd.setStorageName(RandomUtils.instance().nextString(11)); - ValidateTestUtils.runAndAssertValidateFailure - (cmd, EngineMessage.ACTION_TYPE_FAILED_NAME_LENGTH_IS_TOO_LONG); + ValidateTestUtils.runAndAssertValidateFailure(cmd, EngineMessage.ACTION_TYPE_FAILED_NAME_LENGTH_IS_TOO_LONG); } @Test public void validateFailsBlockIso() { sd.setStorageDomainType(StorageDomainType.ISO); sd.setStorageType(StorageType.FCP); - ValidateTestUtils.runAndAssertValidateFailure - (cmd, EngineMessage.ACTION_TYPE_FAILED_DOMAIN_TYPE_CAN_BE_CREATED_ONLY_ON_SPECIFIC_STORAGE_DOMAINS); + ValidateTestUtils.runAndAssertValidateFailure(cmd, + EngineMessage.ACTION_TYPE_FAILED_DOMAIN_TYPE_CAN_BE_CREATED_ONLY_ON_SPECIFIC_STORAGE_DOMAINS); } @Test @@ -167,50 +166,50 @@ public void validateSucceedsExportOnLocal() { public void validateFailsExportOnBlock() { sd.setStorageDomainType(StorageDomainType.ImportExport); sd.setStorageType(StorageType.ISCSI); - ValidateTestUtils.runAndAssertValidateFailure - (cmd, EngineMessage.ACTION_TYPE_FAILED_DOMAIN_TYPE_CAN_BE_CREATED_ONLY_ON_SPECIFIC_STORAGE_DOMAINS); + ValidateTestUtils.runAndAssertValidateFailure(cmd, + EngineMessage.ACTION_TYPE_FAILED_DOMAIN_TYPE_CAN_BE_CREATED_ONLY_ON_SPECIFIC_STORAGE_DOMAINS); } @Test public void validateFailsMaster() { sd.setStorageDomainType(StorageDomainType.Master); - ValidateTestUtils.runAndAssertValidateFailure - (cmd, EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); + ValidateTestUtils.runAndAssertValidateFailure(cmd, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); } @Test public void validateFailsUnsupportedBlockOnlyFormat() { sd.setStorageFormat(StorageFormatType.V2); - ValidateTestUtils.runAndAssertValidateFailure - (cmd, EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_FORMAT_ILLEGAL_HOST); + ValidateTestUtils.runAndAssertValidateFailure(cmd, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_FORMAT_ILLEGAL_HOST); } @Test public void validateFailsUnsupportedIsoFormat() { sd.setStorageDomainType(StorageDomainType.ISO); - ValidateTestUtils.runAndAssertValidateFailure - (cmd, EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_FORMAT_ILLEGAL_HOST); + ValidateTestUtils.runAndAssertValidateFailure(cmd, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_FORMAT_ILLEGAL_HOST); } @Test public void validateFailsUnsupportedExportFormat() { sd.setStorageDomainType(StorageDomainType.ImportExport); - ValidateTestUtils.runAndAssertValidateFailure - (cmd, EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_FORMAT_ILLEGAL_HOST); + ValidateTestUtils.runAndAssertValidateFailure(cmd, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_FORMAT_ILLEGAL_HOST); } @Test public void validateFailsNoConnection() { when(sscDao.get(connId.toString())).thenReturn(null); - ValidateTestUtils.runAndAssertValidateFailure - (cmd, EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_NOT_EXIST); + ValidateTestUtils.runAndAssertValidateFailure(cmd, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_NOT_EXIST); } @Test public void validateFailsConnectionAlreadyUsed() { when(sdDao.getAllByConnectionId(connId)).thenReturn(Collections.singletonList(new StorageDomain())); - ValidateTestUtils.runAndAssertValidateFailure - (cmd, EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_BELONGS_TO_SEVERAL_STORAGE_DOMAINS); + ValidateTestUtils.runAndAssertValidateFailure(cmd, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_BELONGS_TO_SEVERAL_STORAGE_DOMAINS); } @Test @@ -218,7 +217,7 @@ public void validateFailsUnsupportedIsoBackupDomain() { sd.setStorageDomainType(StorageDomainType.ISO); sd.setBackup(true); ValidateTestUtils.runAndAssertValidateFailure(cmd, - EngineMessage.ACTION_TYPE_FAILED_DOMAIN_TYPE_DOES_NOT_SUPPORT_BACKUP); + EngineMessage.ACTION_TYPE_FAILED_DOMAIN_TYPE_DOES_NOT_SUPPORT_BACKUP); } @Test @@ -226,6 +225,6 @@ public void validateFailsUnsupportedImportExportBackupDomain() { sd.setStorageDomainType(StorageDomainType.ImportExport); sd.setBackup(true); ValidateTestUtils.runAndAssertValidateFailure(cmd, - EngineMessage.ACTION_TYPE_FAILED_DOMAIN_TYPE_DOES_NOT_SUPPORT_BACKUP); + EngineMessage.ACTION_TYPE_FAILED_DOMAIN_TYPE_DOES_NOT_SUPPORT_BACKUP); } } diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/RemoveStorageDomainCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/RemoveStorageDomainCommandTest.java index 2b4002d0c21..268e86ab426 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/RemoveStorageDomainCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/RemoveStorageDomainCommandTest.java @@ -142,7 +142,7 @@ public void testSetActionMessageParameters() { public void testRemove() { for (boolean shouldFormat : new boolean[] { true, false }) { for (StorageDomainType sdType : new StorageDomainType[] { StorageDomainType.Data, StorageDomainType.ISO, - StorageDomainType.ImportExport }) { + StorageDomainType.ImportExport }) { for (StorageType sType : StorageType.values()) { if (sType.isConcreteStorageType()) { doTestRemove(sdType, sType, shouldFormat, false); @@ -154,7 +154,7 @@ public void testRemove() { } public void doTestRemove - (StorageDomainType type, StorageType storageType, boolean shouldFormat, boolean shouldFormatFail) { + (StorageDomainType type, StorageType storageType, boolean shouldFormat, boolean shouldFormatFail) { command.getParameters().setDoFormat(shouldFormat); storageDomain.setStorageDomainType(type); storageDomain.setStorageType(storageType); diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/StorageDomainCommandBaseTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/StorageDomainCommandBaseTest.java index 4234e484316..3ac1751ac8c 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/StorageDomainCommandBaseTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/StorageDomainCommandBaseTest.java @@ -33,8 +33,8 @@ public class StorageDomainCommandBaseTest extends BaseCommandTest { private static final Guid[] GUIDS = new Guid[] { - new Guid("11111111-1111-1111-1111-111111111111"), - new Guid("22222222-2222-2222-2222-222222222222") + new Guid("11111111-1111-1111-1111-111111111111"), + new Guid("22222222-2222-2222-2222-222222222222") }; private final Guid HE_SD_ID = new Guid("33333333-3333-3333-3333-333333333333"); private final Guid SHARED_SD_ID = new Guid("44444444-4444-4444-4444-444444444444"); diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/CleanFinishedTasksCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/CleanFinishedTasksCommandTest.java index e870ca14b78..90041d2ebfe 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/CleanFinishedTasksCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/CleanFinishedTasksCommandTest.java @@ -75,33 +75,29 @@ public void testValidateSuccess() { @Test public void testValidateFailureNullStoragePoolID() { when(command.getStoragePoolId()).thenReturn(null); - ValidateTestUtils.runAndAssertValidateFailure - ("Validate did not fail on a null storage pool", command, - EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); + ValidateTestUtils.runAndAssertValidateFailure("Validate did not fail on a null storage pool", command, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); } @Test public void testValidateFailureEmptyStoragePoolID() { when(command.getStoragePoolId()).thenReturn(Guid.Empty); - ValidateTestUtils.runAndAssertValidateFailure - ("Validate did not fail on an empty storage pool ID", command, - EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); + ValidateTestUtils.runAndAssertValidateFailure("Validate did not fail on an empty storage pool ID", command, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); } @Test public void testValidateFailureRandomStoragePoolID() { when(command.getStoragePoolId()).thenReturn(Guid.newGuid()); - ValidateTestUtils.runAndAssertValidateFailure - ("Validate did not fail on randomly generated storage pool ID", command, - EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); + ValidateTestUtils.runAndAssertValidateFailure("Validate did not fail on randomly generated storage pool ID", command, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); } @Test public void testValidateFailureStoragePoolNotInUpStatus() { storagePool.setStatus(StoragePoolStatus.Maintenance); - ValidateTestUtils.runAndAssertValidateFailure - ("Validate did not fail on storage pool that is not in the UP status", command, - EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_STATUS_ILLEGAL); + ValidateTestUtils.runAndAssertValidateFailure("Validate did not fail on storage pool that is not in the UP status", command, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_STATUS_ILLEGAL); } @Test diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/ForceSelectSPMCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/ForceSelectSPMCommandTest.java index 9c97b7a6042..d2cff40eaca 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/ForceSelectSPMCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/ForceSelectSPMCommandTest.java @@ -67,55 +67,50 @@ public void testCDAVDSDoesNotSupportVirtServices() { vds.setId(Guid.newGuid()); vds.setClusterSupportsVirtService(false); ValidateTestUtils.runAndAssertValidateFailure("validate did not fail on host without virt services", - command, EngineMessage.CANNOT_FORCE_SELECT_SPM_HOST_DOES_NOT_SUPPORT_VIRT_SERVICES); + command, EngineMessage.CANNOT_FORCE_SELECT_SPM_HOST_DOES_NOT_SUPPORT_VIRT_SERVICES); } @Test public void testCDAVdsNotUp() { vds.setStatus(VDSStatus.Down); - ValidateTestUtils.runAndAssertValidateFailure - ("validate did not fail for a VDS with a status different from UP", - command, EngineMessage.CANNOT_FORCE_SELECT_SPM_VDS_NOT_UP); + ValidateTestUtils.runAndAssertValidateFailure("validate did not fail for a VDS with a status different from UP", + command, EngineMessage.CANNOT_FORCE_SELECT_SPM_VDS_NOT_UP); } @Test public void testCDAStoragePoolValid() { vds.setId(Guid.newGuid()); ValidateTestUtils.runAndAssertValidateFailure("validate did not fail on mismatch Storage Pool", - command, EngineMessage.CANNOT_FORCE_SELECT_SPM_VDS_NOT_IN_POOL); + command, EngineMessage.CANNOT_FORCE_SELECT_SPM_VDS_NOT_IN_POOL); } @Test public void testCDAVdsIsSPM() { vds.setSpmStatus(VdsSpmStatus.SPM); - ValidateTestUtils.runAndAssertValidateFailure - ("validate did not fail on a VDS that is already set as SPM", - command, EngineMessage.CANNOT_FORCE_SELECT_SPM_VDS_ALREADY_SPM); + ValidateTestUtils.runAndAssertValidateFailure("validate did not fail on a VDS that is already set as SPM", + command, EngineMessage.CANNOT_FORCE_SELECT_SPM_VDS_ALREADY_SPM); } @Test public void testCDAVdsSPMPrioritySetToNever() { vds.setVdsSpmPriority(BusinessEntitiesDefinitions.HOST_MIN_SPM_PRIORITY); - ValidateTestUtils.runAndAssertValidateFailure - ("validate did not fail on a VDS that is set to never be elected as SPM", - command, EngineMessage.CANNOT_FORCE_SELECT_SPM_VDS_MARKED_AS_NEVER_SPM); + ValidateTestUtils.runAndAssertValidateFailure("validate did not fail on a VDS that is set to never be elected as SPM", + command, EngineMessage.CANNOT_FORCE_SELECT_SPM_VDS_MARKED_AS_NEVER_SPM); } @Test public void testCDAStoragePoolNotUp() { storagePool.setStatus(StoragePoolStatus.Uninitialized); - ValidateTestUtils.runAndAssertValidateFailure - ("validate did not fail on a Storage Pool which is not up", command, - EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_STATUS_ILLEGAL); + ValidateTestUtils.runAndAssertValidateFailure("validate did not fail on a Storage Pool which is not up", command, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_STATUS_ILLEGAL); } @Test public void testCDAStoragePoolHasTasks() { List tasks = Collections.singletonList(Guid.newGuid()); doReturn(tasks).when(asyncTaskDaoMock).getAsyncTaskIdsByStoragePoolId(storagePoolId); - ValidateTestUtils.runAndAssertValidateFailure - ("validate did not fail on a Storage Pool with running tasks", command, - EngineMessage.CANNOT_FORCE_SELECT_SPM_STORAGE_POOL_HAS_RUNNING_TASKS); + ValidateTestUtils.runAndAssertValidateFailure("validate did not fail on a Storage Pool with running tasks", command, + EngineMessage.CANNOT_FORCE_SELECT_SPM_STORAGE_POOL_HAS_RUNNING_TASKS); } private void createVDSandStoragePool() { diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/SwitchMasterStorageDomainCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/SwitchMasterStorageDomainCommandTest.java index a2f2743f404..46392198227 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/SwitchMasterStorageDomainCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/SwitchMasterStorageDomainCommandTest.java @@ -68,57 +68,50 @@ public void setup() { @Test public void testNullStoragePool() { when(command.getStoragePool()).thenReturn(null); - ValidateTestUtils.runAndAssertValidateFailure - ("validate did not fail on a null storage pool", command, - EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); + ValidateTestUtils.runAndAssertValidateFailure("validate did not fail on a null storage pool", command, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); } @Test public void testEmptyDomainID() { when(command.getStorageDomainId()).thenReturn(Guid.Empty); - ValidateTestUtils.runAndAssertValidateFailure - ("validate did not fail on an empty storage domain ID", command, - EngineMessage.STORAGE_DOMAIN_DOES_NOT_EXIST); + ValidateTestUtils.runAndAssertValidateFailure("validate did not fail on an empty storage domain ID", command, + EngineMessage.STORAGE_DOMAIN_DOES_NOT_EXIST); } @Test public void testAlreadyMasterDomainID() { when(command.getStorageDomainId()).thenReturn(currentMasterStorageDomainId); - ValidateTestUtils.runAndAssertValidateFailure - ("validate did not fail on the current master storage domain ID", command, - EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_ALREADY_MASTER); + ValidateTestUtils.runAndAssertValidateFailure("validate did not fail on the current master storage domain ID", command, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_ALREADY_MASTER); } @Test public void testDomainNotInPool() { doReturn(null).when(storageDomainDao).getForStoragePool(newMasterStorageDomainId, storagePoolId); - ValidateTestUtils.runAndAssertValidateFailure - ("validate did not fail on storage domain that not in the pool", command, - EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_IN_STORAGE_POOL); + ValidateTestUtils.runAndAssertValidateFailure("validate did not fail on storage domain that not in the pool", command, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_IN_STORAGE_POOL); } @Test public void testDomainNotActive() { newMasterStorageDomain.setStatus(StorageDomainStatus.Maintenance); - ValidateTestUtils.runAndAssertValidateFailure - ("validate did not fail on storage domain that is not active", command, - EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_MUST_BE_ACTIVE); + ValidateTestUtils.runAndAssertValidateFailure("validate did not fail on storage domain that is not active", command, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_MUST_BE_ACTIVE); } @Test public void testDomainMarkedAsBackup() { newMasterStorageDomain.setBackup(true); - ValidateTestUtils.runAndAssertValidateFailure - ("validate did not fail on storage domain that marked as backup", command, - EngineMessage.ACTION_TYPE_FAILED_ACTION_IS_SUPPORTED_ONLY_FOR_DATA_DOMAINS); + ValidateTestUtils.runAndAssertValidateFailure("validate did not fail on storage domain that marked as backup", command, + EngineMessage.ACTION_TYPE_FAILED_ACTION_IS_SUPPORTED_ONLY_FOR_DATA_DOMAINS); } @Test public void testHasRunningTasks() { doReturn(true).when(command).hasRunningTasks(storagePoolId); - ValidateTestUtils.runAndAssertValidateFailure - ("validate did not fail on storage pool that has running tasks", command, - EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_HAS_RUNNING_TASKS); + ValidateTestUtils.runAndAssertValidateFailure("validate did not fail on storage pool that has running tasks", command, + EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_HAS_RUNNING_TASKS); } @Test @@ -134,7 +127,7 @@ public void testExecuteCommand() { listStorageDomains.forEach(sd -> { doNothing().when(storageDomainStaticDao).update(sd.getStorageStaticData()); doNothing().when(storagePoolIsoMapDao) - .updateStatus(sd.getStoragePoolIsoMapData().getId(), sd.getStoragePoolIsoMapData().getStatus()); + .updateStatus(sd.getStoragePoolIsoMapData().getId(), sd.getStoragePoolIsoMapData().getStatus()); }); // Skip the VDS call diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/UpdateStoragePoolCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/UpdateStoragePoolCommandTest.java index fee000ae7f0..bd9c87d3c9e 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/UpdateStoragePoolCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/UpdateStoragePoolCommandTest.java @@ -227,7 +227,7 @@ public void testValidateAllClustersLevel() { public void poolHasDefaultCluster() { addDefaultClusterToPool(); doReturn(new ValidationResult - (EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_WITH_DEFAULT_CLUSTER_CANNOT_BE_LOCALFS)) + (EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_WITH_DEFAULT_CLUSTER_CANNOT_BE_LOCALFS)) .when(poolValidator).isNotLocalfsWithDefaultCluster(); ValidateTestUtils.runAndAssertValidateFailure(cmd, EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_WITH_DEFAULT_CLUSTER_CANNOT_BE_LOCALFS); } diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/utils/BlockStorageDiscardFunctionalityHelperTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/utils/BlockStorageDiscardFunctionalityHelperTest.java index 72743249f5b..471dd92e68e 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/utils/BlockStorageDiscardFunctionalityHelperTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/utils/BlockStorageDiscardFunctionalityHelperTest.java @@ -192,11 +192,11 @@ public void testGetLunsThatBreakDiscardAfterDeleteSupportStorageDomainDiscardAft public void testGetLunsThatBreakDiscardAfterDeleteSupportDiscardAfterDeleteBreaks() { storageDomain.setDiscardAfterDelete(true); LUNs lunThatBreaksDiscardSupport = createLunWithDiscardSupport(0L); - assertGetLunsThatBreakDiscardAfterDeleteSupportContainsExpectedLuns( - Arrays.asList( - createLunWithDiscardSupport(1024L), - lunThatBreaksDiscardSupport), - Collections.singletonList(lunThatBreaksDiscardSupport)); + assertGetLunsThatBreakDiscardAfterDeleteSupportContainsExpectedLuns( + Arrays.asList( + createLunWithDiscardSupport(1024L), + lunThatBreaksDiscardSupport), + Collections.singletonList(lunThatBreaksDiscardSupport)); } @Test diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/utils/NumaTestUtils.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/utils/NumaTestUtils.java index fae7e1d7a16..a60f58385bd 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/utils/NumaTestUtils.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/utils/NumaTestUtils.java @@ -27,13 +27,13 @@ public static VdsNumaNode createVdsNumaNode(int index) { } public static VmNumaNode createVmNumaNodeWithId(int index, Guid guid) { - final VmNumaNode numaNode = createVmNumaNode(index); + final VmNumaNode numaNode = createVmNumaNode(index); numaNode.setId(guid); return numaNode; } public static VmNumaNode createVmNumaNodeWithId(int index, List vdsNumaNodes, Guid guid) { - final VmNumaNode numaNode = createVmNumaNode(index, vdsNumaNodes); + final VmNumaNode numaNode = createVmNumaNode(index, vdsNumaNodes); numaNode.setId(guid); return numaNode; } diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/storage/DiskValidatorTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/storage/DiskValidatorTest.java index 26f540379c4..e520395eb54 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/storage/DiskValidatorTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/storage/DiskValidatorTest.java @@ -178,8 +178,8 @@ public void testDiskAttachedToAnyNonDownVM() { @Test public void testDiskAttachedToAnyNonDownVMWithProblems() { - testDiskAttachedToAnyNonDownVMWithProblems - (false, "anotherPausedPlugged,runningSnapshotPlugged,vmPausedPlugged"); + testDiskAttachedToAnyNonDownVMWithProblems(false, + "anotherPausedPlugged,runningSnapshotPlugged,vmPausedPlugged"); } @Test diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/storage/StorageDomainValidatorFreeSpaceTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/storage/StorageDomainValidatorFreeSpaceTest.java index 7faf9c4f53a..08f19fb7959 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/storage/StorageDomainValidatorFreeSpaceTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/storage/StorageDomainValidatorFreeSpaceTest.java @@ -75,7 +75,7 @@ public static Stream createParams() { @ParameterizedTest @MethodSource("createParams") public void testValidateDiskWithSnapshots - (DiskImage disk, StorageDomain sd, boolean isValidForCloned, boolean isValidForNew, boolean isValidForSnapshots) { + (DiskImage disk, StorageDomain sd, boolean isValidForCloned, boolean isValidForNew, boolean isValidForSnapshots) { disk.getSnapshots().add(DiskImage.copyOf(disk)); @@ -88,7 +88,7 @@ public static Stream createParams() { @ParameterizedTest @MethodSource("createParams") public void testValidateClonedDisk - (DiskImage disk, StorageDomain sd, boolean isValidForCloned, boolean isValidForNew, boolean isValidForSnapshots) { + (DiskImage disk, StorageDomain sd, boolean isValidForCloned, boolean isValidForNew, boolean isValidForSnapshots) { disk.getSnapshots().add(DiskImage.copyOf(disk)); @@ -101,7 +101,7 @@ public static Stream createParams() { @ParameterizedTest @MethodSource("createParams") public void testValidateNewDisk - (DiskImage disk, StorageDomain sd, boolean isValidForCloned, boolean isValidForNew, boolean isValidForSnapshots) { + (DiskImage disk, StorageDomain sd, boolean isValidForCloned, boolean isValidForNew, boolean isValidForSnapshots) { disk.getSnapshots().add(DiskImage.copyOf(disk)); diff --git a/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingTheme.java b/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingTheme.java index 83c174e1939..89d5b885aea 100644 --- a/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingTheme.java +++ b/backend/manager/modules/branding/src/main/java/org/ovirt/engine/core/branding/BrandingTheme.java @@ -272,11 +272,11 @@ public List getThemeStylesheets(String applicationName) { List expandedCssList = new ArrayList<>(); for (String cssFileOrRef : inputCssList) { - if (StringUtils.isBlank(cssFileOrRef)) { - continue; - } + if (StringUtils.isBlank(cssFileOrRef)) { + continue; + } - Matcher refMatcher = REF_PATTERN.matcher(cssFileOrRef); + Matcher refMatcher = REF_PATTERN.matcher(cssFileOrRef); if (refMatcher.matches()) { List refExpanded = getThemeStylesheets(refMatcher.group(1)); expandedCssList.addAll(refExpanded); diff --git a/backend/manager/modules/branding/src/test/java/org/ovirt/engine/core/branding/BrandingThemeTest.java b/backend/manager/modules/branding/src/test/java/org/ovirt/engine/core/branding/BrandingThemeTest.java index bb8ad72fa72..7cbf86d5346 100644 --- a/backend/manager/modules/branding/src/test/java/org/ovirt/engine/core/branding/BrandingThemeTest.java +++ b/backend/manager/modules/branding/src/test/java/org/ovirt/engine/core/branding/BrandingThemeTest.java @@ -64,7 +64,7 @@ public void testGetMessagesBundleLocale() { @Test public void testGetCascadingResource() { - assertTrue( //$NON-NLS-1$ + assertTrue(//$NON-NLS-1$ testTheme.getCascadingResource("favicon").getFile().getAbsolutePath().contains("/01-test.brand/images/favicon.ico"), "getCascadingResource not reading file from resources.properties"); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("someMadeUp/contentType", @@ -74,7 +74,7 @@ public void testGetCascadingResource() { @Test public void testGetCascadingResourceMissingKey() { - assertNull( //$NON-NLS-1$ + assertNull(//$NON-NLS-1$ testTheme.getCascadingResource("this_is_not_a_valid_key"), "getCascadingResource not using resources.properties properly"); //$NON-NLS-1$ } @@ -90,7 +90,7 @@ public void testGetCascadingResourceMissingResourcesFile() throws URISyntaxExcep testThemeRootPath, 2); //$NON-NLS-1$ assertTrue(theme4.load(), "Theme 4 should load"); //$NON-NLS-1$ - assertNull( //$NON-NLS-1$ + assertNull(//$NON-NLS-1$ theme4.getCascadingResource("this_file_is_missing_anyway"), "getCascadingResource not handling missing resources.properties gracefully"); //$NON-NLS-1$ } @@ -106,7 +106,7 @@ public void testGetCascadingResourceMissingResourcesProperty() throws URISyntaxE testThemeRootPath, 2); //$NON-NLS-1$ assertTrue(theme5.load(), "Theme 5 should load"); //$NON-NLS-1$ - assertNull( //$NON-NLS-1$ + assertNull(//$NON-NLS-1$ theme5.getCascadingResource("this_file_is_missing_anyway"), "getCascadingResource not handling missing resources key gracefully"); //$NON-NLS-1$ } @@ -133,7 +133,7 @@ public void testTemplateReplaceProperty() throws URISyntaxException { BrandingTheme theme1 = new BrandingTheme(testThemePath.getAbsolutePath(), testThemeRootPath, 2); //$NON-NLS-1$ assertTrue(theme1.load(), "Theme 1 should load"); //$NON-NLS-1$ - assertFalse( //$NON-NLS-1$ + assertFalse(//$NON-NLS-1$ theme1.shouldReplaceWelcomePageSectionTemplate(), "should replace template should be false"); } diff --git a/backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extension/aaa/builtin/internal/InternalAuthn.java b/backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extension/aaa/builtin/internal/InternalAuthn.java index 6bcbdc7cfc2..b4f944366a6 100644 --- a/backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extension/aaa/builtin/internal/InternalAuthn.java +++ b/backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extension/aaa/builtin/internal/InternalAuthn.java @@ -51,7 +51,7 @@ private void doAuthenticate(ExtMap input, ExtMap output) throws IOException, Gen Authn.AuthRecord.PRINCIPAL, adminUser ) - ); + ); } else { output.put(Authn.InvokeKeys.RESULT, Authn.AuthResult.CREDENTIALS_INVALID); } diff --git a/backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extension/aaa/builtin/internal/InternalAuthz.java b/backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extension/aaa/builtin/internal/InternalAuthz.java index a413b5e851a..cfefa694067 100644 --- a/backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extension/aaa/builtin/internal/InternalAuthz.java +++ b/backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extension/aaa/builtin/internal/InternalAuthz.java @@ -51,7 +51,7 @@ public void invoke(ExtMap input, ExtMap output) { output.put( Base.InvokeKeys.RESULT, Base.InvokeResult.UNSUPPORTED - ); + ); } output.putIfAbsent(Authz.InvokeKeys.STATUS, Authz.Status.SUCCESS); output.putIfAbsent(Base.InvokeKeys.RESULT, Base.InvokeResult.SUCCESS); @@ -62,7 +62,7 @@ public void invoke(ExtMap input, ExtMap output) { ).mput( Base.InvokeKeys.MESSAGE, ex.getMessage() - ); + ); } } @@ -139,7 +139,7 @@ private void doLoad(ExtMap input) { ).mput( Authz.ContextKeys.AVAILABLE_NAMESPACES, Collections.singletonList(NAMESPACE) - ); + ); adminUser = new ExtMap().mput( Authz.PrincipalRecord.NAMESPACE, NAMESPACE diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/RemoveVdsParameters.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/RemoveVdsParameters.java index 97559c91647..a670588488f 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/RemoveVdsParameters.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/RemoveVdsParameters.java @@ -15,8 +15,8 @@ public RemoveVdsParameters(Guid vdsId) { } public RemoveVdsParameters(Guid vdsId, boolean forceAction) { - super(vdsId); - this.forceAction = forceAction; + super(vdsId); + this.forceAction = forceAction; } public boolean isForceAction() { diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/SyncGlusterStorageDevicesParameter.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/SyncGlusterStorageDevicesParameter.java index ba092009404..7d69d023d4b 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/SyncGlusterStorageDevicesParameter.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/SyncGlusterStorageDevicesParameter.java @@ -16,8 +16,8 @@ public SyncGlusterStorageDevicesParameter(Guid vdsId) { } public SyncGlusterStorageDevicesParameter(Guid vdsId, boolean forceAction) { - super(vdsId); - this.forceAction = forceAction; + super(vdsId); + this.forceAction = forceAction; } public boolean isForceAction() { diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/asynctasks/gluster/GlusterTaskType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/asynctasks/gluster/GlusterTaskType.java index 318be2d3177..2588d6df802 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/asynctasks/gluster/GlusterTaskType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/asynctasks/gluster/GlusterTaskType.java @@ -28,15 +28,15 @@ public StepEnum getStep() { return step; } - public static GlusterTaskType forValue(StepEnum step) { + public static GlusterTaskType forValue(StepEnum step) { return mappings.get(step); } - public static GlusterTaskType fromValue(String v) { - try { - return valueOf(v.toUpperCase()); - } catch (IllegalArgumentException e) { - return GlusterTaskType.UNKNOWN; - } - } + public static GlusterTaskType fromValue(String v) { + try { + return valueOf(v.toUpperCase()); + } catch (IllegalArgumentException e) { + return GlusterTaskType.UNKNOWN; + } + } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Cluster.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Cluster.java index 3d44d27ab4e..6c04cc2dcb9 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Cluster.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Cluster.java @@ -34,7 +34,7 @@ public class Cluster implements Queryable, BusinessEntity, HasStoragePool, @NotNull(message = "VALIDATION_CLUSTER_NAME_NOT_NULL", groups = { CreateEntity.class, UpdateEntity.class }) @Size(min = 1, max = BusinessEntitiesDefinitions.CLUSTER_NAME_SIZE, message = "VALIDATION_CLUSTER_NAME_MAX", groups = { - CreateEntity.class, UpdateEntity.class }) + CreateEntity.class, UpdateEntity.class }) @ValidI18NName(message = "VALIDATION_CLUSTER_NAME_INVALID", groups = { CreateEntity.class, UpdateEntity.class }) private String name; @@ -328,19 +328,19 @@ public void setUpgradeRunning(boolean upgradeRunning) { } public int getUpgradePercentComplete() { - return upgradePercentComplete; + return upgradePercentComplete; } public void setUpgradePercentComplete(int upgradePercentComplete) { - this.upgradePercentComplete = upgradePercentComplete; + this.upgradePercentComplete = upgradePercentComplete; } public String getUpgradeCorrelationId() { - return upgradeCorrelationId; + return upgradeCorrelationId; } public void setUpgradeCorrelationId(String upgradeCorrelationId) { - this.upgradeCorrelationId = upgradeCorrelationId; + this.upgradeCorrelationId = upgradeCorrelationId; } public boolean getSmtDisabled() { @@ -745,7 +745,7 @@ public void setVncEncryptionEnabled(boolean vncEncryptionEnabled) { } public String getHostNamesOutOfSync() { - return hostNamesOutOfSync; + return hostNamesOutOfSync; } public void setHostNamesOutOfSync(String hostNamesOutOfSync) { diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/ClusterHostsAndVMs.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/ClusterHostsAndVMs.java index 29414f9c010..788fa01b5a2 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/ClusterHostsAndVMs.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/ClusterHostsAndVMs.java @@ -35,11 +35,11 @@ public void setHosts(int hosts) { } public int getHostsWithUpdateAvailable() { - return hostsWithUpdateAvailable; + return hostsWithUpdateAvailable; } public void setHostsWithUpdateAvailable(int hostsWithUpdateAvailable) { - this.hostsWithUpdateAvailable = hostsWithUpdateAvailable; + this.hostsWithUpdateAvailable = hostsWithUpdateAvailable; } public int getVms() { diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Label.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Label.java index d283e9205c6..7ba67f0c0ce 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Label.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Label.java @@ -118,8 +118,8 @@ public void setImplicitAffinityGroup(boolean implicitAffinityGroup) { * Jackson, GWT or for de-serialization. */ private Label() { - this.hosts = new HashSet<>(); - this.vms = new HashSet<>(); + this.hosts = new HashSet<>(); + this.vms = new HashSet<>(); } /** diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Role.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Role.java index fcf50e8f8c7..c92f15a080b 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Role.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Role.java @@ -21,7 +21,7 @@ public class Role implements Queryable, BusinessEntity, Nameable { @NotNull(message = "VALIDATION_ROLES_NAME_NOT_NULL", groups = { CreateEntity.class, UpdateEntity.class }) @Size(min = 1, max = BusinessEntitiesDefinitions.ROLE_NAME_SIZE, message = "VALIDATION_ROLES_NAME_MAX", groups = { - CreateEntity.class, UpdateEntity.class }) + CreateEntity.class, UpdateEntity.class }) @ValidName(message = "VALIDATION_ROLES_NAME_INVALID", groups = { CreateEntity.class, UpdateEntity.class }) private String name; diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageDomainStatic.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageDomainStatic.java index 46596fc2470..0c3efed8c53 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageDomainStatic.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageDomainStatic.java @@ -29,7 +29,7 @@ public class StorageDomainStatic implements BusinessEntity, Nameable { private String name; @ValidDescription(message = "VALIDATION_STORAGE_DOMAIN_DESCRIPTION_INVALID", groups = { CreateEntity.class, - UpdateEntity.class }) + UpdateEntity.class }) @Size(min = 0, max = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE, message = "VALIDATION_STORAGE_DOMAIN_DESCRIPTION_MAX", groups = { CreateEntity.class, UpdateEntity.class }) diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java index 43da486f928..16925374ea2 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java @@ -1607,17 +1607,17 @@ public boolean shouldVdsBeFenced() { boolean result = false; switch (this.getStatus()) { - case Down: - case InstallFailed: - case Maintenance: - case NonOperational: - case NonResponsive: - case Kdumping: // it should happen only after restart when host is stuck in status Kdumping - result = true; - break; - - default: - break; + case Down: + case InstallFailed: + case Maintenance: + case NonOperational: + case NonResponsive: + case Kdumping: // it should happen only after restart when host is stuck in status Kdumping + result = true; + break; + + default: + break; } return result; diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VMStatus.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VMStatus.java index 095cfc6439f..602997b904b 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VMStatus.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VMStatus.java @@ -198,26 +198,26 @@ public boolean isGuestCpuRunning() { */ public boolean isPoweringUpOrMigrating() { switch (this) { - // VM is powering UP - case WaitForLaunch: - case PoweringUp: - - // If there is a reason why the VM was paused, - // others should wait for it. - case Paused: - - // The VM was restarted during startup, - case RebootInProgress: - - // User can trigger a migration when the VM is 'PoweringUp'. - // Other VMs should wait for migration to finish. - case MigratingTo: - case MigratingFrom: - case RestoringState: - return true; - - default: - return false; + // VM is powering UP + case WaitForLaunch: + case PoweringUp: + + // If there is a reason why the VM was paused, + // others should wait for it. + case Paused: + + // The VM was restarted during startup, + case RebootInProgress: + + // User can trigger a migration when the VM is 'PoweringUp'. + // Other VMs should wait for migration to finish. + case MigratingTo: + case MigratingFrom: + case RestoringState: + return true; + + default: + return false; } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java index 3af87d982c2..0653dc01f34 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java @@ -455,7 +455,7 @@ public void setPreviousStatus(VDSStatus value) { } public String getSoftwareVersion() { - return softwareVersion; + return softwareVersion; } public void setSoftwareVersion(String value) { @@ -896,7 +896,7 @@ public boolean isInFenceFlow() { return inFenceFlow; } - public void setInFenceFlow( boolean isInFenceFlow) { + public void setInFenceFlow(boolean isInFenceFlow) { this.inFenceFlow = isInFenceFlow; } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java index 959478cdac5..3a08d720800 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java @@ -46,7 +46,7 @@ public class VdsStatic implements BusinessEntity, Commented { @EditableVdsField( onStatuses = { VDSStatus.NonResponsive, VDSStatus.Maintenance, VDSStatus.Down, - VDSStatus.Unassigned, VDSStatus.InstallFailed, VDSStatus.PendingApproval, VDSStatus.InstallingOS }) + VDSStatus.Unassigned, VDSStatus.InstallFailed, VDSStatus.PendingApproval, VDSStatus.InstallingOS }) @HostnameOrIp(message = "VALIDATION_VDS_HOSTNAME_HOSTNAME_OR_IP", groups = { CreateEntity.class, UpdateEntity.class }) @NotNull(groups = { CreateEntity.class, UpdateEntity.class }) @@ -61,7 +61,7 @@ public class VdsStatic implements BusinessEntity, Commented { @EditableVdsField( onStatuses = { VDSStatus.NonResponsive, VDSStatus.Maintenance, VDSStatus.Down, - VDSStatus.Unassigned, VDSStatus.InstallFailed, VDSStatus.PendingApproval, VDSStatus.InstallingOS }) + VDSStatus.Unassigned, VDSStatus.InstallFailed, VDSStatus.PendingApproval, VDSStatus.InstallingOS }) @Range(min = BusinessEntitiesDefinitions.NETWORK_MIN_LEGAL_PORT, max = BusinessEntitiesDefinitions.NETWORK_MAX_LEGAL_PORT, message = "VALIDATION.VDS.SSH_PORT.RANGE") @@ -70,7 +70,7 @@ public class VdsStatic implements BusinessEntity, Commented { @EditableVdsField @Size(min = 1, max = BusinessEntitiesDefinitions.HOST_NAME_SIZE) @ValidNameWithDot(message = "VALIDATION_VDS_SSH_USERNAME_INVALID", groups = { CreateEntity.class, - UpdateEntity.class }) + UpdateEntity.class }) private String sshUsername; @EditableVdsField(onStatuses = { VDSStatus.Maintenance, VDSStatus.PendingApproval }) diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java index 0e966046fca..76739d9fb5f 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java @@ -269,7 +269,7 @@ public class VmBase implements Queryable, BusinessEntity, Nameable, Commen @Size(max = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE) @Pattern(regexp = ValidationUtils.NO_TRIMMING_WHITE_SPACES_PATTERN, message = "ACTION_TYPE_FAILED_LINUX_BOOT_PARAMS_MAY_NOT_CONTAIN_TRIMMING_WHITESPACES", groups = { CreateEntity.class, - UpdateEntity.class }) + UpdateEntity.class }) private String kernelUrl; @CopyOnNewVersion @@ -278,7 +278,7 @@ public class VmBase implements Queryable, BusinessEntity, Nameable, Commen @Size(max = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE) @Pattern(regexp = ValidationUtils.NO_TRIMMING_WHITE_SPACES_PATTERN, message = "ACTION_TYPE_FAILED_LINUX_BOOT_PARAMS_MAY_NOT_CONTAIN_TRIMMING_WHITESPACES", groups = { CreateEntity.class, - UpdateEntity.class }) + UpdateEntity.class }) private String kernelParams; @CopyOnNewVersion @@ -287,7 +287,7 @@ public class VmBase implements Queryable, BusinessEntity, Nameable, Commen @Size(max = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE) @Pattern(regexp = ValidationUtils.NO_TRIMMING_WHITE_SPACES_PATTERN, message = "ACTION_TYPE_FAILED_LINUX_BOOT_PARAMS_MAY_NOT_CONTAIN_TRIMMING_WHITESPACES", groups = { CreateEntity.class, - UpdateEntity.class }) + UpdateEntity.class }) private String initrdUrl; @CopyOnNewVersion diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmPool.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmPool.java index 1c18e8540ab..3fda7411e2f 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmPool.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmPool.java @@ -24,7 +24,7 @@ public class VmPool implements Queryable, BusinessEntity, Nameable, Commen @NotNull(message = "VALIDATION_VM_POOLS_NAME_NOT_NULL", groups = { CreateEntity.class, UpdateEntity.class }) @Size(min = 1, max = BusinessEntitiesDefinitions.VM_POOL_NAME_SIZE) @Pattern(regexp = ValidationUtils.POOL_NAME_PATTERN, message = "ACTION_TYPE_FAILED_INVALID_POOL_NAME", groups = { CreateEntity.class, - UpdateEntity.class }) + UpdateEntity.class }) private String name; @Size(max = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE) diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java index 6ee684e752b..1e6c0f9f827 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java @@ -343,7 +343,7 @@ public int hashCode() { message = "VALIDATION_VM_TEMPLATE_NAME_MAX", groups = { Default.class, ImportEntity.class, ImportClonedEntity.class }) @ValidI18NName(message = "ACTION_TYPE_FAILED_NAME_MAY_NOT_CONTAIN_SPECIAL_CHARS", groups = { CreateEntity.class, - UpdateEntity.class, ImportEntity.class, ImportClonedEntity.class }) + UpdateEntity.class, ImportEntity.class, ImportClonedEntity.class }) public String getName() { return super.getName(); } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmWithStatusForExclusiveLock.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmWithStatusForExclusiveLock.java index 97db1a5f017..90cf43fcb42 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmWithStatusForExclusiveLock.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmWithStatusForExclusiveLock.java @@ -9,8 +9,8 @@ */ public class VmWithStatusForExclusiveLock extends VM { public VmWithStatusForExclusiveLock() { - super(); - } + super(); + } public VmWithStatusForExclusiveLock(VM vm) { super(vm.getStaticData(), vm.getDynamicData(), vm.getStatisticsData()); diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterBrickEntity.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterBrickEntity.java index cfa51f039a0..445b5ad3c02 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterBrickEntity.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterBrickEntity.java @@ -253,7 +253,7 @@ public BrickProperties getBrickProperties() { @Override public GlusterAsyncTask getAsyncTask() { - return asyncTask; + return asyncTask; } @Override @@ -315,7 +315,7 @@ private Double calculateSelfHealEta() { double healRate = ((double) entries - entriesRemaining) / (Config. getValue(ConfigValues.GlusterRefreshRateHealInfo)); if (healRate > 0) { - healRates.add(healRate); + healRates.add(healRate); } } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterHookConflictFlags.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterHookConflictFlags.java index 30efa4455fb..de4fda9ac55 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterHookConflictFlags.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterHookConflictFlags.java @@ -15,4 +15,4 @@ public Integer getValue() { return flag; } - } +} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterLocalVolumeInfo.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterLocalVolumeInfo.java index a881f8cfb8b..57f34e1b5c7 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterLocalVolumeInfo.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterLocalVolumeInfo.java @@ -122,7 +122,7 @@ private Predicate lvmMatchMapperName(String device) { } private Integer getVdoSavings(GlusterVDOVolume v) { - if ( v.getLogicalBlocks() == 0 || v.getPhysicalBlocks() == 0) { + if (v.getLogicalBlocks() == 0 || v.getPhysicalBlocks() == 0) { return 0; } return (int) (((v.getLogicalBlocks() - v.getPhysicalBlocks()) / v.getLogicalBlocks().doubleValue()) * 100); diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterServerHook.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterServerHook.java index fe58b129509..c8859680bbf 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterServerHook.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterServerHook.java @@ -54,11 +54,11 @@ public void setStatus(GlusterHookStatus status) { } public void setStatus(String status) { - if (status != null) { - this.status = GlusterHookStatus.valueOf(status); - } else { - this.status = null; - } + if (status != null) { + this.status = GlusterHookStatus.valueOf(status); + } else { + this.status = null; + } } public GlusterHookContentType getContentType() { diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeEntity.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeEntity.java index 556f6331a56..77e0c184faa 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeEntity.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeEntity.java @@ -518,7 +518,7 @@ public Object getQueryableId() { @Override public GlusterAsyncTask getAsyncTask() { - return asyncTask; + return asyncTask; } @Override diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/MallInfo.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/MallInfo.java index c3029e641ba..2b61506ff20 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/MallInfo.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/MallInfo.java @@ -110,4 +110,4 @@ public int getKeepcost() { public void setKeepcost(int keepcost) { this.keepcost = keepcost; } - } +} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/StorageSyncSchedule.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/StorageSyncSchedule.java index 24e193baf1b..a9c2441dd7d 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/StorageSyncSchedule.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/StorageSyncSchedule.java @@ -55,9 +55,9 @@ public StorageSyncSchedule(String cronExpression) { this.setFrequency(StorageSyncSchedule.Frequency.DAILY); } else { this.setFrequency(StorageSyncSchedule.Frequency.WEEKLY); - List dayList = new ArrayList<>(); - for (String day: cronParts[5].split(",")) { - dayList.add(StorageSyncSchedule.Day.valueOf(day)); + List dayList = new ArrayList<>(); + for (String day: cronParts[5].split(",")) { + dayList.add(StorageSyncSchedule.Day.valueOf(day)); } this.setDays(dayList.toArray(new Day[dayList.size()])); } @@ -112,18 +112,18 @@ private String toDaysCron() { public String toCronExpression() { String cronExpression = ""; switch (frequency) { - case DAILY: - if (mins != null && hour != null) { - cronExpression = StringFormat.format("0 %s %s * * ? *", mins, hour); - } - break; - case WEEKLY: - if (mins != null && hour != null && days != null) { - cronExpression = StringFormat.format("0 %s %s ? * %s *", mins, hour, toDaysCron()); - } - break; - case NONE: - cronExpression = ""; + case DAILY: + if (mins != null && hour != null) { + cronExpression = StringFormat.format("0 %s %s * * ? *", mins, hour); + } + break; + case WEEKLY: + if (mins != null && hour != null && days != null) { + cronExpression = StringFormat.format("0 %s %s ? * %s *", mins, hour, toDaysCron()); + } + break; + case NONE: + cronExpression = ""; } return cronExpression; } @@ -134,14 +134,14 @@ public String toString() { sb.append(frequency.name()); switch (frequency) { - case WEEKLY: - sb.append(" on ").append(toDaysCron()); - sb.append(" at ").append(StringFormat.format("%02d", hour)).append(":").append(StringFormat.format("%02d", mins)); - break; - case DAILY: - sb.append(" at ").append(StringFormat.format("%02d", hour)).append(":").append(StringFormat.format("%02d", mins)); - break; - case NONE: + case WEEKLY: + sb.append(" on ").append(toDaysCron()); + sb.append(" at ").append(StringFormat.format("%02d", hour)).append(":").append(StringFormat.format("%02d", mins)); + break; + case DAILY: + sb.append(" at ").append(StringFormat.format("%02d", hour)).append(":").append(StringFormat.format("%02d", mins)); + break; + case NONE: } return sb.toString(); } @@ -164,7 +164,7 @@ public boolean equals(Object obj) { } StorageSyncSchedule other = (StorageSyncSchedule) obj; return Objects.equals(frequency, other.frequency) - && Arrays.equals(days, other.days ) + && Arrays.equals(days, other.days) && Objects.equals(hour, other.hour) && Objects.equals(mins, other.mins); } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/ExternalVnicProfileMapping.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/ExternalVnicProfileMapping.java index 9191faa52b5..6aea4eb806a 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/ExternalVnicProfileMapping.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/ExternalVnicProfileMapping.java @@ -127,7 +127,7 @@ public boolean isSameSourceProfile(VmNetworkInterface vnic) { * in the UI when adding and removing from a set. * @return true if the source profile of o is the same as that of this */ - @Override + @Override public boolean equals(Object o) { if (this == o) { return true; diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNic.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNic.java index 464ce7bc758..32856427aef 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNic.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VmNic.java @@ -71,8 +71,8 @@ public void setLinked(boolean linked) { } @NotNull(message = VALIDATION_MESSAGE_NAME_NOT_NULL, - groups = { CreateEntity.class, - UpdateEntity.class }) + groups = { CreateEntity.class, + UpdateEntity.class }) @ValidNameWithDot(groups = { CreateEntity.class, UpdateEntity.class }) @Override public String getName() { @@ -82,21 +82,21 @@ public String getName() { @NotNull(message = VALIDATION_MESSAGE_MAC_ADDRESS_NOT_NULL, groups = UpdateVmNic.class) @Pattern.List({ - @Pattern(regexp = "(^$)|(" + MacAddressValidationPatterns.VALID_MAC_ADDRESS_FORMAT + ")", - message = VALIDATION_MESSAGE_MAC_ADDRESS_INVALID, - groups = CreateEntity.class), - @Pattern(regexp = "(^$)|(" + MacAddressValidationPatterns.NON_MULTICAST_MAC_ADDRESS_FORMAT + ")", - message = VALIDATION_VM_NETWORK_MAC_ADDRESS_MULTICAST, - groups = CreateEntity.class), - @Pattern(regexp = MacAddressValidationPatterns.VALID_MAC_ADDRESS_FORMAT, - message = VALIDATION_MESSAGE_MAC_ADDRESS_INVALID, - groups = UpdateEntity.class), - @Pattern(regexp = MacAddressValidationPatterns.NON_MULTICAST_MAC_ADDRESS_FORMAT, - message = VALIDATION_VM_NETWORK_MAC_ADDRESS_MULTICAST, - groups = UpdateEntity.class), - @Pattern(regexp = MacAddressValidationPatterns.NON_NULLABLE_MAC_ADDRESS_FORMAT, - message = VALIDATION_MESSAGE_MAC_ADDRESS_INVALID, - groups = { CreateEntity.class, UpdateEntity.class }) + @Pattern(regexp = "(^$)|(" + MacAddressValidationPatterns.VALID_MAC_ADDRESS_FORMAT + ")", + message = VALIDATION_MESSAGE_MAC_ADDRESS_INVALID, + groups = CreateEntity.class), + @Pattern(regexp = "(^$)|(" + MacAddressValidationPatterns.NON_MULTICAST_MAC_ADDRESS_FORMAT + ")", + message = VALIDATION_VM_NETWORK_MAC_ADDRESS_MULTICAST, + groups = CreateEntity.class), + @Pattern(regexp = MacAddressValidationPatterns.VALID_MAC_ADDRESS_FORMAT, + message = VALIDATION_MESSAGE_MAC_ADDRESS_INVALID, + groups = UpdateEntity.class), + @Pattern(regexp = MacAddressValidationPatterns.NON_MULTICAST_MAC_ADDRESS_FORMAT, + message = VALIDATION_VM_NETWORK_MAC_ADDRESS_MULTICAST, + groups = UpdateEntity.class), + @Pattern(regexp = MacAddressValidationPatterns.NON_NULLABLE_MAC_ADDRESS_FORMAT, + message = VALIDATION_MESSAGE_MAC_ADDRESS_INVALID, + groups = { CreateEntity.class, UpdateEntity.class }) }) @Override public String getMacAddress() { diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/profiles/ProfileBase.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/profiles/ProfileBase.java index 770325aa8d8..96f35dbe74e 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/profiles/ProfileBase.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/profiles/ProfileBase.java @@ -22,7 +22,7 @@ public abstract class ProfileBase implements Queryable, BusinessEntity, Na @NotNull(groups = { UpdateEntity.class, RemoveEntity.class }) private Guid id; @Size(min = 1, max = BusinessEntitiesDefinitions.PROFILE_NAME_SIZE, groups = { CreateEntity.class, - UpdateEntity.class }) + UpdateEntity.class }) @ValidName(message = "VALIDATION_NAME_INVALID", groups = { CreateEntity.class, UpdateEntity.class }) private String name; private Guid qosId; diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/flow/AbstractHandler.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/flow/AbstractHandler.java index baaa018513c..8c558ed5690 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/flow/AbstractHandler.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/flow/AbstractHandler.java @@ -28,22 +28,22 @@ public final void process(C ctx) { } HandlerOutcome outcome = tryHandle(ctx); switch (outcome) { - case SUCCESS: - processCase(onSuccess, ctx, SUCCESS); - break; - case NEUTRAL: - processCase(onNeutral, ctx, NEUTRAL); - break; - case FAILURE: - processCase(onFailure, ctx, FAILURE); - break; - case EXCEPTION: - logger.error("Exception in handler {}", getClass().getCanonicalName(), ctx.getException()); - processCase(onException, ctx, EXCEPTION); - break; - default: - logger.error("On flow {} handler {} terminated the flow with {}", ctx.getId(), getName(), outcome); - break; + case SUCCESS: + processCase(onSuccess, ctx, SUCCESS); + break; + case NEUTRAL: + processCase(onNeutral, ctx, NEUTRAL); + break; + case FAILURE: + processCase(onFailure, ctx, FAILURE); + break; + case EXCEPTION: + logger.error("Exception in handler {}", getClass().getCanonicalName(), ctx.getException()); + processCase(onException, ctx, EXCEPTION); + break; + default: + logger.error("On flow {} handler {} terminated the flow with {}", ctx.getId(), getName(), outcome); + break; } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VmIconIdSizePair.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VmIconIdSizePair.java index 865ba534aab..01cabfccfed 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VmIconIdSizePair.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VmIconIdSizePair.java @@ -15,7 +15,7 @@ public class VmIconIdSizePair implements Serializable { private VmIconIdSizePair() { } - public VmIconIdSizePair( Guid small, Guid large) { + public VmIconIdSizePair(Guid small, Guid large) { if (large == null || small == null) { throw new IllegalArgumentException("Argument should not be null"); } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/IPAddressConverter.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/IPAddressConverter.java index eb1b29d1aae..a3aab78247c 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/IPAddressConverter.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/IPAddressConverter.java @@ -151,9 +151,9 @@ public String convertPrefixToIPv4Netmask(String prefix) { int prefixAsInt = Integer.parseInt(prefix); int mask = prefixAsInt == 0 ? 0 : 0xffffffff ^ (1 << 32 - prefixAsInt) - 1; byte[] netmaskByteArray = new byte[] { (byte) (mask >>> 24), - (byte) (mask >>> 16), - (byte) (mask >>> 8), - (byte) mask }; + (byte) (mask >>> 16), + (byte) (mask >>> 8), + (byte) mask }; StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < netmaskByteArray.length; i++) { int octet = 0xFF & netmaskByteArray[i]; diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/LocationInfoHelper.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/LocationInfoHelper.java index 599b82ea5c5..843452822e1 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/LocationInfoHelper.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/LocationInfoHelper.java @@ -60,12 +60,12 @@ public static Map prepareLocationInfoForVdsCommand(LocationInfo private static String volumeFormatToString(VolumeFormat format) { switch (format) { - case COW: - return "cow"; - case RAW: - return "raw"; - default: - throw new RuntimeException("Invalid format"); + case COW: + return "cow"; + case RAW: + return "raw"; + default: + throw new RuntimeException("Invalid format"); } } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/MapNetworkAttachments.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/MapNetworkAttachments.java index 40ef46d2ea1..8ce37cbb0fc 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/MapNetworkAttachments.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/MapNetworkAttachments.java @@ -69,7 +69,7 @@ public Map> byNicId() { } private interface CalculateKey { - K keyFrom(I instance); + K keyFrom(I instance); } private static class ByNetworkId implements CalculateKey { diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/NetworkCommonUtils.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/NetworkCommonUtils.java index faf1caa6670..60eec056698 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/NetworkCommonUtils.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/NetworkCommonUtils.java @@ -104,9 +104,9 @@ public static IpV6Address createDefaultIpv6Address() { * @return Base interface name if the nic is a vlan device. * Otherwise, the name of the nic */ - public static String stripVlan(VdsNetworkInterface nic) { - return isVlan(nic) ? nic.getBaseInterface() : nic.getName(); - } + public static String stripVlan(VdsNetworkInterface nic) { + return isVlan(nic) ? nic.getBaseInterface() : nic.getName(); + } /** * Determine if a given network interface is a vlan device @@ -115,9 +115,9 @@ public static String stripVlan(VdsNetworkInterface nic) { * the nic to check. * @return true iff the nic is a vlan. */ - public static boolean isVlan(VdsNetworkInterface nic) { - return nic.getVlanId() != null; - } + public static boolean isVlan(VdsNetworkInterface nic) { + return nic.getVlanId() != null; + } public static boolean isEl8(String kernelVersion) { return kernelVersion != null && kernelVersion.toLowerCase().contains("el8"); //$NON-NLS-1$ diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/RpmVersionUtils.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/RpmVersionUtils.java index 23340f7642a..98c2eabd3ca 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/RpmVersionUtils.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/RpmVersionUtils.java @@ -84,17 +84,17 @@ protected static Long parseLong(String str) { * numbers. Characters which are not alpha numeric should be treated as delimiters */ protected static StringBuilder[] fillCompsArray(String part) { - if (part == null) { + if (part == null) { return null; - } - StringBuilder[] comps = new StringBuilder[part.length()]; - char[] chars = part.toCharArray(); - int arrayIndex = 0; - int index = 0; - int state = 0; //0 - start , 1 - alphabetic, 2 - numeric - 3 other - StringBuilder current = new StringBuilder(); + } + StringBuilder[] comps = new StringBuilder[part.length()]; + char[] chars = part.toCharArray(); + int arrayIndex = 0; + int index = 0; + int state = 0; //0 - start , 1 - alphabetic, 2 - numeric - 3 other + StringBuilder current = new StringBuilder(); // The maximum number of segments is the number of characters in the string - while (index < part.length()) { + while (index < part.length()) { // The current character is letter if (isLetter(chars[index])) { if (state == 2) { diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/ToStringBuilder.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/ToStringBuilder.java index d4657e2cc6b..9dcf4e6cd91 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/ToStringBuilder.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/ToStringBuilder.java @@ -357,15 +357,15 @@ public ToStringBuilder appendFiltered(final String name, final String value) { public String build() { final int bufferLength = buffer.length(); if (bufferLength > 0) { - final char lastChar = buffer.charAt(bufferLength - 1); - if (lastChar == VALUE_SUFFIX) { - // at least one attribute was added to list - buffer.append(ATTRIBUTES_LIST_SUFFIX); - } else if (lastChar == CLASS_NAME_SUFFIX) { - // only class name was added to buffer - buffer.append(ATTRIBUTES_LIST_PREFIX); - buffer.append(ATTRIBUTES_LIST_SUFFIX); - } + final char lastChar = buffer.charAt(bufferLength - 1); + if (lastChar == VALUE_SUFFIX) { + // at least one attribute was added to list + buffer.append(ATTRIBUTES_LIST_SUFFIX); + } else if (lastChar == CLASS_NAME_SUFFIX) { + // only class name was added to buffer + buffer.append(ATTRIBUTES_LIST_PREFIX); + buffer.append(ATTRIBUTES_LIST_SUFFIX); + } } return buffer.toString(); } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmCommonUtils.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmCommonUtils.java index e973a5c4ca4..163ec3c1ec9 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmCommonUtils.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmCommonUtils.java @@ -97,21 +97,21 @@ public static int maxMemorySizeWithHotplugInMb(int osId, Version compatibilityVe } private static ConfigValues getMaxMemConfigValueByOsId(int osId) { - OsRepository osRepository = SimpleDependencyInjector.getInstance().get(OsRepository.class); - return osRepository.get64bitOss().contains(osId) + OsRepository osRepository = SimpleDependencyInjector.getInstance().get(OsRepository.class); + return osRepository.get64bitOss().contains(osId) ? (osRepository.getOsArchitectures().get(osId).getFamily() == ArchitectureType.ppc ? ConfigValues.VMPpc64BitMaxMemorySizeInMB : ConfigValues.VM64BitMaxMemorySizeInMB) : ConfigValues.VM32BitMaxMemorySizeInMB; - } + } - public static int getMaxMemorySizeDefault(int memorySize) { + public static int getMaxMemorySizeDefault(int memorySize) { final int maxMemoryDefaultRatio = 4; return maxMemoryDefaultRatio * memorySize; - } + } - public static int calcMinMemory(int memory, int overcommit) { - double overCommitFactor = 100.0 / overcommit; - return (int) (memory * overCommitFactor); - } + public static int calcMinMemory(int memory, int overcommit) { + double overCommitFactor = 100.0 / overcommit; + return (int) (memory * overCommitFactor); + } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceCommonUtils.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceCommonUtils.java index 765ecb93b8b..acfafd54454 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceCommonUtils.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceCommonUtils.java @@ -106,69 +106,69 @@ public static void updateVmDevicesBootOrder( devices.forEach(device -> device.setBootOrder(0)); switch (bootSequence) { - case C: - bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); - break; - case CD: - bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); - bootOrder = setCDBootOrder(devices, bootOrder); - break; - case CDN: - bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); - bootOrder = setCDBootOrder(devices, bootOrder); - bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); - break; - case CN: - bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); - bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); - break; - case CND: - bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); - bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); - bootOrder = setCDBootOrder(devices, bootOrder); - break; - case D: - bootOrder = setCDBootOrder(devices, bootOrder); - break; - case DC: - bootOrder = setCDBootOrder(devices, bootOrder); - bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); - break; - case DCN: - bootOrder = setCDBootOrder(devices, bootOrder); - bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); - bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); - break; - case DN: - bootOrder = setCDBootOrder(devices, bootOrder); - bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); - break; - case DNC: - bootOrder = setCDBootOrder(devices, bootOrder); - bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); - bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); - break; - case N: - bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); - break; - case NC: - bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); - bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); - break; - case NCD: - bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); - bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); - bootOrder = setCDBootOrder(devices, bootOrder); - break; - case ND: - bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); - bootOrder = setCDBootOrder(devices, bootOrder); - break; - case NDC: - bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); - bootOrder = setCDBootOrder(devices, bootOrder); - bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); - break; + case C: + bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); + break; + case CD: + bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); + bootOrder = setCDBootOrder(devices, bootOrder); + break; + case CDN: + bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); + bootOrder = setCDBootOrder(devices, bootOrder); + bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); + break; + case CN: + bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); + bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); + break; + case CND: + bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); + bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); + bootOrder = setCDBootOrder(devices, bootOrder); + break; + case D: + bootOrder = setCDBootOrder(devices, bootOrder); + break; + case DC: + bootOrder = setCDBootOrder(devices, bootOrder); + bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); + break; + case DCN: + bootOrder = setCDBootOrder(devices, bootOrder); + bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); + bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); + break; + case DN: + bootOrder = setCDBootOrder(devices, bootOrder); + bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); + break; + case DNC: + bootOrder = setCDBootOrder(devices, bootOrder); + bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); + bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); + break; + case N: + bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); + break; + case NC: + bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); + bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); + break; + case NCD: + bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); + bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); + bootOrder = setCDBootOrder(devices, bootOrder); + break; + case ND: + bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); + bootOrder = setCDBootOrder(devices, bootOrder); + break; + case NDC: + bootOrder = setNetworkBootOrder(devices, bootOrder, interfaces); + bootOrder = setCDBootOrder(devices, bootOrder); + bootOrder = setDiskBootOrder(devices, bootOrder, deviceIdToDiskVmElement); + break; } } @@ -444,12 +444,12 @@ public static void addCdDevice(VmBase vmBase) { */ public static int getCdDeviceIndex(String cdInterface) { switch (cdInterface) { - case "scsi": - case "ide": - case "sata": - return 2; - default: - return -1; + case "scsi": + case "ide": + case "sata": + return 2; + default: + return -1; } } @@ -461,13 +461,13 @@ public static int getCdDeviceIndex(String cdInterface) { */ public static int getCdPayloadDeviceIndex(String cdInterface) { switch (cdInterface) { - case "scsi": - case "sata": - return 1; - case "ide": - return 3; - default: - return -1; + case "scsi": + case "sata": + return 1; + case "ide": + return 3; + default: + return -1; } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/validation/ConfiguredRangeValidator.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/validation/ConfiguredRangeValidator.java index a464144ebd3..2cfdcaeb14d 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/validation/ConfiguredRangeValidator.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/validation/ConfiguredRangeValidator.java @@ -37,4 +37,4 @@ public boolean isValid(Integer value, ConstraintValidatorContext context) { } return result; } - } +} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/validation/VmActionByVmOriginTypeValidator.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/validation/VmActionByVmOriginTypeValidator.java index 47e412b8d3f..7686eb8baac 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/validation/VmActionByVmOriginTypeValidator.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/validation/VmActionByVmOriginTypeValidator.java @@ -43,7 +43,7 @@ public class VmActionByVmOriginTypeValidator { } public static boolean isCommandAllowed(VM vm, ActionType actionType) { - return !( vm.isHostedEngine() && !COMMANDS_ALLOWED_ON_HOSTED_ENGINE.contains(actionType) || - vm.isExternalVm() && !COMMANDS_ALLOWED_ON_EXTERNAL_VMS.contains(actionType) ); + return !(vm.isHostedEngine() && !COMMANDS_ALLOWED_ON_HOSTED_ENGINE.contains(actionType) || + vm.isExternalVm() && !COMMANDS_ALLOWED_ON_EXTERNAL_VMS.contains(actionType)); } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/MigrateStatusVDSCommandParameters.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/MigrateStatusVDSCommandParameters.java index 0d920b63361..25c861eb36e 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/MigrateStatusVDSCommandParameters.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/MigrateStatusVDSCommandParameters.java @@ -3,7 +3,7 @@ import org.ovirt.engine.core.compat.Guid; public class MigrateStatusVDSCommandParameters extends VdsAndVmIDVDSParametersBase { - public MigrateStatusVDSCommandParameters(Guid vdsId, Guid vmId) { + public MigrateStatusVDSCommandParameters(Guid vdsId, Guid vmId) { super(vdsId, vmId); } diff --git a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/businessentities/EntitiesTest.java b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/businessentities/EntitiesTest.java index ee4260c67c3..8a93af6df01 100644 --- a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/businessentities/EntitiesTest.java +++ b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/businessentities/EntitiesTest.java @@ -13,10 +13,10 @@ public class EntitiesTest { private static final Guid[] GUIDs = { - new Guid("000000000000-0000-0000-0000-00000001"), - new Guid("000000000000-0000-0000-0000-00000002"), - new Guid("000000000000-0000-0000-0000-00000003"), - new Guid("000000000000-0000-0000-0000-00000004") }; + new Guid("000000000000-0000-0000-0000-00000001"), + new Guid("000000000000-0000-0000-0000-00000002"), + new Guid("000000000000-0000-0000-0000-00000003"), + new Guid("000000000000-0000-0000-0000-00000004") }; @Test public void businessEntitiesById() { diff --git a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/CidrAnnotationTest.java b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/CidrAnnotationTest.java index 90d57fec2a0..8de587fa63f 100644 --- a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/CidrAnnotationTest.java +++ b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/CidrAnnotationTest.java @@ -50,10 +50,10 @@ public void checkCidrFormatAnnotation(String cidr, @ParameterizedTest @MethodSource(value = "namesParams") public void checkCidrNetworkAddressAnnotation - (String cidr, - IpVersion ipVersion, - boolean validCidrFormatExpectedResult, - boolean validNetworkAddressExpectedResult) { + (String cidr, + IpVersion ipVersion, + boolean validCidrFormatExpectedResult, + boolean validNetworkAddressExpectedResult) { ExternalSubnet container = createContainer(cidr, ipVersion); Set> result = validator.validate(container); if (!validCidrFormatExpectedResult) { diff --git a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/IPAddressConverterTest.java b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/IPAddressConverterTest.java index 69a8244bb53..a8b2ff5fe1c 100644 --- a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/IPAddressConverterTest.java +++ b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/IPAddressConverterTest.java @@ -27,24 +27,24 @@ public void checkIpAddressConversionToLong() { runIpAddressConversionToBigInt("0.0.0.1", BigInteger.valueOf(0x00000001)); runIpAddressConversionToBigInt("1.1.1.1", BigInteger.valueOf(0x01010101)); runIpAddressConversionToBigInt("1234:5678:9abc::", new BigInteger(new byte[] { - (byte) 0x12, (byte) 0x34, - (byte) 0x56, (byte) 0x78, - (byte) 0x9a, (byte) 0xbc, - 0, 0, - 0, 0, - 0, 0, - 0, 0, - 0, 0 + (byte) 0x12, (byte) 0x34, + (byte) 0x56, (byte) 0x78, + (byte) 0x9a, (byte) 0xbc, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0 })); runIpAddressConversionToBigInt("1234:5678:9abc::4321", new BigInteger(new byte[] { - (byte) 0x12, (byte) 0x34, - (byte) 0x56, (byte) 0x78, - (byte) 0x9a, (byte) 0xbc, - 0, 0, - 0, 0, - 0, 0, - 0, 0, - (byte) 0x43, (byte) 0x21 + (byte) 0x12, (byte) 0x34, + (byte) 0x56, (byte) 0x78, + (byte) 0x9a, (byte) 0xbc, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + (byte) 0x43, (byte) 0x21 })); } diff --git a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/IPAddressPatternTest.java b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/IPAddressPatternTest.java index 3a5df678648..c93e3519785 100644 --- a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/IPAddressPatternTest.java +++ b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/IPAddressPatternTest.java @@ -26,44 +26,44 @@ public void checkIPAdress(String address, boolean expectedResult) { public static Stream checkIPAdress() { return Stream.of( - Arguments.of("0.0.0.0", true ), - Arguments.of("1.1.1.1", true ), - Arguments.of("255.255.255.255", true ), - Arguments.of("192.168.1.1", true ), - Arguments.of("10.10.1.1", true ), - Arguments.of("127.0.0.1", true ), - Arguments.of("", false ), - Arguments.of(null, true ), - Arguments.of("10.10.10", false ), - Arguments.of("10.10", false ), - Arguments.of( "10", false ), - Arguments.of( "1.1.1.", false ), - Arguments.of( "1.1..1", false ), - Arguments.of( "1..1.1", false ), - Arguments.of( ".1.1.1", false ), - Arguments.of( "....", false ), - Arguments.of( "...", false ), - Arguments.of( "..", false ), - Arguments.of( ".", false ), - Arguments.of( "1.1.1.1.1", false ), - Arguments.of( "a.10.10.10", false ), - Arguments.of( "10.a.10.10", false ), - Arguments.of( "10.10.a.10", false ), - Arguments.of( "10.10.10.a", false ), - Arguments.of( "a.a.a.a", false ), - Arguments.of( "256.10.10.10", false ), - Arguments.of( "10.256.10.10", false ), - Arguments.of( "10.10.256.10", false ), - Arguments.of( "10.10.10.256", false ), - Arguments.of( "300.10.10.10", false ), - Arguments.of( "10.300.10.10", false ), - Arguments.of( "10.10.300.10", false ), - Arguments.of( "10.10.10.300", false ), - Arguments.of( "-1.10.10.10", false ), - Arguments.of( "10.-1.10.10", false ), - Arguments.of( "10.10.-1.10", false ), - Arguments.of( "10.10.10.-1", false ), - Arguments.of( " ", false ) + Arguments.of("0.0.0.0", true), + Arguments.of("1.1.1.1", true), + Arguments.of("255.255.255.255", true), + Arguments.of("192.168.1.1", true), + Arguments.of("10.10.1.1", true), + Arguments.of("127.0.0.1", true), + Arguments.of("", false), + Arguments.of(null, true), + Arguments.of("10.10.10", false), + Arguments.of("10.10", false), + Arguments.of("10", false), + Arguments.of("1.1.1.", false), + Arguments.of("1.1..1", false), + Arguments.of("1..1.1", false), + Arguments.of(".1.1.1", false), + Arguments.of("....", false), + Arguments.of("...", false), + Arguments.of("..", false), + Arguments.of(".", false), + Arguments.of("1.1.1.1.1", false), + Arguments.of("a.10.10.10", false), + Arguments.of("10.a.10.10", false), + Arguments.of("10.10.a.10", false), + Arguments.of("10.10.10.a", false), + Arguments.of("a.a.a.a", false), + Arguments.of("256.10.10.10", false), + Arguments.of("10.256.10.10", false), + Arguments.of("10.10.256.10", false), + Arguments.of("10.10.10.256", false), + Arguments.of("300.10.10.10", false), + Arguments.of("10.300.10.10", false), + Arguments.of("10.10.300.10", false), + Arguments.of("10.10.10.300", false), + Arguments.of("-1.10.10.10", false), + Arguments.of("10.-1.10.10", false), + Arguments.of("10.10.-1.10", false), + Arguments.of("10.10.10.-1", false), + Arguments.of(" ", false) ); } diff --git a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/NetworkLabelFormatValidatorTest.java b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/NetworkLabelFormatValidatorTest.java index fa6f13ada77..203da488543 100644 --- a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/NetworkLabelFormatValidatorTest.java +++ b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/NetworkLabelFormatValidatorTest.java @@ -30,14 +30,14 @@ public void checkNetworkLabelFormat(Set labels, boolean expectedResult) public static Stream checkNetworkLabelFormat() { return Stream.of( - Arguments.of(Collections.emptySet(), true ), - Arguments.of(null, true ), - Arguments.of(Collections.singleton("abc"), true ), - Arguments.of(new HashSet<>(Arrays.asList("abc", "xyz")), true ), - Arguments.of(Collections.singleton("abc-_sc"), true ), - Arguments.of(Collections.singleton(""), false ), - Arguments.of(Collections.singleton(" "), false ), - Arguments.of(Collections.singleton("abc*"), false ), + Arguments.of(Collections.emptySet(), true), + Arguments.of(null, true), + Arguments.of(Collections.singleton("abc"), true), + Arguments.of(new HashSet<>(Arrays.asList("abc", "xyz")), true), + Arguments.of(Collections.singleton("abc-_sc"), true), + Arguments.of(Collections.singleton(""), false), + Arguments.of(Collections.singleton(" "), false), + Arguments.of(Collections.singleton("abc*"), false), Arguments.of(new HashSet<>(Arrays.asList("aaa", "abc*")), false) ); } diff --git a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/NumaPinningHelperTest.java b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/NumaPinningHelperTest.java index a09bab27ea6..5b41ff3966b 100644 --- a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/NumaPinningHelperTest.java +++ b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/NumaPinningHelperTest.java @@ -244,25 +244,25 @@ private VDS createVDS() { host.setCpuCores(32); return host; } - private VdsNumaNode createHostNumaNodeWithCpus(int index, long freeMem, List cpus) { + private VdsNumaNode createHostNumaNodeWithCpus(int index, long freeMem, List cpus) { VdsNumaNode vdsNumaNode = createHostNumaNode(index, freeMem); vdsNumaNode.setCpuIds(cpus); return vdsNumaNode; - } - - private static VmNumaNode createVmNumaNode(int index) { - VmNumaNode vmNumaNode = new VmNumaNode(); - vmNumaNode.setId(Guid.newGuid()); - vmNumaNode.setIndex(index); - vmNumaNode.setMemTotal(1000); - return vmNumaNode; - } - - private static VdsNumaNode createVdsNumaNode(int index) { - VdsNumaNode vdsNumaNode = new VdsNumaNode(); - vdsNumaNode.setIndex(index); - vdsNumaNode.setId(Guid.newGuid()); - vdsNumaNode.setMemTotal(2000); - return vdsNumaNode; - } + } + + private static VmNumaNode createVmNumaNode(int index) { + VmNumaNode vmNumaNode = new VmNumaNode(); + vmNumaNode.setId(Guid.newGuid()); + vmNumaNode.setIndex(index); + vmNumaNode.setMemTotal(1000); + return vmNumaNode; + } + + private static VdsNumaNode createVdsNumaNode(int index) { + VdsNumaNode vdsNumaNode = new VdsNumaNode(); + vdsNumaNode.setIndex(index); + vdsNumaNode.setId(Guid.newGuid()); + vdsNumaNode.setMemTotal(2000); + return vdsNumaNode; + } } diff --git a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/ValidNameValidatorTest.java b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/ValidNameValidatorTest.java index ed311a0403c..2dfe42891ac 100644 --- a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/ValidNameValidatorTest.java +++ b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/ValidNameValidatorTest.java @@ -33,16 +33,16 @@ public void checkName(String name, boolean expectedResult) { public static Stream checkName() { return Stream.of( - Arguments.of("abc", true ), - Arguments.of("123", true ), - Arguments.of("abc123", true ), - Arguments.of("123abc", true ), - Arguments.of(null, true ), - Arguments.of(" ", false ), - Arguments.of("", false ), - Arguments.of("abc ", false ), - Arguments.of(" abc", false ), - Arguments.of("abc cde", false ), + Arguments.of("abc", true), + Arguments.of("123", true), + Arguments.of("abc123", true), + Arguments.of("123abc", true), + Arguments.of(null, true), + Arguments.of(" ", false), + Arguments.of("", false), + Arguments.of("abc ", false), + Arguments.of(" abc", false), + Arguments.of("abc cde", false), Arguments.of("abc*", false) ); } diff --git a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/ValidationUtilsTest.java b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/ValidationUtilsTest.java index 2460b75620f..f4688ddbddc 100644 --- a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/ValidationUtilsTest.java +++ b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/ValidationUtilsTest.java @@ -18,10 +18,10 @@ public void testcontainsIlegalCharacters() { public void testIsInvalidHostname() { String[] straValidHosts = new String[] { "blahblah", "www.redhat.com", "www.rhn.redhat.com", "127.0.0.1", - "1::2", "1:0002:34:4:5:6:7:8" }; + "1::2", "1:0002:34:4:5:6:7:8" }; String[] straInvalidHosts = new String[] { "www.redhat#com", "123/456", "www@redhat.com", "www.řhň.řěďháť.čőm", "你好世界", - "שלוםעולם" }; + "שלוםעולם" }; for (String s : straValidHosts) { assertTrue(ValidationUtils.validHostname(s), "Valid host name: " + s); } diff --git a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/pm/FenceProxySourceTypeHelperTest.java b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/pm/FenceProxySourceTypeHelperTest.java index e0fea0bd70a..fae7fde5b44 100644 --- a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/pm/FenceProxySourceTypeHelperTest.java +++ b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/pm/FenceProxySourceTypeHelperTest.java @@ -52,7 +52,7 @@ public void parseValidString() { }; for (String invalidValue : validValues) { - FenceProxySourceTypeHelper.parseFromString(invalidValue); + FenceProxySourceTypeHelper.parseFromString(invalidValue); } } @@ -62,10 +62,10 @@ public void parseValidString() { @Test public void parseInvalidString() { String[] invalidValues = { - "clust", // invalid fence proxy source type - "clust,dc", // invalid fence proxy source type - "cluster,d", // invalid fence proxy source type - "cluster, dc" // space should not be used + "clust", // invalid fence proxy source type + "clust,dc", // invalid fence proxy source type + "cluster,d", // invalid fence proxy source type + "cluster, dc" // space should not be used }; for (String invalidValue : invalidValues) { diff --git a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/validation/IPv4MaskValidatorTest.java b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/validation/IPv4MaskValidatorTest.java index 671587113db..d794e126eaf 100644 --- a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/validation/IPv4MaskValidatorTest.java +++ b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/validation/IPv4MaskValidatorTest.java @@ -46,7 +46,7 @@ public static Stream netmaskValidValue() { } public static Stream namesParams() { - Random random = new Random(); + Random random = new Random(); return Stream.of( diff --git a/backend/manager/modules/compat/src/main/java/org/ovirt/engine/core/compat/RegexOptions.java b/backend/manager/modules/compat/src/main/java/org/ovirt/engine/core/compat/RegexOptions.java index 9600363614a..ec7d4752459 100644 --- a/backend/manager/modules/compat/src/main/java/org/ovirt/engine/core/compat/RegexOptions.java +++ b/backend/manager/modules/compat/src/main/java/org/ovirt/engine/core/compat/RegexOptions.java @@ -11,7 +11,7 @@ public class RegexOptions { public static final int Compiled = 0; // Java RegExp are always compiled, // this option makes no sense in // Java context - public static final int IgnoreCase = Pattern.CASE_INSENSITIVE; + public static final int IgnoreCase = Pattern.CASE_INSENSITIVE; public static final int Singleline = Pattern.DOTALL; public static final RegexOptions None = null; diff --git a/backend/manager/modules/compat/src/main/java/org/ovirt/engine/core/compat/Version.java b/backend/manager/modules/compat/src/main/java/org/ovirt/engine/core/compat/Version.java index 6f8b0f85c01..14c31dd201b 100644 --- a/backend/manager/modules/compat/src/main/java/org/ovirt/engine/core/compat/Version.java +++ b/backend/manager/modules/compat/src/main/java/org/ovirt/engine/core/compat/Version.java @@ -86,14 +86,14 @@ public void setValue(String value) { } else { String[] partialVersions = value.split("\\."); switch (partialVersions.length) { - case 4: - revision = Integer.parseInt(partialVersions[3]); - case 3: - build = Integer.parseInt(partialVersions[2]); - case 2: - minor = Integer.parseInt(partialVersions[1]); - case 1: - major = Integer.parseInt(partialVersions[0]); + case 4: + revision = Integer.parseInt(partialVersions[3]); + case 3: + build = Integer.parseInt(partialVersions[2]); + case 2: + minor = Integer.parseInt(partialVersions[1]); + case 1: + major = Integer.parseInt(partialVersions[0]); } } } @@ -137,14 +137,14 @@ public boolean lessOrEquals(Collection candidates) { public String toString(int i) { StringBuilder sb = new StringBuilder(); switch (i) { - case 4: - sb.append('.').append(revision); - case 3: - sb.insert(0, build).insert(0, '.'); - case 2: - sb.insert(0, minor).insert(0, '.'); - case 1: - sb.insert(0, major); + case 4: + sb.append('.').append(revision); + case 3: + sb.insert(0, build).insert(0, '.'); + case 2: + sb.insert(0, minor).insert(0, '.'); + case 1: + sb.insert(0, major); } return sb.toString(); } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java index 420732123a2..6b2eaebefb9 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java @@ -81,17 +81,17 @@ private AuditLog saveToDb(AuditLogable auditLogable, AuditLogType logType, Strin private void logMessage(AuditLog auditLog) { String logMessage = getMessageToLog(auditLog); switch (auditLog.getSeverity()) { - case NORMAL: - log.info(logMessage); - break; - case ERROR: - log.error(logMessage); - break; - case ALERT: - case WARNING: - default: - log.warn(logMessage); - break; + case NORMAL: + log.info(logMessage); + break; + case ERROR: + log.error(logMessage); + break; + case ALERT: + case WARNING: + default: + log.warn(logMessage); + break; } } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/MessageResolver.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/MessageResolver.java index e5c9d4d7bab..625f74e8ae9 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/MessageResolver.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/MessageResolver.java @@ -52,14 +52,14 @@ public static String resolveMessage(String message, Map values) if (value == null || value.isEmpty()) { // replace value with UNKNOWN_VARIABLE_VALUE if value not defined switch (token) { - case REASON_TOKEN: - value = UNKNOWN_REASON_VALUE; - break; - case OPTIONAL_REASON_TOKEN: - value = ""; - break; - default: - value = UNKNOWN_VARIABLE_VALUE; + case REASON_TOKEN: + value = UNKNOWN_REASON_VALUE; + break; + case OPTIONAL_REASON_TOKEN: + value = ""; + break; + default: + value = UNKNOWN_VARIABLE_VALUE; } } matcher.appendReplacement(buffer, Matcher.quoteReplacement(value)); // put the value into message diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskDaoImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskDaoImpl.java index 1f2550e9d11..1007f73606c 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskDaoImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskDaoImpl.java @@ -175,10 +175,10 @@ public List getAllWithQuery(String query) { } private static final RowMapper diskRowMapper = (rs, rowNum) -> { - Disk disk = null; - DiskStorageType diskStorageType = DiskStorageType.forValue(rs.getInt("disk_storage_type")); + Disk disk = null; + DiskStorageType diskStorageType = DiskStorageType.forValue(rs.getInt("disk_storage_type")); - switch (diskStorageType) { + switch (diskStorageType) { case MANAGED_BLOCK_STORAGE: disk = ManagedBlockStorageRowMapper.instance.mapRow(rs, rowNum); break; @@ -194,9 +194,9 @@ public List getAllWithQuery(String query) { case CINDER: disk = CinderDiskRowMapper.instance.mapRow(rs, rowNum); break; - } + } - return disk; + return disk; }; private static final RowMapper diskForVmRowMapper = (rs, rowNum) -> { diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDao.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDao.java index 24b90e96c90..cce61d39d3e 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDao.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDao.java @@ -68,7 +68,7 @@ public interface DiskImageDao extends ReadDao { * the snapshot id * @return the list of snapshots */ - DiskImage getDiskSnapshotForVmSnapshot(Guid diskId, Guid vmSnapshotId); + DiskImage getDiskSnapshotForVmSnapshot(Guid diskId, Guid vmSnapshotId); /** * Retrieves all snapshots associated with the given image group. diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StepDao.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StepDao.java index 767108f3aa4..74e444c75c5 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StepDao.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StepDao.java @@ -66,5 +66,5 @@ public interface StepDao extends GenericDao { * Retrieves all {@link Step} in status {@code JobExecutionStatus.STARTED} for the given {@link SubjectEntity} */ List getStartedStepsByStepSubjectEntity(SubjectEntity subjectEntity); - } +} diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageDomainDRDaoImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageDomainDRDaoImpl.java index 8c03faababc..87ab652a572 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageDomainDRDaoImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageDomainDRDaoImpl.java @@ -73,11 +73,11 @@ public void update(StorageDomainDR storageDomainDR) { @Override public void saveOrUpdate(StorageDomainDR storageDomainDR) { - if (get(storageDomainDR.getStorageDomainId(), storageDomainDR.getGeoRepSessionId()) != null) { - update(storageDomainDR); - } else { - save(storageDomainDR); - } + if (get(storageDomainDR.getStorageDomainId(), storageDomainDR.getGeoRepSessionId()) != null) { + update(storageDomainDR); + } else { + save(storageDomainDR); + } } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDao.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDao.java index 73f033dd302..7ba9fa19bdf 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDao.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDao.java @@ -51,7 +51,7 @@ public interface VdsDynamicDao extends GenericDao, StatusAware * @param host * the host to be updated */ - void updateStatusAndReasons(VdsDynamic host); + void updateStatusAndReasons(VdsDynamic host); /** * Checks if exists a host with the given status in the given cluster. diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsSpmIdMapDaoImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsSpmIdMapDaoImpl.java index 69d67561360..b8976f9586f 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsSpmIdMapDaoImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsSpmIdMapDaoImpl.java @@ -60,7 +60,7 @@ public void removeByVdsAndStoragePool(Guid vdsId, Guid storagePoolId) { } @Override - public VdsSpmIdMap get(Guid storagePoolId, int spmId ) { + public VdsSpmIdMap get(Guid storagePoolId, int spmId) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("storage_pool_id", storagePoolId).addValue("vds_spm_id", spmId); return getCallsHandler().executeRead("Getvds_spm_id_mapBystorage_pool_idAndByvds_spm_id", diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDeviceDaoImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDeviceDaoImpl.java index 27b69796094..013dc514c6e 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDeviceDaoImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDeviceDaoImpl.java @@ -113,7 +113,7 @@ public List getVmDeviceByVmIdTypeAndDevice(Guid vmBaseId, VmDeviceGene @Override public List getVmDeviceByVmIdTypeAndDevice - (Guid vmId, VmDeviceGeneralType type, String device, Guid userID, boolean isFiltered) { + (Guid vmId, VmDeviceGeneralType type, String device, Guid userID, boolean isFiltered) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("vm_id", vmId) .addValue("type", type.getValue()) @@ -127,7 +127,7 @@ public List getVmDeviceByVmIdTypeAndDevice(Guid vmBaseId, VmDeviceGene @Override public List getVmDeviceByTypeAndDevice - (List vmsIds, VmDeviceGeneralType type, String device, Guid userID, boolean isFiltered) { + (List vmsIds, VmDeviceGeneralType type, String device, Guid userID, boolean isFiltered) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("vm_ids", createArrayOfUUIDs(vmsIds)) .addValue("type", type.getValue()) diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmJobDaoImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmJobDaoImpl.java index 19b993617a1..3b1236eed92 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmJobDaoImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmJobDaoImpl.java @@ -73,18 +73,18 @@ protected RowMapper createEntityRowMapper() { VmJobType jobType = VmJobType.forValue(rs.getInt("job_type")); switch (jobType) { - case BLOCK: - VmBlockJob blockJob = new VmBlockJob(); - blockJob.setBlockJobType(VmBlockJobType.forValue(rs.getInt("block_job_type"))); - blockJob.setBandwidth(rs.getLong("bandwidth")); - blockJob.setCursorCur(rs.getLong("cursor_cur")); - blockJob.setCursorEnd(rs.getLong("cursor_end")); - blockJob.setImageGroupId(getGuidDefaultEmpty(rs, "image_group_id")); - entity = blockJob; - break; - default: - entity = new VmJob(); - break; + case BLOCK: + VmBlockJob blockJob = new VmBlockJob(); + blockJob.setBlockJobType(VmBlockJobType.forValue(rs.getInt("block_job_type"))); + blockJob.setBandwidth(rs.getLong("bandwidth")); + blockJob.setCursorCur(rs.getLong("cursor_cur")); + blockJob.setCursorEnd(rs.getLong("cursor_end")); + blockJob.setImageGroupId(getGuidDefaultEmpty(rs, "image_group_id")); + entity = blockJob; + break; + default: + entity = new VmJob(); + break; } entity.setId(getGuidDefaultEmpty(rs, "vm_job_id")); diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterDBUtils.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterDBUtils.java index 70a5e601d08..f21b3f8e724 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterDBUtils.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterDBUtils.java @@ -100,14 +100,14 @@ public VdsStatic getServer(Guid clusterId, String hostnameOrIp) { interfaceDao.getAllInterfacesWithIpAddress(clusterId, InetAddress.getByName(hostnameOrIp).getHostAddress()); switch (ifaces.size()) { - case 0: - // not found - return null; - case 1: - return vdsStaticDao.get(ifaces.get(0).getVdsId()); - default: - // multiple servers in the DB having this ip address! - throw new RuntimeException("There are multiple servers in DB having same IP address " + hostnameOrIp); + case 0: + // not found + return null; + case 1: + return vdsStaticDao.get(ifaces.get(0).getVdsId()); + default: + // multiple servers in the DB having this ip address! + throw new RuntimeException("There are multiple servers in DB having same IP address " + hostnameOrIp); } } catch (UnknownHostException e) { throw new RuntimeException(e); diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDao.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDao.java index 650810b6464..b2e3eb7334e 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDao.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDao.java @@ -61,4 +61,4 @@ public interface GlusterGeoRepDao extends Dao { public GlusterGeoRepSessionConfiguration getGeoRepSessionConfigByKey(Guid sessionId, String configKey); public List getAllSessions(); - } +} diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterHooksDaoImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterHooksDaoImpl.java index 3a16696ede6..ce372e791cd 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterHooksDaoImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterHooksDaoImpl.java @@ -138,7 +138,7 @@ public void remove(Guid id) { createIdParameterMapper(id)); } - @Override + @Override public void removeAll(Collection ids) { getCallsHandler().executeModification("DeleteGlusterHooksByIds", getCustomMapSqlParameterSource().addValue("ids", StringUtils.join(ids, ','))); diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/StorageDeviceDao.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/StorageDeviceDao.java index f4ab2d0d32b..a113344eca6 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/StorageDeviceDao.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/StorageDeviceDao.java @@ -19,4 +19,4 @@ public interface StorageDeviceDao extends ModificationDao, void updateIsFreeFlag(Guid deviceId, boolean isFree); - } +} diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/InterfaceDaoImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/InterfaceDaoImpl.java index 033417c8845..e9891fc33f4 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/InterfaceDaoImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/InterfaceDaoImpl.java @@ -331,32 +331,32 @@ private static final class VdsNetworkInterfaceRowMapper implements RowMapper entity) { if (entity.getAdditionalProperties() != null) { switch (entity.getType()) { - case EXTERNAL_NETWORK: - case OPENSTACK_NETWORK: - OpenstackNetworkProviderProperties networkProperties = - (OpenstackNetworkProviderProperties) entity.getAdditionalProperties(); - readOnly = networkProperties.getReadOnly(); - pluginType = networkProperties.getPluginType(); - autoSync = networkProperties.getAutoSync(); - case OPENSTACK_IMAGE: - case OPENSTACK_VOLUME: - OpenStackProviderProperties openStackProviderProperties = - (OpenStackProviderProperties) entity.getAdditionalProperties(); - tenantName = openStackProviderProperties.getTenantName(); - userDomainName = openStackProviderProperties.getUserDomainName(); - projectName = openStackProviderProperties.getProjectName(); - projectDomainName = openStackProviderProperties.getProjectDomainName(); - break; - case VMWARE: - case KVM: - case XEN: - case KUBEVIRT: - additionalProperties = entity.getAdditionalProperties(); - break; - default: - break; + case EXTERNAL_NETWORK: + case OPENSTACK_NETWORK: + OpenstackNetworkProviderProperties networkProperties = + (OpenstackNetworkProviderProperties) entity.getAdditionalProperties(); + readOnly = networkProperties.getReadOnly(); + pluginType = networkProperties.getPluginType(); + autoSync = networkProperties.getAutoSync(); + case OPENSTACK_IMAGE: + case OPENSTACK_VOLUME: + OpenStackProviderProperties openStackProviderProperties = + (OpenStackProviderProperties) entity.getAdditionalProperties(); + tenantName = openStackProviderProperties.getTenantName(); + userDomainName = openStackProviderProperties.getUserDomainName(); + projectName = openStackProviderProperties.getProjectName(); + projectDomainName = openStackProviderProperties.getProjectDomainName(); + break; + case VMWARE: + case KVM: + case XEN: + case KUBEVIRT: + additionalProperties = entity.getAdditionalProperties(); + break; + default: + break; } } @@ -155,32 +155,32 @@ public Provider mapRow(ResultSet rs, int index) throws SQLException { private AdditionalProperties mapAdditionalProperties(ResultSet rs, Provider entity) throws SQLException { switch (entity.getType()) { - case EXTERNAL_NETWORK: - case OPENSTACK_NETWORK: - OpenstackNetworkProviderProperties networkProperties = new OpenstackNetworkProviderProperties(); - mapOpenStackProperties(rs, networkProperties); - networkProperties.setReadOnly(rs.getBoolean("read_only")); - networkProperties.setAutoSync(rs.getBoolean("auto_sync")); - networkProperties.setPluginType(rs.getString("plugin_type")); - return networkProperties; - case OPENSTACK_IMAGE: - OpenStackImageProviderProperties imageProperties = new OpenStackImageProviderProperties(); - mapOpenStackProperties(rs, imageProperties); - return imageProperties; - case OPENSTACK_VOLUME: - OpenStackVolumeProviderProperties volumeProperties = new OpenStackVolumeProviderProperties(); - mapOpenStackProperties(rs, volumeProperties); - return volumeProperties; - case VMWARE: - return SerializationFactory.getDeserializer().deserialize(rs.getString("additional_properties"), VmwareVmProviderProperties.class); - case KVM: - return SerializationFactory.getDeserializer().deserialize(rs.getString("additional_properties"), KVMVmProviderProperties.class); - case XEN: - return SerializationFactory.getDeserializer().deserialize(rs.getString("additional_properties"), XENVmProviderProperties.class); - case KUBEVIRT: - return SerializationFactory.getDeserializer().deserialize(rs.getString("additional_properties"), KubevirtProviderProperties.class); - default: - return null; + case EXTERNAL_NETWORK: + case OPENSTACK_NETWORK: + OpenstackNetworkProviderProperties networkProperties = new OpenstackNetworkProviderProperties(); + mapOpenStackProperties(rs, networkProperties); + networkProperties.setReadOnly(rs.getBoolean("read_only")); + networkProperties.setAutoSync(rs.getBoolean("auto_sync")); + networkProperties.setPluginType(rs.getString("plugin_type")); + return networkProperties; + case OPENSTACK_IMAGE: + OpenStackImageProviderProperties imageProperties = new OpenStackImageProviderProperties(); + mapOpenStackProperties(rs, imageProperties); + return imageProperties; + case OPENSTACK_VOLUME: + OpenStackVolumeProviderProperties volumeProperties = new OpenStackVolumeProviderProperties(); + mapOpenStackProperties(rs, volumeProperties); + return volumeProperties; + case VMWARE: + return SerializationFactory.getDeserializer().deserialize(rs.getString("additional_properties"), VmwareVmProviderProperties.class); + case KVM: + return SerializationFactory.getDeserializer().deserialize(rs.getString("additional_properties"), KVMVmProviderProperties.class); + case XEN: + return SerializationFactory.getDeserializer().deserialize(rs.getString("additional_properties"), XENVmProviderProperties.class); + case KUBEVIRT: + return SerializationFactory.getDeserializer().deserialize(rs.getString("additional_properties"), KubevirtProviderProperties.class); + default: + return null; } } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/qos/AllQosBaseDaoImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/qos/AllQosBaseDaoImpl.java index d6ca33af9dc..554d6524950 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/qos/AllQosBaseDaoImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/qos/AllQosBaseDaoImpl.java @@ -47,17 +47,17 @@ protected static class AllQosBaseDaoFacadaeImplMapper extends QosBaseDaoFacadaeI protected QosBase createQosEntity(ResultSet rs) throws SQLException { QosType qosType = QosType.forValue(rs.getInt("qos_type")); switch (qosType) { - case STORAGE: - return StorageQosDaoImpl.StorageDaoDbFacadaeImplMapper.MAPPER.createQosEntity(rs); - case CPU: - return CpuQosDaoImpl.CpuDaoDbFacadaeImplMapper.MAPPER.createQosEntity(rs); - case NETWORK: - return NetworkQoSDaoImpl.NetworkQosDaoDbFacadaeImplMapper.MAPPER.createQosEntity(rs); - case HOSTNETWORK: - return HostNetworkQosDaoImpl.HostNetworkQosDaoDbFacadaeImplMapper.MAPPER.createQosEntity(rs); - default: - log.debug("not handled/missing qos_type '{}'", qosType); - break; + case STORAGE: + return StorageQosDaoImpl.StorageDaoDbFacadaeImplMapper.MAPPER.createQosEntity(rs); + case CPU: + return CpuQosDaoImpl.CpuDaoDbFacadaeImplMapper.MAPPER.createQosEntity(rs); + case NETWORK: + return NetworkQoSDaoImpl.NetworkQosDaoDbFacadaeImplMapper.MAPPER.createQosEntity(rs); + case HOSTNETWORK: + return HostNetworkQosDaoImpl.HostNetworkQosDaoDbFacadaeImplMapper.MAPPER.createQosEntity(rs); + default: + log.debug("not handled/missing qos_type '{}'", qosType); + break; } return null; diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BaseGenericDaoTestCase.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BaseGenericDaoTestCase.java index 6729cf205d8..8c3ea741c13 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BaseGenericDaoTestCase.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BaseGenericDaoTestCase.java @@ -16,7 +16,7 @@ import org.ovirt.engine.core.utils.MockedConfig; public abstract class BaseGenericDaoTestCase, -D extends GenericDao> extends BaseReadDaoTestCase { + D extends GenericDao> extends BaseReadDaoTestCase { public BaseGenericDaoTestCase() { super(); } diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BaseReadDaoTestCase.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BaseReadDaoTestCase.java index 93d08426693..92275988c55 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BaseReadDaoTestCase.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BaseReadDaoTestCase.java @@ -13,7 +13,7 @@ import org.ovirt.engine.core.common.businessentities.BusinessEntity; public abstract class BaseReadDaoTestCase, -D extends ReadDao> extends BaseDaoTestCase { + D extends ReadDao> extends BaseDaoTestCase { protected T existingEntity; diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BusinessEntitySnapshotDaoTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BusinessEntitySnapshotDaoTest.java index 22ed80d5d9a..b6ed8baeb78 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BusinessEntitySnapshotDaoTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BusinessEntitySnapshotDaoTest.java @@ -48,7 +48,7 @@ public void testInsertSnapshot() { public void testDeleteByCommandId() { int numberOfResultsBeforeDeletion = 2; Guid commandId = commandWithTwoSnapshotsId; - testDeleteByCommandId(numberOfResultsBeforeDeletion, commandId); + testDeleteByCommandId(numberOfResultsBeforeDeletion, commandId); numberOfResultsBeforeDeletion = 1; commandId = commandWithOneSnapshotId; testDeleteByCommandId(numberOfResultsBeforeDeletion, commandId); diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/ImageStorageDomainMapDaoTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/ImageStorageDomainMapDaoTest.java index a723df2c5c6..bdab2abe3b3 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/ImageStorageDomainMapDaoTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/ImageStorageDomainMapDaoTest.java @@ -85,8 +85,7 @@ public void testChangeQuotaForDisk() { ImageStorageDomainMap imageStorageDomainMap = dao.getAllByImageId(EXISTING_IMAGE_ID).get(0); Guid quotaId = imageStorageDomainMap.getQuotaId(); // test that the current quota doesn't equal with the new quota - assertNotEquals - (FixturesTool.DEFAULT_QUOTA_GENERAL, quotaId, "Same source and dest quota id, cannot perform test"); + assertNotEquals(FixturesTool.DEFAULT_QUOTA_GENERAL, quotaId, "Same source and dest quota id, cannot perform test"); // change quota to the new quota 91 dao.updateQuotaForImageAndSnapshots(FixturesTool.IMAGE_GROUP_ID, FixturesTool.STORAGE_DOMAIN_SCALE_SD5, FixturesTool.DEFAULT_QUOTA_GENERAL); // fetch the image again diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/MultiThreadedDaoTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/MultiThreadedDaoTest.java index 60cfe869675..efbb5cbdc24 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/MultiThreadedDaoTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/MultiThreadedDaoTest.java @@ -20,9 +20,9 @@ */ public class MultiThreadedDaoTest extends BaseDaoTestCase { private static final Guid[] EXISTING_TAGS_IDS = { - new Guid("d3ec3e01-ca89-48e1-8b43-a9b38f873b0c"), - new Guid("d3ec3e01-ca89-48e1-8b43-a9b38f873b0d"), - new Guid("d3ec3e01-ca89-48e1-8b43-a9b38f873b0e") }; + new Guid("d3ec3e01-ca89-48e1-8b43-a9b38f873b0c"), + new Guid("d3ec3e01-ca89-48e1-8b43-a9b38f873b0d"), + new Guid("d3ec3e01-ca89-48e1-8b43-a9b38f873b0e") }; private CountDownLatch latch = null; diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageDomainDaoTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageDomainDaoTest.java index d8a0613d782..f4c0cb6ff5c 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageDomainDaoTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageDomainDaoTest.java @@ -63,11 +63,11 @@ public class StorageDomainDaoTest extends BaseDaoTestCase { private StorageDomain existingDomain; - public static Stream> mockConfiguration() { - return Stream.of( - MockConfigDescriptor.of(ConfigValues.PropagateDiskErrors, false) - ); - } + public static Stream> mockConfiguration() { + return Stream.of( + MockConfigDescriptor.of(ConfigValues.PropagateDiskErrors, false) + ); + } @BeforeEach diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StoragePoolIsoMapDaoTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StoragePoolIsoMapDaoTest.java index a3e467d0c4f..7898c3ef0d7 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StoragePoolIsoMapDaoTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StoragePoolIsoMapDaoTest.java @@ -19,7 +19,7 @@ public class StoragePoolIsoMapDaoTest extends @Override protected StoragePoolIsoMap generateNewEntity() { return new StoragePoolIsoMap - (FixturesTool.STORAGE_DOMAIN_SCALE_SD6, FixturesTool.DATA_CENTER, StorageDomainStatus.Unattached); + (FixturesTool.STORAGE_DOMAIN_SCALE_SD6, FixturesTool.DATA_CENTER, StorageDomainStatus.Unattached); } @Override diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageServerConnectionDaoTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageServerConnectionDaoTest.java index 2031c16694c..456114864ea 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageServerConnectionDaoTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageServerConnectionDaoTest.java @@ -319,16 +319,16 @@ public void testNfsOptions() { @Test public void testGetAllConnectionsOfNfsDomain() { - List connections = dao.getAllForDomain(Guid.createGuidFromString("d9ede37f-e6c3-4bf9-a984-19174070aa31")); - assertEquals(1, connections.size()); - assertEquals("0cc146e8-e5ed-482c-8814-270bc48c2981", connections.get(0).getId()); + List connections = dao.getAllForDomain(Guid.createGuidFromString("d9ede37f-e6c3-4bf9-a984-19174070aa31")); + assertEquals(1, connections.size()); + assertEquals("0cc146e8-e5ed-482c-8814-270bc48c2981", connections.get(0).getId()); } @Test public void testGetAllConnectionsOfIscsiDomain() { - List connections = dao.getAllForDomain(FixturesTool.STORAGE_DOMAIN_SCALE_SD5); - assertEquals(2, connections.size()); - assertTrue(connections.get(0).getId().equals("fDMzhE-wx3s-zo3q-Qcxd-T0li-yoYU-QvVePk") || connections.get(0).getId().equals("0cc146e8-e5ed-482c-8814-270bc48c297e")); + List connections = dao.getAllForDomain(FixturesTool.STORAGE_DOMAIN_SCALE_SD5); + assertEquals(2, connections.size()); + assertTrue(connections.get(0).getId().equals("fDMzhE-wx3s-zo3q-Qcxd-T0li-yoYU-QvVePk") || connections.get(0).getId().equals("0cc146e8-e5ed-482c-8814-270bc48c297e")); } @Test diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmStaticDaoTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmStaticDaoTest.java index a599a4fb50d..2c26402034e 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmStaticDaoTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmStaticDaoTest.java @@ -44,8 +44,8 @@ public static Stream> mockConfiguration() { } protected static final Guid[] HOST_GUIDS = { FixturesTool.HOST_WITH_NO_VFS_CONFIGS_ID, - FixturesTool.HOST_ID, - FixturesTool.GLUSTER_BRICK_SERVER1}; + FixturesTool.HOST_ID, + FixturesTool.GLUSTER_BRICK_SERVER1}; private static final String RUNNING_NAME_WITH_LEASE_ON_STORAGE_DOMAIN = "rhel5-pool-57"; diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmTemplateDaoTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmTemplateDaoTest.java index 46721e309c6..eb6224dfc3f 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmTemplateDaoTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmTemplateDaoTest.java @@ -31,8 +31,8 @@ public class VmTemplateDaoTest extends BaseGenericDaoTestCase result) { } else { r.getQos().setOutAverageLinkshare(31); r.getQos().setOutAverageUpperlimit(32); - r.getQos().setOutAverageRealtime(33 ); + r.getQos().setOutAverageRealtime(33); hostNetworkQosDao.update(r.getQos()); } }); diff --git a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/api/AuthenticationException.java b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/api/AuthenticationException.java index 311a8e87506..8fd23d08b0b 100644 --- a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/api/AuthenticationException.java +++ b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/api/AuthenticationException.java @@ -18,7 +18,7 @@ public AuthenticationException(String errorCode, String errorMsg, Exception ex) } public String getErrorCode() { - return errorCode; + return errorCode; } @Override diff --git a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/api/SsoContext.java b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/api/SsoContext.java index 90c5db924b4..28592bc085a 100644 --- a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/api/SsoContext.java +++ b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/api/SsoContext.java @@ -227,7 +227,7 @@ public String getEngineUrl() { } public String getChangePasswordUrl() { - return changePasswordUrl; + return changePasswordUrl; } public void setScopeDependencies(Map> scopeDependenciesMap) { diff --git a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/api/SsoSession.java b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/api/SsoSession.java index fb8b3653094..5db1223e3ed 100644 --- a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/api/SsoSession.java +++ b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/api/SsoSession.java @@ -253,11 +253,11 @@ public Date getAuthTime() { } public String getLoginErrorCode() { - return loginErrorCode; + return loginErrorCode; } public void setLoginErrorCode(String loginErrorCode) { - this.loginErrorCode = loginErrorCode; + this.loginErrorCode = loginErrorCode; } public String getLoginMessage() { diff --git a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/service/ExternalOIDCService.java b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/service/ExternalOIDCService.java index ce1936122e4..972c9c5550c 100644 --- a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/service/ExternalOIDCService.java +++ b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/service/ExternalOIDCService.java @@ -128,7 +128,7 @@ private static SsoSession login(SsoContext ssoContext, // We should request this scope by RFC (https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest) // to have possibility for working with other oidc endpoints. - if ( ! scope.contains(OPENID_SCOPE)) { + if (!scope.contains(OPENID_SCOPE)) { scope = scope + " " + OPENID_SCOPE; } diff --git a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/service/NegotiateAuthService.java b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/service/NegotiateAuthService.java index 232f139779c..612acb06d12 100644 --- a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/service/NegotiateAuthService.java +++ b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/service/NegotiateAuthService.java @@ -106,71 +106,71 @@ private AuthResult doAuth(HttpServletRequest req, HttpServletResponse rsp, Deque retVal.setStatus(output. get(Authn.InvokeKeys.RESULT)); switch (output. get(Authn.InvokeKeys.RESULT)) { - case Authn.AuthResult.SUCCESS: - try { - ExtMap authRecord = output.get(Authn.InvokeKeys.AUTH_RECORD); - if (profile.getMapper() != null) { - authRecord = profile.getMapper() - .invoke( - new ExtMap().mput( - Base.InvokeKeys.COMMAND, - Mapping.InvokeCommands.MAP_AUTH_RECORD) - .mput( - Authn.InvokeKeys.AUTH_RECORD, - authRecord), - true) - .get( + case Authn.AuthResult.SUCCESS: + try { + ExtMap authRecord = output.get(Authn.InvokeKeys.AUTH_RECORD); + if (profile.getMapper() != null) { + authRecord = profile.getMapper() + .invoke( + new ExtMap().mput( + Base.InvokeKeys.COMMAND, + Mapping.InvokeCommands.MAP_AUTH_RECORD) + .mput( + Authn.InvokeKeys.AUTH_RECORD, + authRecord), + true) + .get( + Authn.InvokeKeys.AUTH_RECORD, + authRecord); + } + ExtMap input = new ExtMap().mput( + Base.InvokeKeys.COMMAND, + Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD) + .mput( Authn.InvokeKeys.AUTH_RECORD, - authRecord); + authRecord) + .mput( + Authz.InvokeKeys.QUERY_FLAGS, + Authz.QueryFlags.RESOLVE_GROUPS | Authz.QueryFlags.RESOLVE_GROUPS_RECURSIVE); + if (SsoService.getSsoContext(req) + .getSsoLocalConfig() + .getBoolean("ENGINE_SSO_ENABLE_EXTERNAL_SSO")) { + input.put(Authz.InvokeKeys.HTTP_SERVLET_REQUEST, req); + } + ExtMap outputMap = profile.getAuthz().invoke(input); + token = SsoService.getTokenFromHeader(req); + SsoSession ssoSession = SsoService.persistAuthInfoInContextWithToken(req, + token, + null, + profile.getName(), + authRecord, + outputMap.get(Authz.InvokeKeys.PRINCIPAL_RECORD)); + log.info("User {}@{} with profile [{}] successfully logged in with scopes : {} ", + SsoService.getUserId(outputMap.get(Authz.InvokeKeys.PRINCIPAL_RECORD)), + profile.getAuthzName(), + profile.getName(), + ssoSession.getScope()); + token = (String) req.getAttribute(SsoConstants.HTTP_REQ_ATTR_ACCESS_TOKEN); + stack.clear(); + } catch (Exception e) { + log.debug("Cannot fetch principal, trying other authn extension."); + stack.pop(); } - ExtMap input = new ExtMap().mput( - Base.InvokeKeys.COMMAND, - Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD) - .mput( - Authn.InvokeKeys.AUTH_RECORD, - authRecord) - .mput( - Authz.InvokeKeys.QUERY_FLAGS, - Authz.QueryFlags.RESOLVE_GROUPS | Authz.QueryFlags.RESOLVE_GROUPS_RECURSIVE); - if (SsoService.getSsoContext(req) - .getSsoLocalConfig() - .getBoolean("ENGINE_SSO_ENABLE_EXTERNAL_SSO")) { - input.put(Authz.InvokeKeys.HTTP_SERVLET_REQUEST, req); - } - ExtMap outputMap = profile.getAuthz().invoke(input); - token = SsoService.getTokenFromHeader(req); - SsoSession ssoSession = SsoService.persistAuthInfoInContextWithToken(req, - token, - null, - profile.getName(), - authRecord, - outputMap.get(Authz.InvokeKeys.PRINCIPAL_RECORD)); - log.info("User {}@{} with profile [{}] successfully logged in with scopes : {} ", - SsoService.getUserId(outputMap.get(Authz.InvokeKeys.PRINCIPAL_RECORD)), - profile.getAuthzName(), - profile.getName(), - ssoSession.getScope()); - token = (String) req.getAttribute(SsoConstants.HTTP_REQ_ATTR_ACCESS_TOKEN); - stack.clear(); - } catch (Exception e) { - log.debug("Cannot fetch principal, trying other authn extension."); + break; + + case Authn.AuthResult.NEGOTIATION_UNAUTHORIZED: + stack.pop(); + break; + + case Authn.AuthResult.NEGOTIATION_INCOMPLETE: + stop = true; + break; + + default: + log.error("Unexpected authentication result. AuthResult code: {}", + output. get(Authn.InvokeKeys.RESULT)); stack.pop(); - } - break; - - case Authn.AuthResult.NEGOTIATION_UNAUTHORIZED: - stack.pop(); - break; - - case Authn.AuthResult.NEGOTIATION_INCOMPLETE: - stop = true; - break; - - default: - log.error("Unexpected authentication result. AuthResult code: {}", - output. get(Authn.InvokeKeys.RESULT)); - stack.pop(); - break; + break; } } if (!stack.isEmpty()) { diff --git a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/servlets/InteractiveNegotiateAuthServlet.java b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/servlets/InteractiveNegotiateAuthServlet.java index 6186516b856..950984138c8 100644 --- a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/servlets/InteractiveNegotiateAuthServlet.java +++ b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/servlets/InteractiveNegotiateAuthServlet.java @@ -21,18 +21,18 @@ public class InteractiveNegotiateAuthServlet extends HttpServlet { protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { switch (SsoService.getSsoContext(request).getNegotiateAuthUtils().doAuth(request, response).getStatus()) { - case Authn.AuthResult.NEGOTIATION_UNAUTHORIZED: - log.debug("External authentication failed redirecting to url: {}", - SsoConstants.INTERACTIVE_LOGIN_NEXT_AUTH_URI); - response.sendRedirect(request.getContextPath() + SsoConstants.INTERACTIVE_LOGIN_NEXT_AUTH_URI); - break; - case Authn.AuthResult.SUCCESS: - log.debug("External authentication succeeded redirecting to module"); - response.sendRedirect(request.getContextPath() + SsoConstants.INTERACTIVE_REDIRECT_TO_MODULE_URI); - break; - case Authn.AuthResult.NEGOTIATION_INCOMPLETE: - log.debug("External authentication incomplete"); - break; + case Authn.AuthResult.NEGOTIATION_UNAUTHORIZED: + log.debug("External authentication failed redirecting to url: {}", + SsoConstants.INTERACTIVE_LOGIN_NEXT_AUTH_URI); + response.sendRedirect(request.getContextPath() + SsoConstants.INTERACTIVE_LOGIN_NEXT_AUTH_URI); + break; + case Authn.AuthResult.SUCCESS: + log.debug("External authentication succeeded redirecting to module"); + response.sendRedirect(request.getContextPath() + SsoConstants.INTERACTIVE_REDIRECT_TO_MODULE_URI); + break; + case Authn.AuthResult.NEGOTIATION_INCOMPLETE: + log.debug("External authentication incomplete"); + break; } } } diff --git a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/servlets/OAuthTokenServlet.java b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/servlets/OAuthTokenServlet.java index 71826897b9a..06629eb0d6a 100644 --- a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/servlets/OAuthTokenServlet.java +++ b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/servlets/OAuthTokenServlet.java @@ -67,26 +67,26 @@ protected void handleRequest(HttpServletRequest request, HttpServletResponse res String scope = SsoService.getScopeRequestParameter(request, ""); switch (grantType) { - case "authorization_code": - issueTokenForAuthCode(request, response, scope); - break; - case "password": - if (SsoService.getSsoContext(request).getSsoLocalConfig().getBoolean("ENGINE_SSO_ENABLE_EXTERNAL_SSO")) { - ExternalOIDCService.issueTokenUsingExternalOIDC(ssoContext, request, response); - } else { - handlePasswordGrantType(request, response, scope); - } - break; - case "urn:ovirt:params:oauth:grant-type:http": - if (SsoService.getSsoContext(request).getSsoLocalConfig().getBoolean("ENGINE_SSO_ENABLE_EXTERNAL_SSO")) { - ExternalOIDCService.issueTokenUsingExternalOIDC(ssoContext, request, response); - } else { - issueTokenUsingHttpHeaders(request, response); - } - break; - default: - throw new OAuthException(SsoConstants.ERR_CODE_UNSUPPORTED_GRANT_TYPE, - SsoConstants.ERR_CODE_UNSUPPORTED_GRANT_TYPE_MSG); + case "authorization_code": + issueTokenForAuthCode(request, response, scope); + break; + case "password": + if (SsoService.getSsoContext(request).getSsoLocalConfig().getBoolean("ENGINE_SSO_ENABLE_EXTERNAL_SSO")) { + ExternalOIDCService.issueTokenUsingExternalOIDC(ssoContext, request, response); + } else { + handlePasswordGrantType(request, response, scope); + } + break; + case "urn:ovirt:params:oauth:grant-type:http": + if (SsoService.getSsoContext(request).getSsoLocalConfig().getBoolean("ENGINE_SSO_ENABLE_EXTERNAL_SSO")) { + ExternalOIDCService.issueTokenUsingExternalOIDC(ssoContext, request, response); + } else { + issueTokenUsingHttpHeaders(request, response); + } + break; + default: + throw new OAuthException(SsoConstants.ERR_CODE_UNSUPPORTED_GRANT_TYPE, + SsoConstants.ERR_CODE_UNSUPPORTED_GRANT_TYPE_MSG); } } diff --git a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/servlets/OpenIdAuthorizeServlet.java b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/servlets/OpenIdAuthorizeServlet.java index cc2f0216c22..5cb14ab6704 100644 --- a/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/servlets/OpenIdAuthorizeServlet.java +++ b/backend/manager/modules/enginesso/src/main/java/org/ovirt/engine/core/sso/servlets/OpenIdAuthorizeServlet.java @@ -82,17 +82,17 @@ protected void login( log.debug("Entered login queryString: {}", request.getQueryString()); switch (ssoSession.getStatus()) { - case unauthenticated: - if (StringUtils.isNotEmpty(ssoSession.getAccessToken()) && - StringUtils.isNotEmpty(ssoSession.getAuthorizationCode())) { - ssoSession = (SsoSession) ssoSession.clone(); - request.getSession().setAttribute(SsoConstants.OVIRT_SSO_SESSION, ssoSession); - } - break; - case authenticated: - ssoSession.setTokenIssued(false); - ssoSession.setActive(true); - break; + case unauthenticated: + if (StringUtils.isNotEmpty(ssoSession.getAccessToken()) && + StringUtils.isNotEmpty(ssoSession.getAuthorizationCode())) { + ssoSession = (SsoSession) ssoSession.clone(); + request.getSession().setAttribute(SsoConstants.OVIRT_SSO_SESSION, ssoSession); + } + break; + case authenticated: + ssoSession.setTokenIssued(false); + ssoSession.setActive(true); + break; } super.login(request, response, ssoSession); diff --git a/backend/manager/modules/extensions-manager/src/main/java/org/ovirt/engine/core/extensions/mgr/ExtensionProxy.java b/backend/manager/modules/extensions-manager/src/main/java/org/ovirt/engine/core/extensions/mgr/ExtensionProxy.java index 2f076b044e1..46719dc4278 100644 --- a/backend/manager/modules/extensions-manager/src/main/java/org/ovirt/engine/core/extensions/mgr/ExtensionProxy.java +++ b/backend/manager/modules/extensions-manager/src/main/java/org/ovirt/engine/core/extensions/mgr/ExtensionProxy.java @@ -74,28 +74,28 @@ public ExtMap invoke(ExtMap input, boolean allowUnsupported, boolean allowFail) String message = output.get(Base.InvokeKeys.MESSAGE); switch (output.get(Base.InvokeKeys.RESULT, Base.InvokeResult.FAILED)) { - case Base.InvokeResult.SUCCESS: - break; - case Base.InvokeResult.UNSUPPORTED: - if (!allowUnsupported) { - throw new ExtensionInvokeCommandUnsupportedException( - message == null ? "Unsupported command" : message, - input, - output - ); - } - break; - case Base.InvokeResult.FAILED: - default: - if (!allowFail) { - throw new ExtensionInvokeCommandFailedException( - message == null ? "Invoke failed" : message, - input, - output, - output.get(ExtensionsManager.CAUSE_OUTPUT_KEY) - ); - } - break; + case Base.InvokeResult.SUCCESS: + break; + case Base.InvokeResult.UNSUPPORTED: + if (!allowUnsupported) { + throw new ExtensionInvokeCommandUnsupportedException( + message == null ? "Unsupported command" : message, + input, + output + ); + } + break; + case Base.InvokeResult.FAILED: + default: + if (!allowFail) { + throw new ExtensionInvokeCommandFailedException( + message == null ? "Invoke failed" : message, + input, + output, + output.get(ExtensionsManager.CAUSE_OUTPUT_KEY) + ); + } + break; } return output; diff --git a/backend/manager/modules/extensions-manager/src/main/java/org/ovirt/engine/core/extensions/mgr/ExtensionsManager.java b/backend/manager/modules/extensions-manager/src/main/java/org/ovirt/engine/core/extensions/mgr/ExtensionsManager.java index ff0a6c2b0a8..a60ad349904 100644 --- a/backend/manager/modules/extensions-manager/src/main/java/org/ovirt/engine/core/extensions/mgr/ExtensionsManager.java +++ b/backend/manager/modules/extensions-manager/src/main/java/org/ovirt/engine/core/extensions/mgr/ExtensionsManager.java @@ -224,7 +224,7 @@ private synchronized String loadImpl(Properties props, File confFile) { ).mput( Base.ContextKeys.PROVIDES, splitString(props.getProperty(Base.ConfigKeys.PROVIDES, "")) - ); + ); log.info("Loading extension '{}'", entry.name); ExtMap output = entry.extension.invoke( @@ -245,14 +245,14 @@ private synchronized String loadImpl(Properties props, File confFile) { entry.extension.getContext().get(Base.ContextKeys.INSTANCE_NAME) ) ) - ); - if (output.get(Base.InvokeKeys.RESULT) != Base.InvokeResult.SUCCESS) { - throw new RuntimeException( + ); + if (output.get(Base.InvokeKeys.RESULT) != Base.InvokeResult.SUCCESS) { + throw new RuntimeException( String.format("Invoke of LOAD returned with error code: %1$s", output.get(Base.InvokeKeys.RESULT) ) - ); - } + ); + } } catch (Exception e) { throw new RuntimeException(String.format("Error loading extension '%1$s': %2$s", entry.name, e.getMessage()), e); } @@ -341,7 +341,7 @@ globalContext.> get(Base.GlobalContextKeys.EXTENSIONS).add( Base.ExtensionRecord.CONTEXT, entry.extension.getContext() ) - ); + ); } setChanged(); notifyObservers(); @@ -373,7 +373,7 @@ public void dump() { emptyIfNull(context.get(Base.ContextKeys.BUILD_INTERFACE_VERSION)), entry.getFileName(), entry.initialized - ); + ); } } log.info("End of enabled extensions list"); diff --git a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/ParamData.java b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/ParamData.java index ce5fe8fdc27..ff6590ca345 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/ParamData.java +++ b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/ParamData.java @@ -39,4 +39,4 @@ public String getValue() { public void setValue(String value) { this.value = value; } - } +} diff --git a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlBuilder.java b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlBuilder.java index a1c555ba62e..d3156b6e95c 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlBuilder.java +++ b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlBuilder.java @@ -153,9 +153,9 @@ public String getDescription() { @Override public String toString() { - return "RSDL Href: " + getHref() + - ", Description:" + getDescription() + - ", Links: " + (rsdl != null ? rsdl.isSetLinks() ? rsdl.getLinks().getLinks().size() : "0" : "0") + "."; + return "RSDL Href: " + getHref() + + ", Description:" + getDescription() + + ", Links: " + (rsdl != null ? rsdl.isSetLinks() ? rsdl.getLinks().getLinks().size() : "0" : "0") + "."; } public class LinkBuilder { @@ -649,7 +649,7 @@ private void addUrlParams(DetailedLink link, Action action) { if (action.getRequest().getUrlparams() != null && !action.getRequest().getUrlparams().isEmpty()) { link.getRequest().setUrl(new Url()); ParametersSet ps = new ParametersSet(); - for (Object key : action.getRequest().getUrlparams().keySet()) { + for (Object key : action.getRequest().getUrlparams().keySet()) { Parameter param = new Parameter(); param.setName(key.toString()); Object value = action.getRequest().getUrlparams().get(key); @@ -814,7 +814,7 @@ private DetailedLink decideWhichToDelete(DetailedLink link1, DetailedLink link2) && link2.getRequest().getBody().isRequired() != null && Boolean.FALSE.equals(link1.getRequest().getBody().isRequired()) && Boolean.FALSE.equals(link2.getRequest().getBody().isRequired()) - ) { + ) { if (link1ParamType != null && link2ParamType == null) { return link2; } diff --git a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlManager.java b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlManager.java index 8a9cfda398e..e1c829d62be 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlManager.java +++ b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlManager.java @@ -86,16 +86,16 @@ private static void serializeRsdl(Rsdl rsdl, String rsdlLocation) { private static Rsdl buildRsdl(MetaData metadata, List rels) throws IOException, ClassNotFoundException { RsdlBuilder builder = new RsdlBuilder(rels, metadata) - .description(RSDL_DESCRIPTION) - .rel(RSDL_REL) + .description(RSDL_DESCRIPTION) + .rel(RSDL_REL) .href(QUERY_PARAMETER + RSDL_CONSTRAINT_PARAMETER) - .schema(new SchemaBuilder() + .schema(new SchemaBuilder() .rel(SCHEMA_REL) .href(QUERY_PARAMETER + SCHEMA_CONSTRAINT_PARAMETER) .name(SCHEMA_NAME) .description(SCHEMA_DESCRIPTION) .build()) - .generalMetadata(new GeneralMetadataBuilder() + .generalMetadata(new GeneralMetadataBuilder() .rel(GENERAL_METADATA_REL) .href("*") .name(GENERAL_METADATA_NAME) diff --git a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/SchemaBuilder.java b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/SchemaBuilder.java index 765ff348c47..d971e629aaa 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/SchemaBuilder.java +++ b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/SchemaBuilder.java @@ -16,7 +16,7 @@ public SchemaBuilder() { } public Schema build() { - return this.schema; + return this.schema; } public SchemaBuilder description(String description) { diff --git a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/utils/ArrayUtils.java b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/utils/ArrayUtils.java index 0354e53baf2..b6e8d596bd5 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/utils/ArrayUtils.java +++ b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/utils/ArrayUtils.java @@ -7,5 +7,5 @@ public static T[] concat(T[] first, T[] second) { T[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; - } + } } diff --git a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/utils/InvalidValueException.java b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/utils/InvalidValueException.java index 295940d6efe..439a704ddeb 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/utils/InvalidValueException.java +++ b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/utils/InvalidValueException.java @@ -3,7 +3,7 @@ public class InvalidValueException extends RuntimeException { public InvalidValueException(String msg) { - super(msg); + super(msg); } } diff --git a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/utils/LinkCreator.java b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/utils/LinkCreator.java index 597f26d2eb2..00acc475c6f 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/utils/LinkCreator.java +++ b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/utils/LinkCreator.java @@ -113,11 +113,11 @@ public static String combine(String head, String tail) { public static String combine(String head, List params) { StringBuilder combined_params = new StringBuilder(); if (params != null) { - for (ParametersSet ps : params) { - for (Parameter param : ps.getParameters()) { - combined_params.append(String.format(MATRIX_PARAMETER_TEMPLATE, param.getName(), param.getValue())); - } - } + for (ParametersSet ps : params) { + for (Parameter param : ps.getParameters()) { + combined_params.append(String.format(MATRIX_PARAMETER_TEMPLATE, param.getName(), param.getValue())); + } + } } combined_params.insert(0, head); return combined_params.toString(); diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/invocation/CurrentFilter.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/invocation/CurrentFilter.java index 9dd41a9e5d3..d9e4cc71ef1 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/invocation/CurrentFilter.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/invocation/CurrentFilter.java @@ -115,7 +115,7 @@ private ApplicationMode findApplicationMode(String sessionId) { ConfigCommon.defaultConfigurationVersion ); parameters.setSessionId(sessionId); - QueryReturnValue result = backend.runPublicQuery( QueryType.GetConfigurationValue, parameters); + QueryReturnValue result = backend.runPublicQuery(QueryType.GetConfigurationValue, parameters); return ApplicationMode.from(result.getReturnValue()); } @@ -133,21 +133,21 @@ private String getRoot(HttpServletRequest request) { buffer.append(host); int port = request.getServerPort(); switch (scheme) { - case "http": - if (port != 80) { + case "http": + if (port != 80) { + buffer.append(":"); + buffer.append(port); + } + break; + case "https": + if (port != 443) { + buffer.append(":"); + buffer.append(port); + } + break; + default: buffer.append(":"); buffer.append(port); - } - break; - case "https": - if (port != 443) { - buffer.append(":"); - buffer.append(port); - } - break; - default: - buffer.append(":"); - buffer.append(port); } return buffer.toString(); } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendActionableResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendActionableResource.java index 6fecf960eb9..089c2e1f3ef 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendActionableResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendActionableResource.java @@ -138,17 +138,17 @@ public ActionResource getActionResource(String action, String oid) { // resource should never be queried) // return new ActionResource() { - @Override - public Response get() { - URI uri = URI.create(LinkHelper.addLinks(newModel(id)).getHref()); - Response.Status status = Response.Status.MOVED_PERMANENTLY; - return Response.status(status).location(uri).build(); - } - @Override - public Action getAction() { - return null; - } - }; + @Override + public Response get() { + URI uri = URI.create(LinkHelper.addLinks(newModel(id)).getHref()); + Response.Status status = Response.Status.MOVED_PERMANENTLY; + return Response.status(status).location(uri).build(); + } + @Override + public Action getAction() { + return null; + } + }; } @@ -232,8 +232,8 @@ protected Guid lookupStorageDomainIdByName(String name) { StorageDomainStatic storageDomain = getEntity(org.ovirt.engine.core.common.businessentities.StorageDomainStatic.class, QueryType.GetStorageDomainByName, - new NameQueryParameters(name), - "Storage: name=" + name); + new NameQueryParameters(name), + "Storage: name=" + name); if (storageDomain != null) { return storageDomain.getId(); diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendResource.java index 24f4d73517c..8fbc45d84f3 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendResource.java @@ -309,7 +309,7 @@ private boolean shouldExclude(String member, String[] subCollectionMembersToExcl if (subCollectionMembersToExclude != null && subCollectionMembersToExclude.length > 0) { for (String excludeMember : subCollectionMembersToExclude) { if (member.equals(excludeMember)) { - return true; + return true; } } } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendStorageDomainContentsResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendStorageDomainContentsResource.java index 85235f4ff94..ad7e4e0e68d 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendStorageDomainContentsResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendStorageDomainContentsResource.java @@ -89,15 +89,15 @@ public List getCollection(StorageDomainType storageDomainType) { Collection entities = new ArrayList<>(); switch (storageDomainType) { - case Data: - case Master: - entities = getEntitiesFromDataDomain(); - break; - case ImportExport: - entities = getEntitiesFromExportDomain(); - break; - case ISO: - case Unknown: + case Data: + case Master: + entities = getEntitiesFromDataDomain(); + break; + case ImportExport: + entities = getEntitiesFromExportDomain(); + break; + case ISO: + case Unknown: } List collection = new ArrayList<>(); diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendApiResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendApiResource.java index e378b9da67b..f704878f308 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendApiResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendApiResource.java @@ -168,7 +168,7 @@ private Template createBlankTemplate() { Template template = new Template(); String id = "00000000-0000-0000-0000-000000000000"; template.setId(id); - template.setHref(getAbsolutePath( "templates", id)); + template.setHref(getAbsolutePath("templates", id)); return template; } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendAssignedPermissionsResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendAssignedPermissionsResource.java index 6b455fb3da0..ca29656ec8e 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendAssignedPermissionsResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendAssignedPermissionsResource.java @@ -109,9 +109,9 @@ public PermissionResource getPermissionResource(String id) { protected Permissions mapCollection(Set entities) { Permissions collection = new Permissions(); for (org.ovirt.engine.core.common.businessentities.Permission entity : entities) { - castEveryonePermissionsToUser(entity); - Permission permission = map(entity, getUserById(entity.getAdElementId())); - collection.getPermissions().add(addLinks(permission, permission.getUser() != null ? suggestedParentType : Group.class)); + castEveryonePermissionsToUser(entity); + Permission permission = map(entity, getUserById(entity.getAdElementId())); + collection.getPermissions().add(addLinks(permission, permission.getUser() != null ? suggestedParentType : Group.class)); } return collection; } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterFeaturesResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterFeaturesResource.java index c196f9ea8bd..a0195a76f1b 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterFeaturesResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterFeaturesResource.java @@ -14,7 +14,7 @@ import org.ovirt.engine.core.common.businessentities.AdditionalFeature; public class BackendClusterFeaturesResource extends AbstractBackendCollectionResource -implements ClusterFeaturesResource { + implements ClusterFeaturesResource { private String version; public BackendClusterFeaturesResource(String version) { diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterLevelsResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterLevelsResource.java index 478c1dbad66..e5b3dcf731d 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterLevelsResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterLevelsResource.java @@ -70,9 +70,9 @@ public ClusterLevel makeClusterLevel(String version) { private List getServerCpuList(String version) { return getEntity( - List.class, QueryType.GetAllServerCpuList, - new GetAllServerCpuListParameters(new Version(version)), - version + List.class, QueryType.GetAllServerCpuList, + new GetAllServerCpuListParameters(new Version(version)), + version ); } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterResource.java index 2d5a5a01d0d..a58c57d57bf 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendClusterResource.java @@ -177,7 +177,7 @@ public Response remove() { @Override public ClusterEnabledFeaturesResource getEnabledFeaturesResource() { - return inject(new BackendClusterEnabledFeaturesResource(guid)); + return inject(new BackendClusterEnabledFeaturesResource(guid)); } @Override diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendDataCenterResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendDataCenterResource.java index e39d8301fa6..1f0485cd8d4 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendDataCenterResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendDataCenterResource.java @@ -82,7 +82,7 @@ public ClustersResource getClustersResource() { @Override public QuotasResource getQuotasResource() { - return inject(new BackendQuotasResource(id)); + return inject(new BackendQuotasResource(id)); } @Override diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java index edfd12b50da..4bfd2dd42e3 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java @@ -506,7 +506,7 @@ public Response unregisteredStorageDomainsDiscover(Action action) { storageServerConnections.add(connectionDetails); } } - } else { + } else { // For FC we don't need to do anything. } GetUnregisteredBlockStorageDomainsParameters unregisteredBlockStorageDomainsParameters = @@ -633,18 +633,18 @@ public Response fence(Action action) { FenceType fenceType = validateEnum(FenceType.class, action.getFenceType().toUpperCase()); switch (fenceType) { - case MANUAL: - return fenceManually(action); - case RESTART: - return fenceRestart(action); - case START: - return fence(action, ActionType.StartVds); - case STOP: - return fence(action, ActionType.StopVds); - case STATUS: - return getFenceStatus(action); - default: - return null; + case MANUAL: + return fenceManually(action); + case RESTART: + return fenceRestart(action); + case START: + return fence(action, ActionType.StartVds); + case STOP: + return fence(action, ActionType.StopVds); + case STATUS: + return getFenceStatus(action); + default: + return null; } } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendImageTransferResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendImageTransferResource.java index e762bb91d94..cfae1b73b84 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendImageTransferResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendImageTransferResource.java @@ -23,8 +23,7 @@ public BackendImageTransferResource(String id) { } @Override - public - ImageTransfer get() { + public ImageTransfer get() { return performGet(QueryType.GetImageTransferById, new IdQueryParameters(guid)); } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendInstanceTypeGraphicsConsolesResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendInstanceTypeGraphicsConsolesResource.java index 9e3e1c11f1b..7627440ca10 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendInstanceTypeGraphicsConsolesResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendInstanceTypeGraphicsConsolesResource.java @@ -42,7 +42,7 @@ public GraphicsConsoles list() { // be detected as parent and the link would contain 'null'. org.ovirt.engine.api.model.InstanceType.class )) - ); + ); return consoles; } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendJobResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendJobResource.java index b4c0f984eab..65016209b4c 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendJobResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendJobResource.java @@ -45,10 +45,10 @@ public Response clear(Action action) { public Job get() { IdQueryParameters params = new IdQueryParameters(guid); return performGet(QueryType.GetJobByJobId, params); - } + } @Override public StepsResource getStepsResource() { - return inject(new BackendStepsResource(guid)); + return inject(new BackendStepsResource(guid)); } } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendQosResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendQosResource.java index 6c3c3215e98..4b0caad9aa9 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendQosResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendQosResource.java @@ -53,16 +53,16 @@ public Qos update(final Qos incoming) { private ActionType updateActionTypeForQosType(QosType qosType) { switch (qosType) { - case STORAGE: - return ActionType.UpdateStorageQos; - case CPU: - return ActionType.UpdateCpuQos; - case NETWORK: - return ActionType.UpdateNetworkQoS; - case HOSTNETWORK: - return ActionType.UpdateHostNetworkQos; - default: - throw new IllegalArgumentException("Unsupported QoS type \"" + qosType + "\""); + case STORAGE: + return ActionType.UpdateStorageQos; + case CPU: + return ActionType.UpdateCpuQos; + case NETWORK: + return ActionType.UpdateNetworkQoS; + case HOSTNETWORK: + return ActionType.UpdateHostNetworkQos; + default: + throw new IllegalArgumentException("Unsupported QoS type \"" + qosType + "\""); } } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendQossResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendQossResource.java index a9cb52b82a9..3272fdb8c80 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendQossResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendQossResource.java @@ -55,31 +55,31 @@ public Response add(Qos qos) { private QosBase createNewQosEntityForQosType(QosType qosType) { switch (qosType) { - case STORAGE: - return new StorageQos(); - case CPU: - return new CpuQos(); - case NETWORK: - return new NetworkQoS(); - case HOSTNETWORK: - return new HostNetworkQos(); - default: - throw new IllegalArgumentException("Unsupported QoS type \"" + qosType + "\""); + case STORAGE: + return new StorageQos(); + case CPU: + return new CpuQos(); + case NETWORK: + return new NetworkQoS(); + case HOSTNETWORK: + return new HostNetworkQos(); + default: + throw new IllegalArgumentException("Unsupported QoS type \"" + qosType + "\""); } } private ActionType addActionTypeForQosType(QosType qosType) { switch (qosType) { - case STORAGE: - return ActionType.AddStorageQos; - case CPU: - return ActionType.AddCpuQos; - case NETWORK: - return ActionType.AddNetworkQoS; - case HOSTNETWORK: - return ActionType.AddHostNetworkQos; - default: - throw new IllegalArgumentException("Unsupported QoS type \"" + qosType + "\""); + case STORAGE: + return ActionType.AddStorageQos; + case CPU: + return ActionType.AddCpuQos; + case NETWORK: + return ActionType.AddNetworkQoS; + case HOSTNETWORK: + return ActionType.AddHostNetworkQos; + default: + throw new IllegalArgumentException("Unsupported QoS type \"" + qosType + "\""); } } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendResource.java index 78109318ee1..ba8675c2f26 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendResource.java @@ -151,7 +151,7 @@ protected List getBackendCollection(Class clz, QueryType query, QueryP try { List results = asCollection(clz, new ArrayList()); QueryReturnValue result = runQuery(query, queryParams); - if (result != null ) { + if (result != null) { if (!result.getSucceeded()) { backendFailure(result.getExceptionString()); } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStepResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStepResource.java index 70e642d95d6..432242e3d50 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStepResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStepResource.java @@ -98,28 +98,28 @@ public GlusterVolumeTaskStatusEntity resolve(Guid id) throws BackendFailureExcep } switch (stepEntity.getStepType()) { - case REBALANCING_VOLUME: - GlusterVolumeTaskStatusEntity rebalanceStatusEntity = getEntity(GlusterVolumeTaskStatusEntity.class, - QueryType.GetGlusterVolumeRebalanceStatus, - new GlusterVolumeQueriesParameters(volume.getClusterId(), volume.getId()), - null, - true); - return rebalanceStatusEntity; - case REMOVING_BRICKS: - List bricks = new ArrayList<>(); - for (GlusterBrickEntity brick: volume.getBricks()) { - if (brick.getAsyncTask() != null && brick.getAsyncTask().getTaskId() != null) { - bricks.add(brick); + case REBALANCING_VOLUME: + GlusterVolumeTaskStatusEntity rebalanceStatusEntity = getEntity(GlusterVolumeTaskStatusEntity.class, + QueryType.GetGlusterVolumeRebalanceStatus, + new GlusterVolumeQueriesParameters(volume.getClusterId(), volume.getId()), + null, + true); + return rebalanceStatusEntity; + case REMOVING_BRICKS: + List bricks = new ArrayList<>(); + for (GlusterBrickEntity brick: volume.getBricks()) { + if (brick.getAsyncTask() != null && brick.getAsyncTask().getTaskId() != null) { + bricks.add(brick); + } } - } - GlusterVolumeTaskStatusEntity removeBricksStatusEntity = getEntity(GlusterVolumeTaskStatusEntity.class, - QueryType.GetGlusterVolumeRemoveBricksStatus, - new GlusterVolumeRemoveBricksQueriesParameters(volume.getClusterId(), volume.getId(), bricks), - null, - true); - return removeBricksStatusEntity; - default: - break; + GlusterVolumeTaskStatusEntity removeBricksStatusEntity = getEntity(GlusterVolumeTaskStatusEntity.class, + QueryType.GetGlusterVolumeRemoveBricksStatus, + new GlusterVolumeRemoveBricksQueriesParameters(volume.getClusterId(), volume.getId(), bricks), + null, + true); + return removeBricksStatusEntity; + default: + break; } return null; diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStepsResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStepsResource.java index 83a38374289..4f632d35349 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStepsResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStepsResource.java @@ -66,7 +66,7 @@ protected Steps mapCollection(List entiti public Step injectParent(Step step) { if (step.getParentStep() != null) { step.getParentStep() - .setHref(step.getHref() + .setHref(step.getHref() .replace(step.getId(), step.getParentStep().getId())); } return step; diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainDiskSnapshotsResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainDiskSnapshotsResource.java index 1da4a3e43db..3be887fb0bf 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainDiskSnapshotsResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainDiskSnapshotsResource.java @@ -29,8 +29,8 @@ public BackendStorageDomainDiskSnapshotsResource(Guid storageDomainId, String... @Override public DiskSnapshots list() { - return mapCollection(getBackendCollection(QueryType.GetAllDiskSnapshotsByStorageDomainId, - new DiskSnapshotsQueryParameters(this.storageDomainId, includeActive(), includeTemplate()))); + return mapCollection(getBackendCollection(QueryType.GetAllDiskSnapshotsByStorageDomainId, + new DiskSnapshotsQueryParameters(this.storageDomainId, includeActive(), includeTemplate()))); } protected DiskSnapshots mapCollection(List entities) { diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainResource.java index a07566c8c28..8ac00433f80 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainResource.java @@ -89,12 +89,12 @@ public StorageDomain update(StorageDomain incoming) { StorageType storageType = entity.getStorageType(); if (storageType != null) { switch (storageType) { - case ISCSI: - case FCP: - extendStorageDomain(incoming, model); - break; - default: - break; + case ISCSI: + case FCP: + extendStorageDomain(incoming, model); + break; + default: + break; } } @@ -234,7 +234,7 @@ public static synchronized String[] getLinksToExclude(StorageDomain storageDomai return isIsoDomain(storageDomain) ? new String[] { "templates", "vms", "disks", "images" } : isExportDomain(storageDomain) ? new String[] { "files", "images" } : isImageDomain(storageDomain) ? new String[] { "templates", "vms", "files", "disks", - "storageconnections" } + "storageconnections" } : new String[] { "files", "images" }; } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainTemplateResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainTemplateResource.java index a47029f3671..9e0e937770e 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainTemplateResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainTemplateResource.java @@ -40,13 +40,13 @@ public BackendStorageDomainTemplateResource(BackendStorageDomainTemplatesResourc @Override public Template get() { switch (parent.getStorageDomainType()) { - case Data: - case Master: - return getFromDataDomain(); - case ImportExport: - return getFromExportDomain(); - default: - return null; + case Data: + case Master: + return getFromDataDomain(); + case ImportExport: + return getFromExportDomain(); + default: + return null; } } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainVmResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainVmResource.java index 19e0d147a5e..bbb4fdaa581 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainVmResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainVmResource.java @@ -54,13 +54,13 @@ public BackendStorageDomainVmResource(BackendStorageDomainVmsResource parent, St @Override public Vm get() { switch (parent.getStorageDomainType()) { - case Data: - case Master: - return getFromDataDomain(); - case ImportExport: - return getFromExportDomain(); - default: - return null; + case Data: + case Master: + return getFromDataDomain(); + case ImportExport: + return getFromExportDomain(); + default: + return null; } } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainsResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainsResource.java index 26d23e4eaec..d8a316d3d04 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainsResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainsResource.java @@ -291,44 +291,44 @@ public Response add(StorageDomain storageDomain) { StorageDomainStatic entity = mapToStatic(storageDomain); Response resp = null; switch (entity.getStorageType()) { - case ISCSI: - case FCP: - if (storageDomain.isSetImport() && storageDomain.isImport()) { - validateParameters(storageDomain, "id"); - resp = addExistingSAN(storageDomain, entity.getStorageType(), hostId); - } else { - resp = addSAN(storageDomain, entity.getStorageType(), entity, hostId); - } - break; - case NFS: - if (!storageConnectionFromUser.isSetId()) { - validateParameters(storageDomain.getStorage(), "address"); - } - resp = addDomain(ActionType.AddNFSStorageDomain, storageDomain, entity, hostId, cnx); - break; - case LOCALFS: - resp = addDomain(ActionType.AddLocalStorageDomain, storageDomain, entity, hostId, cnx); - break; - case POSIXFS: - if (!storageConnectionFromUser.isSetId()) { - validateParameters(storageDomain.getStorage(), "vfsType"); - } - resp = addDomain(ActionType.AddPosixFsStorageDomain, storageDomain, entity, hostId, cnx); - break; - case GLUSTERFS: - if (!storageConnectionFromUser.isSetId()) { - validateParameters(storageDomain.getStorage(), "vfsType"); - } - resp = addDomain(ActionType.AddGlusterFsStorageDomain, storageDomain, entity, hostId, cnx); - break; - case MANAGED_BLOCK_STORAGE: - resp = addManagedBlockStorageDomain(ActionType.AddManagedBlockStorageDomain, - entity, - storageDomain.getStorage().getDriverOptions(), - storageDomain.getStorage().getDriverSensitiveOptions()); - break; - default: - break; + case ISCSI: + case FCP: + if (storageDomain.isSetImport() && storageDomain.isImport()) { + validateParameters(storageDomain, "id"); + resp = addExistingSAN(storageDomain, entity.getStorageType(), hostId); + } else { + resp = addSAN(storageDomain, entity.getStorageType(), entity, hostId); + } + break; + case NFS: + if (!storageConnectionFromUser.isSetId()) { + validateParameters(storageDomain.getStorage(), "address"); + } + resp = addDomain(ActionType.AddNFSStorageDomain, storageDomain, entity, hostId, cnx); + break; + case LOCALFS: + resp = addDomain(ActionType.AddLocalStorageDomain, storageDomain, entity, hostId, cnx); + break; + case POSIXFS: + if (!storageConnectionFromUser.isSetId()) { + validateParameters(storageDomain.getStorage(), "vfsType"); + } + resp = addDomain(ActionType.AddPosixFsStorageDomain, storageDomain, entity, hostId, cnx); + break; + case GLUSTERFS: + if (!storageConnectionFromUser.isSetId()) { + validateParameters(storageDomain.getStorage(), "vfsType"); + } + resp = addDomain(ActionType.AddGlusterFsStorageDomain, storageDomain, entity, hostId, cnx); + break; + case MANAGED_BLOCK_STORAGE: + resp = addManagedBlockStorageDomain(ActionType.AddManagedBlockStorageDomain, + entity, + storageDomain.getStorage().getDriverOptions(), + storageDomain.getStorage().getDriverSensitiveOptions()); + break; + default: + break; } if (resp != null) { @@ -353,18 +353,18 @@ protected StorageDomain map(org.ovirt.engine.core.common.businessentities.Storag // Mapping the connection properties only in case it is a non-filtered session if (!isFiltered()) { switch (entity.getStorageType()) { - case ISCSI: - mapVolumeGroupIscsi(model, entity); - break; - case FCP: - mapVolumeGroupFcp(model, entity); - break; - case NFS: - case LOCALFS: - case POSIXFS: - case GLUSTERFS: - mapFileDomain(model, entity); - break; + case ISCSI: + mapVolumeGroupIscsi(model, entity); + break; + case FCP: + mapVolumeGroupFcp(model, entity); + break; + case NFS: + case LOCALFS: + case POSIXFS: + case GLUSTERFS: + mapFileDomain(model, entity); + break; } } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionResource.java index b6fe26aba1f..8d8748661a3 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionResource.java @@ -86,7 +86,7 @@ public ActionParametersBase getParameters(StorageConnection incoming, StorageSer StorageServerConnections connection = map(incoming, entity); Guid hostId = Guid.Empty; if (incoming.getHost() != null) { - hostId = getHostId(incoming.getHost()); + hostId = getHostId(incoming.getHost()); } return new StorageServerConnectionParametersBase(connection, hostId, isForce()); } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionsResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionsResource.java index 8b301b45da9..a53b8f5ade3 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionsResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionsResource.java @@ -54,25 +54,25 @@ public Response add(StorageConnection storageConn) { Guid hostId = Guid.Empty; if (storageConn.getHost() != null) { - hostId = getHostId(storageConn.getHost()); + hostId = getHostId(storageConn.getHost()); } switch (storageConnection.getStorageType()) { - case ISCSI: - validateParameters(storageConn, "address", "target", "port"); - break; - case NFS: - validateParameters(storageConn, "address", "path"); - break; - case LOCALFS: - validateParameters(storageConn, "path"); - break; - case POSIXFS: - case GLUSTERFS: - // address is possible, but is optional, non mandatory - validateParameters(storageConn, "path", "vfsType"); - break; - default: - break; + case ISCSI: + validateParameters(storageConn, "address", "target", "port"); + break; + case NFS: + validateParameters(storageConn, "address", "path"); + break; + case LOCALFS: + validateParameters(storageConn, "path"); + break; + case POSIXFS: + case GLUSTERFS: + // address is possible, but is optional, non mandatory + validateParameters(storageConn, "path", "vfsType"); + break; + default: + break; } return performCreate(ActionType.AddStorageServerConnection, getAddParams(storageConnection, hostId), diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplateCdromResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplateCdromResource.java index 98cb8af8db7..584b3d702cd 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplateCdromResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplateCdromResource.java @@ -29,11 +29,11 @@ public BackendTemplateCdromResource(String cdromId, Guid templateId) { public Cdrom get() { GetVmTemplateParameters parameters = new GetVmTemplateParameters(templateId); VmTemplate entity = getEntity( - VmTemplate.class, - QueryType.GetVmTemplate, - parameters, - templateId.toString(), - true + VmTemplate.class, + QueryType.GetVmTemplate, + parameters, + templateId.toString(), + true ); return addLinks(populate(map(entity), entity)); } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplateGraphicsConsolesResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplateGraphicsConsolesResource.java index 3d7d6d7e378..815b1a4e300 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplateGraphicsConsolesResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplateGraphicsConsolesResource.java @@ -39,7 +39,7 @@ public GraphicsConsoles list() { populate(VmMapper.map(graphicsInfo, null), entity), Template.class )) - ); + ); return consoles; } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmBackupDiskResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmBackupDiskResource.java index a3eaa9d9243..2207f6a3f94 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmBackupDiskResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmBackupDiskResource.java @@ -21,4 +21,4 @@ public Disk get() { protected Disk getDisk() { return performGet(QueryType.GetDiskByDiskId, new IdQueryParameters(guid)); } - } +} diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmCheckpointDiskResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmCheckpointDiskResource.java index a2e0353caf8..76df0a8a188 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmCheckpointDiskResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmCheckpointDiskResource.java @@ -21,4 +21,4 @@ public Disk get() { protected Disk getDisk() { return performGet(QueryType.GetDiskByDiskId, new IdQueryParameters(guid)); } - } +} diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java index 4b7afdf1c70..c16779f5900 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java @@ -395,7 +395,7 @@ public Response doClone(Action action) { org.ovirt.engine.core.common.businessentities.VM.class, QueryType.GetVmByVmId, new IdQueryParameters(guid), "VM: id=" + guid); - CloneVmParameters cloneVmParameters = new CloneVmParameters(vm, action.getVm().getName()); + CloneVmParameters cloneVmParameters = new CloneVmParameters(vm, action.getVm().getName()); cloneVmParameters.setMakeCreatorExplicitOwner(isFiltered()); if (action.isSetStorageDomain() && getStorageDomainId(action) != null) { cloneVmParameters.setDestStorageDomainId(getStorageDomainId(action)); diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmSessionsResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmSessionsResource.java index 5ae7d830845..0c5a15d4d73 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmSessionsResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmSessionsResource.java @@ -138,9 +138,9 @@ private void setSessionUser(Session session) { } private void addLinkToUser(Session session) { - ServiceTreeNode node = ServiceTree.getNode(UsersResource.class); - String href = CurrentManager.get().getAbsolutePath(node.getPath(), session.getUser().getId()); - session.getUser().setHref(href); + ServiceTreeNode node = ServiceTree.getNode(UsersResource.class); + String href = CurrentManager.get().getAbsolutePath(node.getPath(), session.getUser().getId()); + session.getUser().setHref(href); } private BackendUserResource getUserResource() { diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BrickStatisticalQuery.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BrickStatisticalQuery.java index 77bb98b50df..2a2429703ec 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BrickStatisticalQuery.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BrickStatisticalQuery.java @@ -28,7 +28,7 @@ public class BrickStatisticalQuery extends AbstractStatisticalQuery getStatistics(org.ovirt.engine.core.common.businessentiti public Statistic adopt(Statistic statistic) { // clone required because LinkHelper unsets the grandparent - statistic.setDisk(clone(parent)); - return statistic; - } + statistic.setDisk(clone(parent)); + return statistic; + } private Disk clone(Disk parent) { Disk disk = new Disk(); diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/HostStatisticalQuery.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/HostStatisticalQuery.java index 0239dd70034..8798b7deaab 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/HostStatisticalQuery.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/HostStatisticalQuery.java @@ -16,10 +16,10 @@ public class HostStatisticalQuery extends AbstractStatisticalQuery { private static final Statistic MEM_USED = create("memory.used", "Used memory", GAUGE, BYTES, INTEGER); private static final Statistic MEM_FREE = create("memory.free", "Free memory", GAUGE, BYTES, INTEGER); private static final Statistic MEM_SHARED = create("memory.shared", - "The amount of memory, in bytes, shared among Virtual-Machines on this Host by Kernel Same-page Merging (KSM)", - GAUGE, - BYTES, - INTEGER); + "The amount of memory, in bytes, shared among Virtual-Machines on this Host by Kernel Same-page Merging (KSM)", + GAUGE, + BYTES, + INTEGER); private static final Statistic SWAP_TOTAL = create("swap.total", "Total swap", GAUGE, BYTES, INTEGER); private static final Statistic SWAP_FREE = create("swap.free", "Free swap", GAUGE, BYTES, INTEGER); private static final Statistic SWAP_USED = create("swap.used", "Used swap", GAUGE, BYTES, INTEGER); diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/VmStatisticalQuery.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/VmStatisticalQuery.java index 9af7cc7e0b2..cbb2b0299b6 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/VmStatisticalQuery.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/VmStatisticalQuery.java @@ -56,19 +56,19 @@ public List getStatistics(org.ovirt.engine.core.common.businessentiti Double cpuSys = s.getCpuSys() == null ? zero : s.getCpuSys(); List statistics = asList( - setDatum(clone(MEM_CONFIG), mem), - setDatum(clone(MEM_USED), memUsedByCent / 100), - setDatum(clone(CPU_GUEST), cpuUser), - setDatum(clone(CPU_OVERHEAD), cpuSys), - setDatum(clone(CPU_TOTAL), cpuUser + cpuSys), - setDatum(clone(MIGRATION_PROGRESS), migrationProgress), - setDatum(clone(MEM_BUFFERED), memBuffered), - setDatum(clone(MEM_CACHED), memCached), - setDatum(clone(MEM_FREE), memFree), - setDatum(clone(MEM_UNUSED), memUnused), - setDatum(clone(NETWORK_TOTAL), networkUsagePercent), - setDatum(clone(DISKS_USAGE), disksUsage), - setDatum(clone(ELAPSED_TIME), elapsedTime) + setDatum(clone(MEM_CONFIG), mem), + setDatum(clone(MEM_USED), memUsedByCent / 100), + setDatum(clone(CPU_GUEST), cpuUser), + setDatum(clone(CPU_OVERHEAD), cpuSys), + setDatum(clone(CPU_TOTAL), cpuUser + cpuSys), + setDatum(clone(MIGRATION_PROGRESS), migrationProgress), + setDatum(clone(MEM_BUFFERED), memBuffered), + setDatum(clone(MEM_CACHED), memCached), + setDatum(clone(MEM_FREE), memFree), + setDatum(clone(MEM_UNUSED), memUnused), + setDatum(clone(NETWORK_TOTAL), networkUsagePercent), + setDatum(clone(DISKS_USAGE), disksUsage), + setDatum(clone(ELAPSED_TIME), elapsedTime) ); statistics.add(addHistoryData(clone(CPU_USAGE_HISTORY), entity.getCpuUsageHistory())); diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/VolumeStatisticalQuery.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/VolumeStatisticalQuery.java index 23857b35df5..0c20009864f 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/VolumeStatisticalQuery.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/VolumeStatisticalQuery.java @@ -15,7 +15,7 @@ public class VolumeStatisticalQuery extends AbstractStatisticalQuery -implements DomainResource { + implements DomainResource { private String id; private BackendDomainsResource parent; diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendGroupsResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendGroupsResource.java index 18ed1ec2cda..4b5ff31c22e 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendGroupsResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendGroupsResource.java @@ -74,7 +74,7 @@ private String getAuthzProviderName(Group group, Collection authzProvide for (String domain : authzProvidersNames) { Guid domainId = new Guid(domain.getBytes(StandardCharsets.UTF_8)); if (domainId.toString().equals(group.getDomain().getId())) { - return domain; + return domain; } } throw new WebFaultException( diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendUserResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendUserResource.java index ab8cc4b03cd..27644825c3e 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendUserResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendUserResource.java @@ -51,21 +51,21 @@ public class BackendUserResource private static final String MERGE = "merge"; private static final String[] IMMUTABLE_FIELDS = { - "department", - "domainEntryId", - "email", - "lastName", - "loggedIn", - "namespace", - "password", - "principal", - "userName", - "domain", - "groups", - "permissions", - "roles", - "sshPublicKeys", - "tags" }; + "department", + "domainEntryId", + "email", + "lastName", + "loggedIn", + "namespace", + "password", + "principal", + "userName", + "domain", + "groups", + "permissions", + "roles", + "sshPublicKeys", + "tags" }; private BackendUsersResource parent; public BackendUserResource(String id, BackendUsersResource parent) { diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendUsersResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendUsersResource.java index 0d00981a81c..f72f3f6acfe 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendUsersResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/aaa/BackendUsersResource.java @@ -82,7 +82,7 @@ protected String getAuthzProviderName(User user, Collection authzProvide for (String domain : authzProvidersNames) { Guid domainId = asGuid(domain.getBytes(StandardCharsets.UTF_8)); if (domainId.toString().equals(user.getDomain().getId())) { - return domain; + return domain; } } throw new WebFaultException(null, "Domain: '" + user.getDomain().getId().toString() + "' does not exist.", Response.Status.BAD_REQUEST); @@ -146,7 +146,7 @@ public Users list() { if (isFiltered()) { return mapDbUserCollection(getBackendCollection(QueryType.GetAllDbUsers, new QueryParametersBase(), SearchType.DBUser)); } else { - return mapDbUserCollection(getBackendCollection(SearchType.DBUser, getSearchPattern())); + return mapDbUserCollection(getBackendCollection(SearchType.DBUser, getSearchPattern())); } } @@ -189,15 +189,15 @@ private DirectoryUser findDirectoryUser(String directoryName, User user) { } else if (user.isSetPrincipal()) { result = getEntity(DirectoryUser.class, QueryType.GetDirectoryUserByPrincipal, new GetDirectoryUserByPrincipalParameters(directoryName, user.getPrincipal()), user.getPrincipal()); } else if (user.isSetUserName()) { - result = getEntity( - DirectoryUser.class, - SearchType.DirectoryUser, - getDirectoryUserSearchPattern( - AuthzUtils.getEntityNameWithoutAuthz(user.getUserName(), directoryName), - user.getNamespace(), - directoryName) - ); - } + result = getEntity( + DirectoryUser.class, + SearchType.DirectoryUser, + getDirectoryUserSearchPattern( + AuthzUtils.getEntityNameWithoutAuthz(user.getUserName(), directoryName), + user.getNamespace(), + directoryName) + ); + } return result; } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterHookResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterHookResource.java index d3f3c4dd303..b858941ec2d 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterHookResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterHookResource.java @@ -71,12 +71,12 @@ public Response resolve(Action action) { ResolutionType resolutionType = EnumValidator.validateEnum(ResolutionType.class, action.getResolutionType(), true); switch (resolutionType) { - case ADD: - return addToMissingServers(action); - case COPY: - return copy(action); - default: - return null; + case ADD: + return addToMissingServers(action); + case COPY: + return copy(action); + default: + return null; } } @@ -104,7 +104,7 @@ public void setParent(BackendGlusterHooksResource parent) { } public String getId() { - return this.id; + return this.id; } @Override diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/validation/UsageFinder.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/validation/UsageFinder.java index 8c20c155765..f19de1994f9 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/validation/UsageFinder.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/validation/UsageFinder.java @@ -97,16 +97,16 @@ private String processNodeName(ServiceTreeNode node) { private String getMethodName(String httpMethod) { switch (httpMethod) { - case "POST": - return "add"; - case "PUT": - return "update"; - case "GET": - return "get"; - case "DELETE": - return "remove"; - default: - return ""; //shouldn't reach here. + case "POST": + return "add"; + case "PUT": + return "update"; + case "GET": + return "get"; + case "DELETE": + return "remove"; + default: + return ""; //shouldn't reach here. } } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/util/ErrorMessageHelper.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/util/ErrorMessageHelper.java index cc30019e4eb..0ea3e0fef38 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/util/ErrorMessageHelper.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/util/ErrorMessageHelper.java @@ -54,28 +54,28 @@ private static List getStatuses(List errors) { private static Status getStatus(ErrorType errorType) { switch (errorType) { - case BAD_PARAMETERS: - return Status.BAD_REQUEST; - case CONFLICT: - return Status.CONFLICT; - case CONSTRAINT_VIOLATION: - return Status.BAD_REQUEST; - case DATA_CORRUPTION: - return Status.INTERNAL_SERVER_ERROR; - case INTERNAL_ERROR: - return Status.INTERNAL_SERVER_ERROR; - case NO_AUTHENTICATION: - return Status.UNAUTHORIZED; - case NO_PERMISSION: - return Status.FORBIDDEN; - case NOT_SUPPORTED: - return Status.BAD_REQUEST; - case INCOMPATIBLE_VERSION: - return Status.BAD_REQUEST; - case ATTESTATION_SERVER_ERROR: - return Status.BAD_REQUEST; - default: - return Status.BAD_REQUEST; + case BAD_PARAMETERS: + return Status.BAD_REQUEST; + case CONFLICT: + return Status.CONFLICT; + case CONSTRAINT_VIOLATION: + return Status.BAD_REQUEST; + case DATA_CORRUPTION: + return Status.INTERNAL_SERVER_ERROR; + case INTERNAL_ERROR: + return Status.INTERNAL_SERVER_ERROR; + case NO_AUTHENTICATION: + return Status.UNAUTHORIZED; + case NO_PERMISSION: + return Status.FORBIDDEN; + case NOT_SUPPORTED: + return Status.BAD_REQUEST; + case INCOMPATIBLE_VERSION: + return Status.BAD_REQUEST; + case ATTESTATION_SERVER_ERROR: + return Status.BAD_REQUEST; + default: + return Status.BAD_REQUEST; } } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/util/VersionHelper.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/util/VersionHelper.java index 8a1cd6bbc17..fc93bf6ec3c 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/util/VersionHelper.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/util/VersionHelper.java @@ -13,14 +13,14 @@ public static Version parseVersion(String text) { Version version = new Version(); String[] parts = text.split("\\.", -1); switch (parts.length) { - case 4: - version.setRevision(Integer.parseInt(parts[3])); - case 3: - version.setBuild(Integer.parseInt(parts[2])); - case 2: - version.setMinor(Integer.parseInt(parts[1])); - case 1: - version.setMajor(Integer.parseInt(parts[0])); + case 4: + version.setRevision(Integer.parseInt(parts[3])); + case 3: + version.setBuild(Integer.parseInt(parts[2])); + case 2: + version.setMinor(Integer.parseInt(parts[1])); + case 1: + version.setMajor(Integer.parseInt(parts[0])); } return version; } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/util/links/EntityLocationMap.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/util/links/EntityLocationMap.java index e4b0051954c..22a3d6ba5f1 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/util/links/EntityLocationMap.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/util/links/EntityLocationMap.java @@ -96,5 +96,5 @@ private static void handleNode(ServiceTreeNode node, EntityLocationMap map) { for (ServiceTreeNode subServiceNode : node.getSubServices()) { handleNode(subServiceNode, map); } - } + } } diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/xml/JAXBValidationEventHandler.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/xml/JAXBValidationEventHandler.java index 2be98f05aa9..131999362fa 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/xml/JAXBValidationEventHandler.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/xml/JAXBValidationEventHandler.java @@ -17,11 +17,11 @@ public class JAXBValidationEventHandler implements ValidationEventHandler { @Override public boolean handleEvent(ValidationEvent event) { switch (event.getSeverity()) { - case ValidationEvent.ERROR: - case ValidationEvent.FATAL_ERROR: - return false; - default: - return true; + case ValidationEvent.ERROR: + case ValidationEvent.FATAL_ERROR: + return false; + default: + return true; } } } diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/AbstractBackendBaseTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/AbstractBackendBaseTest.java index 620d27acb53..5327e1b93b8 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/AbstractBackendBaseTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/AbstractBackendBaseTest.java @@ -73,18 +73,18 @@ public abstract class AbstractBackendBaseTest { protected static final Guid[] GUIDS = { new Guid("00000000-0000-0000-0000-000000000000"), - new Guid("11111111-1111-1111-1111-111111111111"), - new Guid("22222222-2222-2222-2222-222222222222"), - new Guid("33333333-3333-3333-3333-333333333333") }; + new Guid("11111111-1111-1111-1111-111111111111"), + new Guid("22222222-2222-2222-2222-222222222222"), + new Guid("33333333-3333-3333-3333-333333333333") }; /** * External identifiers used by directory users and groups. */ protected static final String[] EXTERNAL_IDS = { - DirectoryEntryIdUtils.encode("0"), - DirectoryEntryIdUtils.encode("1"), - DirectoryEntryIdUtils.encode("2"), - DirectoryEntryIdUtils.encode("3"), + DirectoryEntryIdUtils.encode("0"), + DirectoryEntryIdUtils.encode("1"), + DirectoryEntryIdUtils.encode("2"), + DirectoryEntryIdUtils.encode("3"), }; /** @@ -95,7 +95,7 @@ public abstract class AbstractBackendBaseTest { protected static final Guid EVERYONE = new Guid("EEE00000-0000-0000-0000-123456789EEE"); protected static final String[] NAMES = { "sedna", "eris", "orcus" }; protected static final String[] DESCRIPTIONS = { "top notch entity", "a fine example", - "state of the art" }; + "state of the art" }; protected static final String URI_ROOT = "http://localhost:8088"; protected static final String BASE_PATH = "/ovirt-engine/api"; protected static final String URI_BASE = URI_ROOT + BASE_PATH; diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/AbstractBackendNetworksResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/AbstractBackendNetworksResourceTest.java index 9d263e19a82..8b0d50bfca4 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/AbstractBackendNetworksResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/AbstractBackendNetworksResourceTest.java @@ -63,7 +63,7 @@ static org.ovirt.engine.core.common.businessentities.network.Network setUpEntity networkCluster.setDefaultRoute(isDefaultRoute); when(entity.getCluster()).thenReturn(networkCluster); return setUpEntityExpectations(entity, index); - } + } static org.ovirt.engine.core.common.businessentities.network.Network setUpEntityExpectations(org.ovirt.engine.core.common.businessentities.network.Network entity, int index) { when(entity.getId()).thenReturn(GUIDS[index]); diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendApiResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendApiResourceTest.java index b55a043dfd4..575420b63e8 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendApiResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendApiResourceTest.java @@ -138,21 +138,21 @@ public class BackendApiResourceTest { }; private static final String[] relationshipsGlusterOnly = { - "clusters", - "clusters/search", - "events", - "events/search", - "hosts", - "hosts/search", - "networks", - "networks/search", - "roles", - "tags", - "users", - "users/search", - "groups", - "groups/search", - "domains", + "clusters", + "clusters/search", + "events", + "events/search", + "hosts", + "hosts/search", + "networks", + "networks/search", + "roles", + "tags", + "users", + "users/search", + "groups", + "groups/search", + "domains", }; private static final String[] hrefs = { @@ -211,21 +211,21 @@ public class BackendApiResourceTest { }; private static final String[] hrefsGlusterOnly = { - BASE_PATH + "/clusters", - BASE_PATH + "/clusters?search={query}", - BASE_PATH + "/events", - BASE_PATH + "/events;from={event_id}?search={query}", - BASE_PATH + "/hosts", - BASE_PATH + "/hosts?search={query}", - BASE_PATH + "/networks", - BASE_PATH + "/networks?search={query}", - BASE_PATH + "/roles", - BASE_PATH + "/tags", - BASE_PATH + "/users", - BASE_PATH + "/users?search={query}", - BASE_PATH + "/groups", - BASE_PATH + "/groups?search={query}", - BASE_PATH + "/domains", + BASE_PATH + "/clusters", + BASE_PATH + "/clusters?search={query}", + BASE_PATH + "/events", + BASE_PATH + "/events;from={event_id}?search={query}", + BASE_PATH + "/hosts", + BASE_PATH + "/hosts?search={query}", + BASE_PATH + "/networks", + BASE_PATH + "/networks?search={query}", + BASE_PATH + "/roles", + BASE_PATH + "/tags", + BASE_PATH + "/users", + BASE_PATH + "/users?search={query}", + BASE_PATH + "/groups", + BASE_PATH + "/groups?search={query}", + BASE_PATH + "/domains", }; public BackendApiResourceTest() { diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAssignedCpuProfileResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAssignedCpuProfileResourceTest.java index 869ed3bd09c..cd720f2aaa8 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAssignedCpuProfileResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAssignedCpuProfileResourceTest.java @@ -26,8 +26,7 @@ public BackendAssignedCpuProfileResourceTest() { @Test public void testBadGuid() { - verifyNotFoundException - (assertThrows(WebApplicationException.class, () -> new BackendCpuProfileResource("foo"))); + verifyNotFoundException(assertThrows(WebApplicationException.class, () -> new BackendCpuProfileResource("foo"))); } @Test diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainsResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainsResourceTest.java index 7ccac74a2e3..e423d0396be 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainsResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendAttachedStorageDomainsResourceTest.java @@ -81,8 +81,8 @@ public void testAdd() { static StorageServerConnections setUpStorageServerConnection() { StorageServerConnections cnx = new StorageServerConnections(); - cnx.setId(GUIDS[0].toString()); - cnx.setConnection("10.11.12.13" + ":" + "/1"); + cnx.setId(GUIDS[0].toString()); + cnx.setConnection("10.11.12.13" + ":" + "/1"); return cnx; } @@ -172,7 +172,7 @@ public void testList() throws Exception { Object[] paramValues = new Object[] { GUIDS[0].toString() }; QueryReturnValue queryResult = new QueryReturnValue(); when(backend.runQuery(eq(QueryType.GetStorageServerConnectionById), eqParams(StorageServerConnectionQueryParametersBase.class, addSession(paramNames), addSession(paramValues)))) - .thenReturn(queryResult); + .thenReturn(queryResult); queryResult.setSucceeded(true); queryResult.setReturnValue(setUpStorageServerConnection()); setUpQueryExpectations(""); diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendClusterNetworkResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendClusterNetworkResourceTest.java index 3c47ec077b6..4e171169821 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendClusterNetworkResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendClusterNetworkResourceTest.java @@ -157,7 +157,7 @@ protected void verifyUpdate(Network model) { assertTrue(model.getUsages().getUsages().contains(NetworkUsage.DEFAULT_ROUTE)); assertTrue(model.isSetRequired()); assertEquals(true, model.isRequired()); - } + } protected void setUpEntityQueryExpectations(int times, boolean isDisplay, boolean isMigration, boolean isRequired, boolean isDefaultRoute) { diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendEventsResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendEventsResourceTest.java index 68df8b38bcb..6435e10841c 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendEventsResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendEventsResourceTest.java @@ -42,7 +42,7 @@ public BackendEventsResourceTest() { static org.ovirt.engine.api.model.Event getModel(int index) { org.ovirt.engine.api.model.Event model = new org.ovirt.engine.api.model.Event(); model.setId(String.valueOf(LOG_IDS[index])); - model.setSeverity( LogSeverity.ALERT); + model.setSeverity(LogSeverity.ALERT); model.setDescription(MESSAGES[index]); model.setOrigin(ORIGIN_NAMES[index]); model.setCustomId(CUSTOMER_EVENT_IDS[index]); diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendExportDomainDiskResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendExportDomainDiskResourceTest.java index 7c9fc1b9be2..97e304cbad1 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendExportDomainDiskResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendExportDomainDiskResourceTest.java @@ -40,7 +40,7 @@ @MockitoSettings(strictness = Strictness.LENIENT) public class BackendExportDomainDiskResourceTest - extends AbstractBackendSubResourceTest { + extends AbstractBackendSubResourceTest { private static final Guid TEMPLATE_ID = GUIDS[1]; private static final Guid DISK_ID = GUIDS[2]; @@ -105,27 +105,27 @@ protected void setUpGetEntityExpectations(StorageDomainType domainType, Guid get protected void setUpGetEntityExpectations(StorageDomainType domainType, Guid getStoragePoolsByStorageDomainId, boolean notFound) { switch (domainType) { - case Data: - setUpEntityQueryExpectations(QueryType.GetVmTemplate, - GetVmTemplateParameters.class, - new String[] { "Id" }, - new Object[] { TEMPLATE_ID }, - notFound ? null : getEntity(1)); - break; - case ImportExport: - setUpEntityQueryExpectations(QueryType.GetStoragePoolsByStorageDomainId, - IdQueryParameters.class, - new String[] { "Id" }, - new Object[] { getStoragePoolsByStorageDomainId }, - setUpStoragePool()); - setUpEntityQueryExpectations(QueryType.GetTemplatesFromExportDomain, - GetAllFromExportDomainQueryParameters.class, - new String[] { "StoragePoolId", "StorageDomainId" }, - new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID }, - setUpTemplates(notFound)); - break; - default: - break; + case Data: + setUpEntityQueryExpectations(QueryType.GetVmTemplate, + GetVmTemplateParameters.class, + new String[] { "Id" }, + new Object[] { TEMPLATE_ID }, + notFound ? null : getEntity(1)); + break; + case ImportExport: + setUpEntityQueryExpectations(QueryType.GetStoragePoolsByStorageDomainId, + IdQueryParameters.class, + new String[] { "Id" }, + new Object[] { getStoragePoolsByStorageDomainId }, + setUpStoragePool()); + setUpEntityQueryExpectations(QueryType.GetTemplatesFromExportDomain, + GetAllFromExportDomainQueryParameters.class, + new String[] { "StoragePoolId", "StorageDomainId" }, + new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID }, + setUpTemplates(notFound)); + break; + default: + break; } } diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendExportDomainDisksResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendExportDomainDisksResourceTest.java index 4f2e7a53b0b..a1ad8d4c9e8 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendExportDomainDisksResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendExportDomainDisksResourceTest.java @@ -144,30 +144,30 @@ protected void setUpGetEntityExpectations(StorageDomainType domainType, Guid get protected void setUpGetEntityExpectations(StorageDomainType domainType, Guid getStoragePoolsByStorageDomainId, boolean notFound, Object failure) { switch (domainType) { - case Data: - setUpEntityQueryExpectations(QueryType.GetVmTemplate, - GetVmTemplateParameters.class, - new String[] { "Id" }, - new Object[] { TEMPLATE_ID }, - notFound ? null : getEntity(1), - failure); - break; - case ImportExport: - setUpEntityQueryExpectations(QueryType.GetStoragePoolsByStorageDomainId, - IdQueryParameters.class, - new String[] { "Id" }, - new Object[] { getStoragePoolsByStorageDomainId }, - setUpStoragePool(), - null); - setUpEntityQueryExpectations(QueryType.GetTemplatesFromExportDomain, - GetAllFromExportDomainQueryParameters.class, - new String[] { "StoragePoolId", "StorageDomainId" }, - new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID }, - setUpTemplates(notFound), - failure); - break; - default: - break; + case Data: + setUpEntityQueryExpectations(QueryType.GetVmTemplate, + GetVmTemplateParameters.class, + new String[] { "Id" }, + new Object[] { TEMPLATE_ID }, + notFound ? null : getEntity(1), + failure); + break; + case ImportExport: + setUpEntityQueryExpectations(QueryType.GetStoragePoolsByStorageDomainId, + IdQueryParameters.class, + new String[] { "Id" }, + new Object[] { getStoragePoolsByStorageDomainId }, + setUpStoragePool(), + null); + setUpEntityQueryExpectations(QueryType.GetTemplatesFromExportDomain, + GetAllFromExportDomainQueryParameters.class, + new String[] { "StoragePoolId", "StorageDomainId" }, + new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID }, + setUpTemplates(notFound), + failure); + break; + default: + break; } } diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendExternalTemplateImportsResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendExternalTemplateImportsResourceTest.java index e2162d108d8..fe8869f12dc 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendExternalTemplateImportsResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendExternalTemplateImportsResourceTest.java @@ -44,18 +44,18 @@ public void testOvaImport() { setUpActionExpectations(ActionType.ImportVmTemplateFromExternalUrl, ImportVmTemplateFromExternalUrlParameters.class, new String[] { - "StorageDomainId", - "ClusterId", - "Url", - "ProxyHostId", - "NewTemplateName" + "StorageDomainId", + "ClusterId", + "Url", + "ProxyHostId", + "NewTemplateName" }, new Object[] { - STORAGE_DOMAIN_ID, - CLUSTER_ID, - OVA_URL, - HOST_ID, - CREATED_TEMPLATE_NAME + STORAGE_DOMAIN_ID, + CLUSTER_ID, + OVA_URL, + HOST_ID, + CREATED_TEMPLATE_NAME }, true, true, diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendHostNicResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendHostNicResourceTest.java index f40bd76273b..1571331d026 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendHostNicResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendHostNicResourceTest.java @@ -153,14 +153,14 @@ protected void verifyQuery(AbstractStatisticalQuery statistics = query.getStatistics(entity); verifyStatistics(statistics, new String[] { "data.current.rx", "data.current.tx", "data.current.rx.bps", - "data.current.tx.bps", "errors.total.rx", "errors.total.tx", - "data.total.rx", "data.total.tx" }, + "data.current.tx.bps", "errors.total.rx", "errors.total.tx", + "data.total.rx", "data.total.tx" }, new BigDecimal[] { asDec(RxTxCalculator.percent2bytes(SPEED, RECEIVE_RATE)), - asDec(RxTxCalculator.percent2bytes(SPEED, TRANSMIT_RATE)), - asDec(RxTxCalculator.percent2bits(SPEED, RECEIVE_RATE)), - asDec(RxTxCalculator.percent2bits(SPEED, TRANSMIT_RATE)), - asDec(RECEIVE_DROPS), asDec(TRANSMIT_DROPS), - asDec(RECEIVED_BYTES), asDec(TRANSMITTED_BYTES) }); + asDec(RxTxCalculator.percent2bytes(SPEED, TRANSMIT_RATE)), + asDec(RxTxCalculator.percent2bits(SPEED, RECEIVE_RATE)), + asDec(RxTxCalculator.percent2bits(SPEED, TRANSMIT_RATE)), + asDec(RECEIVE_DROPS), asDec(TRANSMIT_DROPS), + asDec(RECEIVED_BYTES), asDec(TRANSMITTED_BYTES) }); Statistic adopted = query.adopt(new Statistic()); assertTrue(adopted.isSetHostNic()); assertEquals(NIC_ID.toString(), adopted.getHostNic().getId()); diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendHostResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendHostResourceTest.java index 1e3e30ffe14..276964ba452 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendHostResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendHostResourceTest.java @@ -657,13 +657,13 @@ protected void verifyQuery(AbstractStatisticalQuery query, VDS entity assertSame(entity, query.resolve(GUIDS[0])); List statistics = query.getStatistics(entity); verifyStatistics(statistics, - new String[] {"memory.total", "memory.used", "memory.free", "memory.shared", - "swap.total", "swap.free", "swap.used", "ksm.cpu.current", - "cpu.current.user", "cpu.current.system", - "cpu.current.idle", "cpu.load.avg.5m", "boot.time"}, - new BigDecimal[] { asDec(5120 * Mb), asDec(1024 * Mb), asDec(4096 * Mb), asDec(38 * Mb), asDec(30 * Mb), - asDec(25 * Mb), asDec(5 * Mb), asDec(40), asDec(45), asDec(50), asDec(55), - new BigDecimal(0.0060, new MathContext(2)), asDec(0) }); + new String[] {"memory.total", "memory.used", "memory.free", "memory.shared", + "swap.total", "swap.free", "swap.used", "ksm.cpu.current", + "cpu.current.user", "cpu.current.system", + "cpu.current.idle", "cpu.load.avg.5m", "boot.time"}, + new BigDecimal[] { asDec(5120 * Mb), asDec(1024 * Mb), asDec(4096 * Mb), asDec(38 * Mb), asDec(30 * Mb), + asDec(25 * Mb), asDec(5 * Mb), asDec(40), asDec(45), asDec(50), asDec(55), + new BigDecimal(0.0060, new MathContext(2)), asDec(0) }); Statistic adopted = query.adopt(new Statistic()); assertTrue(adopted.isSetHost()); assertEquals(GUIDS[0].toString(), adopted.getHost().getId()); diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendHostsResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendHostsResourceTest.java index 16a779684c8..5dbd8d84b04 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendHostsResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendHostsResourceTest.java @@ -46,7 +46,7 @@ public static Stream> mockConfiguration() { protected static final String[] ADDRESSES = { "10.11.12.13", "13.12.11.10", "10.01.10.01" }; protected static final VDSStatus[] VDS_STATUS = { VDSStatus.Up, VDSStatus.Down, VDSStatus.Up }; protected static final HostStatus[] HOST_STATUS = { HostStatus.UP, HostStatus.DOWN, - HostStatus.UP }; + HostStatus.UP }; protected static final String ROOT_PASSWORD = "s3CR3t"; public BackendHostsResourceTest() { diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendIconsResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendIconsResourceTest.java index 9c00ff5393a..cc2442fbdbd 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendIconsResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendIconsResourceTest.java @@ -17,10 +17,10 @@ public class BackendIconsResourceTest extends AbstractBackendCollectionResourceTest { private static final String[] DATA_URLS = new String[] { - "data:image/png;base64,iVB0", - "data:image/png;base64,iVB1", - "data:image/png;base64,iVB2", - "data:image/png;base64,iVB3", + "data:image/png;base64,iVB0", + "data:image/png;base64,iVB1", + "data:image/png;base64,iVB2", + "data:image/png;base64,iVB3", }; public BackendIconsResourceTest() { @@ -51,7 +51,7 @@ protected void verifyModel(Icon model, int index) { } public static void verifyIconModel(Icon model, int index) { - assertEquals(VmIcon.dataUrlToTypeAndData( DATA_URLS[index]).getFirst(), model.getMediaType()); + assertEquals(VmIcon.dataUrlToTypeAndData(DATA_URLS[index]).getFirst(), model.getMediaType()); assertEquals(VmIcon.dataUrlToTypeAndData(DATA_URLS[index]).getSecond(), model.getData()); assertEquals(GUIDS[index].toString(), model.getId()); } diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendNetworksResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendNetworksResourceTest.java index 449c53dc4b1..fc7943eba00 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendNetworksResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendNetworksResourceTest.java @@ -137,7 +137,7 @@ public void testQueryWithFilter() throws Exception { when(httpHeaders.getRequestHeader(USER_FILTER_HEADER)).thenReturn(filterValue); setUpEntityQueryExpectations(1); setUriInfo(setUpBasicUriExpectations()); - List networks = getCollection(); + List networks = getCollection(); networks.sort(Comparator.comparing(Network::getId)); verifyCollection(networks); } diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendQuotasResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendQuotasResourceTest.java index 8ff6671ae10..d5e0ac55a9b 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendQuotasResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendQuotasResourceTest.java @@ -62,10 +62,10 @@ public void testAdd() { setUpCreationExpectations(ActionType.AddQuota, QuotaCRUDParameters.class, new String[] { "Quota.StoragePoolId", "Quota.ThresholdClusterPercentage", - "Quota.GraceClusterPercentage", "Quota.ThresholdStoragePercentage", - "Quota.GraceStoragePercentage" }, + "Quota.GraceClusterPercentage", "Quota.ThresholdStoragePercentage", + "Quota.GraceStoragePercentage" }, new Object[] { DATACENTER_ID, CLUSTER_SOFT_LIMIT_PCT, CLUSTER_HARD_LIMIT_PCT, STORAGE_SOFT_LIMIT_PCT, - STORAGE_HARD_LIMIT_PCT }, + STORAGE_HARD_LIMIT_PCT }, true, true, GUIDS[0], diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStepsResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStepsResourceTest.java index e22fec673b5..136bfd004d6 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStepsResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStepsResourceTest.java @@ -26,9 +26,10 @@ @MockitoSettings(strictness = Strictness.LENIENT) public class BackendStepsResourceTest extends AbstractBackendCollectionResourceTest { - public BackendStepsResourceTest() { - super(new BackendStepsResource(GUIDS[1]), null, ""); + public BackendStepsResourceTest() { + super(new BackendStepsResource(GUIDS[1]), null, ""); } + @Override protected List getCollection() { return collection.list().getSteps(); @@ -72,7 +73,7 @@ protected void verifyModel(Step model, int index) { assertEquals(DESCRIPTIONS[index], model.getDescription()); assertTrue(model.isExternal()); verifyLinks(model); - } + } protected List setUpSteps() { List steps = new ArrayList<>(); diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainImagesResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainImagesResourceTest.java index bda392709e6..c1dc324122e 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainImagesResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainImagesResourceTest.java @@ -113,7 +113,7 @@ protected void setUpEntityQueryExpectations(String failure) { entities.add(getEntity(i)); } - setUpEntityQueryExpectations( QueryType.GetImagesList, GetImagesListParameters.class, + setUpEntityQueryExpectations(QueryType.GetImagesList, GetImagesListParameters.class, new String[]{"StorageDomainId", "ImageType"}, new Object[]{GUIDS[3], ImageFileType.All}, entities, failure); } diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainServerConnectionsResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainServerConnectionsResourceTest.java index f9d05313c5c..9f20b982a84 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainServerConnectionsResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainServerConnectionsResourceTest.java @@ -27,10 +27,10 @@ @MockitoSettings(strictness = Strictness.LENIENT) public class BackendStorageDomainServerConnectionsResourceTest extends AbstractBackendCollectionResourceTest { protected static final StorageType[] STORAGE_TYPES_MAPPED = { - StorageType.NFS, - StorageType.LOCALFS, - StorageType.POSIXFS, - StorageType.ISCSI }; + StorageType.NFS, + StorageType.LOCALFS, + StorageType.POSIXFS, + StorageType.ISCSI }; public BackendStorageDomainServerConnectionsResourceTest() { super(new BackendStorageDomainServerConnectionsResource(GUIDS[3]), null, ""); diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainTemplateResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainTemplateResourceTest.java index 3ab2ca53f04..7150186d225 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainTemplateResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainTemplateResourceTest.java @@ -135,7 +135,7 @@ public void doTestRegister(org.ovirt.engine.api.model.Cluster cluster, boolean i setUriInfo(setUpActionExpectations(ActionType.ImportVmTemplateFromConfiguration, ImportVmTemplateFromConfParameters.class, new String[] { "ContainerId", "StorageDomainId", "ClusterId", "ImportAsNewEntity", - "ImagesExistOnTargetStorageDomain" }, + "ImagesExistOnTargetStorageDomain" }, new Object[] { TEMPLATE_ID, GUIDS[3], GUIDS[1], importAsNewEntity, true })); Action action = new Action(); @@ -347,27 +347,27 @@ protected void setUpGetEntityExpectations(StorageDomainType domainType, Guid get protected void setUpGetEntityExpectations(StorageDomainType domainType, Guid getStoragePoolsByStorageDomainId, boolean notFound) { switch (domainType) { - case Data: - setUpEntityQueryExpectations(QueryType.GetVmTemplate, - GetVmTemplateParameters.class, - new String[] { "Id" }, - new Object[] { TEMPLATE_ID }, - notFound ? null : getEntity(1)); - break; - case ImportExport: - setUpEntityQueryExpectations(QueryType.GetStoragePoolsByStorageDomainId, - IdQueryParameters.class, - new String[] { "Id" }, - new Object[] { getStoragePoolsByStorageDomainId }, - setUpStoragePool()); - setUpEntityQueryExpectations(QueryType.GetTemplatesFromExportDomain, - GetAllFromExportDomainQueryParameters.class, - new String[] { "StoragePoolId", "StorageDomainId" }, - new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID }, - setUpTemplates(notFound)); - break; - default: - break; + case Data: + setUpEntityQueryExpectations(QueryType.GetVmTemplate, + GetVmTemplateParameters.class, + new String[] { "Id" }, + new Object[] { TEMPLATE_ID }, + notFound ? null : getEntity(1)); + break; + case ImportExport: + setUpEntityQueryExpectations(QueryType.GetStoragePoolsByStorageDomainId, + IdQueryParameters.class, + new String[] { "Id" }, + new Object[] { getStoragePoolsByStorageDomainId }, + setUpStoragePool()); + setUpEntityQueryExpectations(QueryType.GetTemplatesFromExportDomain, + GetAllFromExportDomainQueryParameters.class, + new String[] { "StoragePoolId", "StorageDomainId" }, + new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID }, + setUpTemplates(notFound)); + break; + default: + break; } } @@ -442,24 +442,24 @@ protected void setUpQueryExpectations(String query, Object failure, StorageDomai setUpStorageDomain(domainType)); switch (domainType) { - case Data: - setUpEntityQueryExpectations(QueryType.GetVmTemplatesFromStorageDomain, - GetVmTemplatesFromStorageDomainParameters.class, - new String[] { "Id" }, - new Object[] { STORAGE_DOMAIN_ID }, - setUpTemplates(), - failure); - break; - case ImportExport: - setUpEntityQueryExpectations(QueryType.GetTemplatesFromExportDomain, - GetAllFromExportDomainQueryParameters.class, - new String[] { "StoragePoolId", "StorageDomainId" }, - new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID }, - setUpExportTemplates(), - failure); - break; - default: - break; + case Data: + setUpEntityQueryExpectations(QueryType.GetVmTemplatesFromStorageDomain, + GetVmTemplatesFromStorageDomainParameters.class, + new String[] { "Id" }, + new Object[] { STORAGE_DOMAIN_ID }, + setUpTemplates(), + failure); + break; + case ImportExport: + setUpEntityQueryExpectations(QueryType.GetTemplatesFromExportDomain, + GetAllFromExportDomainQueryParameters.class, + new String[] { "StoragePoolId", "StorageDomainId" }, + new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID }, + setUpExportTemplates(), + failure); + break; + default: + break; } } diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainTemplatesResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainTemplatesResourceTest.java index d418a60a9ea..224b1c5ebdb 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainTemplatesResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainTemplatesResourceTest.java @@ -99,24 +99,24 @@ protected void setUpQueryExpectations(String query, Object failure, StorageDomai setUpStorageDomain(domainType)); switch (domainType) { - case Data: - setUpEntityQueryExpectations(QueryType.GetVmTemplatesFromStorageDomain, - GetVmTemplatesFromStorageDomainParameters.class, - new String[] { "Id" }, - new Object[] { STORAGE_DOMAIN_ID }, - setUpTemplates(), - failure); - break; - case ImportExport: - setUpEntityQueryExpectations(QueryType.GetTemplatesFromExportDomain, - GetAllFromExportDomainQueryParameters.class, - new String[] { "StoragePoolId", "StorageDomainId"}, - new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID}, - setUpExportTemplates(), - failure); - break; - default: - break; + case Data: + setUpEntityQueryExpectations(QueryType.GetVmTemplatesFromStorageDomain, + GetVmTemplatesFromStorageDomainParameters.class, + new String[] { "Id" }, + new Object[] { STORAGE_DOMAIN_ID }, + setUpTemplates(), + failure); + break; + case ImportExport: + setUpEntityQueryExpectations(QueryType.GetTemplatesFromExportDomain, + GetAllFromExportDomainQueryParameters.class, + new String[] { "StoragePoolId", "StorageDomainId"}, + new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID}, + setUpExportTemplates(), + failure); + break; + default: + break; } } diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainVmResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainVmResourceTest.java index 54d6459484b..93838b3ced8 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainVmResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainVmResourceTest.java @@ -251,18 +251,18 @@ protected void setUpQueryExpectations(String query, Object failure, StorageDomai setUpStorageDomain(domainType)); switch (domainType) { - case Data: - break; - case ImportExport: - setUpEntityQueryExpectations(QueryType.GetVmsFromExportDomain, - GetAllFromExportDomainQueryParameters.class, - new String[] { "StoragePoolId", "StorageDomainId"}, - new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID}, - setUpVms(), - failure); - break; - default: - break; + case Data: + break; + case ImportExport: + setUpEntityQueryExpectations(QueryType.GetVmsFromExportDomain, + GetAllFromExportDomainQueryParameters.class, + new String[] { "StoragePoolId", "StorageDomainId"}, + new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID}, + setUpVms(), + failure); + break; + default: + break; } } @@ -317,7 +317,7 @@ public void doTestRegister(org.ovirt.engine.api.model.Cluster cluster, boolean i setUriInfo(setUpActionExpectations(ActionType.ImportVmFromConfiguration, ImportVmFromConfParameters.class, new String[] { "ContainerId", "StorageDomainId", "ClusterId", "ImportAsNewEntity", - "ImagesExistOnTargetStorageDomain" }, + "ImagesExistOnTargetStorageDomain" }, new Object[] { VM_ID, GUIDS[3], GUIDS[1], importAsNewEntity, true })); Action action = new Action(); @@ -414,27 +414,27 @@ protected void setUpGetEntityExpectations(StorageDomainType domainType, Guid get protected void setUpGetEntityExpectations(StorageDomainType domainType, Guid getStoragePoolsByStorageDomainId, boolean notFound) { switch (domainType) { - case Data: - setUpEntityQueryExpectations(QueryType.GetVmByVmId, - IdQueryParameters.class, - new String[] { "Id" }, - new Object[] { VM_ID }, - notFound ? null : getEntity(1)); - break; - case ImportExport: - setUpEntityQueryExpectations(QueryType.GetStoragePoolsByStorageDomainId, - IdQueryParameters.class, - new String[] { "Id" }, - new Object[] { getStoragePoolsByStorageDomainId }, - setUpStoragePool()); - setUpEntityQueryExpectations(QueryType.GetVmsFromExportDomain, - GetAllFromExportDomainQueryParameters.class, - new String[] { "StoragePoolId", "StorageDomainId" }, - new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID }, - setUpVms(notFound)); - break; - default: - break; + case Data: + setUpEntityQueryExpectations(QueryType.GetVmByVmId, + IdQueryParameters.class, + new String[] { "Id" }, + new Object[] { VM_ID }, + notFound ? null : getEntity(1)); + break; + case ImportExport: + setUpEntityQueryExpectations(QueryType.GetStoragePoolsByStorageDomainId, + IdQueryParameters.class, + new String[] { "Id" }, + new Object[] { getStoragePoolsByStorageDomainId }, + setUpStoragePool()); + setUpEntityQueryExpectations(QueryType.GetVmsFromExportDomain, + GetAllFromExportDomainQueryParameters.class, + new String[] { "StoragePoolId", "StorageDomainId" }, + new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID }, + setUpVms(notFound)); + break; + default: + break; } } diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainVmsResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainVmsResourceTest.java index d304ee0fe9f..7538f4485eb 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainVmsResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainVmsResourceTest.java @@ -91,18 +91,18 @@ protected void setUpQueryExpectations(String query, Object failure, StorageDomai setUpStorageDomain(domainType)); switch (domainType) { - case Data: - break; - case ImportExport: - setUpEntityQueryExpectations(QueryType.GetVmsFromExportDomain, - GetAllFromExportDomainQueryParameters.class, - new String[] { "StoragePoolId", "StorageDomainId"}, - new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID}, - setUpVms(), - failure); - break; - default: - break; + case Data: + break; + case ImportExport: + setUpEntityQueryExpectations(QueryType.GetVmsFromExportDomain, + GetAllFromExportDomainQueryParameters.class, + new String[] { "StoragePoolId", "StorageDomainId"}, + new Object[] { DATA_CENTER_ID, STORAGE_DOMAIN_ID}, + setUpVms(), + failure); + break; + default: + break; } } diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainsResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainsResourceTest.java index 29ad0433b9d..4e8881e0b0c 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainsResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainsResourceTest.java @@ -46,9 +46,9 @@ public class BackendStorageDomainsResourceTest extends AbstractBackendCollectionResourceTest { protected static final StorageDomainType[] TYPES = { StorageDomainType.DATA, - StorageDomainType.ISO, StorageDomainType.EXPORT }; + StorageDomainType.ISO, StorageDomainType.EXPORT }; protected static final StorageType[] STORAGE_TYPES = { StorageType.NFS, StorageType.NFS, - StorageType.LOCALFS, StorageType.POSIXFS }; + StorageType.LOCALFS, StorageType.POSIXFS }; protected static final int LOCAL_IDX = 2; protected static final int POSIX_IDX = 3; @@ -62,15 +62,15 @@ public class BackendStorageDomainsResourceTest protected static final Integer PORT = 3260; protected static final org.ovirt.engine.core.common.businessentities.StorageDomainType[] TYPES_MAPPED = { - org.ovirt.engine.core.common.businessentities.StorageDomainType.Data, - org.ovirt.engine.core.common.businessentities.StorageDomainType.ISO, - org.ovirt.engine.core.common.businessentities.StorageDomainType.ImportExport }; + org.ovirt.engine.core.common.businessentities.StorageDomainType.Data, + org.ovirt.engine.core.common.businessentities.StorageDomainType.ISO, + org.ovirt.engine.core.common.businessentities.StorageDomainType.ImportExport }; protected static final org.ovirt.engine.core.common.businessentities.storage.StorageType[] STORAGE_TYPES_MAPPED = { - org.ovirt.engine.core.common.businessentities.storage.StorageType.NFS, - org.ovirt.engine.core.common.businessentities.storage.StorageType.NFS, - org.ovirt.engine.core.common.businessentities.storage.StorageType.LOCALFS, - org.ovirt.engine.core.common.businessentities.storage.StorageType.POSIXFS }; + org.ovirt.engine.core.common.businessentities.storage.StorageType.NFS, + org.ovirt.engine.core.common.businessentities.storage.StorageType.NFS, + org.ovirt.engine.core.common.businessentities.storage.StorageType.LOCALFS, + org.ovirt.engine.core.common.businessentities.storage.StorageType.POSIXFS }; public BackendStorageDomainsResourceTest() { super(new BackendStorageDomainsResource(), SearchType.StorageDomain, "Storage : "); @@ -260,10 +260,10 @@ public void testAddPosixStorageDomain() { setUriInfo(setUpActionExpectations(ActionType.AddStorageServerConnection, StorageServerConnectionParametersBase.class, new String[] { "StorageServerConnection.Connection", - "StorageServerConnection.StorageType", - "StorageServerConnection.MountOptions", - "StorageServerConnection.VfsType", - "VdsId" }, + "StorageServerConnection.StorageType", + "StorageServerConnection.MountOptions", + "StorageServerConnection.VfsType", + "VdsId" }, new Object[] { ADDRESSES[POSIX_IDX] + ":" + PATHS[POSIX_IDX], STORAGE_TYPES_MAPPED[POSIX_IDX], MOUNT_OPTIONS[POSIX_IDX], VFS_TYPES[POSIX_IDX], GUIDS[0] }, diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionResourceTest.java index 78657f81d80..6c3cbe99027 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionResourceTest.java @@ -29,10 +29,10 @@ public class BackendStorageServerConnectionResourceTest extends AbstractBackendS org.ovirt.engine.api.model.StorageType.ISCSI }; protected static final StorageType[] STORAGE_TYPES_MAPPED = { - StorageType.NFS, - StorageType.LOCALFS, - StorageType.POSIXFS, - StorageType.ISCSI }; + StorageType.NFS, + StorageType.LOCALFS, + StorageType.POSIXFS, + StorageType.ISCSI }; public BackendStorageServerConnectionResourceTest() { super(new BackendStorageServerConnectionResource(GUIDS[3].toString(), diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionsResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionsResourceTest.java index ee76e25170d..c70ae1f252d 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionsResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageServerConnectionsResourceTest.java @@ -37,10 +37,10 @@ public class BackendStorageServerConnectionsResourceTest extends AbstractBackend org.ovirt.engine.api.model.StorageType.ISCSI }; protected static final StorageType[] STORAGE_TYPES_MAPPED = { - StorageType.NFS, - StorageType.LOCALFS, - StorageType.POSIXFS, - StorageType.ISCSI }; + StorageType.NFS, + StorageType.LOCALFS, + StorageType.POSIXFS, + StorageType.ISCSI }; public BackendStorageServerConnectionsResourceTest() { super(new BackendStorageServerConnectionsResource(), null, ""); @@ -65,7 +65,7 @@ protected StorageServerConnections getEntity(int index) { StorageConnection getModel(int index) { StorageConnection model = new StorageConnection(); model.setType(STORAGE_TYPES[index]); - if ( index == 0 || index == 3 ) { + if (index == 0 || index == 3) { model.setAddress("1.1.1.1"); } Host host = new Host(); diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendTemplateDiskResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendTemplateDiskResourceTest.java index c355ef90f82..b81c503dbd4 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendTemplateDiskResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendTemplateDiskResourceTest.java @@ -137,10 +137,10 @@ public void testCopyBySdId() { getEntity(3)); setUriInfo(setUpActionExpectations(ActionType.MoveOrCopyDisk, MoveOrCopyImageGroupParameters.class, - new String[] { "ImageId", "ImageGroupID", "SourceDomainId", - "StorageDomainId", "Operation" }, - new Object[] { GUIDS[1], GUIDS[3], Guid.Empty, GUIDS[3], ImageOperation - .Copy })); + new String[] { "ImageId", "ImageGroupID", "SourceDomainId", + "StorageDomainId", "Operation" }, + new Object[] { GUIDS[1], GUIDS[3], Guid.Empty, GUIDS[3], ImageOperation + .Copy })); verifyActionResponse(resource.copy(setUpCopyParams(false))); } diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendTemplateDisksResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendTemplateDisksResourceTest.java index 9c984d18b26..02ef404b67e 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendTemplateDisksResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendTemplateDisksResourceTest.java @@ -36,7 +36,7 @@ public class BackendTemplateDisksResourceTest private static final Guid TEMPLATE_ID = GUIDS[1]; public BackendTemplateDisksResourceTest() { - super(new BackendTemplateDisksResource(TEMPLATE_ID), null, null ); + super(new BackendTemplateDisksResource(TEMPLATE_ID), null, null); } @Override diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendTemplatesResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendTemplatesResourceTest.java index ee7ef6e7678..8bf49b0250b 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendTemplatesResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendTemplatesResourceTest.java @@ -225,34 +225,34 @@ public void testAddVersion() { setUpGetRngDeviceExpectations(2, 2); setUpGetTpmExpectations(2); - setUpGetEntityExpectations(QueryType.GetVmByVmId, - IdQueryParameters.class, - new String[] { "Id" }, - new Object[] { GUIDS[1] }, - setUpVm(GUIDS[1])); + setUpGetEntityExpectations(QueryType.GetVmByVmId, + IdQueryParameters.class, + new String[] { "Id" }, + new Object[] { GUIDS[1] }, + setUpVm(GUIDS[1])); setUpGetEntityExpectations(2); - setUpCreationExpectations(ActionType.AddVmTemplate, - AddVmTemplateParameters.class, - new String[] { "Name", "Description" }, - new Object[] { NAMES[2], DESCRIPTIONS[2] }, - true, - true, - GUIDS[2], - asList(GUIDS[2]), - asList(new AsyncTaskStatus(AsyncTaskStatusEnum.finished)), - QueryType.GetVmTemplate, - GetVmTemplateParameters.class, - new String[] { "Id" }, - new Object[] { GUIDS[2] }, - getEntity(2)); - - Response response = collection.add(getModel(2)); - assertEquals(201, response.getStatus()); - assertTrue(response.getEntity() instanceof Template); - assertEquals(VERSION_NAME, ((Template) response.getEntity()).getVersion().getVersionName()); - assertEquals(((Template) response.getEntity()).getVersion().getBaseTemplate().getId(), GUIDS[1].toString()); - verifyModel((Template) response.getEntity(), 2); + setUpCreationExpectations(ActionType.AddVmTemplate, + AddVmTemplateParameters.class, + new String[] { "Name", "Description" }, + new Object[] { NAMES[2], DESCRIPTIONS[2] }, + true, + true, + GUIDS[2], + asList(GUIDS[2]), + asList(new AsyncTaskStatus(AsyncTaskStatusEnum.finished)), + QueryType.GetVmTemplate, + GetVmTemplateParameters.class, + new String[] { "Id" }, + new Object[] { GUIDS[2] }, + getEntity(2)); + + Response response = collection.add(getModel(2)); + assertEquals(201, response.getStatus()); + assertTrue(response.getEntity() instanceof Template); + assertEquals(VERSION_NAME, ((Template) response.getEntity()).getVersion().getVersionName()); + assertEquals(((Template) response.getEntity()).getVersion().getBaseTemplate().getId(), GUIDS[1].toString()); + verifyModel((Template) response.getEntity(), 2); } @Test @@ -591,10 +591,10 @@ static VmTemplate setUpEntityExpectations(VmTemplate entity, int index) { when(entity.getThreadsPerCpu()).thenReturn(1); when(entity.getCpuPerSocket()).thenReturn(4); if (index == 2) { - when(entity.getTemplateVersionName()).thenReturn(VERSION_NAME); - when(entity.getTemplateVersionNumber()).thenReturn(2); - when(entity.getBaseTemplateId()).thenReturn(GUIDS[1]); - when(entity.isBaseTemplate()).thenReturn(false); + when(entity.getTemplateVersionName()).thenReturn(VERSION_NAME); + when(entity.getTemplateVersionNumber()).thenReturn(2); + when(entity.getBaseTemplateId()).thenReturn(GUIDS[1]); + when(entity.isBaseTemplate()).thenReturn(false); } else { when(entity.getTemplateVersionNumber()).thenReturn(1); // same base template id as the template itself @@ -642,9 +642,9 @@ protected void verifyCollection(List