Skip to content

Commit 8176aa9

Browse files
author
gitlab
committed
Merge branch 'fix/cre-batch-quality-issues@@2' into '5.5.12'
<fix>[multi]: batch fix CRE quality issues See merge request zstackio/zstack!9214
2 parents 107905d + beccef9 commit 8176aa9

4 files changed

Lines changed: 18 additions & 14 deletions

File tree

compute/src/main/java/org/zstack/compute/allocator/HostAllocatorManagerImpl.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -851,17 +851,15 @@ public HostCapacityVO call(HostCapacityVO cap) {
851851
long deltaMemory = ratioMgr.calculateMemoryByRatio(hostUuid, memory);
852852
long availMemory = cap.getAvailableMemory() + deltaMemory;
853853
if (availMemory > cap.getTotalMemory()) {
854-
throw new CloudRuntimeException(
855-
String.format("invalid memory capacity of host[uuid:%s]," +
856-
" available memory[%s] is greater than total memory[%s]." +
857-
" Available Memory before is [%s], Delta Memory is [%s].",
858-
hostUuid,
859-
new DecimalFormat(",###").format(availMemory),
860-
new DecimalFormat(",###").format(cap.getTotalMemory()),
861-
new DecimalFormat(",###").format(cap.getAvailableMemory()),
862-
new DecimalFormat(",###").format(deltaMemory)
863-
)
864-
);
854+
logger.warn(String.format("memory capacity overflow on host[uuid:%s]," +
855+
" available memory[%s] > total memory[%s], clamping to total." +
856+
" Available Memory before is [%s], Delta Memory is [%s].",
857+
hostUuid,
858+
new DecimalFormat(",###").format(availMemory),
859+
new DecimalFormat(",###").format(cap.getTotalMemory()),
860+
new DecimalFormat(",###").format(cap.getAvailableMemory()),
861+
new DecimalFormat(",###").format(deltaMemory)));
862+
availMemory = cap.getTotalMemory();
865863
}
866864

867865
cap.setAvailableMemory(availMemory);

plugin/ldap/src/main/java/org/zstack/ldap/LdapUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,10 +657,10 @@ public LdapServerVO getLdapServer() {
657657
sq.add(LdapServerVO_.scope, SimpleQuery.Op.EQ, scope);
658658
List<LdapServerVO> ldapServers = sq.list();
659659
if (ldapServers.isEmpty()) {
660-
throw new CloudRuntimeException("No LDAP/AD server record in database.");
660+
throw new OperationFailureException(operr(ORG_ZSTACK_LDAP_10020, "No LDAP/AD server record in database."));
661661
}
662662
if (ldapServers.size() > 1) {
663-
throw new CloudRuntimeException("More than one LDAP/AD server record in database.");
663+
throw new OperationFailureException(operr(ORG_ZSTACK_LDAP_10021, "More than one LDAP/AD server record in database."));
664664
}
665665
return ldapServers.get(0);
666666
}

search/src/main/java/org/zstack/query/QueryFacadeImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ private void handle(APIQueryMessage msg) {
378378
} catch (OperationFailureException of) {
379379
throw of;
380380
} catch (Exception e) {
381-
throw new CloudRuntimeException(e);
381+
throw new OperationFailureException(inerr("failed to query: %s", e.getMessage()));
382382
}
383383
}
384384

utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,6 +1654,10 @@ public class CloudOperationsErrorCode {
16541654

16551655
public static final String ORG_ZSTACK_LDAP_10019 = "ORG_ZSTACK_LDAP_10019";
16561656

1657+
public static final String ORG_ZSTACK_LDAP_10020 = "ORG_ZSTACK_LDAP_10020";
1658+
1659+
public static final String ORG_ZSTACK_LDAP_10021 = "ORG_ZSTACK_LDAP_10021";
1660+
16571661
public static final String ORG_ZSTACK_IMAGE_10000 = "ORG_ZSTACK_IMAGE_10000";
16581662

16591663
public static final String ORG_ZSTACK_IMAGE_10001 = "ORG_ZSTACK_IMAGE_10001";
@@ -10654,6 +10658,8 @@ public class CloudOperationsErrorCode {
1065410658

1065510659
public static final String ORG_ZSTACK_PREMIUM_EXTERNALSERVICE_PROMETHEUS_10013 = "ORG_ZSTACK_PREMIUM_EXTERNALSERVICE_PROMETHEUS_10013";
1065610660

10661+
public static final String ORG_ZSTACK_PREMIUM_EXTERNALSERVICE_PROMETHEUS_10014 = "ORG_ZSTACK_PREMIUM_EXTERNALSERVICE_PROMETHEUS_10014";
10662+
1065710663
public static final String ORG_ZSTACK_AI_CONTAINER_10000 = "ORG_ZSTACK_AI_CONTAINER_10000";
1065810664

1065910665
public static final String ORG_ZSTACK_AI_CONTAINER_10001 = "ORG_ZSTACK_AI_CONTAINER_10001";

0 commit comments

Comments
 (0)