Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MAJOR=5
MINOR=5
UPDATE=12
UPDATE=16
4 changes: 4 additions & 0 deletions conf/db/upgrade/V5.5.12.1__schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- ZSTAC-83966: Add hidden field to AlarmVO/EventSubscriptionVO/ActiveAlarmVO for soft-hide support
CALL ADD_COLUMN('AlarmVO', 'hidden', 'TINYINT(1)', 0, '0');
CALL ADD_COLUMN('EventSubscriptionVO', 'hidden', 'TINYINT(1)', 0, '0');
CALL ADD_COLUMN('ActiveAlarmVO', 'hidden', 'TINYINT(1)', 0, '0');
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,12 @@ public void run(SyncTaskChain chain) {

// Execute batch with the direct completion object
List<T> items = requests.stream().map(req -> req.item).collect(Collectors.toList());
try {
executeBatch(items, batchCompletion);
} catch (Throwable t) {
logger.warn(String.format("[%s] executeBatch threw exception for signature[%s]",
name, syncSignature), t);
handleFailure(syncSignature, requests,
operr(ORG_ZSTACK_CORE_THREAD_10004, "executeBatch threw exception: %s", t.getMessage()), chain);
}

/** *(.., AbstractCompletion, ..) is not AsyncSafeAspect's pointcut, but it will call
* executeBatch(.., Completion/ReturnValueCompletion) which is pointcut,
* so we do not need try-catch here.
*/
executeBatch(items, batchCompletion);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected final void executeBatch(List<T> items, AbstractCompletion batchComplet

@Override
protected final AbstractCompletion createBatchCompletion(String syncSignature, List<PendingRequest> requests, SyncTaskChain chain) {
return new ReturnValueCompletion<R>(null) {
return new ReturnValueCompletion<R>(chain) {
@Override
public void success(R batchResult) {
handleSuccess(syncSignature, requests, batchResult, chain);
Expand Down
30 changes: 28 additions & 2 deletions rest/src/main/resources/scripts/SdkDataStructureGenerator.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,16 @@ class SdkDataStructureGenerator implements SdkTemplate {
Reflections reflections = Platform.getReflections()
responseClasses = reflections.getTypesAnnotatedWith(RestResponse.class)
laterResolvedClasses.addAll(reflections.getTypesAnnotatedWith(SDK.class)
.findAll() { !Message.class.isAssignableFrom(it) })
.findAll() {
!Message.class.isAssignableFrom(it) && !excludedFromSdkGeneration(it)
})
}

static boolean excludedFromSdkGeneration(Class clz) {
if (clz == null) {
return true
}
return clz.getName().startsWith("org.zstack.test.")
}

@Override
Expand Down Expand Up @@ -128,6 +137,10 @@ ${dstToSrc.join("\n")}
return
}

if (excludedFromSdkGeneration(clz)) {
return
}

if (clz.isAnnotationPresent(NoSDK.class)) {
return
}
Expand Down Expand Up @@ -202,14 +215,24 @@ ${output.join("\n")}
|| short.class == clz || char.class == clz || boolean.class == clz || float.class == clz
|| double.class == clz) {
return false
} else if (clz.getCanonicalName().startsWith("org.zstack")) {
}
if (clz.getName().startsWith("groovy.") || clz.getName().startsWith("org.codehaus.groovy.")) {
return false
}

def canonicalName = clz.getCanonicalName()
if (canonicalName != null && canonicalName.startsWith("org.zstack")) {
return true
} else {
throw new CloudRuntimeException("${clz.getName()} is neither JRE class nor ZStack class")
}
}

def addToLaterResolvedClassesIfNeed(Class clz) {
if (excludedFromSdkGeneration(clz)) {
return
}

if (clz.isAnnotationPresent(NoSDK.class)) {
return
}
Expand All @@ -219,6 +242,9 @@ ${output.join("\n")}
}

Platform.reflections.getSubTypesOf(clz).forEach({ i ->
if (excludedFromSdkGeneration(i)) {
return
}
if (!sdkFileMap.containsKey(i) && !i.isAnnotationPresent(NoSDK.class)) {
laterResolvedClasses.add(i)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,12 @@ public java.lang.String getEmergencyLevel() {
return this.emergencyLevel;
}

public java.lang.Boolean hidden;
public void setHidden(java.lang.Boolean hidden) {
this.hidden = hidden;
}
public java.lang.Boolean getHidden() {
return this.hidden;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,12 @@ public java.lang.String getEmergencyLevel() {
return this.emergencyLevel;
}

public java.lang.Boolean hidden;
public void setHidden(java.lang.Boolean hidden) {
this.hidden = hidden;
}
public java.lang.Boolean getHidden() {
return this.hidden;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,12 @@ public java.lang.String getUuid() {
return this.uuid;
}

public java.lang.Boolean hidden;
public void setHidden(java.lang.Boolean hidden) {
this.hidden = hidden;
}
public java.lang.Boolean getHidden() {
return this.hidden;
}

}