This is an automated email from the ASF dual-hosted git repository. vishesh pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit 33dc7465c2becd95b3e40d4ef6c851fb704b46fc Merge: f76c6f3ea97 fe5d7412364 Author: Vishesh <[email protected]> AuthorDate: Tue Mar 19 15:18:02 2024 +0530 Merge remote-tracking branch 'origin/4.19' .../java/com/cloud/offering/ServiceOffering.java | 2 +- .../org/apache/cloudstack/acl/RoleService.java | 4 +- .../apache/cloudstack/api/InternalIdentity.java | 14 + .../api/storage/PrimaryDataStoreDriver.java | 15 + .../engine/orchestration/VolumeOrchestrator.java | 42 +- .../orchestration/VolumeOrchestratorTest.java | 55 + .../java/com/cloud/service/ServiceOfferingVO.java | 4 +- .../org/apache/cloudstack/acl/dao/RoleDao.java | 2 + .../org/apache/cloudstack/acl/dao/RoleDaoImpl.java | 17 + .../resourcedetail/DiskOfferingDetailVO.java | 4 + .../storage/datastore/db/ImageStoreDao.java | 2 + .../storage/datastore/db/ImageStoreDaoImpl.java | 16 + .../storage/datastore/db/PrimaryDataStoreDao.java | 8 + .../datastore/db/PrimaryDataStoreDaoImpl.java | 98 ++ .../db/views/cloud.service_offering_view.sql | 2 +- .../main/java/com/cloud/utils/db/Attribute.java | 9 + .../main/java/com/cloud/utils/db/GenericDao.java | 2 + .../java/com/cloud/utils/db/GenericDaoBase.java | 153 ++- .../com/cloud/utils/db/GenericSearchBuilder.java | 22 + .../main/java/com/cloud/utils/db/JoinBuilder.java | 62 +- .../main/java/com/cloud/utils/db/SearchBase.java | 93 +- .../java/com/cloud/utils/db/SearchCriteria.java | 12 +- .../com/cloud/utils/db/GenericDaoBaseTest.java | 35 +- .../cloudstack/metrics/MetricsServiceImpl.java | 9 +- .../driver/DateraPrimaryDataStoreDriver.java | 5 + .../driver/NexentaPrimaryDataStoreDriver.java | 5 + .../driver/ScaleIOPrimaryDataStoreDriver.java | 10 + .../driver/SolidFirePrimaryDataStoreDriver.java | 5 + server/src/main/java/com/cloud/api/ApiDBUtils.java | 25 + .../java/com/cloud/api/query/QueryManagerImpl.java | 1159 ++++++++++++++------ .../com/cloud/api/query/ViewResponseHelper.java | 6 +- .../com/cloud/api/query/dao/AccountJoinDao.java | 2 + .../cloud/api/query/dao/AccountJoinDaoImpl.java | 53 + .../cloud/api/query/dao/DiskOfferingJoinDao.java | 2 + .../api/query/dao/DiskOfferingJoinDaoImpl.java | 54 + .../com/cloud/api/query/dao/DomainJoinDao.java | 2 + .../com/cloud/api/query/dao/DomainJoinDaoImpl.java | 53 + .../api/query/dao/ServiceOfferingJoinDao.java | 1 + .../api/query/dao/ServiceOfferingJoinDaoImpl.java | 58 +- .../cloud/api/query/dao/StoragePoolJoinDao.java | 5 - .../api/query/dao/StoragePoolJoinDaoImpl.java | 74 -- .../cloud/api/query/dao/TemplateJoinDaoImpl.java | 11 +- .../configuration/ConfigurationManagerImpl.java | 8 +- .../java/com/cloud/network/NetworkServiceImpl.java | 4 +- .../router/VirtualNetworkApplianceManager.java | 2 +- .../com/cloud/server/ManagementServerImpl.java | 41 +- .../org/apache/cloudstack/acl/RoleManagerImpl.java | 27 +- .../com/cloud/api/query/QueryManagerImplTest.java | 38 +- .../com/cloud/network/NetworkServiceImplTest.java | 4 +- .../com/cloud/server/ManagementServerImplTest.java | 39 + .../java/com/cloud/user/MockUsageEventDao.java | 5 + ui/src/views/compute/AssignInstance.vue | 6 +- 52 files changed, 1785 insertions(+), 601 deletions(-) diff --cc engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java index 93271088069,e97f4638b54..d42e863cbed --- a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java @@@ -21,8 -21,9 +21,10 @@@ import java.util.Map import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.ScopeType; +import com.cloud.storage.Storage; import com.cloud.storage.StoragePoolStatus; + import com.cloud.utils.Pair; + import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDao; /** @@@ -137,7 -138,13 +139,13 @@@ public interface PrimaryDataStoreDao ex Integer countAll(); - List<StoragePoolVO> findPoolsByStorageType(String storageType); + List<StoragePoolVO> findPoolsByStorageType(Storage.StoragePoolType storageType); List<StoragePoolVO> listStoragePoolsWithActiveVolumesByOfferingId(long offeringid); + + Pair<List<Long>, Integer> searchForIdsAndCount(Long storagePoolId, String storagePoolName, Long zoneId, + String path, Long podId, Long clusterId, String address, ScopeType scopeType, StoragePoolStatus status, + String keyword, Filter searchFilter); + + List<StoragePoolVO> listByIds(List<Long> ids); } diff --cc framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java index d510cb93d40,6724da8b8be..2385dc61293 --- a/framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java +++ b/framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java @@@ -59,6 -56,8 +59,7 @@@ import javax.persistence.Enumerated import javax.persistence.Table; import javax.persistence.TableGenerator; + import com.amazonaws.util.CollectionUtils; -import org.apache.log4j.Logger; import com.cloud.utils.DateUtil; import com.cloud.utils.NumbersUtil; @@@ -1601,13 -1624,24 +1630,28 @@@ public abstract class GenericDaoBase<T return; } } - if(attr.field.getDeclaredAnnotation(Convert.class) != null) { ++ + if (attr.getValue() != null && attr.getValue() instanceof String) { + pstmt.setString(j, (String)attr.getValue()); + } else if (attr.getValue() != null && attr.getValue() instanceof Long) { + pstmt.setLong(j, (Long)attr.getValue()); ++ } else if(attr.field.getDeclaredAnnotation(Convert.class) != null) { + Object val = _conversionSupport.convertToDatabaseColumn(attr.field, value); + pstmt.setObject(j, val); } else if (attr.field.getType() == String.class) { - final String str = (String)value; - if (str == null) { - pstmt.setString(j, null); + final String str; + try { + str = (String) value; + if (str == null) { + pstmt.setString(j, null); + return; + } + } catch (ClassCastException ex) { + // This happens when we pass in an integer, long or any other object which can't be cast to String. + // Converting to string in case of integer or long can result in different results. Required specifically for details tables. + // So, we set the value for the object directly. - s_logger.debug("ClassCastException when casting value to String. Setting the value of the object directly."); ++ logger.debug("ClassCastException when casting value to String. Setting the value of the object directly."); + pstmt.setObject(j, value); return; } final Column column = attr.field.getAnnotation(Column.class); diff --cc server/src/main/java/com/cloud/api/query/QueryManagerImpl.java index 494723f5ff2,db462373eed..a06999a700f --- a/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java @@@ -176,8 -186,10 +186,9 @@@ import org.apache.cloudstack.storage.da import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao; import org.apache.commons.collections.CollectionUtils; + import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.cloud.api.query.dao.AccountJoinDao; @@@ -3192,8 -3332,15 +3333,16 @@@ public class QueryManagerImpl extends M Long storagePoolId = cmd.getStoragePoolId(); Boolean encrypt = cmd.getEncrypt(); String storageType = cmd.getStorageType(); + final Long vmId = cmd.getVirtualMachineId(); + Filter searchFilter = new Filter(DiskOfferingVO.class, "sortKey", SortKeyAscending.value(), cmd.getStartIndex(), cmd.getPageSizeVal()); + searchFilter.addOrderBy(DiskOfferingVO.class, "id", true); + SearchBuilder<DiskOfferingVO> diskOfferingSearch = _diskOfferingDao.createSearchBuilder(); + diskOfferingSearch.select(null, Func.DISTINCT, diskOfferingSearch.entity().getId()); // select distinct + + diskOfferingSearch.and("computeOnly", diskOfferingSearch.entity().isComputeOnly(), Op.EQ); + diskOfferingSearch.and("activeState", diskOfferingSearch.entity().getState(), Op.EQ); + // Keeping this logic consistent with domain specific zones // if a domainId is provided, we just return the disk offering // associated with this domain @@@ -3269,53 -3429,87 +3431,97 @@@ } currentDiskOffering = _diskOfferingDao.findByIdIncludingRemoved(volume.getDiskOfferingId()); if (!currentDiskOffering.isComputeOnly() && currentDiskOffering.getDiskSizeStrictness()) { - SearchCriteria<DiskOfferingJoinVO> ssc = _diskOfferingJoinDao.createSearchCriteria(); - ssc.addOr("diskSize", Op.EQ, volume.getSize()); - ssc.addOr("customized", SearchCriteria.Op.EQ, true); - sc.addAnd("diskSizeOrCustomized", SearchCriteria.Op.SC, ssc); + diskOfferingSearch.and().op("diskSize", diskOfferingSearch.entity().getDiskSize(), Op.EQ); + diskOfferingSearch.or("customized", diskOfferingSearch.entity().isCustomized(), Op.EQ); + diskOfferingSearch.cp(); } - sc.addAnd("id", SearchCriteria.Op.NEQ, currentDiskOffering.getId()); - sc.addAnd("diskSizeStrictness", Op.EQ, currentDiskOffering.getDiskSizeStrictness()); + diskOfferingSearch.and("idNEQ", diskOfferingSearch.entity().getId(), Op.NEQ); + diskOfferingSearch.and("diskSizeStrictness", diskOfferingSearch.entity().getDiskSizeStrictness(), Op.EQ); } - // Filter offerings that are not associated with caller's domain - // Fetch the offering ids from the details table since theres no smart way to filter them in the join ... yet! account = accountMgr.finalizeOwner(account, accountName, domainId, projectId); if (!Account.Type.ADMIN.equals(account.getType())) { - Domain callerDomain = _domainDao.findById(account.getDomainId()); - List<Long> domainIds = findRelatedDomainIds(callerDomain, isRecursive); + SearchBuilder<DiskOfferingDetailVO> domainDetailsSearch = _diskOfferingDetailsDao.createSearchBuilder(); + domainDetailsSearch.and().op("domainIdIN", domainDetailsSearch.entity().getValue(), Op.IN); + domainDetailsSearch.or("domainIdNull", domainDetailsSearch.entity().getId(), Op.NULL); + domainDetailsSearch.cp(); + + diskOfferingSearch.join("domainDetailsSearch", domainDetailsSearch, JoinBuilder.JoinType.LEFT, JoinBuilder.JoinCondition.AND, + diskOfferingSearch.entity().getId(), domainDetailsSearch.entity().getResourceId(), + domainDetailsSearch.entity().getName(), diskOfferingSearch.entity().setString(ApiConstants.DOMAIN_ID)); + } + + SearchCriteria<DiskOfferingVO> sc = diskOfferingSearch.create(); + + sc.setParameters("computeOnly", false); + sc.setParameters("activeState", DiskOffering.State.Active); + + if (keyword != null) { + sc.setParameters("keywordDisplayText", "%" + keyword + "%"); + sc.setParameters("keywordName", "%" + keyword + "%"); + } + + if (id != null) { + sc.setParameters("id", id); + } + + if (name != null) { + sc.setParameters("name", name); + } + + if (encrypt != null) { + sc.setParameters("encrypt", encrypt); + } + + if (storageType != null) { + if (storageType.equalsIgnoreCase(ServiceOffering.StorageType.local.toString())) { + sc.setParameters("useLocalStorage", true); - List<Long> ids = _diskOfferingDetailsDao.findOfferingIdsByDomainIds(domainIds); - SearchBuilder<DiskOfferingJoinVO> sb = _diskOfferingJoinDao.createSearchBuilder(); - if (ids != null && !ids.isEmpty()) { - sb.and("id", sb.entity().getId(), Op.IN); + } else if (storageType.equalsIgnoreCase(ServiceOffering.StorageType.shared.toString())) { + sc.setParameters("useLocalStorage", false); } - sb.or("domainId", sb.entity().getDomainId(), Op.NULL); - sb.done(); + } + + if (zoneId != null) { + sc.setJoinParameters("zoneDetailSearch", "zoneId", zoneId); - SearchCriteria<DiskOfferingJoinVO> scc = sb.create(); - if (ids != null && !ids.isEmpty()) { - scc.setParameters("id", ids.toArray()); + DataCenterJoinVO zone = _dcJoinDao.findById(zoneId); + if (DataCenter.Type.Edge.equals(zone.getType())) { + sc.setParameters("useLocalStorage", true); } - sc.addAnd("domainId", SearchCriteria.Op.SC, scc); + } + + if (volumeId != null) { + if (!currentDiskOffering.isComputeOnly() && currentDiskOffering.getDiskSizeStrictness()) { + sc.setParameters("diskSize", volume.getSize()); + sc.setParameters("customized", true); + } + sc.setParameters("idNEQ", currentDiskOffering.getId()); + sc.setParameters("diskSizeStrictness", currentDiskOffering.getDiskSizeStrictness()); + } + + // Filter offerings that are not associated with caller's domain + if (!Account.Type.ADMIN.equals(account.getType())) { + Domain callerDomain = _domainDao.findById(account.getDomainId()); + List<Long> domainIds = findRelatedDomainIds(callerDomain, isRecursive); + + sc.setJoinParameters("domainDetailsSearch", "domainIdIN", domainIds.toArray()); } + if (vmId != null) { + UserVmVO vm = userVmDao.findById(vmId); + if (vm == null) { + throw new InvalidParameterValueException("Unable to find the VM instance with the specified ID"); + } + if (!isRootAdmin) { + accountMgr.checkAccess(account, null, false, vm); + } + } + - Pair<List<DiskOfferingJoinVO>, Integer> result = _diskOfferingJoinDao.searchAndCount(sc, searchFilter); + Pair<List<DiskOfferingVO>, Integer> uniquePairs = _diskOfferingDao.searchAndCount(sc, searchFilter); String[] requiredTagsArray = new String[0]; - if (CollectionUtils.isNotEmpty(result.first()) && VolumeApiServiceImpl.MatchStoragePoolTagsWithDiskOffering.valueIn(zoneId)) { + if (CollectionUtils.isNotEmpty(uniquePairs.first()) && VolumeApiServiceImpl.MatchStoragePoolTagsWithDiskOffering.valueIn(zoneId)) { if (volumeId != null) { - Volume volume = volumeDao.findById(volumeId); - currentDiskOffering = _diskOfferingDao.findByIdIncludingRemoved(volume.getDiskOfferingId()); requiredTagsArray = currentDiskOffering.getTagsArray(); } else if (storagePoolId != null) { requiredTagsArray = _storageTagDao.getStoragePoolTags(storagePoolId).toArray(new String[0]); @@@ -3368,25 -3552,21 +3564,39 @@@ return response; } + protected List<String> getHostTagsFromTemplateForServiceOfferingsListing(Account caller, Long templateId) { + List<String> hostTags = new ArrayList<>(); + if (templateId == null) { + return hostTags; + } + VMTemplateVO template = _templateDao.findByIdIncludingRemoved(templateId); + if (template == null) { + throw new InvalidParameterValueException("Unable to find template with the specified ID"); + } + if (caller.getType() != Account.Type.ADMIN) { + accountMgr.checkAccess(caller, null, false, template); + } + if (StringUtils.isNotEmpty(template.getTemplateTag())) { + hostTags.add(template.getTemplateTag()); + } + return hostTags; + } + private Pair<List<ServiceOfferingJoinVO>, Integer> searchForServiceOfferingsInternal(ListServiceOfferingsCmd cmd) { + Pair<List<Long>, Integer> offeringIdPage = searchForServiceOfferingIdsAndCount(cmd); + + Integer count = offeringIdPage.second(); + Long[] idArray = offeringIdPage.first().toArray(new Long[0]); + + if (count == 0) { + return new Pair<>(new ArrayList<>(), count); + } + + List<ServiceOfferingJoinVO> srvOfferings = _srvOfferingJoinDao.searchByIds(idArray); + return new Pair<>(srvOfferings, count); + } + + private Pair<List<Long>, Integer> searchForServiceOfferingIdsAndCount(ListServiceOfferingsCmd cmd) { // Note // The filteredOfferings method for offerings is being modified in accordance with // discussion with Will/Kevin @@@ -3417,12 -3595,11 +3625,12 @@@ Integer cpuSpeed = cmd.getCpuSpeed(); Boolean encryptRoot = cmd.getEncryptRoot(); String storageType = cmd.getStorageType(); + final Long templateId = cmd.getTemplateId(); final Account owner = accountMgr.finalizeOwner(caller, accountName, domainId, projectId); - SearchCriteria<ServiceOfferingJoinVO> sc = _srvOfferingJoinDao.createSearchCriteria(); + if (!accountMgr.isRootAdmin(caller.getId()) && isSystem) { - throw new InvalidParameterValueException("Only ROOT admins can access system's offering"); + throw new InvalidParameterValueException("Only ROOT admins can access system offerings."); } // Keeping this logic consistent with domain specific zones @@@ -3597,65 -4016,32 +4047,50 @@@ Domain callerDomain = _domainDao.findById(owner.getDomainId()); List<Long> domainIds = findRelatedDomainIds(callerDomain, isRecursive); - List<Long> ids = _srvOfferingDetailsDao.findOfferingIdsByDomainIds(domainIds); - SearchBuilder<ServiceOfferingJoinVO> sb = _srvOfferingJoinDao.createSearchBuilder(); - if (ids != null && !ids.isEmpty()) { - sb.and("id", sb.entity().getId(), Op.IN); - } - sb.or("domainId", sb.entity().getDomainId(), Op.NULL); - sb.done(); - - SearchCriteria<ServiceOfferingJoinVO> scc = sb.create(); - if (ids != null && !ids.isEmpty()) { - scc.setParameters("id", ids.toArray()); - } - sc.addAnd("domainId", SearchCriteria.Op.SC, scc); + sc.setJoinParameters("domainDetailSearchNormalUser", "domainIdIN", domainIds.toArray()); } + List<String> hostTags = getHostTagsFromTemplateForServiceOfferingsListing(caller, templateId); + if (currentVmOffering != null) { - DiskOfferingVO diskOffering = _diskOfferingDao.findByIdIncludingRemoved(currentVmOffering.getDiskOfferingId()); - List<String> storageTags = com.cloud.utils.StringUtils.csvTagsToList(diskOffering.getTags()); - if (!storageTags.isEmpty() && VolumeApiServiceImpl.MatchStoragePoolTagsWithDiskOffering.value()) { - SearchBuilder<ServiceOfferingJoinVO> sb = _srvOfferingJoinDao.createSearchBuilder(); - for(String tag : storageTags) { - sb.and(tag, sb.entity().getTags(), Op.FIND_IN_SET); - } - sb.done(); - SearchCriteria<ServiceOfferingJoinVO> scc = sb.create(); - for(String tag : storageTags) { - scc.setParameters(tag, tag); + if (diskOffering != null) { + List<String> storageTags = com.cloud.utils.StringUtils.csvTagsToList(diskOffering.getTags()); + if (!storageTags.isEmpty() && VolumeApiServiceImpl.MatchStoragePoolTagsWithDiskOffering.value()) { + for(String tag : storageTags) { + sc.setJoinParameters("diskOfferingSearch", tag, tag); + } } - sc.addAnd("storageTags", SearchCriteria.Op.SC, scc); } - List<String> hostTags = com.cloud.utils.StringUtils.csvTagsToList(currentVmOffering.getHostTag()); - if (!hostTags.isEmpty()) { - for(String tag : hostTags) { - sc.setParameters(tag, tag); - } + List<String> offeringHostTags = com.cloud.utils.StringUtils.csvTagsToList(currentVmOffering.getHostTag()); + if (!offeringHostTags.isEmpty()) { + hostTags.addAll(offeringHostTags); } } + if (CollectionUtils.isNotEmpty(hostTags)) { + SearchBuilder<ServiceOfferingJoinVO> hostTagsSearchBuilder = _srvOfferingJoinDao.createSearchBuilder(); + for(String tag : hostTags) { + hostTagsSearchBuilder.and(tag, hostTagsSearchBuilder.entity().getHostTag(), Op.FIND_IN_SET); + } + hostTagsSearchBuilder.done(); + + SearchCriteria<ServiceOfferingJoinVO> hostTagsSearchCriteria = hostTagsSearchBuilder.create(); + for(String tag : hostTags) { + hostTagsSearchCriteria.setParameters(tag, tag); + } + + SearchCriteria<ServiceOfferingJoinVO> finalHostTagsSearchCriteria = _srvOfferingJoinDao.createSearchCriteria(); + finalHostTagsSearchCriteria.addOr("hostTag", Op.NULL); + finalHostTagsSearchCriteria.addOr("hostTag", Op.SC, hostTagsSearchCriteria); + + sc.addAnd("hostTagsConstraint", SearchCriteria.Op.SC, finalHostTagsSearchCriteria); + } - return _srvOfferingJoinDao.searchAndCount(sc, searchFilter); + Pair<List<ServiceOfferingVO>, Integer> uniquePair = _srvOfferingDao.searchAndCount(sc, searchFilter); + Integer count = uniquePair.second(); + List<Long> offeringIds = uniquePair.first().stream().map(ServiceOfferingVO::getId).collect(Collectors.toList()); + return new Pair<>(offeringIds, count); } @Override diff --cc server/src/main/java/com/cloud/api/query/dao/AccountJoinDaoImpl.java index d4871a1d136,2daa411e4fb..7ffd3ef319f --- a/server/src/main/java/com/cloud/api/query/dao/AccountJoinDaoImpl.java +++ b/server/src/main/java/com/cloud/api/query/dao/AccountJoinDaoImpl.java @@@ -21,6 -22,8 +22,7 @@@ import java.util.List import javax.inject.Inject; + import org.apache.cloudstack.framework.config.dao.ConfigurationDao; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import org.apache.cloudstack.api.ApiConstants.DomainDetails; @@@ -43,8 -46,12 +45,11 @@@ import com.cloud.utils.db.SearchCriteri @Component public class AccountJoinDaoImpl extends GenericDaoBase<AccountJoinVO, Long> implements AccountJoinDao { - public static final Logger s_logger = Logger.getLogger(AccountJoinDaoImpl.class); + @Inject + private ConfigurationDao configDao; private final SearchBuilder<AccountJoinVO> acctIdSearch; + private final SearchBuilder<AccountJoinVO> domainSearch; @Inject AccountManager _acctMgr; diff --cc server/src/main/java/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java index 1a2f4c534f6,5341b3b56d7..2688a982e43 --- a/server/src/main/java/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java +++ b/server/src/main/java/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java @@@ -26,6 -27,8 +27,7 @@@ import org.apache.cloudstack.annotation import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.response.DiskOfferingResponse; import org.apache.cloudstack.context.CallContext; + import org.apache.cloudstack.framework.config.dao.ConfigurationDao; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.cloud.api.ApiDBUtils; diff --cc server/src/main/java/com/cloud/api/query/dao/DomainJoinDaoImpl.java index 61ac12e8c85,24200fa84f9..9ad05d216a9 --- a/server/src/main/java/com/cloud/api/query/dao/DomainJoinDaoImpl.java +++ b/server/src/main/java/com/cloud/api/query/dao/DomainJoinDaoImpl.java @@@ -29,6 -30,8 +30,7 @@@ import org.apache.cloudstack.api.Respon import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ResourceLimitAndCountResponse; import org.apache.cloudstack.context.CallContext; + import org.apache.cloudstack.framework.config.dao.ConfigurationDao; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.cloud.api.ApiDBUtils; @@@ -43,8 -46,10 +45,9 @@@ import javax.inject.Inject @Component public class DomainJoinDaoImpl extends GenericDaoBase<DomainJoinVO, Long> implements DomainJoinDao { - public static final Logger s_logger = Logger.getLogger(DomainJoinDaoImpl.class); private SearchBuilder<DomainJoinVO> domainIdSearch; + private SearchBuilder<DomainJoinVO> domainSearch; @Inject private AnnotationDao annotationDao; diff --cc server/src/main/java/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java index 41609e06be1,92175568cd9..485e02399ce --- a/server/src/main/java/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java +++ b/server/src/main/java/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java @@@ -34,6 -35,8 +35,8 @@@ import com.cloud.storage.DiskOfferingVO import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.context.CallContext; + import org.apache.cloudstack.framework.config.dao.ConfigurationDao; -import org.apache.log4j.Logger; ++ import org.springframework.stereotype.Component; import com.cloud.api.ApiDBUtils; @@@ -182,10 -194,9 +193,9 @@@ public class ServiceOfferingJoinDaoImp return offerings.get(0); } - @Override public Map<Long, List<String>> listDomainsOfServiceOfferingsUsedByDomainPath(String domainPath) { - logger.debug(String.format("Retrieving the domains of the service offerings used by domain with path [%s].", domainPath)); - s_logger.debug(String.format("Retrieving the domains of the service offerings used by domain with path [%s].", domainPath)); ++ logger.debug("Retrieving the domains of the service offerings used by domain with path [{}].", domainPath); TransactionLegacy txn = TransactionLegacy.currentTxn(); try (PreparedStatement pstmt = txn.prepareStatement(LIST_DOMAINS_OF_SERVICE_OFFERINGS_USED_BY_DOMAIN_PATH)) { diff --cc server/src/main/java/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java index 76ca179868a,f3b832d1042..14de5ffe71d --- a/server/src/main/java/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java +++ b/server/src/main/java/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java @@@ -34,25 -43,12 +34,22 @@@ import org.apache.cloudstack.storage.da import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.utils.jsinterpreter.TagAsRuleHelper; -import org.apache.log4j.Logger; import org.springframework.stereotype.Component; -import javax.inject.Inject; -import java.util.ArrayList; -import java.util.List; +import com.cloud.api.ApiDBUtils; +import com.cloud.api.query.vo.StoragePoolJoinVO; +import com.cloud.capacity.CapacityManager; +import com.cloud.storage.DataStoreRole; +import com.cloud.storage.ScopeType; +import com.cloud.storage.Storage; +import com.cloud.storage.StoragePool; - import com.cloud.storage.StoragePoolStatus; +import com.cloud.storage.StorageStats; +import com.cloud.storage.VolumeApiServiceImpl; +import com.cloud.user.AccountManager; - import com.cloud.utils.Pair; +import com.cloud.utils.StringUtils; - import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; @Component public class StoragePoolJoinDaoImpl extends GenericDaoBase<StoragePoolJoinVO, Long> implements StoragePoolJoinDao {
