DaanHoogland commented on code in PR #7446:
URL: https://github.com/apache/cloudstack/pull/7446#discussion_r1410871604
##########
engine/schema/src/main/java/com/cloud/network/dao/NetworkDomainDaoImpl.java:
##########
@@ -71,4 +92,34 @@ public List<Long> listNetworkIdsByDomain(long domainId) {
}
return networkIdsToReturn;
}
+
+ @Override
+ public Map<Long, List<String>>
listDomainsOfSharedNetworksUsedByDomainPath(String domainPath) {
+ logger.debug(String.format("Retrieving the domains of the shared
networks with subdomain access used by domain with path [%s].", domainPath));
+
+ TransactionLegacy txn = TransactionLegacy.currentTxn();
+ try (PreparedStatement pstmt =
txn.prepareStatement(LIST_DOMAINS_OF_SHARED_NETWORKS_USED_BY_DOMAIN_PATH)) {
+ Map<Long, List<String>> domainsOfSharedNetworksUsedByDomainPath =
new HashMap<>();
+
+ String domainSearch = domainPath.concat("%");
+ pstmt.setString(1, domainSearch);
+ pstmt.setString(2, domainSearch);
+
+ try (ResultSet rs = pstmt.executeQuery()) {
+ while (rs.next()) {
+ Long domainId = rs.getLong(1);
+ List<String> vmUuidsAndNetworkUuids =
Arrays.asList(rs.getString(2).split(","));
+
+ domainsOfSharedNetworksUsedByDomainPath.put(domainId,
vmUuidsAndNetworkUuids);
+ }
+ }
+
+ return domainsOfSharedNetworksUsedByDomainPath;
+ } catch (SQLException e) {
+ logger.error(String.format("Failed to retrieve the domains of the
shared networks with subdomain access used by domain with path [%s] due to
[%s]. Returning an empty "
+ + "list of domains.", domainPath, e.getMessage()), e);
Review Comment:
if we keep escalating what we print on what level we won't need levels.
Debug is for debugging. Error is for notifications of errors. The message
should be very clear but these shouldn't clog the log. Recently in a formerly
empty catch clause an error log was added and the people that were
troubleshooting a problem got red herring'd by it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]