Merge branch '4.22'

This commit is contained in:
Daan Hoogland 2026-06-29 15:42:25 +02:00
commit fb5e24fa08
10 changed files with 51 additions and 20 deletions

View File

@ -61,9 +61,6 @@ public class UsageJobDaoImpl extends GenericDaoBase<UsageJobVO, Long> implements
public void updateJobSuccess(Long jobId, long startMillis, long endMillis, long execTime, boolean success) {
TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB);
try {
txn.start();
UsageJobVO job = lockRow(jobId, Boolean.TRUE);
UsageJobVO jobForUpdate = createForUpdate();
jobForUpdate.setStartMillis(startMillis);
jobForUpdate.setEndMillis(endMillis);
@ -71,11 +68,8 @@ public class UsageJobDaoImpl extends GenericDaoBase<UsageJobVO, Long> implements
jobForUpdate.setStartDate(new Date(startMillis));
jobForUpdate.setEndDate(new Date(endMillis));
jobForUpdate.setSuccess(success);
update(job.getId(), jobForUpdate);
txn.commit();
update(jobId, jobForUpdate);
} catch (Exception ex) {
txn.rollback();
logger.error("error updating job success date", ex);
throw new CloudRuntimeException(ex.getMessage());
} finally {

View File

@ -73,7 +73,8 @@ public class CloudStackExtendedLifeCycle extends AbstractBeanCollector {
try {
lifecycle.start();
} catch (Exception e) {
logger.error("Error on starting bean {} - {}", lifecycle.getName(), e.getMessage(), e);
logger.error("Error on starting bean [{}] due to: {}", lifecycle.getName(), e);
throw new CloudRuntimeException("Failed to start bean [" + lifecycle.getName() + "]");
}
if (lifecycle instanceof ManagementBean) {

View File

@ -112,10 +112,8 @@ public class DefaultModuleDefinitionSet implements ModuleDefinitionSet {
logger.debug(String.format("Could not get module [%s] context bean.", moduleDefinitionName));
}
} catch (BeansException e) {
logger.warn(String.format("Failed to start module [%s] due to: [%s].", moduleDefinitionName, e.getMessage()));
if (logger.isDebugEnabled()) {
logger.debug(String.format("module start failure of module [%s] was due to: ", moduleDefinitionName), e);
}
logger.error("Failed to start module [{}] due to: {}", def.getName(), e);
throw new RuntimeException(String.format("Failed to start module [%s]", def.getName()));
}
} catch (EmptyStackException e) {
logger.warn(String.format("Failed to obtain module context due to [%s]. Using root context instead.", e.getMessage()));
@ -147,10 +145,8 @@ public class DefaultModuleDefinitionSet implements ModuleDefinitionSet {
logger.debug("Failed to obtain module context: ", e);
}
} catch (BeansException e) {
logger.warn(String.format("Failed to start module [%s] due to: [%s].", def.getName(), e.getMessage()));
if (logger.isDebugEnabled()) {
logger.debug(String.format("module start failure of module [%s] was due to: ", def.getName()), e);
}
logger.error("Failed to load module [{}] due to: {}", def.getName(), e);
throw new RuntimeException(String.format("Failed to load module [%s]", def.getName()));
}
}
});

12
pom.xml
View File

@ -196,6 +196,8 @@
<cs.caffeine.version>3.1.7</cs.caffeine.version>
<cs.protobuf.version>3.25.5</cs.protobuf.version>
<cs.minio.version>8.6.0</cs.minio.version>
<cs.opentelemetry.version>1.51.0</cs.opentelemetry.version>
<cs.opentelemetry-instrumentation.version>2.16.0</cs.opentelemetry-instrumentation.version>
</properties>
<distributionManagement>
@ -434,6 +436,16 @@
<artifactId>commons-validator</artifactId>
<version>${cs.commons-validator.version}</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
<version>${cs.opentelemetry.version}</version>
</dependency>
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-annotations</artifactId>
<version>${cs.opentelemetry-instrumentation.version}</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>

