[ https://issues.apache.org/jira/browse/CLOUDSTACK-10365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16449729#comment-16449729 ]
ASF GitHub Bot commented on CLOUDSTACK-10365: --------------------------------------------- BruceKuiLiu closed pull request #2602: CLOUDSTACK-10365: Change the "getXXX" boolean-related method names to… URL: https://github.com/apache/cloudstack/pull/2602 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/api/src/main/java/com/cloud/agent/api/to/S3TO.java b/api/src/main/java/com/cloud/agent/api/to/S3TO.java index ec6bc02cca0..233238cf793 100644 --- a/api/src/main/java/com/cloud/agent/api/to/S3TO.java +++ b/api/src/main/java/com/cloud/agent/api/to/S3TO.java @@ -201,7 +201,7 @@ public DataStoreRole getRole() { return DataStoreRole.Image; } - public boolean getEnableRRS() { + public boolean isEnableRRS() { return enableRRS; } diff --git a/api/src/main/java/com/cloud/offering/NetworkOffering.java b/api/src/main/java/com/cloud/offering/NetworkOffering.java index 0c8378908e6..e822e39d803 100644 --- a/api/src/main/java/com/cloud/offering/NetworkOffering.java +++ b/api/src/main/java/com/cloud/offering/NetworkOffering.java @@ -122,7 +122,7 @@ boolean getIsPersistent(); - boolean getInternalLb(); + boolean isInternalLb(); boolean getPublicLb(); diff --git a/api/src/main/java/com/cloud/offering/ServiceOffering.java b/api/src/main/java/com/cloud/offering/ServiceOffering.java index 196d2b4eb47..822168dd4c4 100644 --- a/api/src/main/java/com/cloud/offering/ServiceOffering.java +++ b/api/src/main/java/com/cloud/offering/ServiceOffering.java @@ -76,7 +76,7 @@ /** * @return Does this service plan offer HA? */ - boolean getOfferHA(); + boolean isOfferHA(); /** * @return Does this service plan offer VM to use CPU resources beyond the service offering limits? @@ -86,7 +86,7 @@ /** * @return Does this service plan support Volatile VM that is, discard VM's root disk and create a new one on reboot? */ - boolean getVolatileVm(); + boolean isVolatileVm(); /** * @return the rate in megabits per sec to which a VM's network interface is throttled to diff --git a/api/src/main/java/com/cloud/storage/GuestOS.java b/api/src/main/java/com/cloud/storage/GuestOS.java index 371260bec64..33c08722ad3 100644 --- a/api/src/main/java/com/cloud/storage/GuestOS.java +++ b/api/src/main/java/com/cloud/storage/GuestOS.java @@ -33,5 +33,5 @@ Date getRemoved(); - boolean getIsUserDefined(); + boolean isUserDefined(); } diff --git a/api/src/main/java/com/cloud/template/VirtualMachineTemplate.java b/api/src/main/java/com/cloud/template/VirtualMachineTemplate.java index 564f3b987be..ad2f6363170 100644 --- a/api/src/main/java/com/cloud/template/VirtualMachineTemplate.java +++ b/api/src/main/java/com/cloud/template/VirtualMachineTemplate.java @@ -101,9 +101,9 @@ String getDisplayText(); - boolean getEnablePassword(); + boolean isEnablePassword(); - boolean getEnableSshKey(); + boolean isEnableSshKey(); boolean isCrossZones(); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java index 0bde79bbd7b..3daea8d2075 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java @@ -210,7 +210,7 @@ public String getDeploymentPlanner() { return deploymentPlanner; } - public boolean getCustomized() { + public boolean isCustomized() { return (cpuNumber == null || memory == null || cpuSpeed == null); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java index 8eea632a72e..7b9ffa03289 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java @@ -107,7 +107,7 @@ public Long getSize() { return size; } - public boolean getShrinkOk() { + public boolean isShrinkOk() { return shrinkOk; } diff --git a/core/src/main/java/com/cloud/storage/template/S3TemplateDownloader.java b/core/src/main/java/com/cloud/storage/template/S3TemplateDownloader.java index d584cdffb10..0506dab22c0 100644 --- a/core/src/main/java/com/cloud/storage/template/S3TemplateDownloader.java +++ b/core/src/main/java/com/cloud/storage/template/S3TemplateDownloader.java @@ -184,7 +184,7 @@ public long download(boolean resume, DownloadCompleteCallback callback) { PutObjectRequest putObjectRequest = new PutObjectRequest(s3TO.getBucketName(), s3Key, inputStream, objectMetadata); // If reduced redundancy is enabled, set it. - if (s3TO.getEnableRRS()) { + if (s3TO.isEnableRRS()) { putObjectRequest.withStorageClass(StorageClass.ReducedRedundancy); } diff --git a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java index fb1c1b41933..7ea454fa4c9 100755 --- a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java @@ -3195,7 +3195,7 @@ public boolean upgradeVmDb(final long vmId, final long serviceOfferingId) { final VMInstanceVO vmForUpdate = _vmDao.createForUpdate(); vmForUpdate.setServiceOfferingId(serviceOfferingId); final ServiceOffering newSvcOff = _entityMgr.findById(ServiceOffering.class, serviceOfferingId); - vmForUpdate.setHaEnabled(newSvcOff.getOfferHA()); + vmForUpdate.setHaEnabled(newSvcOff.isOfferHA()); vmForUpdate.setLimitCpuUse(newSvcOff.getLimitCpuUse()); vmForUpdate.setServiceOfferingId(newSvcOff.getId()); return _vmDao.update(vmId, vmForUpdate); diff --git a/engine/schema/src/main/java/com/cloud/network/vpc/PrivateIpVO.java b/engine/schema/src/main/java/com/cloud/network/vpc/PrivateIpVO.java index ad17eb1c8f3..d03e55d6b28 100644 --- a/engine/schema/src/main/java/com/cloud/network/vpc/PrivateIpVO.java +++ b/engine/schema/src/main/java/com/cloud/network/vpc/PrivateIpVO.java @@ -97,7 +97,7 @@ public Long getVpcId() { return vpcId; } - public boolean getSourceNat() { + public boolean isSourceNat() { return sourceNat; } diff --git a/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java b/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java index e31714356e6..28e5716a153 100644 --- a/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java +++ b/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java @@ -490,7 +490,7 @@ public boolean getIsPersistent() { } @Override - public boolean getInternalLb() { + public boolean isInternalLb() { return internalLb; } diff --git a/engine/schema/src/main/java/com/cloud/service/ServiceOfferingVO.java b/engine/schema/src/main/java/com/cloud/service/ServiceOfferingVO.java index 9c755df7af2..7d3c57b6217 100644 --- a/engine/schema/src/main/java/com/cloud/service/ServiceOfferingVO.java +++ b/engine/schema/src/main/java/com/cloud/service/ServiceOfferingVO.java @@ -185,15 +185,15 @@ public ServiceOfferingVO(ServiceOfferingVO offering) { speed = offering.getSpeed(); rateMbps = offering.getRateMbps(); multicastRateMbps = offering.getMulticastRateMbps(); - offerHA = offering.getOfferHA(); + offerHA = offering.isOfferHA(); limitCpuUse = offering.getLimitCpuUse(); - volatileVm = offering.getVolatileVm(); + volatileVm = offering.isVolatileVm(); hostTag = offering.getHostTag(); vmType = offering.getSystemVmType(); } @Override - public boolean getOfferHA() { + public boolean isOfferHA() { return offerHA; } @@ -296,7 +296,7 @@ public int getSortKey() { } @Override - public boolean getVolatileVm() { + public boolean isVolatileVm() { return volatileVm; } diff --git a/engine/schema/src/main/java/com/cloud/storage/GuestOSVO.java b/engine/schema/src/main/java/com/cloud/storage/GuestOSVO.java index f04f9a4208c..1afea4ef66b 100644 --- a/engine/schema/src/main/java/com/cloud/storage/GuestOSVO.java +++ b/engine/schema/src/main/java/com/cloud/storage/GuestOSVO.java @@ -113,7 +113,7 @@ public Date getRemoved() { } @Override - public boolean getIsUserDefined() { + public boolean isUserDefined() { return isUserDefined; } diff --git a/engine/schema/src/main/java/com/cloud/storage/VMTemplateVO.java b/engine/schema/src/main/java/com/cloud/storage/VMTemplateVO.java index d206835a28a..30440d3dc74 100644 --- a/engine/schema/src/main/java/com/cloud/storage/VMTemplateVO.java +++ b/engine/schema/src/main/java/com/cloud/storage/VMTemplateVO.java @@ -284,7 +284,7 @@ private VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format } @Override - public boolean getEnablePassword() { + public boolean isEnablePassword() { return enablePassword; } @@ -573,7 +573,7 @@ public boolean isDynamicallyScalable() { } @Override - public boolean getEnableSshKey() { + public boolean isEnableSshKey() { return enableSshKey; } diff --git a/engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/store/TemplateObject.java b/engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/store/TemplateObject.java index 9b9b711c40c..25f27a23c1e 100644 --- a/engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/store/TemplateObject.java +++ b/engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/store/TemplateObject.java @@ -403,13 +403,13 @@ public String getDisplayText() { } @Override - public boolean getEnablePassword() { - return imageVO.getEnablePassword(); + public boolean isEnablePassword() { + return imageVO.isEnablePassword(); } @Override - public boolean getEnableSshKey() { - return imageVO.getEnableSshKey(); + public boolean isEnableSshKey() { + return imageVO.isEnableSshKey(); } @Override diff --git a/engine/storage/src/main/java/org/apache/cloudstack/storage/image/TemplateEntityImpl.java b/engine/storage/src/main/java/org/apache/cloudstack/storage/image/TemplateEntityImpl.java index d3c1effd2a1..b027c42a86e 100644 --- a/engine/storage/src/main/java/org/apache/cloudstack/storage/image/TemplateEntityImpl.java +++ b/engine/storage/src/main/java/org/apache/cloudstack/storage/image/TemplateEntityImpl.java @@ -179,13 +179,13 @@ public String getDisplayText() { } @Override - public boolean getEnablePassword() { + public boolean isEnablePassword() { // TODO Auto-generated method stub return false; } @Override - public boolean getEnableSshKey() { + public boolean isEnableSshKey() { // TODO Auto-generated method stub return false; } diff --git a/framework/quota/src/main/java/org/apache/cloudstack/quota/vo/ServiceOfferingVO.java b/framework/quota/src/main/java/org/apache/cloudstack/quota/vo/ServiceOfferingVO.java index 795a1782383..c7b2e16e961 100644 --- a/framework/quota/src/main/java/org/apache/cloudstack/quota/vo/ServiceOfferingVO.java +++ b/framework/quota/src/main/java/org/apache/cloudstack/quota/vo/ServiceOfferingVO.java @@ -140,15 +140,15 @@ public ServiceOfferingVO(ServiceOfferingVO offering) { speed = offering.getSpeed(); rateMbps = offering.getRateMbps(); multicastRateMbps = offering.getMulticastRateMbps(); - offerHA = offering.getOfferHA(); + offerHA = offering.isOfferHA(); limitCpuUse = offering.getLimitCpuUse(); - volatileVm = offering.getVolatileVm(); + volatileVm = offering.isVolatileVm(); hostTag = offering.getHostTag(); vmType = offering.getSystemVmType(); } @Override - public boolean getOfferHA() { + public boolean isOfferHA() { return offerHA; } @@ -251,7 +251,7 @@ public int getSortKey() { } @Override - public boolean getVolatileVm() { + public boolean isVolatileVm() { return volatileVm; } diff --git a/plugins/network-elements/elastic-loadbalancer/src/main/java/com/cloud/network/lb/LoadBalanceRuleHandler.java b/plugins/network-elements/elastic-loadbalancer/src/main/java/com/cloud/network/lb/LoadBalanceRuleHandler.java index dc5f0ab6cee..05ed6157d4f 100644 --- a/plugins/network-elements/elastic-loadbalancer/src/main/java/com/cloud/network/lb/LoadBalanceRuleHandler.java +++ b/plugins/network-elements/elastic-loadbalancer/src/main/java/com/cloud/network/lb/LoadBalanceRuleHandler.java @@ -289,7 +289,7 @@ private DomainRouterVO deployELBVm(Network guestNetwork, final DeployDestination ServiceOfferingVO elasticLbVmOffering = _serviceOfferingDao.findDefaultSystemOffering(ServiceOffering.elbVmDefaultOffUniqueName, ConfigurationManagerImpl.SystemVMUseLocalStorage.valueIn(dest.getDataCenter().getId())); elbVm = new DomainRouterVO(id, elasticLbVmOffering.getId(), vrProvider.getId(), VirtualMachineName.getSystemVmName(id, _instance, ELB_VM_NAME_PREFIX), template.getId(), template.getHypervisorType(), template.getGuestOSId(), owner.getDomainId(), owner.getId(), userId, false, RedundantState.UNKNOWN, - elasticLbVmOffering.getOfferHA(), false, null); + elasticLbVmOffering.isOfferHA(), false, null); elbVm.setRole(Role.LB); elbVm = _routerDao.persist(elbVm); _itMgr.allocate(elbVm.getInstanceName(), template, elasticLbVmOffering, networks, plan, null); diff --git a/server/src/main/java/com/cloud/api/ApiResponseHelper.java b/server/src/main/java/com/cloud/api/ApiResponseHelper.java index bd9b543c58f..07eabd25c95 100644 --- a/server/src/main/java/com/cloud/api/ApiResponseHelper.java +++ b/server/src/main/java/com/cloud/api/ApiResponseHelper.java @@ -3203,7 +3203,7 @@ public GuestOSResponse createGuestOSResponse(GuestOS guestOS) { GuestOSResponse response = new GuestOSResponse(); response.setDescription(guestOS.getDisplayName()); response.setId(guestOS.getUuid()); - response.setIsUserDefined(Boolean.valueOf(guestOS.getIsUserDefined()).toString()); + response.setIsUserDefined(Boolean.valueOf(guestOS.isUserDefined()).toString()); GuestOSCategoryVO category = ApiDBUtils.findGuestOsCategoryById(guestOS.getCategoryId()); if (category != null) { response.setOsCategoryId(category.getUuid()); diff --git a/server/src/main/java/com/cloud/api/SerializationContext.java b/server/src/main/java/com/cloud/api/SerializationContext.java index 8bf6acedf32..fe25a106cd5 100644 --- a/server/src/main/java/com/cloud/api/SerializationContext.java +++ b/server/src/main/java/com/cloud/api/SerializationContext.java @@ -33,7 +33,7 @@ public static SerializationContext current() { return context; } - public boolean getUuidTranslation() { + public boolean isUuidTranslation() { return _doUuidTranslation; } diff --git a/server/src/main/java/com/cloud/api/query/dao/AsyncJobJoinDaoImpl.java b/server/src/main/java/com/cloud/api/query/dao/AsyncJobJoinDaoImpl.java index fefc89677dd..8341373bde3 100644 --- a/server/src/main/java/com/cloud/api/query/dao/AsyncJobJoinDaoImpl.java +++ b/server/src/main/java/com/cloud/api/query/dao/AsyncJobJoinDaoImpl.java @@ -68,7 +68,7 @@ public AsyncJobResponse newAsyncJobResponse(AsyncJobJoinVO job) { } jobResponse.setJobResultCode(job.getResultCode()); - boolean savedValue = SerializationContext.current().getUuidTranslation(); + boolean savedValue = SerializationContext.current().isUuidTranslation(); SerializationContext.current().setUuidTranslation(false); Object resultObject = ApiSerializerHelper.fromSerializedString(job.getResult()); diff --git a/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java index e6c0a8da6ec..faa9f98698a 100644 --- a/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java +++ b/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java @@ -773,7 +773,7 @@ protected NetworkVO getDefaultNetworkForBasicZone(DataCenter dc) { } ConsoleProxyVO proxy = new ConsoleProxyVO(id, serviceOffering.getId(), name, template.getId(), template.getHypervisorType(), template.getGuestOSId(), dataCenterId, - systemAcct.getDomainId(), systemAcct.getId(), _accountMgr.getSystemUser().getId(), 0, serviceOffering.getOfferHA()); + systemAcct.getDomainId(), systemAcct.getId(), _accountMgr.getSystemUser().getId(), 0, serviceOffering.isOfferHA()); proxy.setDynamicallyScalable(template.isDynamicallyScalable()); proxy = _consoleProxyDao.persist(proxy); try { diff --git a/server/src/main/java/com/cloud/network/NetworkServiceImpl.java b/server/src/main/java/com/cloud/network/NetworkServiceImpl.java index c121d1e75a1..111e0e83ffd 100644 --- a/server/src/main/java/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/main/java/com/cloud/network/NetworkServiceImpl.java @@ -1376,7 +1376,7 @@ public Network doInTransaction(TransactionStatus status) throws InsufficientCapa if (_configMgr.isOfferingForVpc(ntwkOff)) { throw new InvalidParameterValueException("Network offering can be used for VPC networks only"); } - if (ntwkOff.getInternalLb()) { + if (ntwkOff.isInternalLb()) { throw new InvalidParameterValueException("Internal Lb can be enabled on vpc networks only"); } @@ -2751,7 +2751,7 @@ private boolean canMoveToPhysicalNetwork(Network network, long oldNetworkOfferin //can't update from internal LB to public LB if (areServicesSupportedByNetworkOffering(oldNetworkOfferingId, Service.Lb) && areServicesSupportedByNetworkOffering(newNetworkOfferingId, Service.Lb)) { - if (oldNetworkOffering.getPublicLb() != newNetworkOffering.getPublicLb() || oldNetworkOffering.getInternalLb() != newNetworkOffering.getInternalLb()) { + if (oldNetworkOffering.getPublicLb() != newNetworkOffering.getPublicLb() || oldNetworkOffering.isInternalLb() != newNetworkOffering.isInternalLb()) { throw new InvalidParameterValueException("Original and new offerings support different types of LB - Internal vs Public," + " can't upgrade"); } } diff --git a/server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java index 9b7cf9b4230..1eac5dd2ef5 100644 --- a/server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java +++ b/server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java @@ -2511,7 +2511,7 @@ public void isLbServiceSupportedInNetwork(long networkId, Scheme scheme) { throw new InvalidParameterValueException("Scheme " + scheme + " is not supported by the network offering " + off); } } else { - if (!off.getInternalLb()) { + if (!off.isInternalLb()) { throw new InvalidParameterValueException("Scheme " + scheme + " is not supported by the network offering " + off); } } diff --git a/server/src/main/java/com/cloud/network/router/NetworkHelperImpl.java b/server/src/main/java/com/cloud/network/router/NetworkHelperImpl.java index 5c84527317a..25e2793cc42 100644 --- a/server/src/main/java/com/cloud/network/router/NetworkHelperImpl.java +++ b/server/src/main/java/com/cloud/network/router/NetworkHelperImpl.java @@ -479,7 +479,7 @@ public DomainRouterVO deployRouter(final RouterDeploymentDefinition routerDeploy continue; } - final boolean offerHA = routerOffering.getOfferHA(); + final boolean offerHA = routerOffering.isOfferHA(); // routerDeploymentDefinition.getVpc().getId() ==> do not use // VPC because it is not a VPC offering. diff --git a/server/src/main/java/com/cloud/network/vpc/PrivateIpAddress.java b/server/src/main/java/com/cloud/network/vpc/PrivateIpAddress.java index 81644285cb4..6ec880f723f 100644 --- a/server/src/main/java/com/cloud/network/vpc/PrivateIpAddress.java +++ b/server/src/main/java/com/cloud/network/vpc/PrivateIpAddress.java @@ -41,7 +41,7 @@ public PrivateIpAddress(PrivateIpVO privateIp, String broadcastUri, String gatew this.netmask = netmask; this.macAddress = macAddress; this.networkId = privateIp.getNetworkId(); - this.sourceNat = privateIp.getSourceNat(); + this.sourceNat = privateIp.isSourceNat(); } @Override diff --git a/server/src/main/java/com/cloud/server/ManagementServerImpl.java b/server/src/main/java/com/cloud/server/ManagementServerImpl.java index 3082f1dfa72..bc72af83e86 100644 --- a/server/src/main/java/com/cloud/server/ManagementServerImpl.java +++ b/server/src/main/java/com/cloud/server/ManagementServerImpl.java @@ -2179,7 +2179,7 @@ public GuestOS updateGuestOs(final UpdateGuestOsCmd cmd) { throw new InvalidParameterValueException("Guest OS not found. Please specify a valid ID for the Guest OS"); } - if (!guestOsHandle.getIsUserDefined()) { + if (!guestOsHandle.isUserDefined()) { throw new InvalidParameterValueException("Unable to modify system defined guest OS"); } @@ -2221,7 +2221,7 @@ public boolean removeGuestOs(final RemoveGuestOsCmd cmd) { throw new InvalidParameterValueException("Guest OS not found. Please specify a valid ID for the Guest OS"); } - if (!guestOs.getIsUserDefined()) { + if (!guestOs.isUserDefined()) { throw new InvalidParameterValueException("Unable to remove system defined guest OS"); } diff --git a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java index 2ac317c660f..247f9e135e1 100644 --- a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java @@ -855,7 +855,7 @@ public VolumeVO resizeVolume(ResizeVolumeCmd cmd) throws ResourceAllocationExcep Long newMinIops; Long newMaxIops; Integer newHypervisorSnapshotReserve; - boolean shrinkOk = cmd.getShrinkOk(); + boolean shrinkOk = cmd.isShrinkOk(); VolumeVO volume = _volsDao.findById(cmd.getEntityId()); if (volume == null) { diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java index df81dd3ff2b..d53b2081986 100644 --- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java @@ -672,7 +672,7 @@ public UserVm resetVMPassword(ResetVMPasswordCmd cmd, String password) throws Re _vmDao.loadDetails(userVm); VMTemplateVO template = _templateDao.findByIdIncludingRemoved(userVm.getTemplateId()); - if (template == null || !template.getEnablePassword()) { + if (template == null || !template.isEnablePassword()) { throw new InvalidParameterValueException("Fail to reset password for the virtual machine, the template is not password enabled"); } @@ -707,7 +707,7 @@ private boolean resetVMPasswordInternal(Long vmId, String password) throws Resou } VMTemplateVO template = _templateDao.findByIdIncludingRemoved(vmInstance.getTemplateId()); - if (template.getEnablePassword()) { + if (template.isEnablePassword()) { Nic defaultNic = _networkModel.getDefaultNic(vmId); if (defaultNic == null) { s_logger.error("Unable to reset password for vm " + vmInstance + " as the instance doesn't have default nic"); @@ -790,7 +790,7 @@ public UserVm resetVMSSHKey(ResetVMSSHKeyCmd cmd) throws ResourceUnavailableExce _accountMgr.checkAccess(caller, null, true, userVm); String password = null; String sshPublicKey = s.getPublicKey(); - if (template != null && template.getEnablePassword()) { + if (template != null && template.isEnablePassword()) { password = _mgr.generateRandomPassword(); } @@ -798,7 +798,7 @@ public UserVm resetVMSSHKey(ResetVMSSHKeyCmd cmd) throws ResourceUnavailableExce if (result) { userVm.setDetail("SSH.PublicKey", sshPublicKey); - if (template != null && template.getEnablePassword()) { + if (template != null && template.isEnablePassword()) { userVm.setPassword(password); //update the encrypted password in vm_details table too encryptAndStorePassword(userVm, password); @@ -827,7 +827,7 @@ private boolean resetVMSSHKeyInternal(Long vmId, String sshPublicKey, String pas VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(vmInstance); - if (template.getEnablePassword()) { + if (template.isEnablePassword()) { vmProfile.setParameter(VirtualMachineProfile.Param.VmPassword, password); } @@ -2500,7 +2500,7 @@ public UserVm updateVirtualMachine(long id, String displayName, String group, Bo } ServiceOffering offering = _serviceOfferingDao.findById(vm.getId(), vm.getServiceOfferingId()); - if (!offering.getOfferHA() && ha) { + if (!offering.isOfferHA() && ha) { throw new InvalidParameterValueException("Can't enable ha for the vm as it's created from the Service offering having HA disabled"); } @@ -2683,7 +2683,7 @@ public UserVm rebootVirtualMachine(RebootVMCmd cmd) throws InsufficientCapacityE long serviceOfferingId = vmInstance.getServiceOfferingId(); ServiceOfferingVO offering = _serviceOfferingDao.findById(vmInstance.getId(), serviceOfferingId); if (offering != null && offering.getRemoved() == null) { - if (offering.getVolatileVm()) { + if (offering.isVolatileVm()) { return restoreVMInternal(caller, vmInstance, null); } } else { @@ -3508,7 +3508,7 @@ private UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffe throw new InvalidParameterValueException("Unable to deploy VM as SSH keypair is provided while deploying the VM, but there is no support for " + Network.Service.UserData.getName() + " service in the default network " + network.getId()); } - if (template.getEnablePassword()) { + if (template.isEnablePassword()) { throw new InvalidParameterValueException("Unable to deploy VM as template " + template.getId() + " is password enabled, but there is no support for " + Network.Service.UserData.getName() + " service in the default network " + network.getId()); } } @@ -3663,7 +3663,7 @@ private UserVmVO commitUserVm(final DataCenter zone, final VirtualMachineTemplat return Transaction.execute(new TransactionCallbackWithException<UserVmVO, InsufficientCapacityException>() { @Override public UserVmVO doInTransaction(TransactionStatus status) throws InsufficientCapacityException { - UserVmVO vm = new UserVmVO(id, instanceName, displayName, template.getId(), hypervisorType, template.getGuestOSId(), offering.getOfferHA(), + UserVmVO vm = new UserVmVO(id, instanceName, displayName, template.getId(), hypervisorType, template.getGuestOSId(), offering.isOfferHA(), offering.getLimitCpuUse(), owner.getDomainId(), owner.getId(), userId, offering.getId(), userData, hostName, diskOfferingId); vm.setUuid(uuidName); vm.setDynamicallyScalable(template.isDynamicallyScalable()); @@ -4063,7 +4063,7 @@ private UserVm startVirtualMachine(DeployVMCmd cmd, Map<VirtualMachineProfile.Pa // Check that the password was passed in and is valid VMTemplateVO template = _templateDao.findByIdIncludingRemoved(vm.getTemplateId()); - if (template.getEnablePassword()) { + if (template.isEnablePassword()) { // this value is not being sent to the backend; need only for api // display purposes vm.setPassword((String)vmParamPair.second().get(VirtualMachineProfile.Param.VmPassword)); @@ -4433,7 +4433,7 @@ public void finalizeStop(VirtualMachineProfile profile, Answer answer) { template = _templateDao.findByIdIncludingRemoved(vm.getTemplateId()); String password = "saved_password"; - if (template.getEnablePassword()) { + if (template.isEnablePassword()) { if (vm.getDetail("password") != null) { password = DBEncryptionUtil.decrypt(vm.getDetail("password")); } else { @@ -4475,7 +4475,7 @@ public void finalizeStop(VirtualMachineProfile profile, Answer answer) { if (vm != null && vm.isUpdateParameters()) { // this value is not being sent to the backend; need only for api // display purposes - if (template.getEnablePassword()) { + if (template.isEnablePassword()) { vm.setPassword((String)vmParamPair.second().get(VirtualMachineProfile.Param.VmPassword)); vm.setUpdateParameters(false); if (vm.getDetail("password") != null) { @@ -6134,7 +6134,7 @@ public UserVm restoreVMInternal(Account caller, UserVmVO vm, Long newTemplateId) Map<VirtualMachineProfile.Param, Object> params = null; String password = null; - if (template.getEnablePassword()) { + if (template.isEnablePassword()) { password = _mgr.generateRandomPassword(); boolean result = resetVMPasswordInternal(vmId, password); if (result) { @@ -6157,7 +6157,7 @@ public UserVm restoreVMInternal(Account caller, UserVmVO vm, Long newTemplateId) } _itMgr.start(vm.getUuid(), params); vm = _vmDao.findById(vmId); - if (template.getEnablePassword()) { + if (template.isEnablePassword()) { // this value is not being sent to the backend; need only for api // display purposes vm.setPassword(password); diff --git a/server/src/main/java/org/apache/cloudstack/network/topology/BasicNetworkVisitor.java b/server/src/main/java/org/apache/cloudstack/network/topology/BasicNetworkVisitor.java index 53ddebbc3de..31493dc02bf 100644 --- a/server/src/main/java/org/apache/cloudstack/network/topology/BasicNetworkVisitor.java +++ b/server/src/main/java/org/apache/cloudstack/network/topology/BasicNetworkVisitor.java @@ -216,7 +216,7 @@ public boolean visit(final SshKeyToRouterRules sshkey) throws ResourceUnavailabl final NicVO nicVo = sshkey.getNicVo(); final VMTemplateVO template = sshkey.getTemplate(); - if (template != null && template.getEnablePassword()) { + if (template != null && template.isEnablePassword()) { _commandSetupHelper.createPasswordCommand(router, profile, nicVo, commands); } diff --git a/services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java b/services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java index 66c436b15c3..8670cf8dc90 100644 --- a/services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java +++ b/services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java @@ -653,7 +653,7 @@ protected NetworkVO getDefaultNetworkForBasicZone(DataCenter dc) { } SecondaryStorageVmVO secStorageVm = new SecondaryStorageVmVO(id, serviceOffering.getId(), name, template.getId(), template.getHypervisorType(), template.getGuestOSId(), dataCenterId, - systemAcct.getDomainId(), systemAcct.getId(), _accountMgr.getSystemUser().getId(), role, serviceOffering.getOfferHA()); + systemAcct.getDomainId(), systemAcct.getId(), _accountMgr.getSystemUser().getId(), role, serviceOffering.isOfferHA()); secStorageVm.setDynamicallyScalable(template.isDynamicallyScalable()); secStorageVm = _secStorageVmDao.persist(secStorageVm); try { ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Inconsistent boolean-related method names > ----------------------------------------- > > Key: CLOUDSTACK-10365 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10365 > Project: CloudStack > Issue Type: Improvement > Security Level: Public(Anyone can view this level - this is the > default.) > Reporter: KuiLIU > Priority: Major > > These boolean-return methods are named as "getXXX". > Other boolean-return methods are named as "isXXX". > Considering there methods will return boolean values, it should be more clear > to rename them as "isXXX". > {code:java} > public boolean getEnableRRS() { > return enableRRS; > } > public boolean getEnableRRS() { > return enableRRS; > } > public boolean getShrinkOk() { > return shrinkOk; > } > > public boolean getSourceNat() { > return sourceNat; > } > > public boolean getInternalLb() { > return internalLb; > } > > public boolean getOfferHA() { > return offerHA; > } > > public boolean getVolatileVm() { > return volatileVm; > } > > public boolean getIsUserDefined() { > return isUserDefined; > } > > public boolean getEnablePassword() { > return enablePassword; > } > > public boolean getEnableSshKey() { > return enableSshKey; > } > > public boolean getUuidTranslation() { > return _doUuidTranslation; > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)