Skip to content

Commit 82123d3

Browse files
vishesh92dhslove
authored andcommitted
Merge remote-tracking branch 'origin/4.19'
1 parent b3ced1d commit 82123d3

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,7 @@ protected void prepareAttribute(final int j, final PreparedStatement pstmt, fina
16311631
}
16321632
}
16331633

1634+
16341635
if (attr.getValue() != null && attr.getValue() instanceof String) {
16351636
pstmt.setString(j, (String)attr.getValue());
16361637
} else if (attr.getValue() != null && attr.getValue() instanceof Long) {
@@ -1650,7 +1651,7 @@ protected void prepareAttribute(final int j, final PreparedStatement pstmt, fina
16501651
// This happens when we pass in an integer, long or any other object which can't be cast to String.
16511652
// Converting to string in case of integer or long can result in different results. Required specifically for details tables.
16521653
// So, we set the value for the object directly.
1653-
s_logger.debug("ClassCastException when casting value to String. Setting the value of the object directly.");
1654+
logger.debug("ClassCastException when casting value to String. Setting the value of the object directly.");
16541655
pstmt.setObject(j, value);
16551656
return;
16561657
}

server/src/main/java/com/cloud/api/query/QueryManagerImpl.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3516,6 +3516,16 @@ private Ternary<List<Long>, Integer, String[]> searchForDiskOfferingsIdsAndCount
35163516
sc.setJoinParameters("domainDetailsSearch", "domainIdIN", domainIds.toArray());
35173517
}
35183518

3519+
if (vmId != null) {
3520+
UserVmVO vm = userVmDao.findById(vmId);
3521+
if (vm == null) {
3522+
throw new InvalidParameterValueException("Unable to find the VM instance with the specified ID");
3523+
}
3524+
if (!isRootAdmin) {
3525+
accountMgr.checkAccess(account, null, false, vm);
3526+
}
3527+
}
3528+
35193529
Pair<List<DiskOfferingVO>, Integer> uniquePairs = _diskOfferingDao.searchAndCount(sc, searchFilter);
35203530
String[] requiredTagsArray = new String[0];
35213531
if (CollectionUtils.isNotEmpty(uniquePairs.first()) && VolumeApiServiceImpl.MatchStoragePoolTagsWithDiskOffering.valueIn(zoneId)) {

server/src/main/java/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
3737
import org.apache.cloudstack.context.CallContext;
3838
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
39+
3940
import org.springframework.stereotype.Component;
4041

4142
import com.cloud.api.ApiDBUtils;
@@ -195,7 +196,7 @@ public ServiceOfferingJoinVO newServiceOfferingView(ServiceOffering offering) {
195196

196197
@Override
197198
public Map<Long, List<String>> listDomainsOfServiceOfferingsUsedByDomainPath(String domainPath) {
198-
logger.debug(String.format("Retrieving the domains of the service offerings used by domain with path [%s].", domainPath));
199+
logger.debug("Retrieving the domains of the service offerings used by domain with path [{}].", domainPath);
199200

200201
TransactionLegacy txn = TransactionLegacy.currentTxn();
201202
try (PreparedStatement pstmt = txn.prepareStatement(LIST_DOMAINS_OF_SERVICE_OFFERINGS_USED_BY_DOMAIN_PATH)) {

0 commit comments

Comments
 (0)