View File

@ -197,6 +197,14 @@
<version>4.23.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -62,6 +62,9 @@ import javax.naming.ConfigurationException;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.instrumentation.annotations.WithSpan;
import org.apache.cloudstack.acl.APIChecker;
import org.apache.cloudstack.acl.ApiKeyPairManagerImpl;
import org.apache.cloudstack.acl.apikeypair.ApiKeyPair;
@ -627,6 +630,7 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
}
@Override
@WithSpan("ApiServer.handleRequest")
@SuppressWarnings("rawtypes")
public String handleRequest(final Map params, final String responseType, final StringBuilder auditTrailSb) throws ServerApiException {
checkCharacterInkParams(params);
@ -636,6 +640,10 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
try {
command = (String[])params.get("command");
if (command != null && command.length > 0) {
Span.current().updateName("ApiServer.handleRequest " + command[0]);
Span.current().setAttribute("api.command", command[0]);
}
if (command == null) {
logger.error("invalid request, no command sent");
if (logger.isTraceEnabled()) {

View File

@ -166,6 +166,7 @@ import com.codahale.metrics.JvmAttributeGaugeSet;
import com.codahale.metrics.Metric;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.MetricSet;
import com.codahale.metrics.JmxReporter;
import com.codahale.metrics.jvm.BufferPoolMetricSet;
import com.codahale.metrics.jvm.GarbageCollectorMetricSet;
import com.codahale.metrics.jvm.MemoryUsageGaugeSet;
@ -387,7 +388,11 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
private boolean _dailyOrHourly = false;
protected long managementServerNodeId = ManagementServerNode.getManagementServerId();
protected long msId = managementServerNodeId;
final static MetricRegistry METRIC_REGISTRY = new MetricRegistry();
public static final MetricRegistry METRIC_REGISTRY = new MetricRegistry();
public static void registerMetric(String name, Metric metric) {
METRIC_REGISTRY.register(name, metric);
}
public static StatsCollector getInstance() {
return s_instance;
@ -410,6 +415,11 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
registerAll("memory", new MemoryUsageGaugeSet(), METRIC_REGISTRY);
registerAll("threads", new ThreadStatesGaugeSet(), METRIC_REGISTRY);
registerAll("jvm", new JvmAttributeGaugeSet(), METRIC_REGISTRY);
try {
JmxReporter.forRegistry(METRIC_REGISTRY).inDomain("vm-extra").build().start();
} catch (Exception e) {
logger.warn("Failed to start JMX reporter for METRIC_REGISTRY, metrics will not be visible via JMX", e);
}
return true;
}
@Override

View File

@ -12,6 +12,7 @@ command=/bin/bash -c "mvn -pl client jetty:run -Dsimulator -Dorg.eclipse.jetty.a
directory=/root
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
redirect_stderr=true
user=root
[program:cloudstack-ui]

View File

@ -83,7 +83,8 @@ export default {
computed: {
allowed () {
return (this.$route.meta.name === 'template' ||
(this.$route.meta.name === 'iso' && this.resource.bootable))
(this.$route.meta.name === 'iso' && this.resource?.bootable)) &&
!!this.resource?.isready
}
},
methods: {
@ -91,7 +92,7 @@ export default {
this.fetchResourceData()
},
fetchResourceData () {
if (!this.resource || !this.resource.id) {
if (!this.resource || !this.resource.id || !this.resource.isready) {
return
}
const params = {

View File

@ -50,7 +50,7 @@
<template #network="{ record }">
<a-form-item style="display: block" :name="'nic-' + record.deviceid">
<a-select
disabled="templateNics && templateNics.length > 0"
:disabled="templateNics && templateNics.length > 0"
@change="updateNicNetworkValue($event, record.deviceid)"
optionFilterProp="label"
:filterOption="(input, option) => {