From f379d789635a140fd6ea287d1d4384743328fc56 Mon Sep 17 00:00:00 2001
From: Abhishek Kumar
Date: Fri, 28 Nov 2025 09:29:10 +0100
Subject: [PATCH 001/630] ui: fix section search filter (#12146)
Signed-off-by: Abhishek Kumar
---
ui/src/views/AutogenView.vue | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue
index b1f26a17f8f6..a01e300c1c9a 100644
--- a/ui/src/views/AutogenView.vue
+++ b/ui/src/views/AutogenView.vue
@@ -1821,8 +1821,13 @@ export default {
},
onSearch (opts) {
const query = Object.assign({}, this.$route.query)
- const searchFilters = this.$route?.meta?.searchFilters || []
- searchFilters.forEach(key => delete query[key])
+ let searchFilters = this.$route?.meta?.searchFilters || []
+ if (typeof searchFilters === 'function') {
+ searchFilters = searchFilters()
+ }
+ if (Array.isArray(searchFilters)) {
+ searchFilters.forEach(key => delete query[key])
+ }
delete query.name
delete query.templatetype
delete query.keyword
From 44119cf34fcbbd12086a694cbc2cd06abe9bfb9d Mon Sep 17 00:00:00 2001
From: Abhishek Kumar
Date: Fri, 28 Nov 2025 10:29:18 +0100
Subject: [PATCH 002/630] ui: fix dsiple managementservermetricsresponse -
agentcount (#12148)
Signed-off-by: Abhishek Kumar
---
ui/src/config/section/infra/managementServers.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui/src/config/section/infra/managementServers.js b/ui/src/config/section/infra/managementServers.js
index bc7b42d9cf05..1466a4402967 100644
--- a/ui/src/config/section/infra/managementServers.js
+++ b/ui/src/config/section/infra/managementServers.js
@@ -26,8 +26,8 @@ export default {
permission: ['listManagementServersMetrics'],
resourceType: 'ManagementServer',
columns: () => {
- const fields = ['name', 'state', 'ipaddress', 'version', 'osdistribution', 'agentcount']
- const metricsFields = ['collectiontime', 'availableprocessors', 'cpuload', 'heapmemoryused']
+ const fields = ['name', 'state', 'ipaddress', 'version', 'osdistribution']
+ const metricsFields = ['agentcount', 'collectiontime', 'availableprocessors', 'cpuload', 'heapmemoryused']
if (store.getters.metrics) {
fields.push(...metricsFields)
}
From 516012a0b492ef8613f919c48bad950cc541bd97 Mon Sep 17 00:00:00 2001
From: Wei Zhou
Date: Fri, 28 Nov 2025 15:44:00 +0100
Subject: [PATCH 003/630] ceph: fix offline volume migration between ceph pools
(#12103)
---
.../cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
index e8924ecf5ebc..87544cfaa9da 100644
--- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
+++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
@@ -1689,7 +1689,11 @@ to support snapshots(backuped) as qcow2 files. */
*/
srcFile = new QemuImgFile(KVMPhysicalDisk.RBDStringBuilder(srcPool, sourcePath));
srcFile.setFormat(sourceFormat);
- destFile = new QemuImgFile(destPath);
+ if (destPool.getType() == StoragePoolType.RBD) {
+ destFile = new QemuImgFile(KVMPhysicalDisk.RBDStringBuilder(destPool, destPath));
+ } else {
+ destFile = new QemuImgFile(destPath);
+ }
destFile.setFormat(destFormat);
try {
From 243f566a603a6215505342d93d45a67d5386251e Mon Sep 17 00:00:00 2001
From: Abhishek Kumar
Date: Mon, 1 Dec 2025 08:19:09 +0100
Subject: [PATCH 004/630] refactor: add null check for BroadcastDomainType
retrievals (#11572)
Signed-off-by: Abhishek Kumar
---
.../main/java/com/cloud/network/Networks.java | 12 ++++++------
.../java/com/cloud/network/NetworksTest.java | 18 ++++++++++++++++++
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/api/src/main/java/com/cloud/network/Networks.java b/api/src/main/java/com/cloud/network/Networks.java
index dfa0ddb84cae..8e7399bb21d0 100644
--- a/api/src/main/java/com/cloud/network/Networks.java
+++ b/api/src/main/java/com/cloud/network/Networks.java
@@ -78,7 +78,7 @@ public URI toUri(T value) {
}
@Override
public String getValueFrom(URI uri) {
- return uri.getAuthority();
+ return uri == null ? null : uri.getAuthority();
}
},
Vswitch("vs", String.class), LinkLocal(null, null), Vnet("vnet", Long.class), Storage("storage", Integer.class), Lswitch("lswitch", String.class) {
@@ -96,7 +96,7 @@ public URI toUri(T value) {
*/
@Override
public String getValueFrom(URI uri) {
- return uri.getSchemeSpecificPart();
+ return uri == null ? null : uri.getSchemeSpecificPart();
}
},
Mido("mido", String.class), Pvlan("pvlan", String.class),
@@ -176,7 +176,7 @@ public URI toUri(T value) {
* @return the scheme as BroadcastDomainType
*/
public static BroadcastDomainType getSchemeValue(URI uri) {
- return toEnumValue(uri.getScheme());
+ return toEnumValue(uri == null ? null : uri.getScheme());
}
/**
@@ -190,7 +190,7 @@ public static BroadcastDomainType getTypeOf(String str) throws URISyntaxExceptio
if (com.cloud.dc.Vlan.UNTAGGED.equalsIgnoreCase(str)) {
return Native;
}
- return getSchemeValue(new URI(str));
+ return getSchemeValue(str == null ? null : new URI(str));
}
/**
@@ -219,7 +219,7 @@ public static BroadcastDomainType toEnumValue(String scheme) {
* @return the host part as String
*/
public String getValueFrom(URI uri) {
- return uri.getHost();
+ return uri == null ? null : uri.getHost();
}
/**
@@ -242,7 +242,7 @@ public static String getValue(URI uri) {
* @throws URISyntaxException the string is not even an uri
*/
public static String getValue(String uriString) throws URISyntaxException {
- return getValue(new URI(uriString));
+ return getValue(uriString == null ? null : new URI(uriString));
}
/**
diff --git a/api/src/test/java/com/cloud/network/NetworksTest.java b/api/src/test/java/com/cloud/network/NetworksTest.java
index ef5829243421..6f0f3fbd1efe 100644
--- a/api/src/test/java/com/cloud/network/NetworksTest.java
+++ b/api/src/test/java/com/cloud/network/NetworksTest.java
@@ -37,6 +37,24 @@ public class NetworksTest {
public void setUp() {
}
+ @Test
+ public void nullBroadcastDomainTypeTest() throws URISyntaxException {
+ BroadcastDomainType type = BroadcastDomainType.getTypeOf(null);
+ Assert.assertEquals("a null uri should mean a broadcasttype of undecided", BroadcastDomainType.UnDecided, type);
+ }
+
+ @Test
+ public void nullBroadcastDomainTypeValueTest() {
+ URI uri = null;
+ Assert.assertNull(BroadcastDomainType.getValue(uri));
+ }
+
+ @Test
+ public void nullBroadcastDomainTypeStringValueTest() throws URISyntaxException {
+ String uriString = null;
+ Assert.assertNull(BroadcastDomainType.getValue(uriString));
+ }
+
@Test
public void emptyBroadcastDomainTypeTest() throws URISyntaxException {
BroadcastDomainType type = BroadcastDomainType.getTypeOf("");
From f3a112fd9e7437b6507434190083005824915ec8 Mon Sep 17 00:00:00 2001
From: dahn
Date: Mon, 1 Dec 2025 08:33:14 +0100
Subject: [PATCH 005/630] use upstream method for creating enums from strings
(#12158)
Co-authored-by: Daan Hoogland
---
.../datastore/api/VTreeMigrationInfo.java | 2 +-
.../main/java/com/cloud/api/ApiDBUtils.java | 2 +-
.../main/java/com/cloud/utils/EnumUtils.java | 26 -------------------
3 files changed, 2 insertions(+), 28 deletions(-)
diff --git a/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/api/VTreeMigrationInfo.java b/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/api/VTreeMigrationInfo.java
index f4e926bfd33f..072b52b69d66 100644
--- a/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/api/VTreeMigrationInfo.java
+++ b/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/api/VTreeMigrationInfo.java
@@ -59,7 +59,7 @@ public MigrationStatus getMigrationStatus() {
}
public void setMigrationStatus(String migrationStatus) {
- this.migrationStatus = EnumUtils.fromString(MigrationStatus.class, migrationStatus, MigrationStatus.None);
+ this.migrationStatus = EnumUtils.getEnumIgnoreCase(MigrationStatus.class, migrationStatus, MigrationStatus.None);
}
public void setMigrationStatus(MigrationStatus migrationStatus) {
diff --git a/server/src/main/java/com/cloud/api/ApiDBUtils.java b/server/src/main/java/com/cloud/api/ApiDBUtils.java
index f7ffb0398019..57eeb63ea9f9 100644
--- a/server/src/main/java/com/cloud/api/ApiDBUtils.java
+++ b/server/src/main/java/com/cloud/api/ApiDBUtils.java
@@ -1767,7 +1767,7 @@ public static String findJobInstanceUuid(AsyncJob job) {
return null;
}
String jobInstanceId = null;
- ApiCommandResourceType jobInstanceType = EnumUtils.fromString(ApiCommandResourceType.class, job.getInstanceType(), ApiCommandResourceType.None);
+ ApiCommandResourceType jobInstanceType = EnumUtils.getEnumIgnoreCase(ApiCommandResourceType.class, job.getInstanceType(), ApiCommandResourceType.None);
if (job.getInstanceId() == null) {
// when assert is hit, implement 'getInstanceId' of BaseAsyncCmd and return appropriate instance id
diff --git a/utils/src/main/java/com/cloud/utils/EnumUtils.java b/utils/src/main/java/com/cloud/utils/EnumUtils.java
index 380b595a0ad1..1af29066ef1b 100644
--- a/utils/src/main/java/com/cloud/utils/EnumUtils.java
+++ b/utils/src/main/java/com/cloud/utils/EnumUtils.java
@@ -29,30 +29,4 @@ public static String listValues(Enum>[] enums) {
b.append("]");
return b.toString();
}
-
- public static > T fromString(Class clz, String value, T defaultVal) {
- assert (clz != null);
-
- if (value != null) {
- try {
- return Enum.valueOf(clz, value.trim());
- } catch (IllegalArgumentException ex) {
- assert (false);
- }
- }
- return defaultVal;
- }
-
- public static > T fromString(Class clz, String value) {
- assert (clz != null);
-
- if (value != null) {
- try {
- return Enum.valueOf(clz, value.trim());
- } catch (IllegalArgumentException ex) {
- assert (false);
- }
- }
- return null;
- }
}
From e4414d1c4491620cf35a8948b6a835c9f82b65b7 Mon Sep 17 00:00:00 2001
From: Suresh Kumar Anaparti
Date: Wed, 3 Dec 2025 11:19:47 +0530
Subject: [PATCH 006/630] Fix agent wait before reconnect (#12153)
---
agent/src/main/java/com/cloud/agent/Agent.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/agent/src/main/java/com/cloud/agent/Agent.java b/agent/src/main/java/com/cloud/agent/Agent.java
index 23b5e790eb93..c01f025c6a8e 100644
--- a/agent/src/main/java/com/cloud/agent/Agent.java
+++ b/agent/src/main/java/com/cloud/agent/Agent.java
@@ -1228,7 +1228,14 @@ public void doTask(final Task task) throws TaskExecutionException {
logger.error("Error parsing task", e);
}
} else if (task.getType() == Task.Type.DISCONNECT) {
- logger.debug("Executing disconnect task - {}", () -> getLinkLog(task.getLink()));
+ try {
+ // an issue has been found if reconnect immediately after disconnecting.
+ // wait 5 seconds before reconnecting
+ logger.debug("Wait for 5 secs before reconnecting, disconnect task - {}", () -> getLinkLog(task.getLink()));
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ }
+ logger.debug("Executing disconnect task - {} and reconnecting", () -> getLinkLog(task.getLink()));
reconnect(task.getLink());
} else if (task.getType() == Task.Type.OTHER) {
processOtherTask(task);
From 4379666fb62ded6aa4e102ebba7eada1243421c9 Mon Sep 17 00:00:00 2001
From: Abhisar Sinha <63767682+abh1sar@users.noreply.github.com>
Date: Wed, 3 Dec 2025 17:05:22 +0530
Subject: [PATCH 007/630] Proxmox Extension : Make settings such as storage,
disk_size,... (#12174)
Make storage, disk-size and os-type configurable in the Proxmox extension
Doc PR: apache/cloudstack-documentation#601
---------
Co-authored-by: dahn
---
extensions/Proxmox/proxmox.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/extensions/Proxmox/proxmox.sh b/extensions/Proxmox/proxmox.sh
index 23f30311e2b7..fc27f2f30757 100755
--- a/extensions/Proxmox/proxmox.sh
+++ b/extensions/Proxmox/proxmox.sh
@@ -39,6 +39,10 @@ parse_json() {
"template_id": (.externaldetails.virtualmachine.template_id // ""),
"template_type": (.externaldetails.virtualmachine.template_type // ""),
"iso_path": (.externaldetails.virtualmachine.iso_path // ""),
+ "iso_os_type": (.externaldetails.virtualmachine.iso_os_type // "l26"),
+ "disk_size_gb": (.externaldetails.virtualmachine.disk_size_gb // "64"),
+ "storage": (.externaldetails.virtualmachine.storage // "local-lvm"),
+ "is_full_clone": (.externaldetails.virtualmachine.is_full_clone // "false"),
"snap_name": (.parameters.snap_name // ""),
"snap_description": (.parameters.snap_description // ""),
"snap_save_memory": (.parameters.snap_save_memory // ""),
@@ -212,9 +216,9 @@ create() {
local data="vmid=$vmid"
data+="&name=$vm_name"
data+="&ide2=$(urlencode "$iso_path,media=cdrom")"
- data+="&ostype=l26"
+ data+="&ostype=$iso_os_type"
data+="&scsihw=virtio-scsi-single"
- data+="&scsi0=$(urlencode "local-lvm:64,iothread=on")"
+ data+="&scsi0=$(urlencode "$storage:$disk_size_gb,iothread=on")"
data+="&sockets=1"
data+="&cores=$vmcpus"
data+="&numa=0"
@@ -228,6 +232,8 @@ create() {
check_required_fields template_id
local data="newid=$vmid"
data+="&name=$vm_name"
+ clone_flag=$(( is_full_clone == "true" ))
+ data+="&storage=$storage&full=$clone_flag"
execute_and_wait POST "/nodes/${node}/qemu/${template_id}/clone" "$data"
cleanup_vm=1
From 12f432195284dbd420f20dbb7590d2b27f58621b Mon Sep 17 00:00:00 2001
From: Lucas Martins <56271185+lucas-a-martins@users.noreply.github.com>
Date: Mon, 8 Dec 2025 05:41:56 -0300
Subject: [PATCH 008/630] Changes error message when using invalid
`endpoint.url` (#8603)
Co-authored-by: lucas.martins.scclouds
Co-authored-by: Daniel Augusto Veronezi Salvador <38945620+GutoVeronezi@users.noreply.github.com>
Co-authored-by: erikbocks
---
.../config/ApiServiceConfiguration.java | 19 ++++
.../config/ApiServiceConfigurationTest.java | 95 +++++++++++++++++++
.../cluster/KubernetesClusterManagerImpl.java | 15 +--
.../KubernetesClusterActionWorker.java | 2 +-
.../network/as/AutoScaleManagerImpl.java | 5 +-
.../lb/LoadBalancingRulesManagerImpl.java | 8 +-
6 files changed, 122 insertions(+), 22 deletions(-)
create mode 100644 api/src/test/java/org/apache/cloudstack/config/ApiServiceConfigurationTest.java
diff --git a/api/src/main/java/org/apache/cloudstack/config/ApiServiceConfiguration.java b/api/src/main/java/org/apache/cloudstack/config/ApiServiceConfiguration.java
index a4aa860487f3..113b97f43c8f 100644
--- a/api/src/main/java/org/apache/cloudstack/config/ApiServiceConfiguration.java
+++ b/api/src/main/java/org/apache/cloudstack/config/ApiServiceConfiguration.java
@@ -16,10 +16,15 @@
// under the License.
package org.apache.cloudstack.config;
+import com.cloud.exception.InvalidParameterValueException;
import org.apache.cloudstack.framework.config.ConfigKey;
import org.apache.cloudstack.framework.config.Configurable;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class ApiServiceConfiguration implements Configurable {
+ protected static Logger LOGGER = LogManager.getLogger(ApiServiceConfiguration.class);
public static final ConfigKey ManagementServerAddresses = new ConfigKey<>(String.class, "host", "Advanced", "localhost", "The ip address of management server. This can also accept comma separated addresses.", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.CSV, null);
public static final ConfigKey ApiServletPath = new ConfigKey("Advanced", String.class, "endpoint.url", "http://localhost:8080/client/api",
"API end point. Can be used by CS components/services deployed remotely, for sending CS API requests", true);
@@ -29,6 +34,20 @@ public class ApiServiceConfiguration implements Configurable {
"true", "Are the source checks on API calls enabled (true) or not (false)? See api.allowed.source.cidr.list", true, ConfigKey.Scope.Global);
public static final ConfigKey ApiAllowedSourceCidrList = new ConfigKey<>(String.class, "api.allowed.source.cidr.list", "Advanced",
"0.0.0.0/0,::/0", "Comma separated list of IPv4/IPv6 CIDRs from which API calls can be performed. Can be set on Global and Account levels.", true, ConfigKey.Scope.Account, null, null, null, null, null, ConfigKey.Kind.CSV, null);
+
+
+ public static void validateEndpointUrl() {
+ String csUrl = getApiServletPathValue();
+ if (StringUtils.isBlank(csUrl) || StringUtils.containsAny(csUrl, "localhost", "127.0.0.1", "[::1]")) {
+ LOGGER.error("Global setting [{}] cannot contain localhost or be blank. Current value: {}", ApiServletPath.key(), csUrl);
+ throw new InvalidParameterValueException("Unable to complete this operation. Contact your cloud admin.");
+ }
+ }
+
+ public static String getApiServletPathValue() {
+ return ApiServletPath.value();
+ }
+
@Override
public String getConfigComponentName() {
return ApiServiceConfiguration.class.getSimpleName();
diff --git a/api/src/test/java/org/apache/cloudstack/config/ApiServiceConfigurationTest.java b/api/src/test/java/org/apache/cloudstack/config/ApiServiceConfigurationTest.java
new file mode 100644
index 000000000000..4e96af3ead41
--- /dev/null
+++ b/api/src/test/java/org/apache/cloudstack/config/ApiServiceConfigurationTest.java
@@ -0,0 +1,95 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.config;
+
+import com.cloud.exception.InvalidParameterValueException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.MockedStatic;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ApiServiceConfigurationTest {
+
+ private static final String LOCALHOST = "http://localhost";
+
+ private static final String ENDPOINT_URL = "https://acs.clouds.com/client/api";
+
+ private static final String WHITE_SPACE = " ";
+
+ private static final String BLANK_STRING = "";
+
+ private static final String NULL_STRING = null;
+
+ private static final String LOCALHOST_IP = "127.0.0.1";
+
+ @Test(expected = InvalidParameterValueException.class)
+ public void validateEndpointUrlTestIfEndpointUrlContainLocalhostShouldThrowInvalidParameterValueException() {
+ try (MockedStatic apiServiceConfigurationMockedStatic = Mockito.mockStatic(ApiServiceConfiguration.class)) {
+ apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::getApiServletPathValue).thenReturn(LOCALHOST);
+ apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::validateEndpointUrl).thenCallRealMethod();
+ ApiServiceConfiguration.validateEndpointUrl();
+ }
+ }
+
+ @Test
+ public void validateEndpointUrlTestIfEndpointUrlContainLocalhostShouldNotThrowInvalidParameterValueException() {
+ try (MockedStatic apiServiceConfigurationMockedStatic = Mockito.mockStatic(ApiServiceConfiguration.class)) {
+ apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::getApiServletPathValue).thenReturn(ENDPOINT_URL);
+ apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::validateEndpointUrl).thenCallRealMethod();
+ ApiServiceConfiguration.validateEndpointUrl();
+ }
+ }
+
+ @Test(expected = InvalidParameterValueException.class)
+ public void validateEndpointUrlTestIfEndpointUrlIsNullShouldThrowInvalidParameterValueException() {
+ try (MockedStatic apiServiceConfigurationMockedStatic = Mockito.mockStatic(ApiServiceConfiguration.class)) {
+ apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::getApiServletPathValue).thenReturn(NULL_STRING);
+ apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::validateEndpointUrl).thenCallRealMethod();
+ ApiServiceConfiguration.validateEndpointUrl();
+ }
+ }
+
+ @Test(expected = InvalidParameterValueException.class)
+ public void validateEndpointUrlTestIfEndpointUrlIsBlankShouldThrowInvalidParameterValueException() {
+ try (MockedStatic apiServiceConfigurationMockedStatic = Mockito.mockStatic(ApiServiceConfiguration.class)) {
+ apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::getApiServletPathValue).thenReturn(BLANK_STRING);
+ apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::validateEndpointUrl).thenCallRealMethod();
+ ApiServiceConfiguration.validateEndpointUrl();
+ }
+ }
+
+ @Test(expected = InvalidParameterValueException.class)
+ public void validateEndpointUrlTestIfEndpointUrlIsWhiteSpaceShouldThrowInvalidParameterValueException() {
+ try (MockedStatic apiServiceConfigurationMockedStatic = Mockito.mockStatic(ApiServiceConfiguration.class)) {
+ apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::getApiServletPathValue).thenReturn(WHITE_SPACE);
+ apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::validateEndpointUrl).thenCallRealMethod();
+ ApiServiceConfiguration.validateEndpointUrl();
+ }
+ }
+
+ @Test(expected = InvalidParameterValueException.class)
+ public void validateEndpointUrlTestIfEndpointUrlContainLocalhostIpShouldThrowInvalidParameterValueException() {
+ try (MockedStatic apiServiceConfigurationMockedStatic = Mockito.mockStatic(ApiServiceConfiguration.class)) {
+ apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::getApiServletPathValue).thenReturn(LOCALHOST_IP);
+ apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::validateEndpointUrl).thenCallRealMethod();
+ ApiServiceConfiguration.validateEndpointUrl();
+ }
+ }
+}
diff --git a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java
index 213657db0733..422c9072fbff 100644
--- a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java
+++ b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java
@@ -905,15 +905,6 @@ public KubernetesClusterResponse createKubernetesClusterResponse(long kubernetes
return response;
}
- private void validateEndpointUrl() {
- String csUrl = ApiServiceConfiguration.ApiServletPath.value();
- if (csUrl == null || csUrl.contains("localhost")) {
- String error = String.format("Global setting %s has to be set to the Management Server's API end point",
- ApiServiceConfiguration.ApiServletPath.key());
- throw new InvalidParameterValueException(error);
- }
- }
-
private DataCenter validateAndGetZoneForKubernetesCreateParameters(Long zoneId, Long networkId) {
DataCenter zone = dataCenterDao.findById(zoneId);
if (zone == null) {
@@ -1008,7 +999,7 @@ public boolean isCommandSupported(KubernetesCluster cluster, String cmdName) {
}
private void validateManagedKubernetesClusterCreateParameters(final CreateKubernetesClusterCmd cmd) throws CloudRuntimeException {
- validateEndpointUrl();
+ ApiServiceConfiguration.validateEndpointUrl();
final String name = cmd.getName();
final Long zoneId = cmd.getZoneId();
final Long kubernetesVersionId = cmd.getKubernetesVersionId();
@@ -1308,7 +1299,7 @@ private void validateKubernetesClusterScaleParameters(ScaleKubernetesClusterCmd
KubernetesVersionManagerImpl.MINIMUN_AUTOSCALER_SUPPORTED_VERSION ));
}
- validateEndpointUrl();
+ ApiServiceConfiguration.validateEndpointUrl();
if (minSize == null || maxSize == null) {
throw new InvalidParameterValueException("Autoscaling requires minsize and maxsize to be passed");
@@ -1413,7 +1404,7 @@ protected boolean isAnyNodeOfferingEmpty(Map map) {
private void validateKubernetesClusterUpgradeParameters(UpgradeKubernetesClusterCmd cmd) {
// Validate parameters
- validateEndpointUrl();
+ ApiServiceConfiguration.validateEndpointUrl();
final Long kubernetesClusterId = cmd.getId();
final Long upgradeVersionId = cmd.getKubernetesVersionId();
diff --git a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java
index baf717612f86..cd334954946f 100644
--- a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java
+++ b/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java
@@ -685,7 +685,7 @@ protected boolean createCloudStackSecret(String[] keys) {
try {
String command = String.format("sudo %s/%s -u '%s' -k '%s' -s '%s'",
- scriptPath, deploySecretsScriptFilename, ApiServiceConfiguration.ApiServletPath.value(), keys[0], keys[1]);
+ scriptPath, deploySecretsScriptFilename, ApiServiceConfiguration.getApiServletPathValue(), keys[0], keys[1]);
Account account = accountDao.findById(kubernetesCluster.getAccountId());
if (account != null && account.getType() == Account.Type.PROJECT) {
String projectId = projectService.findByProjectAccountId(account.getId()).getUuid();
diff --git a/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java b/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java
index 90380b77e440..232c4a6bd680 100644
--- a/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java
+++ b/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java
@@ -512,7 +512,6 @@ public void checkAutoScaleUser(Long autoscaleUserId, long accountId) {
String apiKey = user.getApiKey();
String secretKey = user.getSecretKey();
- String csUrl = ApiServiceConfiguration.ApiServletPath.value();
if (apiKey == null) {
throw new InvalidParameterValueException("apiKey for user: " + user.getUsername() + " is empty. Please generate it");
@@ -522,9 +521,7 @@ public void checkAutoScaleUser(Long autoscaleUserId, long accountId) {
throw new InvalidParameterValueException("secretKey for user: " + user.getUsername() + " is empty. Please generate it");
}
- if (csUrl == null || csUrl.contains("localhost")) {
- throw new InvalidParameterValueException(String.format("Global setting %s has to be set to the Management Server's API end point", ApiServiceConfiguration.ApiServletPath.key()));
- }
+ ApiServiceConfiguration.validateEndpointUrl();
}
@Override
@ActionEvent(eventType = EventTypes.EVENT_AUTOSCALEVMPROFILE_CREATE, eventDescription = "creating autoscale vm profile", create = true)
diff --git a/server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
index 5ceebf06dd88..df60553bb8e5 100644
--- a/server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
+++ b/server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
@@ -337,7 +337,6 @@ private LbAutoScaleVmGroup getLbAutoScaleVmGroup(AutoScaleVmGroupVO vmGroup, Aut
String apiKey = null;
String secretKey = null;
- String csUrl = ApiServiceConfiguration.ApiServletPath.value();
Network.Provider provider = getLoadBalancerServiceProvider(lb);
if (Network.Provider.Netscaler.equals(provider)) {
Long autoscaleUserId = autoScaleVmProfile.getAutoScaleUserId();
@@ -358,13 +357,12 @@ private LbAutoScaleVmGroup getLbAutoScaleVmGroup(AutoScaleVmGroupVO vmGroup, Aut
throw new InvalidParameterValueException("secretKey for user: " + user.getUsername() + " is empty. Please generate it");
}
- if (csUrl == null || csUrl.contains("localhost")) {
- throw new InvalidParameterValueException(String.format("Global setting %s has to be set to the Management Server's API end point", ApiServiceConfiguration.ApiServletPath.key()));
- }
+ ApiServiceConfiguration.validateEndpointUrl();
}
LbAutoScaleVmProfile lbAutoScaleVmProfile =
- new LbAutoScaleVmProfile(autoScaleVmProfile, apiKey, secretKey, csUrl, zoneId, domainId, serviceOfferingId, templateId, vmName, lbNetworkUuid);
+ new LbAutoScaleVmProfile(autoScaleVmProfile, apiKey, secretKey, ApiServiceConfiguration.getApiServletPathValue(), zoneId, domainId, serviceOfferingId, templateId,
+ vmName, lbNetworkUuid);
return new LbAutoScaleVmGroup(vmGroup, autoScalePolicies, lbAutoScaleVmProfile, currentState);
}
From c81295439f82ddac2116643dfb52907f763bbd7c Mon Sep 17 00:00:00 2001
From: dahn
Date: Mon, 8 Dec 2025 16:31:48 +0100
Subject: [PATCH 009/630] removed code in comments (#11145)
---
.../src/main/java/com/cloud/agent/Agent.java | 1 -
.../main/java/com/cloud/host/HostStats.java | 1 -
.../network/rules/LbStickinessMethod.java | 4 +-
.../iso/ListIsoPermissionsCmdByAdmin.java | 2 +-
.../ListTemplatePermissionsCmdByAdmin.java | 2 +-
.../user/iso/ListIsoPermissionsCmd.java | 2 +-
.../template/ListTemplatePermissionsCmd.java | 2 +-
.../api/response/SslCertResponse.java | 2 -
.../api/command/test/ScaleVMCmdTest.java | 4 -
.../cloud/network/HAProxyConfigurator.java | 3 -
.../VirtualRoutingResourceTest.java | 4 -
.../java/com/cloud/vm/VmWorkSerializer.java | 2 -
.../cloud/agent/manager/AgentManagerImpl.java | 2 -
.../manager/ClusteredAgentManagerImpl.java | 1 -
.../entity/api/db/dao/EngineHostDaoImpl.java | 1 -
.../orchestration/VolumeOrchestrator.java | 4 -
.../service/api/ProvisioningServiceImpl.java | 8 --
.../cloud/dc/dao/ClusterVSMMapDaoImpl.java | 3 -
.../security/dao/VmRulesetLogDaoImpl.java | 1 -
.../cloud/storage/dao/VMTemplateDaoImpl.java | 7 --
.../cloud/upgrade/dao/Upgrade2214to30.java | 2 -
.../com/cloud/upgrade/dao/Upgrade302to40.java | 1 -
.../cloud/upgrade/dao/Upgrade304to305.java | 49 ------------
.../java/com/cloud/user/UserAccountVO.java | 4 -
.../datastore/db/VolumeDataStoreVO.java | 2 -
.../StorageCacheReplacementAlgorithmLRU.java | 1 -
.../storage/test/VolumeServiceTest.java | 43 -----------
.../vmsnapshot/VMSnapshotStrategyKVMTest.java | 1 -
.../storage/volume/VolumeServiceImpl.java | 1 -
.../java/com/cloud/utils/db/GlobalLock.java | 33 ++++----
.../db/TransactionContextBuilderTest.java | 3 -
.../AsyncSampleEventDrivenStyleCaller.java | 15 ++--
.../jobs/dao/AsyncJobJoinMapDaoImpl.java | 64 ----------------
.../jobs/impl/JobSerializerHelper.java | 1 -
.../ratelimit/integration/APITest.java | 1 -
.../BaremetalDhcpManagerImpl.java | 1 -
.../main/java/com/cloud/ovm/object/Test.java | 58 --------------
.../hypervisor/vmware/VmwareCleanupMaid.java | 9 ---
.../CiscoNexusVSMDeviceManagerImpl.java | 26 +------
.../xenbase/CitrixRequestWrapperTest.java | 31 --------
.../xenbase/XenServer610WrapperTest.java | 11 ---
.../cisco/CiscoVnmcConnectionImpl.java | 1 -
.../element/CiscoVnmcElementService.java | 2 -
.../com/cloud/network/ElasticLbVmMapVO.java | 4 -
.../management/ManagementServerMock.java | 37 +++++----
.../tungsten/service/TungstenElementTest.java | 54 -------------
.../ElastistorPrimaryDataStoreDriver.java | 3 -
.../datastore/util/ElastistorUtil.java | 9 ---
.../datastore/util/LinstorUtilTest.java | 1 -
.../driver/NexentaPrimaryDataStoreDriver.java | 3 -
.../util/NexentaStorApplianceTest.java | 1 -
.../cloudstack/storage/test/VolumeTest.java | 12 ---
.../StorPoolDownloadVolumeCommandWrapper.java | 1 -
.../StorPoolAbandonObjectsCollector.java | 1 -
.../StorPoolPrimaryDataStoreDriver.java | 1 -
.../datastore/util/StorPoolHelper.java | 26 -------
scripts/installer/createtmplt.sh | 5 --
scripts/installer/createvolume.sh | 5 --
scripts/storage/secondary/listvmtmplt.sh | 5 --
scripts/storage/secondary/listvolume.sh | 5 --
scripts/vm/hypervisor/ovm3/cloudstack.py | 4 -
scripts/vm/hypervisor/xenserver/perfmon.py | 6 --
.../vm/hypervisor/xenserver/xcposs/NFSSR.py | 14 ----
.../hypervisor/xenserver/xcpserver/NFSSR.py | 15 ----
.../hypervisor/xenserver/xenserver56/NFSSR.py | 14 ----
.../xenserver/xenserver56fp1/NFSSR.py | 15 ----
.../hypervisor/xenserver/xenserver60/NFSSR.py | 14 ----
scripts/vm/network/security_group.py | 9 ---
scripts/vm/network/vnet/ovstunnel.py | 9 ---
.../impl/UserConcentratedAllocator.java | 2 -
.../com/cloud/api/doc/ApiXmlDocWriter.java | 2 -
.../ExternalNetworkDeviceManagerImpl.java | 14 ----
.../network/rules/PrivateGatewayRules.java | 1 -
.../cloud/network/rules/RulesManagerImpl.java | 2 -
.../security/SecurityGroupManagerImpl.java | 1 -
.../cloud/server/ConfigurationServerImpl.java | 2 -
.../java/com/cloud/test/IPRangeConfig.java | 36 +--------
.../java/com/cloud/test/PodZoneConfig.java | 6 --
.../storage/NfsMountManagerImpl.java | 1 -
.../src/test/java/com/cloud/api/APITest.java | 1 -
.../java/com/cloud/vpc/Site2SiteVpnTest.java | 75 -------------------
.../com/cloud/vpc/VpcTestConfiguration.java | 5 --
.../CreateNetworkOfferingTest.java | 2 -
.../java/common/adapter/AwtCanvasAdapter.java | 6 --
.../src/main/java/rdpclient/RdpClient.java | 9 ---
.../rdpclient/clip/ClipboardDataFormat.java | 14 ----
.../rdpclient/ntlmssp/asn1/TSRequest.java | 6 --
.../rdpclient/rdp/ClientConfirmActivePDU.java | 2 +-
.../rdp/ClientMCSAttachUserRequest.java | 2 -
...oinRequestServerMCSChannelConfirmPDUs.java | 5 --
.../rdpclient/rdp/ClientSynchronizePDU.java | 2 -
.../rdpclient/rdp/ServerBitmapUpdate.java | 1 -
.../rdpclient/rdp/ServerDemandActivePDU.java | 11 +--
.../rdpclient/rdp/ServerIOChannelRouter.java | 6 --
.../main/java/rdpclient/rdp/ServerMCSPDU.java | 4 -
.../src/main/java/streamer/BaseElement.java | 1 -
.../src/main/java/streamer/PipelineImpl.java | 3 -
.../src/main/java/streamer/Queue.java | 1 -
.../main/java/streamer/debug/MockSource.java | 1 -
.../vncclient/vnc/Vnc33Authentication.java | 2 -
.../main/java/vncclient/vnc/Vnc33Hello.java | 2 -
.../java/vncclient/vnc/VncInitializer.java | 2 -
.../java/vncclient/vnc/VncMessageHandler.java | 2 -
.../com/cloud/consoleproxy/ConsoleProxy.java | 1 -
.../resource/NfsSecondaryStorageResource.java | 4 -
.../storage/template/DownloadManagerImpl.java | 2 -
.../storage/template/UploadManagerImpl.java | 1 -
.../LocalNfsSecondaryStorageResourceTest.java | 1 -
systemvm/agent/scripts/run-proxy.sh | 12 ---
.../com/cloud/utils/xmlobject/XmlObject.java | 3 -
.../utils/xmlobject/XmlObjectParser.java | 4 -
.../vmware/mo/VirtualMachineMO.java | 4 -
112 files changed, 52 insertions(+), 901 deletions(-)
delete mode 100644 server/src/test/java/com/cloud/vpc/Site2SiteVpnTest.java
diff --git a/agent/src/main/java/com/cloud/agent/Agent.java b/agent/src/main/java/com/cloud/agent/Agent.java
index 52b1fe392e8d..275fd41edc34 100644
--- a/agent/src/main/java/com/cloud/agent/Agent.java
+++ b/agent/src/main/java/com/cloud/agent/Agent.java
@@ -1322,7 +1322,6 @@ public void doTask(final Task task) throws TaskExecutionException {
processResponse((Response)request, task.getLink());
} else {
//put the requests from mgt server into another thread pool, as the request may take a longer time to finish. Don't block the NIO main thread pool
- //processRequest(request, task.getLink());
requestHandler.submit(new AgentRequestHandler(getType(), getLink(), request));
}
} catch (final ClassNotFoundException e) {
diff --git a/api/src/main/java/com/cloud/host/HostStats.java b/api/src/main/java/com/cloud/host/HostStats.java
index d14794401fa3..0e72b5f2d9d0 100644
--- a/api/src/main/java/com/cloud/host/HostStats.java
+++ b/api/src/main/java/com/cloud/host/HostStats.java
@@ -36,5 +36,4 @@ public interface HostStats {
public HostStats getHostStats();
public double getLoadAverage();
- // public double getXapiMemoryUsageKBs();
}
diff --git a/api/src/main/java/com/cloud/network/rules/LbStickinessMethod.java b/api/src/main/java/com/cloud/network/rules/LbStickinessMethod.java
index 56a0622a52ba..5143611ee828 100644
--- a/api/src/main/java/com/cloud/network/rules/LbStickinessMethod.java
+++ b/api/src/main/java/com/cloud/network/rules/LbStickinessMethod.java
@@ -108,8 +108,7 @@ public LbStickinessMethod(StickinessMethodType methodType, String description) {
}
public void addParam(String name, Boolean required, String description, Boolean isFlag) {
- /* FIXME : UI is breaking if the capability string length is larger , temporarily description is commented out */
- // LbStickinessMethodParam param = new LbStickinessMethodParam(name, required, description);
+ /* is this still a valid comment: FIXME : UI is breaking if the capability string length is larger , temporarily description is commented out */
LbStickinessMethodParam param = new LbStickinessMethodParam(name, required, " ", isFlag);
_paramList.add(param);
return;
@@ -133,7 +132,6 @@ public String getDescription() {
public void setDescription(String description) {
/* FIXME : UI is breaking if the capability string length is larger , temporarily description is commented out */
- //this.description = description;
this._description = " ";
}
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/ListIsoPermissionsCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/ListIsoPermissionsCmdByAdmin.java
index 46bd4f3766e7..57cb461a07a5 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/ListIsoPermissionsCmdByAdmin.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/ListIsoPermissionsCmdByAdmin.java
@@ -1,4 +1,4 @@
-// Licensedname = "listIsoPermissions", to the Apache Software Foundation (ASF) under one
+// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatePermissionsCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatePermissionsCmdByAdmin.java
index ae0e220b4952..5792de737a53 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatePermissionsCmdByAdmin.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatePermissionsCmdByAdmin.java
@@ -1,4 +1,4 @@
-// Licensedname = "listTemplatePermissions", to the Apache Software Foundation (ASF) under one
+// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java
index 6f220c774b84..95c7f5fe309d 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java
@@ -1,4 +1,4 @@
-// Licensedname = "listIsoPermissions", to the Apache Software Foundation (ASF) under one
+// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
index 6d544df41871..408f916abdaa 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
@@ -1,4 +1,4 @@
-// Licensedname = "listTemplatePermissions", to the Apache Software Foundation (ASF) under one
+// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
diff --git a/api/src/main/java/org/apache/cloudstack/api/response/SslCertResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/SslCertResponse.java
index aa729f123b44..f7022cecb709 100644
--- a/api/src/main/java/org/apache/cloudstack/api/response/SslCertResponse.java
+++ b/api/src/main/java/org/apache/cloudstack/api/response/SslCertResponse.java
@@ -27,8 +27,6 @@
import org.apache.cloudstack.network.tls.SslCert;
import com.cloud.serializer.Param;
-//import org.apache.cloudstack.api.EntityReference;
-
@EntityReference(value = SslCert.class)
public class SslCertResponse extends BaseResponse {
diff --git a/api/src/test/java/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
index 3ed1d9389d42..b76041755f57 100644
--- a/api/src/test/java/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
+++ b/api/src/test/java/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
@@ -78,10 +78,6 @@ public void testCreateSuccess() {
scaleVMCmd._responseGenerator = responseGenerator;
UserVmResponse userVmResponse = Mockito.mock(UserVmResponse.class);
- //List list = Mockito.mock(UserVmResponse.class);
- //list.add(userVmResponse);
- //LinkedList mockedList = Mockito.mock(LinkedList.class);
- //Mockito.when(mockedList.get(0)).thenReturn(userVmResponse);
List list = new LinkedList();
list.add(userVmResponse);
diff --git a/core/src/main/java/com/cloud/network/HAProxyConfigurator.java b/core/src/main/java/com/cloud/network/HAProxyConfigurator.java
index 7736bea3cdaf..128652fc64fa 100644
--- a/core/src/main/java/com/cloud/network/HAProxyConfigurator.java
+++ b/core/src/main/java/com/cloud/network/HAProxyConfigurator.java
@@ -629,9 +629,6 @@ public String[] generateConfiguration(final LoadBalancerConfigCommand lbCmd) {
}
}
result.addAll(gSection);
- // TODO decide under what circumstances these options are needed
- // result.add("\tnokqueue");
- // result.add("\tnopoll");
result.add(blankLine);
final List dSection = Arrays.asList(defaultsSection);
diff --git a/core/src/test/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java b/core/src/test/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java
index 201242564ba6..4196587cc3f2 100644
--- a/core/src/test/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java
+++ b/core/src/test/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java
@@ -417,8 +417,6 @@ private void verifyArgs(final SetNetworkACLCommand cmd, final String script, fin
// FIXME Check the json content
assertEquals(VRScripts.UPDATE_CONFIG, script);
assertEquals(VRScripts.NETWORK_ACL_CONFIG, args);
- // assertEquals(args, " -d eth3 -M 01:23:45:67:89:AB -i 192.168.1.1 -m 24 -a Egress:ALL:0:0:192.168.0.1/24-192.168.0.2/24:ACCEPT:," +
- // "Ingress:ICMP:0:0:192.168.0.1/24-192.168.0.2/24:DROP:,Ingress:TCP:20:80:192.168.0.1/24-192.168.0.2/24:ACCEPT:,");
break;
case 2:
assertEquals(VRScripts.UPDATE_CONFIG, script);
@@ -464,8 +462,6 @@ protected SetupGuestNetworkCommand generateSetupGuestNetworkCommand() {
private void verifyArgs(final SetupGuestNetworkCommand cmd, final String script, final String args) {
// TODO Check the contents of the json file
- //assertEquals(script, VRScripts.VPC_GUEST_NETWORK);
- //assertEquals(args, " -C -M 01:23:45:67:89:AB -d eth4 -i 10.1.1.2 -g 10.1.1.1 -m 24 -n 10.1.1.0 -s 8.8.8.8,8.8.4.4 -e cloud.test");
}
@Test
diff --git a/engine/components-api/src/main/java/com/cloud/vm/VmWorkSerializer.java b/engine/components-api/src/main/java/com/cloud/vm/VmWorkSerializer.java
index bd6b52d261fa..e4fdc0c4f375 100644
--- a/engine/components-api/src/main/java/com/cloud/vm/VmWorkSerializer.java
+++ b/engine/components-api/src/main/java/com/cloud/vm/VmWorkSerializer.java
@@ -61,7 +61,6 @@ public static String serialize(VmWork work) {
// use java binary serialization instead
//
return JobSerializerHelper.toObjectSerializedString(work);
- // return s_gson.toJson(work);
}
public static T deserialize(Class> clazz, String workInJsonText) {
@@ -69,6 +68,5 @@ public static T deserialize(Class> clazz, String workInJson
// use java binary serialization instead
//
return (T)JobSerializerHelper.fromObjectSerializedString(workInJsonText);
- // return (T)s_gson.fromJson(workInJsonText, clazz);
}
}
diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
index 3d398ca5dd95..439bdf92ddd7 100644
--- a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
@@ -1652,7 +1652,6 @@ protected void processRequest(final Link link, final Request request) {
final String reason = shutdown.getReason();
logger.info("Host {} has informed us that it is shutting down with reason {} and detail {}", attache, reason, shutdown.getDetail());
if (reason.equals(ShutdownCommand.Update)) {
- // disconnectWithoutInvestigation(attache, Event.UpdateNeeded);
throw new CloudRuntimeException("Agent update not implemented");
} else if (reason.equals(ShutdownCommand.Requested)) {
disconnectWithoutInvestigation(attache, Event.ShutdownRequested);
@@ -1753,7 +1752,6 @@ protected void doTask(final Task task) throws TaskExecutionException {
}
} catch (final UnsupportedVersionException e) {
logger.warn(e.getMessage());
- // upgradeAgent(task.getLink(), data, e.getReason());
} catch (final ClassNotFoundException e) {
final String message = String.format("Exception occurred when executing tasks! Error '%s'", e.getMessage());
logger.error(message);
diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
index c64489828033..e80b0219f55d 100644
--- a/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
+++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
@@ -965,7 +965,6 @@ protected void runInContext() {
synchronized (_agentToTransferIds) {
if (!_agentToTransferIds.isEmpty()) {
logger.debug("Found {} agents to transfer", _agentToTransferIds.size());
- // for (Long hostId : _agentToTransferIds) {
for (final Iterator iterator = _agentToTransferIds.iterator(); iterator.hasNext(); ) {
final Long hostId = iterator.next();
final AgentAttache attache = findAttache(hostId);
diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDaoImpl.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDaoImpl.java
index 2ad8d15d0b71..7f6571becc83 100644
--- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDaoImpl.java
+++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDaoImpl.java
@@ -213,7 +213,6 @@ public EngineHostDaoImpl() {
SequenceSearch = createSearchBuilder();
SequenceSearch.and("id", SequenceSearch.entity().getId(), SearchCriteria.Op.EQ);
- // SequenceSearch.addRetrieve("sequence", SequenceSearch.entity().getSequence());
SequenceSearch.done();
DirectlyConnectedSearch = createSearchBuilder();
diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
index 430b7cbc5aa4..281dd2a3cfe1 100644
--- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -1583,12 +1583,8 @@ public void prepareForMigration(VirtualMachineProfile vm, DeployDestination dest
vm.addDisk(disk);
}
- //if (vm.getType() == VirtualMachine.Type.User && vm.getTemplate().getFormat() == ImageFormat.ISO) {
if (vm.getType() == VirtualMachine.Type.User) {
_tmpltMgr.prepareIsoForVmProfile(vm, dest);
- //DataTO dataTO = tmplFactory.getTemplate(vm.getTemplate().getId(), DataStoreRole.Image, vm.getVirtualMachine().getDataCenterId()).getTO();
- //DiskTO iso = new DiskTO(dataTO, 3L, null, Volume.Type.ISO);
- //vm.addDisk(iso);
}
}
diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java
index 51e87663919b..ff75aa0cbb65 100644
--- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java
+++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java
@@ -140,20 +140,12 @@ public List listHosts() {
@Override
public List listPods() {
- /*
- * Not in use now, just commented out.
- */
- //List pods = new ArrayList();
- //pods.add(new PodEntityImpl("pod-uuid-1", "pod1"));
- //pods.add(new PodEntityImpl("pod-uuid-2", "pod2"));
return null;
}
@Override
public List listZones() {
List zones = new ArrayList();
- //zones.add(new ZoneEntityImpl("zone-uuid-1"));
- //zones.add(new ZoneEntityImpl("zone-uuid-2"));
return zones;
}
diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java b/engine/schema/src/main/java/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java
index 02a7ac6977c2..76058d213338 100644
--- a/engine/schema/src/main/java/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java
+++ b/engine/schema/src/main/java/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java
@@ -36,7 +36,6 @@ public class ClusterVSMMapDaoImpl extends GenericDaoBase
final SearchBuilder VsmSearch;
public ClusterVSMMapDaoImpl() {
- //super();
ClusterSearch = createSearchBuilder();
ClusterSearch.and("clusterId", ClusterSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
@@ -82,8 +81,6 @@ public boolean remove(Long id) {
TransactionLegacy txn = TransactionLegacy.currentTxn();
txn.start();
ClusterVSMMapVO cluster = createForUpdate();
- //cluster.setClusterId(null);
- //cluster.setVsmId(null);
update(id, cluster);
diff --git a/engine/schema/src/main/java/com/cloud/network/security/dao/VmRulesetLogDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/security/dao/VmRulesetLogDaoImpl.java
index 9a9ca80bce59..7ed0ad0bcc54 100644
--- a/engine/schema/src/main/java/com/cloud/network/security/dao/VmRulesetLogDaoImpl.java
+++ b/engine/schema/src/main/java/com/cloud/network/security/dao/VmRulesetLogDaoImpl.java
@@ -76,7 +76,6 @@ public VmRulesetLogVO findByVmId(long vmId) {
@Override
public int createOrUpdate(Set workItems) {
- //return createOrUpdateUsingBatch(workItems);
return createOrUpdateUsingMultiInsert(workItems);
}
diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplateDaoImpl.java b/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplateDaoImpl.java
index 08b82cbb45bc..727035855f9d 100644
--- a/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplateDaoImpl.java
+++ b/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplateDaoImpl.java
@@ -100,7 +100,6 @@ public class VMTemplateDaoImpl extends GenericDaoBase implem
private SearchBuilder PublicIsoSearch;
private SearchBuilder UserIsoSearch;
private GenericSearchBuilder CountTemplatesByAccount;
- // private SearchBuilder updateStateSearch;
private SearchBuilder AllFieldsSearch;
protected SearchBuilder ParentTemplateIdSearch;
private SearchBuilder InactiveUnremovedTmpltSearch;
@@ -404,12 +403,6 @@ public boolean configure(String name, Map params) throws Configu
CountTemplatesByAccount.and("state", CountTemplatesByAccount.entity().getState(), SearchCriteria.Op.EQ);
CountTemplatesByAccount.done();
- // updateStateSearch = this.createSearchBuilder();
- // updateStateSearch.and("id", updateStateSearch.entity().getId(), Op.EQ);
- // updateStateSearch.and("state", updateStateSearch.entity().getState(), Op.EQ);
- // updateStateSearch.and("updatedCount", updateStateSearch.entity().getUpdatedCount(), Op.EQ);
- // updateStateSearch.done();
-
AllFieldsSearch = createSearchBuilder();
AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), SearchCriteria.Op.EQ);
AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade2214to30.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade2214to30.java
index 524b6a34893b..d4cdbcb9707d 100644
--- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade2214to30.java
+++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade2214to30.java
@@ -77,8 +77,6 @@ public void performDataMigration(Connection conn) {
encryptData(conn);
// drop keys
dropKeysIfExist(conn);
- //update template ID for system Vms
- //updateSystemVms(conn); This is not required as system template update is handled during 4.2 upgrade
// update domain network ref
updateDomainNetworkRef(conn);
// update networks that use redundant routers to the new network offering
diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade302to40.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade302to40.java
index aa427252585f..bd8ddaa7c498 100644
--- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade302to40.java
+++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade302to40.java
@@ -62,7 +62,6 @@ public InputStream[] getPrepareScripts() {
@Override
public void performDataMigration(Connection conn) {
- //updateVmWareSystemVms(conn); This is not required as system template update is handled during 4.2 upgrade
correctVRProviders(conn);
correctMultiplePhysicaNetworkSetups(conn);
addHostDetailsUniqueKey(conn);
diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade304to305.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade304to305.java
index bb4c73f67b68..21c016c7cc1d 100644
--- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade304to305.java
+++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade304to305.java
@@ -65,7 +65,6 @@ public void performDataMigration(Connection conn) {
addVpcProvider(conn);
updateRouterNetworkRef(conn);
fixZoneUsingExternalDevices(conn);
-// updateSystemVms(conn);
fixForeignKeys(conn);
encryptClusterDetails(conn);
}
@@ -81,54 +80,6 @@ public InputStream[] getCleanupScripts() {
return new InputStream[] {script};
}
- private void updateSystemVms(Connection conn) {
- PreparedStatement pstmt = null;
- ResultSet rs = null;
- boolean VMware = false;
- try {
- pstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null");
- rs = pstmt.executeQuery();
- while (rs.next()) {
- if ("VMware".equals(rs.getString(1))) {
- VMware = true;
- }
- }
- } catch (SQLException e) {
- throw new CloudRuntimeException("Error while iterating through list of hypervisors in use", e);
- }
- // Just update the VMware system template. Other hypervisor templates are unchanged from previous 3.0.x versions.
- logger.debug("Updating VMware System Vms");
- try {
- //Get 3.0.5 VMware system Vm template Id
- pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = 'systemvm-vmware-3.0.5' and removed is null");
- rs = pstmt.executeQuery();
- if (rs.next()) {
- long templateId = rs.getLong(1);
- rs.close();
- pstmt.close();
- // change template type to SYSTEM
- pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?");
- pstmt.setLong(1, templateId);
- pstmt.executeUpdate();
- pstmt.close();
- // update template ID of system Vms
- pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = 'VMware'");
- pstmt.setLong(1, templateId);
- pstmt.executeUpdate();
- pstmt.close();
- } else {
- if (VMware) {
- throw new CloudRuntimeException("3.0.5 VMware SystemVm template not found. Cannot upgrade system Vms");
- } else {
- logger.warn("3.0.5 VMware SystemVm template not found. VMware hypervisor is not used, so not failing upgrade");
- }
- }
- } catch (SQLException e) {
- throw new CloudRuntimeException("Error while updating VMware systemVm template", e);
- }
- logger.debug("Updating System Vm Template IDs Complete");
- }
-
private void addVpcProvider(Connection conn) {
//Encrypt config params and change category to Hidden
logger.debug("Adding vpc provider to all physical networks in the system");
diff --git a/engine/schema/src/main/java/com/cloud/user/UserAccountVO.java b/engine/schema/src/main/java/com/cloud/user/UserAccountVO.java
index e4fcbad6b02f..c5ca410fc530 100644
--- a/engine/schema/src/main/java/com/cloud/user/UserAccountVO.java
+++ b/engine/schema/src/main/java/com/cloud/user/UserAccountVO.java
@@ -226,10 +226,6 @@ public Date getCreated() {
return created;
}
-// public void setCreated(Date created) {
-// this.created = created;
-// }
-
@Override
public Date getRemoved() {
return removed;
diff --git a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/VolumeDataStoreVO.java b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/VolumeDataStoreVO.java
index d57dec8fbfd5..c475a4203a73 100644
--- a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/VolumeDataStoreVO.java
+++ b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/VolumeDataStoreVO.java
@@ -209,10 +209,8 @@ public VolumeDataStoreVO(long hostId, long volumeId) {
public VolumeDataStoreVO(long hostId, long volumeId, Date lastUpdated, int downloadPercent, Status downloadState, String localDownloadPath, String errorString,
String jobId, String installPath, String downloadUrl, String checksum) {
- // super();
dataStoreId = hostId;
this.volumeId = volumeId;
- // this.zoneId = zoneId;
this.lastUpdated = lastUpdated;
this.downloadPercent = downloadPercent;
this.downloadState = downloadState;
diff --git a/engine/storage/cache/src/main/java/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java b/engine/storage/cache/src/main/java/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java
index fc432ac020d6..7042ee453334 100644
--- a/engine/storage/cache/src/main/java/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java
+++ b/engine/storage/cache/src/main/java/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java
@@ -62,7 +62,6 @@ public void initialize() {
/* Avoid using configDao at this time, we can't be sure that the database is already upgraded
* and there might be fatal errors when using a dao.
*/
- //unusedTimeInterval = NumbersUtil.parseInt(configDao.getValue(Config.StorageCacheReplacementLRUTimeInterval.key()), 30);
}
public void setUnusedTimeInterval(Integer interval) {
diff --git a/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/VolumeServiceTest.java b/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/VolumeServiceTest.java
index c478e2e7c637..1e6a85ecff44 100644
--- a/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/VolumeServiceTest.java
+++ b/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/VolumeServiceTest.java
@@ -87,8 +87,6 @@
@ContextConfiguration(locations = {"classpath:/storageContext.xml"})
public class VolumeServiceTest extends CloudStackTestNGBase {
- // @Inject
- // ImageDataStoreProviderManager imageProviderMgr;
@Inject
TemplateService imageService;
@Inject
@@ -232,23 +230,7 @@ private TemplateInfo createTemplate() {
DataStore store = createImageStore();
VMTemplateVO image = createImageData();
TemplateInfo template = imageDataFactory.getTemplate(image.getId(), store);
- // AsyncCallFuture future =
- // imageService.createTemplateAsync(template, store);
- // future.get();
template = imageDataFactory.getTemplate(image.getId(), store);
- /*
- * imageProviderMgr.configure("image Provider", new HashMap()); VMTemplateVO image = createImageData();
- * ImageDataStoreProvider defaultProvider =
- * imageProviderMgr.getProvider("DefaultProvider");
- * ImageDataStoreLifeCycle lifeCycle =
- * defaultProvider.getLifeCycle(); ImageDataStore store =
- * lifeCycle.registerDataStore("defaultHttpStore", new
- * HashMap());
- * imageService.registerTemplate(image.getId(),
- * store.getImageDataStoreId()); TemplateEntity te =
- * imageService.getTemplateEntity(image.getId()); return te;
- */
return template;
} catch (Exception e) {
Assert.fail("failed", e);
@@ -333,30 +315,6 @@ public DataStore createPrimaryDataStore() {
ClusterScope scope = new ClusterScope(clusterId, podId, dcId);
lifeCycle.attachCluster(store, scope);
- /*
- * PrimaryDataStoreProvider provider =
- * primaryDataStoreProviderMgr.getDataStoreProvider
- * ("sample primary data store provider");
- * primaryDataStoreProviderMgr.configure("primary data store mgr",
- * new HashMap());
- *
- * List ds =
- * primaryStoreDao.findPoolByName(this.primaryName); if (ds.size()
- * >= 1) { PrimaryDataStoreVO store = ds.get(0); if
- * (store.getRemoved() == null) { return
- * provider.getDataStore(store.getId()); } }
- *
- *
- * Map params = new HashMap();
- * params.put("url", this.getPrimaryStorageUrl());
- * params.put("dcId", dcId.toString()); params.put("clusterId",
- * clusterId.toString()); params.put("name", this.primaryName);
- * PrimaryDataStoreInfo primaryDataStoreInfo =
- * provider.registerDataStore(params); PrimaryDataStoreLifeCycle lc
- * = primaryDataStoreInfo.getLifeCycle(); ClusterScope scope = new
- * ClusterScope(clusterId, podId, dcId); lc.attachCluster(scope);
- * return primaryDataStoreInfo;
- */
return store;
} catch (Exception e) {
return null;
@@ -376,7 +334,6 @@ public void createVolumeFromTemplate() {
TemplateInfo te = createTemplate();
VolumeVO volume = createVolume(te.getId(), primaryStore.getId());
VolumeInfo vol = volumeFactory.getVolume(volume.getId(), primaryStore);
- // ve.createVolumeFromTemplate(primaryStore.getId(), new VHD(), te);
AsyncCallFuture future = volumeService.createVolumeFromTemplateAsync(vol, primaryStore.getId(), te);
try {
future.get();
diff --git a/engine/storage/snapshot/src/test/java/org/apache/cloudstack/storage/vmsnapshot/VMSnapshotStrategyKVMTest.java b/engine/storage/snapshot/src/test/java/org/apache/cloudstack/storage/vmsnapshot/VMSnapshotStrategyKVMTest.java
index 02c17f8f3bd5..050c0246abaf 100644
--- a/engine/storage/snapshot/src/test/java/org/apache/cloudstack/storage/vmsnapshot/VMSnapshotStrategyKVMTest.java
+++ b/engine/storage/snapshot/src/test/java/org/apache/cloudstack/storage/vmsnapshot/VMSnapshotStrategyKVMTest.java
@@ -237,7 +237,6 @@ public void testRevertDiskSnapshot() throws Exception {
when(vol.getDataStore()).thenReturn(dataStore);
when(snapshotVO.getId()).thenReturn(1L);
when(_snapshotService.revertSnapshot(snapshotVO.getId())).thenReturn(snap);
- // testFindSnapshotByName(name);
vmStrategy.revertDiskSnapshot(vmSnapshot);
}
diff --git a/engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index e22646299525..57d9a0aec1f0 100644
--- a/engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -722,7 +722,6 @@ protected Void managedCopyBaseImageCallback(AsyncCallbackDispatcher
+ * GlobalLock lock = GlobalLock.getInternLock("some table name" + rowId);
+ *
+ * if(lock.lock()) {
+ * try {
+ * do something
+ * } finally {
+ * lock.unlock();
+ * }
+ * }
+ * lock.releaseRef();
+ *
+ */
public class GlobalLock {
protected Logger logger = LogManager.getLogger(getClass());
diff --git a/framework/db/src/test/java/com/cloud/utils/db/TransactionContextBuilderTest.java b/framework/db/src/test/java/com/cloud/utils/db/TransactionContextBuilderTest.java
index a0f7c803e4b8..3ec635c15d98 100644
--- a/framework/db/src/test/java/com/cloud/utils/db/TransactionContextBuilderTest.java
+++ b/framework/db/src/test/java/com/cloud/utils/db/TransactionContextBuilderTest.java
@@ -41,9 +41,6 @@ public class TransactionContextBuilderTest {
@Test
public void test() {
- // _derived.DbAnnotatedMethod();
- // _base.MethodWithClassDbAnnotated();
-
// test @DB injection on dynamically constructed objects
DbAnnotatedBase base = ComponentContext.inject(new DbAnnotatedBase());
base.MethodWithClassDbAnnotated();
diff --git a/framework/ipc/src/test/java/org/apache/cloudstack/framework/codestyle/AsyncSampleEventDrivenStyleCaller.java b/framework/ipc/src/test/java/org/apache/cloudstack/framework/codestyle/AsyncSampleEventDrivenStyleCaller.java
index 164852af4e76..0d8ddcfa5a45 100644
--- a/framework/ipc/src/test/java/org/apache/cloudstack/framework/codestyle/AsyncSampleEventDrivenStyleCaller.java
+++ b/framework/ipc/src/test/java/org/apache/cloudstack/framework/codestyle/AsyncSampleEventDrivenStyleCaller.java
@@ -20,6 +20,8 @@
import java.util.concurrent.ExecutionException;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -36,6 +38,7 @@
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:/SampleManagementServerAppContext.xml")
public class AsyncSampleEventDrivenStyleCaller {
+ protected Logger logger = LogManager.getLogger(getClass());
private AsyncSampleCallee _ds;
AsyncCallbackDriver _callbackDriver;
@@ -53,12 +56,8 @@ public void MethodThatWillCallAsyncMethod() {
try {
String result = future.get();
Assert.assertEquals(result, vol);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ } catch (InterruptedException | ExecutionException e) {
+ logger.info(e);
}
}
@@ -87,10 +86,8 @@ public String getResult() {
if (!this.finished) {
try {
this.wait();
-
} catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ logger.info(e);
}
}
return this.result;
diff --git a/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/dao/AsyncJobJoinMapDaoImpl.java b/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/dao/AsyncJobJoinMapDaoImpl.java
index da7ba36c919f..09a88939492e 100644
--- a/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/dao/AsyncJobJoinMapDaoImpl.java
+++ b/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/dao/AsyncJobJoinMapDaoImpl.java
@@ -44,8 +44,6 @@ public class AsyncJobJoinMapDaoImpl extends GenericDaoBase CompleteJoinSearch;
private final SearchBuilder WakeupSearch;
-// private final GenericSearchBuilder JoinJobSearch;
-
protected AsyncJobJoinMapDaoImpl() {
RecordSearch = createSearchBuilder();
RecordSearch.and("jobId", RecordSearch.entity().getJobId(), Op.EQ);
@@ -65,10 +63,6 @@ protected AsyncJobJoinMapDaoImpl() {
WakeupSearch.and("expiration", WakeupSearch.entity().getExpiration(), Op.GT);
WakeupSearch.and("joinStatus", WakeupSearch.entity().getJoinStatus(), Op.EQ);
WakeupSearch.done();
-
-// JoinJobSearch = createSearchBuilder(Long.class);
-// JoinJobSearch.and(JoinJobSearch.entity().getJoinJobId(), Op.SC, "joinJobId");
-// JoinJobSearch.done();
}
@Override
@@ -148,64 +142,6 @@ public void completeJoin(long joinJobId, JobInfo.Status joinStatus, String joinR
update(ub, sc, null);
}
-// @Override
-// public List wakeupScan() {
-// List standaloneList = new ArrayList();
-//
-// Date cutDate = DateUtil.currentGMTTime();
-//
-// TransactionLegacy txn = TransactionLegacy.currentTxn();
-// PreparedStatement pstmt = null;
-// try {
-// txn.start();
-//
-// //
-// // performance sensitive processing, do it in plain SQL
-// //
-// String sql = "UPDATE async_job SET job_pending_signals=? WHERE id IN " +
-// "(SELECT job_id FROM async_job_join_map WHERE next_wakeup < ? AND expiration > ?)";
-// pstmt = txn.prepareStatement(sql);
-// pstmt.setInt(1, AsyncJob.Constants.SIGNAL_MASK_WAKEUP);
-// pstmt.setString(2, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
-// pstmt.setString(3, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
-// pstmt.executeUpdate();
-// pstmt.close();
-//
-// sql = "UPDATE sync_queue_item SET queue_proc_msid=NULL, queue_proc_number=NULL WHERE content_id IN " +
-// "(SELECT job_id FROM async_job_join_map WHERE next_wakeup < ? AND expiration > ?)";
-// pstmt = txn.prepareStatement(sql);
-// pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
-// pstmt.setString(2, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
-// pstmt.executeUpdate();
-// pstmt.close();
-//
-// sql = "SELECT job_id FROM async_job_join_map WHERE next_wakeup < ? AND expiration > ? AND job_id NOT IN (SELECT content_id FROM sync_queue_item)";
-// pstmt = txn.prepareStatement(sql);
-// pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
-// pstmt.setString(2, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
-// ResultSet rs = pstmt.executeQuery();
-// while(rs.next()) {
-// standaloneList.add(rs.getLong(1));
-// }
-// rs.close();
-// pstmt.close();
-//
-// // update for next wake-up
-// sql = "UPDATE async_job_join_map SET next_wakeup=DATE_ADD(next_wakeup, INTERVAL wakeup_interval SECOND) WHERE next_wakeup < ? AND expiration > ?";
-// pstmt = txn.prepareStatement(sql);
-// pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
-// pstmt.setString(2, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutDate));
-// pstmt.executeUpdate();
-// pstmt.close();
-//
-// txn.commit();
-// } catch (SQLException e) {
-// logger.error("Unexpected exception", e);
-// }
-//
-// return standaloneList;
-// }
-
@Override
public List findJobsToWake(long joinedJobId) {
// TODO: We should fix this. We shouldn't be crossing daos in a dao code.
diff --git a/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/JobSerializerHelper.java b/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/JobSerializerHelper.java
index fa1d175c45f9..66df95426d56 100644
--- a/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/JobSerializerHelper.java
+++ b/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/JobSerializerHelper.java
@@ -193,7 +193,6 @@ public JsonElement serialize(Throwable th, Type type, JsonSerializationContext c
json.add("class", new JsonPrimitive(th.getClass().getName()));
json.add("cause", s_gson.toJsonTree(th.getCause()));
json.add("msg", new JsonPrimitive(th.getMessage()));
-// json.add("stack", s_gson.toJsonTree(th.getStackTrace()));
return json;
}
diff --git a/plugins/api/rate-limit/src/test/java/org/apache/cloudstack/ratelimit/integration/APITest.java b/plugins/api/rate-limit/src/test/java/org/apache/cloudstack/ratelimit/integration/APITest.java
index efe8c53a51b1..eb020c2c499a 100644
--- a/plugins/api/rate-limit/src/test/java/org/apache/cloudstack/ratelimit/integration/APITest.java
+++ b/plugins/api/rate-limit/src/test/java/org/apache/cloudstack/ratelimit/integration/APITest.java
@@ -189,7 +189,6 @@ protected Object fromSerializedString(String result, Class> repCls) {
* @return login response string
*/
protected void login(String username, String password) {
- //String md5Psw = createMD5String(password);
// send login request
HashMap params = new HashMap();
params.put("response", "json");
diff --git a/plugins/hypervisors/baremetal/src/main/java/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java b/plugins/hypervisors/baremetal/src/main/java/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
index 99bedbff05e1..9bdc2fb9ed86 100644
--- a/plugins/hypervisors/baremetal/src/main/java/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/main/java/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
@@ -149,7 +149,6 @@ public boolean addVirtualMachineIntoNetwork(Network network, NicProfile nic, Vir
String errMsg =
String.format("Set dhcp entry on external DHCP %1$s failed(ip=%2$s, mac=%3$s, vmname=%4$s)", h.getPrivateIpAddress(), nic.getIPv4Address(),
nic.getMacAddress(), profile.getVirtualMachine().getHostName());
- // prepareBareMetalDhcpEntry(nic, dhcpCommand);
try {
Answer ans = _agentMgr.send(h.getId(), dhcpCommand);
if (ans.getResult()) {
diff --git a/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/object/Test.java b/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/object/Test.java
index cd1b14eeaa15..32960a9616c6 100644
--- a/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/object/Test.java
+++ b/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/object/Test.java
@@ -23,37 +23,6 @@
public class Test {
public static void main(final String[] args) {
try {
- /*Connection c = new Connection("192.168.105.155", "oracle", "password");
- Utils util = new UtilsImpl(c);
- Storage storage = new StorageImpl(c);
- String[] res = util.listDir("/etc", 1);
- for (String s : res) {
- System.out.println(s);
- }
-
-
- Pool pool = new PoolImpl(c);
-
- //pool.registerServer("192.168.105.155", Pool.ServerType.SITE);
- //pool.registerServer("192.168.105.155", Pool.ServerType.UTILITY);
- //pool.registerServer("192.168.105.155", Pool.ServerType.XEN);
- System.out.println("Is:" + pool.isServerRegistered());
- System.out.println(pool.getServerConfig());
- System.out.println(pool.getServerXmInfo());
- System.out.println(pool.getHostInfo());
- System.out.println(pool.getAgentVersion());
- String[] srs = storage.listSr();
- for (int i=0; i spaceInfo = storage.getSrSpaceInfo("192.168.110.232:/export/frank/nfs");
- System.out.println("Total:" + spaceInfo.first());
- System.out.println("Free:" + spaceInfo.second());*/
final OvmVm.Details vm = new OvmVm.Details();
vm.cpuNum = 1;
vm.memory = 512;
@@ -80,23 +49,7 @@ public static void main(final String[] args) {
vm.vifs.add(vif);
vm.vifs.add(vif);
vm.vifs.add(vif);
- //System.out.println(vm.toJson());
final Connection c = new Connection("192.168.189.12", "oracle", "password");
- //System.out.println(Coder.toJson(OvmHost.getDetails(c)));
-
- /* This is not being used at the moment.
- * Coverity issue: 1012179
- */
-
- //OvmHost.Details d = new GsonBuilder().create().fromJson(txt, OvmHost.Details.class);
- //OvmHost.Details d = Coder.fromJson(txt, OvmHost.Details.class);
- //OvmHost.Details d = OvmHost.getDetails(c);
- //System.out.println(Coder.toJson(d));
- // OvmStoragePool.Details pool = new OvmStoragePool.Details();
- // pool.path = "192.168.110.232:/export/frank/ovs";
- // pool.type = OvmStoragePool.NFS;
- // pool.uuid = "123";
- // System.out.println(pool.toJson());
String cmd = null;
System.out.println(args.length);
@@ -119,15 +72,10 @@ public static void main(final String[] args) {
System.out.println(d.toJson());
if (cmd.equalsIgnoreCase("create")) {
- // String s =
- // "{\"cpuNum\":1,\"memory\":512,\"rootDisk\":{\"type\":\"w\",\"path\":\"/var/ovs/mount/60D0985974CA425AAF5D01A1F161CC8B/running_pool/36_systemvm/System.img\"},\"disks\":[],\"vifs\":[{\"mac\":\"00:16:3E:5C:B1:D1\",\"bridge\":\"xenbr0\",\"type\":\"netfront\"}],\"name\":\"MyTest\",\"uuid\":\"1-2-3-4-5\"}";
OvmVm.create(c, d);
- // c.call("OvmVm.echo", new Object[]{s});
} else if (cmd.equalsIgnoreCase("reboot")) {
final Map res = OvmVm.reboot(c, "MyTest");
System.out.println(res.get("vncPort"));
- //OvmVm.stop(c, "MyTest");
- //OvmVm.create(c, d);
} else if (cmd.equalsIgnoreCase("stop")) {
OvmVm.stop(c, "MyTest");
} else if (cmd.equalsIgnoreCase("details")) {
@@ -166,12 +114,6 @@ public static void main(final String[] args) {
l.add("4b4d8951-f0b6-36c5-b4f3-a82ff2611c65");
System.out.println(Coder.toJson(l));
- // Map res = OvmHost.getPerformanceStats(c, "xenbr0");
- // System.out.println(res.toString());
- // String stxt = "{\"vifs\": [{\"bridge\": \"xenbr0\", \"mac\": \"00:16:3E:5C:B1:D1\", \"type\": \"netfront\"}], \"powerState\": \"RUNNING\", \"disks\": [], \"cpuNum\": 1, \"memory\": 536870912, \"rootDisk\": {\"path\": \"/var/ovs/mount/60D0985974CA425AAF5D01A1F161CC8B/running_pool/MyTest/System.img\", \"type\": \"w\"}}";
- // OvmVm.Details ddd = Coder.fromJson(stxt, OvmVm.Details.class);
- // System.out.println(ddd.vifs.size());
- // System.out.println(ddd.rootDisk.path);
} catch (final Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
diff --git a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/VmwareCleanupMaid.java b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/VmwareCleanupMaid.java
index d2c71c4ee01a..49f10970e7c8 100644
--- a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/VmwareCleanupMaid.java
+++ b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/VmwareCleanupMaid.java
@@ -65,15 +65,6 @@ public VmwareCleanupMaid(String vCenterAddress, String dcMorValue, String vmName
_vmName = vmName;
}
-// @Override
-// public int cleanup(CheckPointManager checkPointMgr) {
-//
-// // save a check-point in case we crash at current run so that we won't lose it
-// _checkPoint = checkPointMgr.pushCheckPoint(new VmwareCleanupMaid(_vCenterAddress, _dcMorValue, _vmName));
-// addLeftOverVM(this);
-// return 0;
-// }
-
public String getCleanupProcedure() {
return null;
}
diff --git a/plugins/hypervisors/vmware/src/main/java/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java b/plugins/hypervisors/vmware/src/main/java/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
index beac489acdb3..73d63f04c5f4 100644
--- a/plugins/hypervisors/vmware/src/main/java/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/main/java/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
@@ -66,9 +66,7 @@ public abstract class CiscoNexusVSMDeviceManagerImpl extends AdapterBase {
@DB
- //public CiscoNexusVSMDeviceVO addCiscoNexusVSM(long clusterId, String ipaddress, String username, String password, ServerResource resource, String vsmName) {
- public
- CiscoNexusVSMDeviceVO addCiscoNexusVSM(long clusterId, String ipaddress, String username, String password, String vCenterIpaddr, String vCenterDcName) {
+ public CiscoNexusVSMDeviceVO addCiscoNexusVSM(long clusterId, String ipaddress, String username, String password, String vCenterIpaddr, String vCenterDcName) {
// In this function, we associate this VSM with each host
// in the clusterId specified.
@@ -154,28 +152,6 @@ CiscoNexusVSMDeviceVO addCiscoNexusVSM(long clusterId, String ipaddress, String
// into each host's resource. Also, we first configure each resource's
// entries in the database to contain this VSM information before the injection.
- //for (HostVO host : hosts) {
- // Create a host details VO object and write it out for this hostid.
- //Long hostid = new Long(vsmId);
- //DetailVO vsmDetail = new DetailVO(host.getId(), "vsmId", hostid.toString());
- //Transaction tx = Transaction.currentTxn();
- //try {
- //tx.start();
- //_hostDetailDao.persist(vsmDetail);
- //tx.commit();
- //} catch (Exception e) {
- //tx.rollback();
- //throw new CloudRuntimeException(e.getMessage());
- //}
- //}
- // Reconfigure the resource.
- //Map hostDetails = new HashMap();
- //hostDetails.put(ApiConstants.ID, vsmId);
- //hostDetails.put(ApiConstants.IP_ADDRESS, ipaddress);
- //hostDetails.put(ApiConstants.USERNAME, username);
- //hostDetails.put(ApiConstants.PASSWORD, password);
- //_agentMrg.send(host.getId(), )
-
return VSMObj;
}
diff --git a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixRequestWrapperTest.java b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixRequestWrapperTest.java
index d464a2664935..b9504b6648a3 100755
--- a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixRequestWrapperTest.java
+++ b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixRequestWrapperTest.java
@@ -576,37 +576,6 @@ public void testMaintainCommand() {
fail(e.getMessage());
}
- // try {
- // PowerMockito.mockStatic(Host.class);
- // //BDDMockito.given(Host.getByUuid(conn,
- // xsHost.getUuid())).willReturn(host);
- // PowerMockito.when(Host.getByUuid(conn,
- // xsHost.getUuid())).thenReturn(host);
- // PowerMockito.verifyStatic(times(1));
- // } catch (final BadServerResponse e) {
- // fail(e.getMessage());
- // } catch (final XenAPIException e) {
- // fail(e.getMessage());
- // } catch (final XmlRpcException e) {
- // fail(e.getMessage());
- // }
- //
- // PowerMockito.mockStatic(Types.class);
- // PowerMockito.when(Types.toHostRecord(spiedMap)).thenReturn(hr);
- // PowerMockito.verifyStatic(times(1));
- //
- // try {
- // PowerMockito.mockStatic(Host.Record.class);
- // when(host.getRecord(conn)).thenReturn(hr);
- // verify(host, times(1)).getRecord(conn);
- // } catch (final BadServerResponse e) {
- // fail(e.getMessage());
- // } catch (final XenAPIException e) {
- // fail(e.getMessage());
- // } catch (final XmlRpcException e) {
- // fail(e.getMessage());
- // }
-
final Answer answer = wrapper.execute(maintainCommand, citrixResourceBase);
assertFalse(answer.getResult());
diff --git a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/XenServer610WrapperTest.java b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/XenServer610WrapperTest.java
index 4b2dd1ac3ec6..d5e794d2899f 100644
--- a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/XenServer610WrapperTest.java
+++ b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/XenServer610WrapperTest.java
@@ -462,17 +462,6 @@ public void testXenServer610MigrateVolumeCommandWrapper() {
verify(xenServer610Resource, times(1)).getConnection();
- // try {
- // verify(xenServer610Resource, times(1)).waitForTask(conn, task, 1000, timeout);
- // verify(xenServer610Resource, times(1)).checkForSuccess(conn, task);
- // } catch (final XenAPIException e) {
- // fail(e.getMessage());
- // } catch (final XmlRpcException e) {
- // fail(e.getMessage());
- // } catch (final TimeoutException e) {
- // fail(e.getMessage());
- // }
-
assertFalse(answer.getResult());
}
diff --git a/plugins/network-elements/cisco-vnmc/src/main/java/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java b/plugins/network-elements/cisco-vnmc/src/main/java/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
index 90597d7b1e19..e0ab727930e8 100644
--- a/plugins/network-elements/cisco-vnmc/src/main/java/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
+++ b/plugins/network-elements/cisco-vnmc/src/main/java/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
@@ -136,7 +136,6 @@ private String getXml(String filename) {
String xml = "";
String line;
while ((line = br.readLine()) != null) {
- //xml += line.replaceAll("\n"," ");
xml += line;
}
diff --git a/plugins/network-elements/cisco-vnmc/src/main/java/com/cloud/network/element/CiscoVnmcElementService.java b/plugins/network-elements/cisco-vnmc/src/main/java/com/cloud/network/element/CiscoVnmcElementService.java
index 8388bb89bb51..8a52893274fa 100644
--- a/plugins/network-elements/cisco-vnmc/src/main/java/com/cloud/network/element/CiscoVnmcElementService.java
+++ b/plugins/network-elements/cisco-vnmc/src/main/java/com/cloud/network/element/CiscoVnmcElementService.java
@@ -28,8 +28,6 @@
public interface CiscoVnmcElementService extends PluggableService {
- //public static final Provider CiscoVnmc = new Provider("CiscoVnmc", true);
-
public CiscoVnmcController addCiscoVnmcResource(AddCiscoVnmcResourceCmd cmd);
public CiscoVnmcResourceResponse createCiscoVnmcResourceResponse(CiscoVnmcController ciscoVnmcResourceVO);
diff --git a/plugins/network-elements/elastic-loadbalancer/src/main/java/com/cloud/network/ElasticLbVmMapVO.java b/plugins/network-elements/elastic-loadbalancer/src/main/java/com/cloud/network/ElasticLbVmMapVO.java
index b9bad7f65754..96a43dfb19e0 100644
--- a/plugins/network-elements/elastic-loadbalancer/src/main/java/com/cloud/network/ElasticLbVmMapVO.java
+++ b/plugins/network-elements/elastic-loadbalancer/src/main/java/com/cloud/network/ElasticLbVmMapVO.java
@@ -79,10 +79,6 @@ public long getElbVmId() {
return elbVmId;
}
-// public String getLbName() {
-// return lbName;
-// }
-
public long getIpAddressId() {
return ipAddressId;
}
diff --git a/plugins/network-elements/juniper-contrail/src/test/java/org/apache/cloudstack/network/contrail/management/ManagementServerMock.java b/plugins/network-elements/juniper-contrail/src/test/java/org/apache/cloudstack/network/contrail/management/ManagementServerMock.java
index 15f546db0f08..2107850c36be 100644
--- a/plugins/network-elements/juniper-contrail/src/test/java/org/apache/cloudstack/network/contrail/management/ManagementServerMock.java
+++ b/plugins/network-elements/juniper-contrail/src/test/java/org/apache/cloudstack/network/contrail/management/ManagementServerMock.java
@@ -32,6 +32,9 @@
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
@@ -86,6 +89,7 @@
import com.cloud.vm.dao.UserVmDao;
public class ManagementServerMock {
+ protected Logger logger = LogManager.getLogger(getClass());
@Inject
private AccountManager _accountMgr;
@@ -217,15 +221,7 @@ public Object answer(InvocationOnMock invocation) {
return null;
}
};
- try {
- Mockito.when(_agentMgr.send(ArgumentMatchers.anyLong(), ArgumentMatchers.any(Commands.class))).thenAnswer(callback);
- } catch (AgentUnavailableException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (OperationTimedoutException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ sendCommands(callback);
long id = _userVmDao.getNextInSequence(Long.class, "id");
UserVmVO vm =
new UserVmVO(id, name, name, tmpl.getId(), HypervisorType.XenServer, tmpl.getGuestOSId(), false, false, _zone.getDomainId(), Account.ACCOUNT_ID_SYSTEM,
@@ -239,12 +235,21 @@ public Object answer(InvocationOnMock invocation) {
try {
_vmMgr.addVmToNetwork(vm, network, profile);
} catch (Exception ex) {
- // TODO Auto-generated catch block
- //ex.printStackTrace();
+ // ignored
}
return vm;
}
+ private void sendCommands(Answer> callback) {
+ try {
+ Mockito.when(_agentMgr.send(ArgumentMatchers.anyLong(), ArgumentMatchers.any(Commands.class))).thenAnswer(callback);
+ } catch (AgentUnavailableException e) {
+ logger.warn("no agent running", e);
+ } catch (OperationTimedoutException e) {
+ logger.warn("agent not responding (in time)", e);
+ }
+ }
+
private void deleteHost() {
_hostDao.remove(_hostId);
@@ -265,15 +270,7 @@ public Object answer(InvocationOnMock invocation) {
return null;
}
};
-
- try {
- Mockito.when(_agentMgr.send(ArgumentMatchers.anyLong(), ArgumentMatchers.any(Commands.class))).thenAnswer(callback);
- } catch (AgentUnavailableException e) {
- e.printStackTrace();
- } catch (OperationTimedoutException e) {
- e.printStackTrace();
- }
-
+ sendCommands(callback);
_userVmDao.remove(vm.getId());
}
diff --git a/plugins/network-elements/tungsten/src/test/java/org/apache/cloudstack/network/tungsten/service/TungstenElementTest.java b/plugins/network-elements/tungsten/src/test/java/org/apache/cloudstack/network/tungsten/service/TungstenElementTest.java
index 58084d3072d1..b22d1e70be3b 100644
--- a/plugins/network-elements/tungsten/src/test/java/org/apache/cloudstack/network/tungsten/service/TungstenElementTest.java
+++ b/plugins/network-elements/tungsten/src/test/java/org/apache/cloudstack/network/tungsten/service/TungstenElementTest.java
@@ -778,60 +778,6 @@ public void shutdownProviderInstancesTest() throws ConcurrentOperationException
verify(tungstenService, times(1)).deleteManagementNetwork(anyLong());
}
- //@Test
- //public void processConnectWithoutSecurityGroupTest() throws ConnectionException {
- // Host host = mock(Host.class);
- // StartupCommand startupCommand = mock(StartupCommand.class);
- // TungstenProviderVO tungstenProvider = mock(TungstenProviderVO.class);
- // DataCenterVO dataCenterVO = mock(DataCenterVO.class);
- // VlanVO vlanVO1 = mock(VlanVO.class);
- // VlanVO vlanVO2 = mock(VlanVO.class);
- // List vlanList = Arrays.asList(vlanVO1, vlanVO2);
- // Network publicNetwork = mock(Network.class);
- // NetworkDetailVO networkDetail = mock(NetworkDetailVO.class);
-//
- // when(host.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.KVM);
- // when(tungstenProviderDao.findByZoneId(anyLong())).thenReturn(tungstenProvider);
- // when(host.getPublicIpAddress()).thenReturn("192.168.100.100");
- // when(tungstenProvider.getGateway()).thenReturn("192.168.100.100");
- // when(dataCenterDao.findById(anyLong())).thenReturn(dataCenterVO);
- // when(vlanDao.listByZone(anyLong())).thenReturn(vlanList);
- // when(networkModel.getSystemNetworkByZoneAndTrafficType(anyLong(), eq(Networks.TrafficType.Public))).thenReturn(publicNetwork);
- // when(networkDetailsDao.findDetail(anyLong(), anyString())).thenReturn(networkDetail);
- // when(vlanVO1.getVlanGateway()).thenReturn("192.168.100.1");
- // when(vlanVO1.getVlanNetmask()).thenReturn("255.255.255.0");
- // when(vlanVO2.getVlanGateway()).thenReturn("192.168.101.1");
- // when(vlanVO2.getVlanNetmask()).thenReturn("255.255.255.0");
- // when(dataCenterVO.isSecurityGroupEnabled()).thenReturn(false);
-//
- // tungstenElement.processConnect(host, startupCommand, true);
- // verify(agentManager, times(1)).easySend(anyLong(), any(SetupTungstenVRouterCommand.class));
- //}
-
- //@Test
- //public void processConnectWithSecurityGroupTest() throws ConnectionException {
- // Host host = mock(Host.class);
- // StartupCommand startupCommand = mock(StartupCommand.class);
- // TungstenProviderVO tungstenProvider = mock(TungstenProviderVO.class);
- // DataCenterVO dataCenterVO = mock(DataCenterVO.class);
- // NetworkVO network = mock(NetworkVO.class);
- // NetworkDetailVO networkDetail = mock(NetworkDetailVO.class);
- // Network publicNetwork = mock(Network.class);
-//
- // when(host.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.KVM);
- // when(tungstenProviderDao.findByZoneId(anyLong())).thenReturn(tungstenProvider);
- // when(host.getPublicIpAddress()).thenReturn("192.168.100.100");
- // when(tungstenProvider.getGateway()).thenReturn("192.168.100.100");
- // when(dataCenterDao.findById(anyLong())).thenReturn(dataCenterVO);
- // when(networkDao.listByZoneSecurityGroup(anyLong())).thenReturn(Arrays.asList(network));
- // when(networkDetailsDao.findDetail(anyLong(), anyString())).thenReturn(networkDetail);
- // when(networkModel.getSystemNetworkByZoneAndTrafficType(anyLong(), eq(Networks.TrafficType.Public))).thenReturn(publicNetwork);
- // when(dataCenterVO.isSecurityGroupEnabled()).thenReturn(true);
-//
- // tungstenElement.processConnect(host, startupCommand, true);
- // verify(agentManager, times(1)).easySend(anyLong(), any(SetupTungstenVRouterCommand.class));
- //}
-
@Test
public void processHostAboutToBeRemovedWithSecurityGroupTest() {
HostVO hostVO = mock(HostVO.class);
diff --git a/plugins/storage/volume/cloudbyte/src/main/java/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java b/plugins/storage/volume/cloudbyte/src/main/java/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
index 3d4afcaf95c5..9e26aa8625ae 100644
--- a/plugins/storage/volume/cloudbyte/src/main/java/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/cloudbyte/src/main/java/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
@@ -175,9 +175,6 @@ public void createAsync(DataStore dataStore, DataObject dataObject, AsyncComplet
_volumeDao.update(volume.getId(), volume);
- // create new volume details for the volume
- //updateVolumeDetails(volume, esvolume);
-
long capacityBytes = storagePool.getCapacityBytes();
long usedBytes = storagePool.getUsedBytes();
diff --git a/plugins/storage/volume/cloudbyte/src/main/java/org/apache/cloudstack/storage/datastore/util/ElastistorUtil.java b/plugins/storage/volume/cloudbyte/src/main/java/org/apache/cloudstack/storage/datastore/util/ElastistorUtil.java
index 6650dad76775..603908e024ca 100644
--- a/plugins/storage/volume/cloudbyte/src/main/java/org/apache/cloudstack/storage/datastore/util/ElastistorUtil.java
+++ b/plugins/storage/volume/cloudbyte/src/main/java/org/apache/cloudstack/storage/datastore/util/ElastistorUtil.java
@@ -341,7 +341,6 @@ public static FileSystem createElastistorVolume(String volumeName, String tsmid,
String qosgroupid;
String VolumeName = volumeName;
String totaliops = String.valueOf(capacityIops);
- //String totalthroughput = String.valueOf(capacityIops * 4);
String totalthroughput = "0";
String quotasize = convertCapacityBytes(capacityBytes);
@@ -679,14 +678,6 @@ public static boolean deleteElastistorTsm(String tsmid, boolean managed) throws
}
LOGGER.info("tsm id is null");
return false;
-
- /*
- * else { LOGGER.error("no volume is present in the tsm"); } } else {
- * LOGGER.error(
- * "List tsm failed, no tsm present in the eastistor for the given IP "
- * ); return false; } return false;
- */
-
}
public static boolean deleteElastistorVolume(String esvolumeid) throws Throwable {
diff --git a/plugins/storage/volume/linstor/src/test/java/org/apache/cloudstack/storage/datastore/util/LinstorUtilTest.java b/plugins/storage/volume/linstor/src/test/java/org/apache/cloudstack/storage/datastore/util/LinstorUtilTest.java
index 55f0c6ebe6dc..39d9a253c57b 100644
--- a/plugins/storage/volume/linstor/src/test/java/org/apache/cloudstack/storage/datastore/util/LinstorUtilTest.java
+++ b/plugins/storage/volume/linstor/src/test/java/org/apache/cloudstack/storage/datastore/util/LinstorUtilTest.java
@@ -82,7 +82,6 @@ public void setUp() throws ApiException {
mockStoragePool("thinpool", "nodeC", ProviderKind.LVM_THIN)
));
-// when(LinstorUtil.getLinstorAPI(LINSTOR_URL_TEST)).thenReturn(api);
}
@Test
diff --git a/plugins/storage/volume/nexenta/src/main/java/org/apache/cloudstack/storage/datastore/driver/NexentaPrimaryDataStoreDriver.java b/plugins/storage/volume/nexenta/src/main/java/org/apache/cloudstack/storage/datastore/driver/NexentaPrimaryDataStoreDriver.java
index 60f3bd2ac8d3..dad4819c83e2 100644
--- a/plugins/storage/volume/nexenta/src/main/java/org/apache/cloudstack/storage/datastore/driver/NexentaPrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/nexenta/src/main/java/org/apache/cloudstack/storage/datastore/driver/NexentaPrimaryDataStoreDriver.java
@@ -187,9 +187,6 @@ public void deleteAsync(DataStore store, DataObject data, AsyncCompletionCallbac
NexentaStorAppliance appliance = getNexentaStorAppliance(storagePoolId);
StoragePoolVO storagePool = _storagePoolDao.findById(storagePoolId);
-
-
-// _storagePoolDao.update(stoagePoolId);
} else {
errorMessage = String.format(
"Invalid DataObjectType(%s) passed to deleteAsync",
diff --git a/plugins/storage/volume/nexenta/src/test/java/org/apache/cloudstack/storage/datastore/util/NexentaStorApplianceTest.java b/plugins/storage/volume/nexenta/src/test/java/org/apache/cloudstack/storage/datastore/util/NexentaStorApplianceTest.java
index 89b5ece576ff..d283e4c35d74 100644
--- a/plugins/storage/volume/nexenta/src/test/java/org/apache/cloudstack/storage/datastore/util/NexentaStorApplianceTest.java
+++ b/plugins/storage/volume/nexenta/src/test/java/org/apache/cloudstack/storage/datastore/util/NexentaStorApplianceTest.java
@@ -60,7 +60,6 @@ public class NexentaStorApplianceTest {
public void init() {
final String url = "nmsUrl=https://admin:nexenta@10.1.3.182:8457;volume=cloudstack;storageType=iscsi";
NexentaUtil.NexentaPluginParameters parameters = NexentaUtil.parseNexentaPluginUrl(url);
- //client = new NexentaNmsClient(parameters.getNmsUrl());
client = mock(NexentaNmsClient.class);
appliance = new NexentaStorAppliance(client, parameters);
}
diff --git a/plugins/storage/volume/solidfire/src/test/java/org/apache/cloudstack/storage/test/VolumeTest.java b/plugins/storage/volume/solidfire/src/test/java/org/apache/cloudstack/storage/test/VolumeTest.java
index 08f95b15d136..d721412b3ec1 100644
--- a/plugins/storage/volume/solidfire/src/test/java/org/apache/cloudstack/storage/test/VolumeTest.java
+++ b/plugins/storage/volume/solidfire/src/test/java/org/apache/cloudstack/storage/test/VolumeTest.java
@@ -64,8 +64,6 @@ public class VolumeTest {
DataCenterDao dcDao;
@Inject
PrimaryDataStoreDao primaryStoreDao;
- // @Inject
- // PrimaryDataStoreProviderManager primaryDataStoreProviderMgr;
@Inject
AgentManager agentMgr;
Long dcId;
@@ -109,25 +107,15 @@ public void setUp() {
results.add(host);
Mockito.when(hostDao.listAll()).thenReturn(results);
Mockito.when(hostDao.findHypervisorHostInCluster(ArgumentMatchers.anyLong())).thenReturn(results);
- // CreateObjectAnswer createVolumeFromImageAnswer = new
- // CreateObjectAnswer(null,UUID.randomUUID().toString(), null);
-
- // Mockito.when(primaryStoreDao.findById(Mockito.anyLong())).thenReturn(primaryStore);
}
private PrimaryDataStoreInfo createPrimaryDataStore() {
try {
- // primaryDataStoreProviderMgr.configure("primary data store mgr",
- // new HashMap());
- // PrimaryDataStoreProvider provider =
- // primaryDataStoreProviderMgr.getDataStoreProvider("Solidfre Primary Data Store Provider");
Map params = new HashMap();
params.put("url", "nfs://test/test");
params.put("dcId", dcId.toString());
params.put("clusterId", clusterId.toString());
params.put("name", "my primary data store");
- // PrimaryDataStoreInfo primaryDataStoreInfo =
- // provider.registerDataStore(params);
return null;
} catch (Exception e) {
return null;
diff --git a/plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/StorPoolDownloadVolumeCommandWrapper.java b/plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/StorPoolDownloadVolumeCommandWrapper.java
index 1679e646e189..de8b9484d117 100644
--- a/plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/StorPoolDownloadVolumeCommandWrapper.java
+++ b/plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/StorPoolDownloadVolumeCommandWrapper.java
@@ -29,7 +29,6 @@
import org.apache.cloudstack.utils.qemu.QemuImg;
import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat;
import org.apache.cloudstack.utils.qemu.QemuImgFile;
-//import java.io.File;
import com.cloud.agent.api.storage.StorPoolDownloadVolumeCommand;
import com.cloud.agent.api.to.DataStoreTO;
diff --git a/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/collector/StorPoolAbandonObjectsCollector.java b/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/collector/StorPoolAbandonObjectsCollector.java
index 84abb1e35d5e..7bfa6332bd15 100644
--- a/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/collector/StorPoolAbandonObjectsCollector.java
+++ b/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/collector/StorPoolAbandonObjectsCollector.java
@@ -23,7 +23,6 @@
import com.cloud.storage.dao.SnapshotDetailsDao;
import com.cloud.storage.dao.SnapshotDetailsVO;
-
import com.cloud.utils.component.ManagerBase;
import com.cloud.utils.concurrency.NamedThreadFactory;
import com.cloud.utils.db.DB;
diff --git a/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java b/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java
index c305c393c9bd..9dc94c20f11b 100644
--- a/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java
@@ -934,7 +934,6 @@ public void copyAsync(DataObject srcData, DataObject dstData, AsyncCompletionCal
if (resp.getError() != null) {
err = String.format("Could not create Storpool volume for CS template %s. Error: %s", name, resp.getError());
} else {
- //updateVolume(dstData.getId());
VolumeObjectTO dstTO = (VolumeObjectTO)dstData.getTO();
dstTO.setPath(StorPoolUtil.devPath(StorPoolUtil.getNameFromResponse(resp, false)));
dstTO.setSize(size);
diff --git a/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolHelper.java b/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolHelper.java
index 685b99e12d59..ea3ba0e96131 100644
--- a/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolHelper.java
+++ b/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolHelper.java
@@ -178,32 +178,6 @@ public static Map addStorPoolTags(String name, String vmUuid, St
return tags;
}
- // Initialize custom logger for updated volume and snapshots
-// public static void appendLogger(Logger log, String filePath, String kindOfLog) {
-// Appender appender = null;
-// PatternLayout patternLayout = new PatternLayout();
-// patternLayout.setConversionPattern("%d{YYYY-MM-dd HH:mm:ss.SSS} %m%n");
-// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
-// Timestamp timestamp = new Timestamp(System.currentTimeMillis());
-// String path = filePath + "-" + sdf.format(timestamp) + ".log";
-// try {
-// appender = new RollingFileAppender(patternLayout, path);
-// log.setAdditivity(false);
-// log.addAppender(appender);
-// } catch (IOException e) {
-// e.printStackTrace();
-// }
-// if (kindOfLog.equals("update")) {
-// StorPoolUtil.spLog(
-// "You can find information about volumes and snapshots, which will be updated in Database with their globalIs in %s log file",
-// path);
-// } else if (kindOfLog.equals("abandon")) {
-// StorPoolUtil.spLog(
-// "You can find information about volumes and snapshots, for which CloudStack doesn't have information in %s log file",
-// path);
-// }
-// }
-
public static void setSpClusterIdIfNeeded(long hostId, String clusterId, ClusterDao clusterDao, HostDao hostDao,
ClusterDetailsDao clusterDetails) {
HostVO host = hostDao.findById(hostId);
diff --git a/scripts/installer/createtmplt.sh b/scripts/installer/createtmplt.sh
index b9b403a94bb7..8d9b9876700f 100755
--- a/scripts/installer/createtmplt.sh
+++ b/scripts/installer/createtmplt.sh
@@ -272,9 +272,4 @@ echo "volume.size=$volsize" >> /$tmpltfs/template.properties
zfs snapshot -r $tmpltfs@vmops_ss
rollback_if_needed $tmpltfs $? "Failed to snapshot filesystem"
-#if [ "$cleanup" == "true" ]
-#then
- #rm -f $tmpltimg
-#fi
-
exit 0
diff --git a/scripts/installer/createvolume.sh b/scripts/installer/createvolume.sh
index 4726404b76a4..716bb8556ce3 100755
--- a/scripts/installer/createvolume.sh
+++ b/scripts/installer/createvolume.sh
@@ -273,9 +273,4 @@ echo "volume.size=$volsize" >> /$volfs/volume.properties
zfs snapshot -r $volfs@vmops_ss
rollback_if_needed $volfs $? "Failed to snapshot filesystem"
-#if [ "$cleanup" == "true" ]
-#then
- #rm -f $volimg
-#fi
-
exit 0
diff --git a/scripts/storage/secondary/listvmtmplt.sh b/scripts/storage/secondary/listvmtmplt.sh
index 8463b51e4f60..c0f2132879ba 100755
--- a/scripts/storage/secondary/listvmtmplt.sh
+++ b/scripts/storage/secondary/listvmtmplt.sh
@@ -53,11 +53,6 @@ for i in $(find /$rootdir -name template.properties );
do
d=$(dirname $i)
filename=$(grep "^filename" $i | awk -F"=" '{print $NF}')
-# size=$(grep "virtualsize" $i | awk -F"=" '{print $NF}')
-# if [ -n "$filename" ] && [ -n "$size" ]
-# then
-# d=$d/$filename/$size
-# fi
echo ${d#/}/$filename #remove leading slash
done
diff --git a/scripts/storage/secondary/listvolume.sh b/scripts/storage/secondary/listvolume.sh
index d039c659094b..605b8b9a190d 100755
--- a/scripts/storage/secondary/listvolume.sh
+++ b/scripts/storage/secondary/listvolume.sh
@@ -53,11 +53,6 @@ for i in $(find /$rootdir -name volume.properties );
do
d=$(dirname $i)
filename=$(grep "^filename" $i | awk -F"=" '{print $NF}')
-# size=$(grep "virtualsize" $i | awk -F"=" '{print $NF}')
-# if [ -n "$filename" ] && [ -n "$size" ]
-# then
-# d=$d/$filename/$size
-# fi
echo ${d#/}/$filename #remove leading slash
done
diff --git a/scripts/vm/hypervisor/ovm3/cloudstack.py b/scripts/vm/hypervisor/ovm3/cloudstack.py
index e82863e7af73..39b5926509da 100644
--- a/scripts/vm/hypervisor/ovm3/cloudstack.py
+++ b/scripts/vm/hypervisor/ovm3/cloudstack.py
@@ -67,10 +67,6 @@ def get_services(self, version=None):
'get_module_version': getModuleVersion,
'get_ovs_version': ovmVersion,
'ping': ping,
-# 'patch': ovmCsPatch,
-# 'ovs_agent_set_ssl': ovsAgentSetSsl,
-# 'ovs_agent_set_port': ovsAgentSetPort,
-# 'ovs_restart_agent': ovsRestartAgent,
}
def getName(self):
diff --git a/scripts/vm/hypervisor/xenserver/perfmon.py b/scripts/vm/hypervisor/xenserver/perfmon.py
index 59c1ac3b367c..fcdc8a62fa44 100755
--- a/scripts/vm/hypervisor/xenserver/perfmon.py
+++ b/scripts/vm/hypervisor/xenserver/perfmon.py
@@ -210,11 +210,6 @@ def get_vm_group_perfmon(args={}):
total_counter = int(args['total_counter'])
now = int(time.time()) / 60
- # Get pool's info of this host
- #pool = login.xenapi.pool.get_all()[0]
- # Get master node's address of pool
- #master = login.xenapi.pool.get_master(pool)
- #master_address = login.xenapi.host.get_address(master)
session = login._session
max_duration = 0
@@ -226,7 +221,6 @@ def get_vm_group_perfmon(args={}):
rrd_updates = RRDUpdates()
rrd_updates.refresh(login.xenapi, now * 60 - max_duration, session, {})
- #for uuid in rrd_updates.get_vm_list():
for vm_count in xrange(1, total_vm + 1):
vm_name = args['vmname' + str(vm_count)]
vm_uuid = getuuid(vm_name)
diff --git a/scripts/vm/hypervisor/xenserver/xcposs/NFSSR.py b/scripts/vm/hypervisor/xenserver/xcposs/NFSSR.py
index 306f94166167..84eb7307b85f 100644
--- a/scripts/vm/hypervisor/xenserver/xcposs/NFSSR.py
+++ b/scripts/vm/hypervisor/xenserver/xcposs/NFSSR.py
@@ -175,20 +175,6 @@ def create(self, sr_uuid, size):
pass
raise exn
- #newpath = os.path.join(self.path, sr_uuid)
- #if util.ioretry(lambda: util.pathexists(newpath)):
- # if len(util.ioretry(lambda: util.listdir(newpath))) != 0:
- # self.detach(sr_uuid)
- # raise xs_errors.XenError('SRExists')
- #else:
- # try:
- # util.ioretry(lambda: util.makedirs(newpath))
- # except util.CommandException, inst:
- # if inst.code != errno.EEXIST:
- # self.detach(sr_uuid)
- # raise xs_errors.XenError('NFSCreate',
- # opterr='remote directory creation error is %d'
- # % inst.code)
self.detach(sr_uuid)
def delete(self, sr_uuid):
diff --git a/scripts/vm/hypervisor/xenserver/xcpserver/NFSSR.py b/scripts/vm/hypervisor/xenserver/xcpserver/NFSSR.py
index 62031e3708af..faaf6d96486b 100755
--- a/scripts/vm/hypervisor/xenserver/xcpserver/NFSSR.py
+++ b/scripts/vm/hypervisor/xenserver/xcpserver/NFSSR.py
@@ -106,7 +106,6 @@ def mount(self, mountpoint, remotepath):
def attach(self, sr_uuid):
self.validate_remotepath(False)
- #self.remotepath = os.path.join(self.dconf['serverpath'], sr_uuid)
self.remotepath = self.dconf['serverpath']
util._testHost(self.dconf['server'], NFSPORT, 'NFSTarget')
self.mount_remotepath(sr_uuid)
@@ -175,20 +174,6 @@ def create(self, sr_uuid, size):
pass
raise exn
- #newpath = os.path.join(self.path, sr_uuid)
- #if util.ioretry(lambda: util.pathexists(newpath)):
- # if len(util.ioretry(lambda: util.listdir(newpath))) != 0:
- # self.detach(sr_uuid)
- # raise xs_errors.XenError('SRExists')
- #else:
- # try:
- # util.ioretry(lambda: util.makedirs(newpath))
- # except util.CommandException, inst:
- # if inst.code != errno.EEXIST:
- # self.detach(sr_uuid)
- # raise xs_errors.XenError('NFSCreate',
- # opterr='remote directory creation error is %d'
- # % inst.code)
self.detach(sr_uuid)
def delete(self, sr_uuid):
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56/NFSSR.py b/scripts/vm/hypervisor/xenserver/xenserver56/NFSSR.py
index b8489e7b7663..50e9e6077ce3 100755
--- a/scripts/vm/hypervisor/xenserver/xenserver56/NFSSR.py
+++ b/scripts/vm/hypervisor/xenserver/xenserver56/NFSSR.py
@@ -178,20 +178,6 @@ def create(self, sr_uuid, size):
pass
raise exn
- #newpath = os.path.join(self.path, sr_uuid)
- #if util.ioretry(lambda: util.pathexists(newpath)):
- # if len(util.ioretry(lambda: util.listdir(newpath))) != 0:
- # self.detach(sr_uuid)
- # raise xs_errors.XenError('SRExists')
- #else:
- # try:
- # util.ioretry(lambda: util.makedirs(newpath))
- # except util.CommandException, inst:
- # if inst.code != errno.EEXIST:
- # self.detach(sr_uuid)
- # raise xs_errors.XenError('NFSCreate',
- # opterr='remote directory creation error is %d'
- # % inst.code)
self.detach(sr_uuid)
@FileSR.locking("SRUnavailable")
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56fp1/NFSSR.py b/scripts/vm/hypervisor/xenserver/xenserver56fp1/NFSSR.py
index b8c115745afd..9d2f81f8e8fa 100755
--- a/scripts/vm/hypervisor/xenserver/xenserver56fp1/NFSSR.py
+++ b/scripts/vm/hypervisor/xenserver/xenserver56fp1/NFSSR.py
@@ -107,7 +107,6 @@ def mount(self, mountpoint, remotepath):
def attach(self, sr_uuid):
self.validate_remotepath(False)
- #self.remotepath = os.path.join(self.dconf['serverpath'], sr_uuid)
self.remotepath = self.dconf['serverpath']
util._testHost(self.dconf['server'], NFSPORT, 'NFSTarget')
self.mount_remotepath(sr_uuid)
@@ -176,20 +175,6 @@ def create(self, sr_uuid, size):
pass
raise exn
- #newpath = os.path.join(self.path, sr_uuid)
- #if util.ioretry(lambda: util.pathexists(newpath)):
- # if len(util.ioretry(lambda: util.listdir(newpath))) != 0:
- # self.detach(sr_uuid)
- # raise xs_errors.XenError('SRExists')
- #else:
- # try:
- # util.ioretry(lambda: util.makedirs(newpath))
- # except util.CommandException, inst:
- # if inst.code != errno.EEXIST:
- # self.detach(sr_uuid)
- # raise xs_errors.XenError('NFSCreate',
- # opterr='remote directory creation error is %d'
- # % inst.code)
self.detach(sr_uuid)
def delete(self, sr_uuid):
diff --git a/scripts/vm/hypervisor/xenserver/xenserver60/NFSSR.py b/scripts/vm/hypervisor/xenserver/xenserver60/NFSSR.py
index 9a3fa8bc9a16..68aaeae24724 100755
--- a/scripts/vm/hypervisor/xenserver/xenserver60/NFSSR.py
+++ b/scripts/vm/hypervisor/xenserver/xenserver60/NFSSR.py
@@ -181,20 +181,6 @@ def create(self, sr_uuid, size):
pass
raise exn
- #newpath = os.path.join(self.path, sr_uuid)
- #if util.ioretry(lambda: util.pathexists(newpath)):
- # if len(util.ioretry(lambda: util.listdir(newpath))) != 0:
- # self.detach(sr_uuid)
- # raise xs_errors.XenError('SRExists')
- #else:
- # try:
- # util.ioretry(lambda: util.makedirs(newpath))
- # except util.CommandException, inst:
- # if inst.code != errno.EEXIST:
- # self.detach(sr_uuid)
- # raise xs_errors.XenError('NFSCreate',
- # opterr='remote directory creation error is %d'
- # % inst.code)
self.detach(sr_uuid)
def delete(self, sr_uuid):
diff --git a/scripts/vm/network/security_group.py b/scripts/vm/network/security_group.py
index d71e27eb2644..e74412020324 100755
--- a/scripts/vm/network/security_group.py
+++ b/scripts/vm/network/security_group.py
@@ -1382,15 +1382,6 @@ def verify_network_rules(vm_name, vm_id, vm_ip, vm_ip6, vm_mac, vif, brname, sec
print("Cannot find vif")
sys.exit(1)
- #vm_name = "i-2-55-VM"
- #vm_id = 55
- #vm_ip = "10.11.118.128"
- #vm_ip6 = "fe80::1c00:b4ff:fe00:5"
- #vm_mac = "1e:00:b4:00:00:05"
- #vif = "vnet11"
- #brname = "cloudbr0"
- #sec_ips = "10.11.118.133;10.11.118.135;10.11.118.138;" # end with ";" and separated by ";"
-
vm_ips = []
if sec_ips is not None:
vm_ips = sec_ips.split(';')
diff --git a/scripts/vm/network/vnet/ovstunnel.py b/scripts/vm/network/vnet/ovstunnel.py
index a39b6b18ecc8..b47455b361d7 100755
--- a/scripts/vm/network/vnet/ovstunnel.py
+++ b/scripts/vm/network/vnet/ovstunnel.py
@@ -49,17 +49,14 @@ def setup_ovs_bridge(bridge, key, cs_host_id):
logging.debug("Bridge has been manually created:%s" % res)
if res:
-# result = "FAILURE:%s" % res
result = 'false'
else:
# Verify the bridge actually exists, with the gre_key properly set
res = lib.do_cmd([lib.VSCTL_PATH, "get", "bridge",
bridge, "other_config:gre_key"])
if key in str(res):
-# result = "SUCCESS:%s" % bridge
result = 'true'
else:
-# result = "FAILURE:%s" % res
result = 'false'
lib.do_cmd([lib.VSCTL_PATH, "set", "bridge", bridge, "other_config:is-ovs-tun-network=True"])
@@ -134,10 +131,8 @@ def destroy_ovs_bridge(bridge):
res = lib.do_cmd([lib.VSCTL_PATH, "del-br", bridge])
logging.debug("Bridge has been manually removed:%s" % res)
if res:
-# result = "FAILURE:%s" % res
result = 'false'
else:
-# result = "SUCCESS:%s" % bridge
result = 'true'
logging.debug("Destroy_ovs_bridge completed with result:%s" % result)
@@ -150,7 +145,6 @@ def create_tunnel(bridge, remote_ip, key, src_host, dst_host):
res = lib.check_switch()
if res != "SUCCESS":
logging.debug("Openvswitch running: NO")
-# return "FAILURE:%s" % res
return 'false'
# We need to keep the name below 14 characters
@@ -189,7 +183,6 @@ def create_tunnel(bridge, remote_ip, key, src_host, dst_host):
if len(iface_list) != 1:
logging.debug("WARNING: Unexpected output while verifying " +
"port %s on bridge %s" % (name, bridge))
-# return "FAILURE:VERIFY_PORT_FAILED"
return 'false'
# verify interface
@@ -205,7 +198,6 @@ def create_tunnel(bridge, remote_ip, key, src_host, dst_host):
if key not in str(key_validation) or remote_ip not in str(ip_validation):
logging.debug("WARNING: Unexpected output while verifying " +
"interface %s on bridge %s" % (name, bridge))
-# return "FAILURE:VERIFY_INTERFACE_FAILED"
return 'false'
logging.debug("Tunnel interface validated:%s" % verify_interface_ip)
@@ -268,7 +260,6 @@ def destroy_tunnel(bridge, iface_name):
ofport = get_field_of_interface(iface_name, "ofport")
lib.del_flows(bridge, in_port=ofport)
lib.del_port(bridge, iface_name)
-# return "SUCCESS"
return 'true'
def get_field_of_interface(iface_name, field):
diff --git a/server/src/main/java/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java b/server/src/main/java/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java
index b5fb77c8179d..737d696abb6e 100644
--- a/server/src/main/java/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java
+++ b/server/src/main/java/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java
@@ -297,8 +297,6 @@ public boolean stop() {
public boolean configure(String name, Map params) throws ConfigurationException {
Map configs = _configDao.getConfiguration("management-server", params);
String stoppedValue = configs.get("vm.resource.release.interval");
- // String destroyedValue =
- // configs.get("capacity.skipcounting.destroyed.hours");
String destroyedValue = null;
_secondsToSkipStoppedVMs = NumbersUtil.parseInt(stoppedValue, 86400);
_secondsToSkipDestroyedVMs = NumbersUtil.parseInt(destroyedValue, 0);
diff --git a/server/src/main/java/com/cloud/api/doc/ApiXmlDocWriter.java b/server/src/main/java/com/cloud/api/doc/ApiXmlDocWriter.java
index 5de5cd03fe13..87d88df79e3b 100644
--- a/server/src/main/java/com/cloud/api/doc/ApiXmlDocWriter.java
+++ b/server/src/main/java/com/cloud/api/doc/ApiXmlDocWriter.java
@@ -77,13 +77,11 @@ private static List setAsyncResponses() {
List asyncResponses = new ArrayList();
asyncResponses.add(TemplateResponse.class.getName());
asyncResponses.add(VolumeResponse.class.getName());
- //asyncResponses.add(LoadBalancerResponse.class.getName());
asyncResponses.add(HostResponse.class.getName());
asyncResponses.add(IPAddressResponse.class.getName());
asyncResponses.add(StoragePoolResponse.class.getName());
asyncResponses.add(UserVmResponse.class.getName());
asyncResponses.add(SecurityGroupResponse.class.getName());
- //asyncResponses.add(ExternalLoadBalancerResponse.class.getName());
asyncResponses.add(SnapshotResponse.class.getName());
return asyncResponses;
diff --git a/server/src/main/java/com/cloud/network/ExternalNetworkDeviceManagerImpl.java b/server/src/main/java/com/cloud/network/ExternalNetworkDeviceManagerImpl.java
index a983af839ca4..f756a4975cb3 100644
--- a/server/src/main/java/com/cloud/network/ExternalNetworkDeviceManagerImpl.java
+++ b/server/src/main/java/com/cloud/network/ExternalNetworkDeviceManagerImpl.java
@@ -139,20 +139,6 @@ public NetworkDeviceResponse getApiResponse(Host device) {
}
private List listNetworkDevice(Long zoneId, Long physicalNetworkId, Long podId, Host.Type type) {
-// List res = new ArrayList();
-// if (podId != null) {
-// List devs = _hostDao.listBy(type, null, podId, zoneId);
-// if (devs.size() == 1) {
-// res.add(devs.get(0));
-// } else {
-// logger.debug("List " + type + ": " + devs.size() + " found");
-// }
-// } else {
-// List devs = _hostDao.listBy(type, zoneId);
-// res.addAll(devs);
- // }
-
- // return res;
return null;
}
diff --git a/server/src/main/java/com/cloud/network/rules/PrivateGatewayRules.java b/server/src/main/java/com/cloud/network/rules/PrivateGatewayRules.java
index 1b827b384d0f..8e70e4ec3a86 100644
--- a/server/src/main/java/com/cloud/network/rules/PrivateGatewayRules.java
+++ b/server/src/main/java/com/cloud/network/rules/PrivateGatewayRules.java
@@ -69,7 +69,6 @@ public boolean accept(final NetworkTopologyVisitor visitor, final VirtualRouter
// setup source nat
if (_nicProfile != null) {
_isAddOperation = true;
- // result = setupVpcPrivateNetwork(router, true, guestNic);
result = visitor.visit(this);
}
} catch (final Exception ex) {
diff --git a/server/src/main/java/com/cloud/network/rules/RulesManagerImpl.java b/server/src/main/java/com/cloud/network/rules/RulesManagerImpl.java
index db53f2dfc0c4..1f1e294bc53a 100644
--- a/server/src/main/java/com/cloud/network/rules/RulesManagerImpl.java
+++ b/server/src/main/java/com/cloud/network/rules/RulesManagerImpl.java
@@ -564,9 +564,7 @@ private boolean enableStaticNat(long ipId, long vmId, long networkId, boolean is
_accountMgr.checkAccess(vmOwner, SecurityChecker.AccessType.UseEntry, false, network);
//is static nat is for vm secondary ip
- //dstIp = guestNic.getIp4Address();
if (vmGuestIp != null) {
- //dstIp = guestNic.getIp4Address();
if (!dstIp.equals(vmGuestIp)) {
//check whether the secondary ip set to the vm or not
diff --git a/server/src/main/java/com/cloud/network/security/SecurityGroupManagerImpl.java b/server/src/main/java/com/cloud/network/security/SecurityGroupManagerImpl.java
index 637ccabad05a..49622e603c84 100644
--- a/server/src/main/java/com/cloud/network/security/SecurityGroupManagerImpl.java
+++ b/server/src/main/java/com/cloud/network/security/SecurityGroupManagerImpl.java
@@ -212,7 +212,6 @@ protected void runInContext() {
try {
cleanupFinishedWork();
cleanupUnfinishedWork();
- //processScheduledWork();
} catch (Throwable th) {
logger.error("Problem with SG Cleanup", th);
}
diff --git a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java
index e476c74d17d2..51793f22e908 100644
--- a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java
@@ -328,8 +328,6 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
// setup XenServer default PV driver version
initiateXenServerPVDriverVersion();
- // We should not update seed data UUID column here since this will be invoked in upgrade case as well.
- //updateUuids();
// Set init to true
_configDao.update("init", "Hidden", "true");
diff --git a/server/src/main/java/com/cloud/test/IPRangeConfig.java b/server/src/main/java/com/cloud/test/IPRangeConfig.java
index 22ebb56963a1..e041f7390532 100644
--- a/server/src/main/java/com/cloud/test/IPRangeConfig.java
+++ b/server/src/main/java/com/cloud/test/IPRangeConfig.java
@@ -77,7 +77,6 @@ public void run(String[] args) {
}
String pod = args[2];
String zone = args[3];
- ;
String startIP = args[4];
String endIP = null;
if (args.length == 6) {
@@ -99,31 +98,6 @@ public void run(String[] args) {
}
}
- public List changePublicIPRangeGUI(String op, String zone, String startIP, String endIP, long physicalNetworkId) {
- String result = checkErrors("public", op, null, zone, startIP, endIP);
- if (!result.equals("success")) {
- return DatabaseConfig.genReturnList("false", result);
- }
-
- long zoneId = PodZoneConfig.getZoneId(zone);
- result = changeRange(op, "public", -1, zoneId, startIP, endIP, null, physicalNetworkId);
-
- return DatabaseConfig.genReturnList("true", result);
- }
-
- public List changePrivateIPRangeGUI(String op, String pod, String zone, String startIP, String endIP) {
- String result = checkErrors("private", op, pod, zone, startIP, endIP);
- if (!result.equals("success")) {
- return DatabaseConfig.genReturnList("false", result);
- }
-
- long podId = PodZoneConfig.getPodId(pod, zone);
- long zoneId = PodZoneConfig.getZoneId(zone);
- result = changeRange(op, "private", podId, zoneId, startIP, endIP, null, -1);
-
- return DatabaseConfig.genReturnList("true", result);
- }
-
private String checkErrors(String type, String op, String pod, String zone, String startIP, String endIP) {
if (!op.equals("add") && !op.equals("delete")) {
return usage();
@@ -153,15 +127,7 @@ private String checkErrors(String type, String op, String pod, String zone, Stri
}
// Check that the IPs that are being added are compatible with either the zone's public netmask, or the pod's CIDR
- if (type.equals("public")) {
- // String publicNetmask = getPublicNetmask(zone);
- // String publicGateway = getPublicGateway(zone);
-
- // if (publicNetmask == null) return "Please ensure that your zone's public net mask is specified";
- // if (!sameSubnet(startIP, endIP, publicNetmask)) return "Please ensure that your start IP and end IP are in the same subnet, as per the zone's netmask.";
- // if (!sameSubnet(startIP, publicGateway, publicNetmask)) return "Please ensure that your start IP is in the same subnet as your zone's gateway, as per the zone's netmask.";
- // if (!sameSubnet(endIP, publicGateway, publicNetmask)) return "Please ensure that your end IP is in the same subnet as your zone's gateway, as per the zone's netmask.";
- } else if (type.equals("private")) {
+ if (type.equals("private")) {
String cidrAddress = getCidrAddress(pod, zone);
long cidrSize = getCidrSize(pod, zone);
diff --git a/server/src/main/java/com/cloud/test/PodZoneConfig.java b/server/src/main/java/com/cloud/test/PodZoneConfig.java
index 7cd6cb118710..2d32621a2522 100644
--- a/server/src/main/java/com/cloud/test/PodZoneConfig.java
+++ b/server/src/main/java/com/cloud/test/PodZoneConfig.java
@@ -75,11 +75,6 @@ public void checkAllPodCidrSubnets() {
}
private String checkPodCidrSubnets(long dcId, HashMap> currentPodCidrSubnets) {
-
-// DataCenterDao _dcDao = null;
-// final ComponentLocator locator = ComponentLocator.getLocator("management-server");
-
-// _dcDao = locator.getDao(DataCenterDao.class);
// For each pod, return an error if any of the following is true:
// 1. The pod's CIDR subnet conflicts with the guest network subnet
// 2. The pod's CIDR subnet conflicts with the CIDR subnet of any other pod
@@ -87,7 +82,6 @@ private String checkPodCidrSubnets(long dcId, HashMap> curr
String zoneName = PodZoneConfig.getZoneName(dcId);
//get the guest network cidr and guest netmask from the zone
-// DataCenterVO dcVo = _dcDao.findById(dcId);
String guestNetworkCidr = IPRangeConfig.getGuestNetworkCidr(dcId);
diff --git a/server/src/main/java/org/apache/cloudstack/storage/NfsMountManagerImpl.java b/server/src/main/java/org/apache/cloudstack/storage/NfsMountManagerImpl.java
index 0d59a6e3a856..f06adac54ef4 100644
--- a/server/src/main/java/org/apache/cloudstack/storage/NfsMountManagerImpl.java
+++ b/server/src/main/java/org/apache/cloudstack/storage/NfsMountManagerImpl.java
@@ -97,7 +97,6 @@ private String mount(String path, String parent, String nfsVersion) {
if (nfsVersion != null){
command.add("-o", "vers=" + nfsVersion);
}
- // command.add("-o", "soft,timeo=133,retrans=2147483647,tcp,acdirmax=0,acdirmin=0");
if ("Mac OS X".equalsIgnoreCase(System.getProperty("os.name"))) {
command.add("-o", "resvport");
}
diff --git a/server/src/test/java/com/cloud/api/APITest.java b/server/src/test/java/com/cloud/api/APITest.java
index e76b7a74905a..dbe91200027e 100644
--- a/server/src/test/java/com/cloud/api/APITest.java
+++ b/server/src/test/java/com/cloud/api/APITest.java
@@ -187,7 +187,6 @@ protected Object fromSerializedString(String result, Class> repCls) {
* @return login response string
*/
protected void login(String username, String password) {
- //String md5Psw = createMD5String(password);
// send login request
HashMap params = new HashMap();
params.put("response", "json");
diff --git a/server/src/test/java/com/cloud/vpc/Site2SiteVpnTest.java b/server/src/test/java/com/cloud/vpc/Site2SiteVpnTest.java
deleted file mode 100644
index f8a42df6c606..000000000000
--- a/server/src/test/java/com/cloud/vpc/Site2SiteVpnTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.vpc;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = "classpath:/VpcTestContext.xml")
-public class Site2SiteVpnTest {
-
-// private static void addDaos(MockComponentLocator locator) {
-// locator.addDao("AccountDao", AccountDaoImpl.class);
-// locator.addDao("Site2SiteCustomerGatewayDao", Site2SiteCustomerGatewayDaoImpl.class);
-// locator.addDao("Site2SiteVpnGatewayDao", Site2SiteVpnGatewayDaoImpl.class);
-// locator.addDao("Site2SiteVpnConnectionDao", Site2SiteVpnConnectionDaoImpl.class);
-//
-// locator.addDao("IPAddressDao", IPAddressDaoImpl.class);
-// locator.addDao("VpcDao", VpcDaoImpl.class);
-// locator.addDao("ConfiguratioDao", MockConfigurationDaoImpl.class);
-//
-// }
-//
-// private static void addManagers(MockComponentLocator locator) {
-// locator.addManager("AccountManager", MockAccountManagerImpl.class);
-// locator.addManager("VpcManager", MockVpcManagerImpl.class);
-// }
-
- @Before
- public void setUp() {
-// locator = new MockComponentLocator("management-server");
-// addDaos(locator);
-// addManagers(locator);
-// logger.info("Finished setUp");
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testInjected() throws Exception {
-// List>> list =
-// new ArrayList>>();
-// list.add(new Pair>("Site2SiteVpnServiceProvider", MockSite2SiteVpnServiceProvider.class));
-// locator.addAdapterChain(Site2SiteVpnServiceProvider.class, list);
-// logger.info("Finished add adapter");
-// locator.makeActive(new DefaultInterceptorLibrary());
-// logger.info("Finished make active");
-// Site2SiteVpnManagerImpl vpnMgr = ComponentLocator.inject(Site2SiteVpnManagerImpl.class);
-// logger.info("Finished inject");
-// Assert.assertTrue(vpnMgr.configure("Site2SiteVpnMgr",new HashMap()) );
-// Assert.assertTrue(vpnMgr.start());
-
- }
-
-}
diff --git a/server/src/test/java/com/cloud/vpc/VpcTestConfiguration.java b/server/src/test/java/com/cloud/vpc/VpcTestConfiguration.java
index 22c0b47e1541..0d45d50d8ae3 100644
--- a/server/src/test/java/com/cloud/vpc/VpcTestConfiguration.java
+++ b/server/src/test/java/com/cloud/vpc/VpcTestConfiguration.java
@@ -176,11 +176,6 @@ public RemoteAccessVpnService remoteAccessVpnService() {
return Mockito.mock(RemoteAccessVpnService.class);
}
-// @Bean
-// public VpcDao vpcDao() {
-// return Mockito.mock(VpcDao.class);
-// }
-
@Bean
public NetworkDao networkDao() {
return Mockito.mock(NetworkDao.class);
diff --git a/server/src/test/java/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java b/server/src/test/java/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
index eab5d3eeffd8..2fa9a2d7a44b 100644
--- a/server/src/test/java/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
+++ b/server/src/test/java/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
@@ -225,7 +225,6 @@ public void createVpcNtwkOff() {
NetworkOfferingVO off =
configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true, Availability.Optional, 200, serviceProviderMap, false,
Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, false,null, null, null, false, null, null, false);
- // System.out.println("Creating Vpc Network Offering");
assertNotNull("Vpc Isolated network offering with Vpc provider ", off);
}
@@ -245,7 +244,6 @@ public void createVpcNtwkOffWithNetscaler() {
NetworkOfferingVO off =
configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true, Availability.Optional, 200, serviceProviderMap, false,
Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, false,null, null, null, false, null, null, false);
- // System.out.println("Creating Vpc Network Offering");
assertNotNull("Vpc Isolated network offering with Vpc and Netscaler provider ", off);
}
}
diff --git a/services/console-proxy/rdpconsole/src/main/java/common/adapter/AwtCanvasAdapter.java b/services/console-proxy/rdpconsole/src/main/java/common/adapter/AwtCanvasAdapter.java
index f3a73d70dbdd..b60dccfc03e7 100644
--- a/services/console-proxy/rdpconsole/src/main/java/common/adapter/AwtCanvasAdapter.java
+++ b/services/console-proxy/rdpconsole/src/main/java/common/adapter/AwtCanvasAdapter.java
@@ -70,7 +70,6 @@ public void handleData(ByteBuffer buf, Link link) {
default:
throw new RuntimeException("Order is not implemented: " + buf + ".");
- // break;
}
buf.unref();
@@ -93,8 +92,6 @@ private void handleBitmap(BitmapOrder order, ByteBuffer buf) {
Graphics2D g = (Graphics2D)image.getGraphics();
for (BitmapRectangle rectangle : order.rectangles) {
- // *DEBUG*/System.out.println("["+this+"] DEBUG: Rectangle: " +
- // rectangle.toString());
int x = rectangle.x;
int y = rectangle.y;
@@ -148,9 +145,6 @@ private void handleBitmap(BitmapOrder order, ByteBuffer buf) {
* Example.
*/
public static void main(String args[]) {
- // System.setProperty("streamer.Link.debug", "true");
- // System.setProperty("streamer.Element.debug", "true");
- // System.setProperty("streamer.Pipeline.debug", "true");
ByteBuffer packet = new ByteBuffer(new byte[] {0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, 0x10, 0x00,
0x01, 0x04, 0x0a, 0x00, 0x0c, (byte)0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00});
diff --git a/services/console-proxy/rdpconsole/src/main/java/rdpclient/RdpClient.java b/services/console-proxy/rdpconsole/src/main/java/rdpclient/RdpClient.java
index 3dd7cf921271..767ca36cb181 100644
--- a/services/console-proxy/rdpconsole/src/main/java/rdpclient/RdpClient.java
+++ b/services/console-proxy/rdpconsole/src/main/java/rdpclient/RdpClient.java
@@ -96,15 +96,6 @@ public RdpClient(String id, String serverHostName, String domain, String userNam
assembleRDPPipeline(serverHostName, domain, userName, password, pcb, screen, canvas, sslState);
}
- // /* DEBUG */
-// @Override
-// protected HashMap initElementMap(String id) {
-// HashMap map = new HashMap();
-// map.put("IN", new ServerPacketSniffer("server <"));
-// map.put("OUT", new ClientPacketSniffer("> client"));
-// return map;
-// }
-
/**
* Assemble connection sequence and main pipeline.
*
diff --git a/services/console-proxy/rdpconsole/src/main/java/rdpclient/clip/ClipboardDataFormat.java b/services/console-proxy/rdpconsole/src/main/java/rdpclient/clip/ClipboardDataFormat.java
index 3a1653609332..29afc523ad75 100644
--- a/services/console-proxy/rdpconsole/src/main/java/rdpclient/clip/ClipboardDataFormat.java
+++ b/services/console-proxy/rdpconsole/src/main/java/rdpclient/clip/ClipboardDataFormat.java
@@ -40,11 +40,6 @@ public class ClipboardDataFormat {
// Names
HTML_FORMAT,
-
- // RTF_AS_TEXT,
- // RICH_TEXT_FORMAT_WITHOUT_OBJECTS,
- // RICH_TEXT_FORMAT,
-
};
public final int id;
@@ -115,15 +110,6 @@ public String parseServerResponseAsString(ByteBuffer buf) {
if (HTML_FORMAT.equals(name))
return buf.readVariableString(RdpConstants.CHARSET_8); // TODO: verify
- // if (RTF_AS_TEXT.equals(name))
- // return buf.readVariableString(RdpConstants.CHARSET_8); // TODO: verify
- //
- // if (RICH_TEXT_FORMAT_WITHOUT_OBJECTS.equals(name))
- // return buf.readVariableString(RdpConstants.CHARSET_8); // TODO: verify
- //
- // if (RICH_TEXT_FORMAT.equals(name))
- // return buf.readVariableString(RdpConstants.CHARSET_8); // TODO: verify
-
return null;
}
diff --git a/services/console-proxy/rdpconsole/src/main/java/rdpclient/ntlmssp/asn1/TSRequest.java b/services/console-proxy/rdpconsole/src/main/java/rdpclient/ntlmssp/asn1/TSRequest.java
index c5ba5d62ba9d..11aee538fb04 100644
--- a/services/console-proxy/rdpconsole/src/main/java/rdpclient/ntlmssp/asn1/TSRequest.java
+++ b/services/console-proxy/rdpconsole/src/main/java/rdpclient/ntlmssp/asn1/TSRequest.java
@@ -180,14 +180,8 @@ public static void main(String[] args) {
TSRequest request = new TSRequest("TSRequest");
// Read request from buffer
- // System.out.println("Request BER tree before parsing: " + request);
ByteBuffer toReadBuf = new ByteBuffer(packet);
request.readTag(toReadBuf);
- // System.out.println("Request BER tree after parsing: " + request);
-
- // System.out.println("version value: " + request.version.value);
- // System.out.println("negoToken value: " + ((NegoItem)
- // request.negoTokens.tags[0]).negoToken.value);
// Write request to buffer and compare with original
ByteBuffer toWriteBuf = new ByteBuffer(packet.length + 100, true);
diff --git a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientConfirmActivePDU.java b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientConfirmActivePDU.java
index b77f201dd772..bee26a635adf 100644
--- a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientConfirmActivePDU.java
+++ b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientConfirmActivePDU.java
@@ -27,7 +27,7 @@
import common.ScreenDescription;
/**
- * @see http://msdn.microsoft.com/en-us/library/cc240488.aspx
+ * @see microsoft msdn explanation
*/
public class ClientConfirmActivePDU extends BaseElement {
diff --git a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientMCSAttachUserRequest.java b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientMCSAttachUserRequest.java
index 47a07da73e0c..df5754738479 100644
--- a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientMCSAttachUserRequest.java
+++ b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientMCSAttachUserRequest.java
@@ -60,9 +60,7 @@ protected void onStart() {
* Example.
*/
public static void main(String args[]) {
- // System.setProperty("streamer.Link.debug", "true");
System.setProperty("streamer.Element.debug", "true");
- // System.setProperty("streamer.Pipeline.debug", "true");
/* @formatter:off */
byte[] packet = new byte[] {
diff --git a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientMCSChannelJoinRequestServerMCSChannelConfirmPDUs.java b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientMCSChannelJoinRequestServerMCSChannelConfirmPDUs.java
index 8213b74a14fc..92c7291c21aa 100644
--- a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientMCSChannelJoinRequestServerMCSChannelConfirmPDUs.java
+++ b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientMCSChannelJoinRequestServerMCSChannelConfirmPDUs.java
@@ -57,7 +57,6 @@ protected void handleOneTimeData(ByteBuffer buf, Link link) {
// Parse channel confirm response
int typeAndFlags = buf.readUnsignedByte();
int type = typeAndFlags >> 2;
- // int flags = typeAndFlags & 0x3;
if (type != MCS_CHANNEL_CONFIRM_PDU)
throw new RuntimeException("[" + this + "] ERROR: Incorrect type of MCS AttachUserConfirm PDU. Expected value: 15, actual value: " + type + ", data: " + buf + ".");
@@ -74,11 +73,9 @@ protected void handleOneTimeData(ByteBuffer buf, Link link) {
// Channel Join Request PDU the connection SHOULD be dropped.
// Initiator: 1007 (6+1001)
- // int initiator=buf.readUnsignedShort();
buf.skipBytes(2);
// Requested channel
- // int requestedChannel=buf.readUnsignedShort();
buf.skipBytes(2);
// Actual channel
@@ -123,9 +120,7 @@ private void sendChannelRequest(int channel) {
* @see http://msdn.microsoft.com/en-us/library/cc240834.aspx
*/
public static void main(String args[]) {
- // System.setProperty("streamer.Link.debug", "true");
System.setProperty("streamer.Element.debug", "true");
- // System.setProperty("streamer.Pipeline.debug", "true");
/* @formatter:off */
byte[] clientRequestPacket = new byte[] {
diff --git a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientSynchronizePDU.java b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientSynchronizePDU.java
index b7b52f0ab5fe..5390fbf4a768 100644
--- a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientSynchronizePDU.java
+++ b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ClientSynchronizePDU.java
@@ -105,9 +105,7 @@ protected void onStart() {
* @see http://msdn.microsoft.com/en-us/library/cc240841.aspx
*/
public static void main(String args[]) {
- // System.setProperty("streamer.Link.debug", "true");
System.setProperty("streamer.Element.debug", "true");
- // System.setProperty("streamer.Pipeline.debug", "true");
/* @formatter:off */
byte[] packet = new byte[] {
diff --git a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerBitmapUpdate.java b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerBitmapUpdate.java
index 6accc162f0b5..39553c97e3c4 100644
--- a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerBitmapUpdate.java
+++ b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerBitmapUpdate.java
@@ -142,7 +142,6 @@ public BitmapRectangle readRectangle(ByteBuffer buf) {
// flag is not.
// Note: Even when compression header is enabled, server sends nothing.
- // rectangle.compressedBitmapHeader = buf.readBytes(8);
}
// (variable): A variable-length array of bytes describing a bitmap image.
diff --git a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerDemandActivePDU.java b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerDemandActivePDU.java
index d11a26b72964..9b95b0ccf330 100644
--- a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerDemandActivePDU.java
+++ b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerDemandActivePDU.java
@@ -28,8 +28,8 @@
import common.ScreenDescription;
/**
- * @see http://msdn.microsoft.com/en-us/library/cc240669.aspx
- * @see http://msdn.microsoft.com/en-us/library/cc240484.aspx
+ * @see msdn cc240669
+ * @see msdn cc240484
*/
public class ServerDemandActivePDU extends BaseElement {
@@ -83,7 +83,6 @@ public void handleData(ByteBuffer buf, Link link) {
// (variable): A variable-length array of bytes containing a source
// descriptor,
- // ByteBuffer sourceDescriptor = buf.readBytes(lengthSourceDescriptor);
buf.skipBytes(lengthSourceDescriptor);
// (variable): An array of Capability Set (section 2.2.1.13.1.1.1)
@@ -216,7 +215,7 @@ public void handleData(ByteBuffer buf, Link link) {
public static final int CAPSSETTYPE_FRAME_ACKNOWLEDGE = 0x001E;
/**
- * @see http://msdn.microsoft.com/en-us/library/cc240486.aspx
+ * @see msdn cc240486
*/
protected void handleCapabiltySets(ByteBuffer buf) {
// (2 bytes): A 16-bit, unsigned integer. The number of capability sets
@@ -312,7 +311,7 @@ protected void handleCapabiltySets(ByteBuffer buf) {
}
/**
- * @see http://msdn.microsoft.com/en-us/library/cc240554.aspx
+ * @see msdn cc240554
*/
protected void handleBitmapCapabilities(ByteBuffer buf) {
@@ -388,9 +387,7 @@ protected void sendHandshakePackets() {
*
*/
public static void main(String args[]) {
- // System.setProperty("streamer.Link.debug", "true");
System.setProperty("streamer.Element.debug", "true");
- // System.setProperty("streamer.Pipeline.debug", "true");
/* @formatter:off */
byte[] packet = new byte[] {
diff --git a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerIOChannelRouter.java b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerIOChannelRouter.java
index 59613bb2b193..20d5f00a0489 100644
--- a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerIOChannelRouter.java
+++ b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerIOChannelRouter.java
@@ -73,7 +73,6 @@ public void handleData(ByteBuffer buf, Link link) {
{
// It is ServerErrorAlert-ValidClient
// Ignore it
- //throw new RuntimeException("[" + this + "] ERROR: Incorrect PDU length: " + length + ", data: " + buf + ".");
}
int type = buf.readUnsignedShortLE() & 0xf;
@@ -88,14 +87,12 @@ public void handleData(ByteBuffer buf, Link link) {
case PDUTYPE_CONFIRMACTIVEPDU:
throw new RuntimeException("Unexpected client CONFIRM ACTIVE PDU. Data: " + buf + ".");
case PDUTYPE_DEACTIVATEALLPDU:
- // pushDataToPad("deactivate_all", buf);
/* ignore */buf.unref();
break;
case PDUTYPE_DATAPDU:
handleDataPdu(buf);
break;
case PDUTYPE_SERVER_REDIR_PKT:
- // pushDataToPad("server_redir", buf);
/* ignore */buf.unref();
break;
default:
@@ -253,7 +250,6 @@ protected void handleDataPdu(ByteBuffer buf) {
long shareId = buf.readUnsignedIntLE();
if (shareId != state.serverShareId)
throw new RuntimeException("Unexpected share ID: " + shareId + ".");
-// buf.skipBytes(4);
// Padding.
buf.skipBytes(1);
@@ -461,9 +457,7 @@ protected void handleDataPdu(ByteBuffer buf) {
*
*/
public static void main(String args[]) {
- // System.setProperty("streamer.Link.debug", "true");
System.setProperty("streamer.Element.debug", "true");
- // System.setProperty("streamer.Pipeline.debug", "true");
byte[] packet = new byte[] {
// TPKT
diff --git a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerMCSPDU.java b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerMCSPDU.java
index d28d0a09f701..71afe4506b37 100644
--- a/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerMCSPDU.java
+++ b/services/console-proxy/rdpconsole/src/main/java/rdpclient/rdp/ServerMCSPDU.java
@@ -42,7 +42,6 @@ public void handleData(ByteBuffer buf, Link link) {
switch (type) {
// Expected type: send data indication: 26 (0x1a, top 6 bits, or 0x68)
case 0x1a: {
- // int userId = buf.readUnsignedShort() + 1001; // User ID: 1002 (1001+1)
buf.skipBytes(2); // Ignore user ID
int channelId = buf.readUnsignedShort(); // Channel ID: 1003
@@ -78,9 +77,6 @@ public void handleData(ByteBuffer buf, Link link) {
*
*/
public static void main(String args[]) {
- // System.setProperty("streamer.Link.debug", "true");
- // System.setProperty("streamer.Element.debug", "true");
- // System.setProperty("streamer.Pipeline.debug", "true");
byte[] packet = new byte[] {
// TPKT
diff --git a/services/console-proxy/rdpconsole/src/main/java/streamer/BaseElement.java b/services/console-proxy/rdpconsole/src/main/java/streamer/BaseElement.java
index 15e1a8710335..5f97da21d1fe 100644
--- a/services/console-proxy/rdpconsole/src/main/java/streamer/BaseElement.java
+++ b/services/console-proxy/rdpconsole/src/main/java/streamer/BaseElement.java
@@ -187,7 +187,6 @@ protected final void pushDataToAllOuts(ByteBuffer buf) {
if (buf == null)
throw new NullPointerException();
- //return;
if (outputPads.size() == 0)
throw new RuntimeException("Number of outgoing connection is zero. Cannot send data to output. Data: " + buf + ".");
diff --git a/services/console-proxy/rdpconsole/src/main/java/streamer/PipelineImpl.java b/services/console-proxy/rdpconsole/src/main/java/streamer/PipelineImpl.java
index 84ed51440d0d..df2652e5c9ae 100644
--- a/services/console-proxy/rdpconsole/src/main/java/streamer/PipelineImpl.java
+++ b/services/console-proxy/rdpconsole/src/main/java/streamer/PipelineImpl.java
@@ -307,9 +307,6 @@ public String toString() {
* Example.
*/
public static void main(String args[]) {
- // System.setProperty("streamer.Link.debug", "true");
- // System.setProperty("streamer.Element.debug", "true");
- // System.setProperty("streamer.Pipeline.debug", "true");
Pipeline pipeline = new PipelineImpl("main");
diff --git a/services/console-proxy/rdpconsole/src/main/java/streamer/Queue.java b/services/console-proxy/rdpconsole/src/main/java/streamer/Queue.java
index ea64b323d2cb..be4ed29e71cf 100644
--- a/services/console-proxy/rdpconsole/src/main/java/streamer/Queue.java
+++ b/services/console-proxy/rdpconsole/src/main/java/streamer/Queue.java
@@ -101,7 +101,6 @@ public String toString() {
* Example.
*/
public static void main(String args[]) {
- // System.setProperty("streamer.Link.debug", "true");
System.setProperty("streamer.Element.debug", "true");
Element source1 = new FakeSource("source1") {
diff --git a/services/console-proxy/rdpconsole/src/main/java/streamer/debug/MockSource.java b/services/console-proxy/rdpconsole/src/main/java/streamer/debug/MockSource.java
index a77f1d4a84b2..31ef81600663 100644
--- a/services/console-proxy/rdpconsole/src/main/java/streamer/debug/MockSource.java
+++ b/services/console-proxy/rdpconsole/src/main/java/streamer/debug/MockSource.java
@@ -75,7 +75,6 @@ public static void main(String args[]) {
new ByteBuffer(new byte[] {3, 1, 2, 3}), new ByteBuffer(new byte[] {4, 1, 2}), new ByteBuffer(new byte[] {5, 1})};
verbose = true;
delay = 100;
- // this.numBuffers = this.bufs.length;
}
};
diff --git a/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/Vnc33Authentication.java b/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/Vnc33Authentication.java
index 4aa834dfcca1..8d0f9173a5b4 100644
--- a/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/Vnc33Authentication.java
+++ b/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/Vnc33Authentication.java
@@ -256,9 +256,7 @@ public String toString() {
* Example.
*/
public static void main(String args[]) {
- // System.setProperty("streamer.Link.debug", "true");
System.setProperty("streamer.Element.debug", "true");
- // System.setProperty("streamer.Pipeline.debug", "true");
final String password = "test";
diff --git a/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/Vnc33Hello.java b/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/Vnc33Hello.java
index 812c6a836445..d677abaffd57 100644
--- a/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/Vnc33Hello.java
+++ b/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/Vnc33Hello.java
@@ -82,9 +82,7 @@ public String toString() {
* Example.
*/
public static void main(String args[]) {
- // System.setProperty("streamer.Link.debug", "true");
System.setProperty("streamer.Element.debug", "true");
- // System.setProperty("streamer.Pipeline.debug", "true");
InputStream is = new ByteArrayInputStream("RFB 003.007\ntest".getBytes(RfbConstants.US_ASCII_CHARSET));
ByteArrayOutputStream initOS = new ByteArrayOutputStream();
diff --git a/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/VncInitializer.java b/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/VncInitializer.java
index 0b96c7303e4b..4f4d96d07d0e 100644
--- a/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/VncInitializer.java
+++ b/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/VncInitializer.java
@@ -158,9 +158,7 @@ public String toString() {
* Example.
*/
public static void main(String args[]) {
- // System.setProperty("streamer.Link.debug", "true");
System.setProperty("streamer.Element.debug", "true");
- // System.setProperty("streamer.Pipeline.debug", "true");
final String desktopName = "test";
diff --git a/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/VncMessageHandler.java b/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/VncMessageHandler.java
index 5914cb30f7ad..e9b8933830fb 100644
--- a/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/VncMessageHandler.java
+++ b/services/console-proxy/rdpconsole/src/main/java/vncclient/vnc/VncMessageHandler.java
@@ -330,9 +330,7 @@ public String toString() {
*/
public static void main(String[] args) {
- // System.setProperty("streamer.Link.debug", "true");
System.setProperty("streamer.Element.debug", "true");
- // System.setProperty("streamer.Pipeline.debug", "true");
Element source = new MockSource("source") {
{
diff --git a/services/console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxy.java b/services/console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxy.java
index a25abac981b9..e75ccea90441 100644
--- a/services/console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxy.java
+++ b/services/console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxy.java
@@ -113,7 +113,6 @@ private static void configLog4j() {
} catch (URISyntaxException e) {
System.out.println("Unable to convert log4j configuration Url to URI");
}
- // DOMConfigurator.configure(configUrl);
} else {
System.out.println("Configure log4j with default properties");
}
diff --git a/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java b/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
index 916773cc5a4f..093840157d0b 100644
--- a/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
+++ b/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
@@ -2225,8 +2225,6 @@ Map s3ListTemplate(S3TO s3) {
Map tmpltInfos = new HashMap();
for (S3ObjectSummary objectSummary : objectSummaries) {
String key = objectSummary.getKey();
- // String installPath = StringUtils.substringBeforeLast(key,
- // S3Utils.SEPARATOR);
String uniqueName = determineS3TemplateNameFromKey(key);
// TODO: isPublic value, where to get?
TemplateProp tInfo = new TemplateProp(uniqueName, key, objectSummary.getSize(), objectSummary.getSize(), true, false);
@@ -2246,8 +2244,6 @@ Map s3ListVolume(S3TO s3) {
Map tmpltInfos = new HashMap();
for (S3ObjectSummary objectSummary : objectSummaries) {
String key = objectSummary.getKey();
- // String installPath = StringUtils.substringBeforeLast(key,
- // S3Utils.SEPARATOR);
Long id = determineS3VolumeIdFromKey(key);
// TODO: how to get volume template name
TemplateProp tInfo = new TemplateProp(id.toString(), key, objectSummary.getSize(), objectSummary.getSize(), true, false);
diff --git a/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/template/DownloadManagerImpl.java b/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/template/DownloadManagerImpl.java
index 599dcfa0c486..dd3ecbdb8f3f 100644
--- a/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/template/DownloadManagerImpl.java
+++ b/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/template/DownloadManagerImpl.java
@@ -1058,7 +1058,6 @@ public Map gatherTemplateInfo(String rootDir) {
try {
if (!loc.load()) {
logger.warn("Post download installation was not completed for " + path);
- // loc.purge();
_storage.cleanup(path, templateDir);
continue;
}
@@ -1104,7 +1103,6 @@ public Map gatherVolumeInfo(String rootDir) {
try {
if (!loc.load()) {
logger.warn("Post download installation was not completed for " + path);
- // loc.purge();
_storage.cleanup(path, volumeDir);
continue;
}
diff --git a/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/template/UploadManagerImpl.java b/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/template/UploadManagerImpl.java
index ae02d7e8aa72..abddc3aa1bf3 100644
--- a/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/template/UploadManagerImpl.java
+++ b/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/template/UploadManagerImpl.java
@@ -415,7 +415,6 @@ public boolean configure(String name, Map params) throws Configu
if (inSystemVM != null && "true".equalsIgnoreCase(inSystemVM)) {
logger.info("UploadManager: starting additional services since we are inside system vm");
startAdditionalServices();
- //blockOutgoingOnPrivate();
}
value = (String)params.get("install.numthreads");
diff --git a/services/secondary-storage/server/src/test/java/org/apache/cloudstack/storage/resource/LocalNfsSecondaryStorageResourceTest.java b/services/secondary-storage/server/src/test/java/org/apache/cloudstack/storage/resource/LocalNfsSecondaryStorageResourceTest.java
index 3d62bc127af8..e79d013afd8c 100644
--- a/services/secondary-storage/server/src/test/java/org/apache/cloudstack/storage/resource/LocalNfsSecondaryStorageResourceTest.java
+++ b/services/secondary-storage/server/src/test/java/org/apache/cloudstack/storage/resource/LocalNfsSecondaryStorageResourceTest.java
@@ -71,7 +71,6 @@ public void setUp() throws ConfigurationException {
}
System.setProperty("paths.script", "/Users/edison/develop/asf-master/script");
- //resource.configure("test", new HashMap());
}
@Test
diff --git a/systemvm/agent/scripts/run-proxy.sh b/systemvm/agent/scripts/run-proxy.sh
index f26f54b12b53..40e7c8f64479 100755
--- a/systemvm/agent/scripts/run-proxy.sh
+++ b/systemvm/agent/scripts/run-proxy.sh
@@ -33,16 +33,4 @@ do
CP=${CP}:$file
done
-#CMDLINE=$(cat /proc/cmdline)
-#for i in $CMDLINE
-# do
-# KEY=$(echo $i | cut -d= -f1)
-# VALUE=$(echo $i | cut -d= -f2)
-# case $KEY in
-# mgmt_host)
-# MGMT_HOST=$VALUE
-# ;;
-# esac
-# done
-
java -mx700m -cp $CP:./conf com.cloud.consoleproxy.ConsoleProxy $@
diff --git a/utils/src/main/java/com/cloud/utils/xmlobject/XmlObject.java b/utils/src/main/java/com/cloud/utils/xmlobject/XmlObject.java
index 67634e46c400..42f687ca74c2 100644
--- a/utils/src/main/java/com/cloud/utils/xmlobject/XmlObject.java
+++ b/utils/src/main/java/com/cloud/utils/xmlobject/XmlObject.java
@@ -55,14 +55,11 @@ public XmlObject putElement(String key, Object e) {
}
Object old = elements.get(key);
if (old == null) {
- //System.out.println(String.format("no %s, add new", key));
elements.put(key, e);
} else {
if (old instanceof List) {
- //System.out.println(String.format("already list %s, add", key));
((List)old).add(e);
} else {
- //System.out.println(String.format("not list list %s, add list", key));
List lst = new ArrayList();
lst.add(old);
lst.add(e);
diff --git a/utils/src/main/java/com/cloud/utils/xmlobject/XmlObjectParser.java b/utils/src/main/java/com/cloud/utils/xmlobject/XmlObjectParser.java
index ea631704820e..25146f72b9a6 100644
--- a/utils/src/main/java/com/cloud/utils/xmlobject/XmlObjectParser.java
+++ b/utils/src/main/java/com/cloud/utils/xmlobject/XmlObjectParser.java
@@ -49,7 +49,6 @@ private class XmlHandler extends DefaultHandler {
@Override
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
- //System.out.println(String.format("startElement: namespaceURI:%s, localName:%s, qName:%s", namespaceURI, localName, qName));
currentValue = null;
XmlObject obj = new XmlObject();
for (int i = 0; i < atts.getLength(); i++) {
@@ -73,8 +72,6 @@ public void endElement(String namespaceURI, String localName, String qName) thro
if (stack.isEmpty()) {
root = currObj;
}
-
- //System.out.println(String.format("endElement: namespaceURI:%s, localName:%s, qName:%s", namespaceURI, localName, qName));
}
@Override
@@ -82,7 +79,6 @@ public void characters(char[] ch, int start, int length) throws SAXException {
StringBuilder str = new StringBuilder();
str.append(ch, start, length);
currentValue = str.toString();
- //System.out.println(String.format("characters: %s", str.toString()));
}
XmlObject getRoot() {
diff --git a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
index 5b9e3520da1b..d896d01eb43f 100644
--- a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
+++ b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
@@ -1716,7 +1716,6 @@ public void attachIso(String isoDatastorePath, ManagedObjectReference morDs,
cdRom.setBacking(backingInfo);
VirtualMachineConfigSpec reConfigSpec = new VirtualMachineConfigSpec();
- //VirtualDeviceConfigSpec[] deviceConfigSpecArray = new VirtualDeviceConfigSpec[1];
VirtualDeviceConfigSpec deviceConfigSpec = new VirtualDeviceConfigSpec();
deviceConfigSpec.setDevice(cdRom);
@@ -1726,7 +1725,6 @@ public void attachIso(String isoDatastorePath, ManagedObjectReference morDs,
deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.EDIT);
}
- //deviceConfigSpecArray[0] = deviceConfigSpec;
reConfigSpec.getDeviceChange().add(deviceConfigSpec);
ManagedObjectReference morTask = _context.getService().reconfigVMTask(_mor, reConfigSpec);
@@ -1768,13 +1766,11 @@ public int detachIso(String isoDatastorePath, final boolean force) throws Except
device.setBacking(backingInfo);
VirtualMachineConfigSpec reConfigSpec = new VirtualMachineConfigSpec();
- //VirtualDeviceConfigSpec[] deviceConfigSpecArray = new VirtualDeviceConfigSpec[1];
VirtualDeviceConfigSpec deviceConfigSpec = new VirtualDeviceConfigSpec();
deviceConfigSpec.setDevice(device);
deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.EDIT);
- //deviceConfigSpecArray[0] = deviceConfigSpec;
reConfigSpec.getDeviceChange().add(deviceConfigSpec);
ManagedObjectReference morTask = _context.getService().reconfigVMTask(_mor, reConfigSpec);
From 5151f8dc6a9ce644513c3a78db0ad8a1601aae9d Mon Sep 17 00:00:00 2001
From: dahn
Date: Mon, 8 Dec 2025 16:33:10 +0100
Subject: [PATCH 010/630] java dependabot file (#11409)
Co-authored-by: Daan Hoogland
---
.github/workflows/dependabot.yaml | 11 +++++++++++
pom.xml | 1 +
2 files changed, 12 insertions(+)
create mode 100644 .github/workflows/dependabot.yaml
diff --git a/.github/workflows/dependabot.yaml b/.github/workflows/dependabot.yaml
new file mode 100644
index 000000000000..5b063201e48d
--- /dev/null
+++ b/.github/workflows/dependabot.yaml
@@ -0,0 +1,11 @@
+# To get started with Dependabot version updates, you'll need to specify which
+# package ecosystems to update and where the package manifests are located.
+# Please see the documentation for all configuration options:
+# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+
+version: 2
+updates:
+ - package-ecosystem: "maven" # See documentation for possible values
+ directory: "/" # Location of package manifests
+ schedule:
+ interval: "daily"
diff --git a/pom.xml b/pom.xml
index fcf11e357d23..7d29ce609c69 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1078,6 +1078,7 @@
ui/legacy/**
utils/testsmallfileinactive
**/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
+ .github/workflows/dependabot.yaml
From 51910cd26066d9064729fbe85b363020994b26c9 Mon Sep 17 00:00:00 2001
From: dahn
Date: Mon, 8 Dec 2025 16:48:18 +0100
Subject: [PATCH 011/630] Add license information to dependabot.yaml
Added Apache License information to dependabot.yaml
---
.github/workflows/dependabot.yaml | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/.github/workflows/dependabot.yaml b/.github/workflows/dependabot.yaml
index 5b063201e48d..88985cbdef1e 100644
--- a/.github/workflows/dependabot.yaml
+++ b/.github/workflows/dependabot.yaml
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
From 223fc2512ce64a5f1165bfa68b0dfec61f043169 Mon Sep 17 00:00:00 2001
From: dahn
Date: Tue, 9 Dec 2025 10:51:42 +0100
Subject: [PATCH 012/630] Enhance NFS mount option check for empty response
(#11839)
---
.../component/maint/test_primary_storage_nfsmountopts_kvm.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/integration/component/maint/test_primary_storage_nfsmountopts_kvm.py b/test/integration/component/maint/test_primary_storage_nfsmountopts_kvm.py
index f2ad18188ca7..21aee0cc7176 100644
--- a/test/integration/component/maint/test_primary_storage_nfsmountopts_kvm.py
+++ b/test/integration/component/maint/test_primary_storage_nfsmountopts_kvm.py
@@ -110,7 +110,7 @@ def getUnusedNFSVersions(self, filter):
def getNFSMountOptionForPool(self, option, poolId):
nfsstat_cmd = "nfsstat -m | sed -n '/%s/{ n; p }'" % poolId
nfsstat = self.sshClient.execute(nfsstat_cmd)
- if (nfsstat == None):
+ if nfsstat == None or len(nfsstat) == 0:
return None
stat = nfsstat[0]
vers = stat[stat.find(option):].split("=")[1].split(",")[0]
From 3c6484792d8df5de7991c1263c0bf338dcd7dc19 Mon Sep 17 00:00:00 2001
From: Pearl Dsilva
Date: Tue, 9 Dec 2025 04:56:04 -0500
Subject: [PATCH 013/630] UI: Create Account form to set proper domain and role
based on route (#12200)
---
ui/src/views/iam/AddAccount.vue | 85 ++++++++++++++++++++++++++-------
1 file changed, 68 insertions(+), 17 deletions(-)
diff --git a/ui/src/views/iam/AddAccount.vue b/ui/src/views/iam/AddAccount.vue
index 9118a61e7fe8..25b45cded4ec 100644
--- a/ui/src/views/iam/AddAccount.vue
+++ b/ui/src/views/iam/AddAccount.vue
@@ -114,6 +114,7 @@
:placeholder="apiParams.domainid.description"
showSearch
optionFilterProp="label"
+ @change="onDomainChange"
:filterOption="(input, option) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
}" >
@@ -207,8 +208,9 @@ export default {
this.fetchTimeZone = debounce(this.fetchTimeZone, 800)
return {
loading: false,
- domain: { loading: false },
+ domain: { id: null, loading: false },
domainsList: [],
+ dom: null,
roleLoading: false,
roles: [],
timeZoneLoading: false,
@@ -227,14 +229,35 @@ export default {
computed: {
samlAllowed () {
return 'authorizeSamlSso' in this.$store.getters.apis
+ },
+ selectedDomain () {
+ return this.domainsList.find(domain => domain.id === this.form.domainid)
+ },
+ isNonRootDomain () {
+ if (!this.selectedDomain) return false
+ return this.selectedDomain.level > 0 && this.selectedDomain.path !== 'ROOT'
+ }
+ },
+ watch: {
+ 'form.domainid': {
+ handler (newDomainId, oldDomainId) {
+ if (newDomainId && this.roles.length > 0) {
+ this.$nextTick(() => {
+ this.setDefaultRole()
+ })
+ }
+ },
+ immediate: false
}
},
methods: {
initForm () {
+ var domId = this.$route.query.domainid || this.$store.getters.userInfo.domainid
this.formRef = ref()
this.form = reactive({
- domainid: this.$store.getters.userInfo.domainid
+ domainid: domId
})
+ this.domain.id = domId
this.rules = reactive({
roleid: [{ required: true, message: this.$t('message.error.select') }],
username: [{ required: true, message: this.$t('message.error.required.input') }],
@@ -263,9 +286,36 @@ export default {
isDomainAdmin () {
return this.$store.getters.userInfo.roletype === 'DomainAdmin'
},
+ isAdmin () {
+ return this.$store.getters.userInfo.roletype === 'Admin'
+ },
isValidValueForKey (obj, key) {
return key in obj && obj[key] != null
},
+ onDomainChange (newDomainId) {
+ if (newDomainId && this.roles.length > 0) {
+ this.$nextTick(() => {
+ this.setDefaultRole()
+ })
+ }
+ },
+ setDefaultRole () {
+ if (this.roles.length === 0) return
+
+ let targetRoleType = null
+
+ if (this.isAdmin()) {
+ targetRoleType = this.isNonRootDomain ? 'DomainAdmin' : 'Admin'
+ } else if (this.isDomainAdmin()) {
+ targetRoleType = 'User'
+ }
+
+ const targetRole = targetRoleType
+ ? this.roles.find(role => role.type === targetRoleType)
+ : this.roles[0]
+
+ this.form.roleid = (targetRole || this.roles[0]).id
+ },
async validateConfirmPassword (rule, value) {
if (!value || value.length === 0) {
return Promise.resolve()
@@ -286,17 +336,22 @@ export default {
this.loadMore('listDomains', 1, this.domain)
},
loadMore (apiToCall, page, sema) {
- console.log('sema.loading ' + sema.loading)
- const params = {}
- params.listAll = true
- params.details = 'min'
- params.pagesize = 100
- params.page = page
+ const params = {
+ listAll: true,
+ details: 'min',
+ pagesize: 100,
+ page: page
+ }
var count
getAPI(apiToCall, params).then(json => {
const listDomains = json.listdomainsresponse.domain
count = json.listdomainsresponse.count
this.domainsList = this.domainsList.concat(listDomains)
+ this.dom = this.domainsList.find(domain => domain.id === this.domain.id)
+
+ if (this.roles.length > 0) {
+ this.setDefaultRole()
+ }
}).finally(() => {
if (count <= this.domainsList.length) {
sema.loading = false
@@ -307,17 +362,13 @@ export default {
},
fetchRoles () {
this.roleLoading = true
- const params = {}
- params.state = 'enabled'
+ const params = {
+ state: 'enabled'
+ }
+
getAPI('listRoles', params).then(response => {
this.roles = response.listrolesresponse.role || []
- this.form.roleid = this.roles[0].id
- if (this.isDomainAdmin()) {
- const userRole = this.roles.filter(role => role.type === 'User')
- if (userRole.length > 0) {
- this.form.roleid = userRole[0].id
- }
- }
+ this.setDefaultRole()
}).finally(() => {
this.roleLoading = false
})
From 951649c420a96256826533d262f9df8017c9b9b2 Mon Sep 17 00:00:00 2001
From: Manoj Kumar
Date: Tue, 9 Dec 2025 16:26:16 +0530
Subject: [PATCH 014/630] Support iprange while creating remote access vpn
(#12063)
---
ui/public/locales/en.json | 3 +
ui/src/views/network/VpnDetails.vue | 140 +++++++++++++++++-----------
2 files changed, 90 insertions(+), 53 deletions(-)
diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json
index 8f2e1bb5c050..00c81104e75f 100644
--- a/ui/public/locales/en.json
+++ b/ui/public/locales/en.json
@@ -1879,6 +1879,7 @@
"label.release.dedicated.pod": "Release dedicated Pod",
"label.release.dedicated.zone": "Release dedicated Zone",
"label.releasing.ip": "Releasing IP",
+"label.remote.access.vpn.specify.iprange": "Specify IP Range of remote VPN",
"label.remote.instances": "Remote Instances",
"label.remove": "Remove",
"label.remove.annotation": "Remove comment",
@@ -3055,6 +3056,7 @@
"message.enable.vpn.processing": "Enabling VPN...",
"message.enabled.vpn": "Your remote access VPN is currently enabled and can be accessed via the IP.",
"message.enabled.vpn.ip.sec": "Your IPSec pre-shared key is",
+"message.enabled.vpn.ip.range": "Your VPN IP Range is",
"message.enabling.security.group.provider": "Enabling security group provider",
"message.enter.valid.nic.ip": "Please enter a valid IP address for NIC",
"message.error.access.key": "Please enter access key.",
@@ -3380,6 +3382,7 @@
"message.releasing.dedicated.host": "Releasing dedicated host...",
"message.releasing.dedicated.pod": "Releasing dedicated Pod...",
"message.releasing.dedicated.zone": "Releasing dedicated Zone...",
+"message.remote.access.vpn.iprange.description": "The range of IP addresses to allocate to VPN clients. The first IP in the range will be taken by the VPN server. (Optional)",
"message.remove.annotation": "Are you sure you want to delete the comment?",
"message.remove.egress.rule.failed": "Removing egress rule failed",
"message.remove.egress.rule.processing": "Deleting egress rule...",
diff --git a/ui/src/views/network/VpnDetails.vue b/ui/src/views/network/VpnDetails.vue
index 206f776aa8cb..d4c7a87ec79f 100644
--- a/ui/src/views/network/VpnDetails.vue
+++ b/ui/src/views/network/VpnDetails.vue
@@ -16,71 +16,93 @@
// under the License.
-
-
-
{{ $t('message.enabled.vpn') }} {{ remoteAccessVpn.publicip }}
-
{{ $t('message.enabled.vpn.ip.sec') }} {{ remoteAccessVpn.presharedkey }}
-
-
{{ $t('label.manage.vpn.user') }}
-
- {{ $t('label.disable.vpn') }}
-
-
+
+
+
+
{{ $t('message.enabled.vpn') }} {{ remoteAccessVpn.publicip }}
+
{{ $t('message.enabled.vpn.ip.sec') }} {{ remoteAccessVpn.presharedkey }}
+
{{ $t('message.enabled.vpn.ip.range') }} {{ remoteAccessVpn.iprange }}
+
+
{{ $t('label.manage.vpn.user') }}
+
+ {{ $t('label.disable.vpn') }}
+
+
-
-
-
{{ $t('message.disable.vpn') }}
+
+
+
{{ $t('message.disable.vpn') }}
-
+
-
-
disableVpn = false">{{ $t('label.cancel') }}
-
{{ $t('label.yes') }}
+
+
disableVpn = false">{{ $t('label.cancel') }}
+
{{ $t('label.yes') }}
+
-
-
+
-
-
-
- {{ $t('label.enable.vpn') }}
-
+
+
+
+ {{ $t('label.enable.vpn') }}
+
-
-
-
{{ $t('message.enable.vpn') }}
+
+
+
{{ $t('message.enable.vpn') }}
+
+
+ {{ $t('label.remote.access.vpn.specify.iprange') }}
+
+
+
+
+
+
+
+
-
+
-
-
enableVpn = false">{{ $t('label.cancel') }}
-
{{ $t('label.yes') }}
+
+
enableVpn = false">{{ $t('label.cancel') }}
+
{{ $t('label.yes') }}
+
-
-
+
+
+
+
diff --git a/ui/src/config/section/tools.js b/ui/src/config/section/tools.js
index a07228ca87b4..5b7f4b9af325 100644
--- a/ui/src/config/section/tools.js
+++ b/ui/src/config/section/tools.js
@@ -116,6 +116,10 @@ export default {
name: 'details',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
},
+ {
+ name: 'filters',
+ component: shallowRef(defineAsyncComponent(() => import('@/components/view/WebhookFiltersTab.vue')))
+ },
{
name: 'recent.deliveries',
component: shallowRef(defineAsyncComponent(() => import('@/components/view/WebhookDeliveriesTab.vue')))
From fca928d609baffa87750d9de8b3d48e8746d64ce Mon Sep 17 00:00:00 2001
From: YoulongChen <30854794+YLChen-007@users.noreply.github.com>
Date: Mon, 5 Jan 2026 20:28:48 +0800
Subject: [PATCH 066/630] fix HMAC Signatures and API Keys Logged in Plaintext
(#12021)
Co-authored-by: chenyoulong20g@ict.ac.cn
Co-authored-by: dahn
---
.../java/com/cloud/storage/template/HttpTemplateDownloader.java | 2 +-
.../schema/src/main/java/com/cloud/upgrade/DatabaseCreator.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/core/src/main/java/com/cloud/storage/template/HttpTemplateDownloader.java b/core/src/main/java/com/cloud/storage/template/HttpTemplateDownloader.java
index cf49217ef5ba..6fe001de72c0 100755
--- a/core/src/main/java/com/cloud/storage/template/HttpTemplateDownloader.java
+++ b/core/src/main/java/com/cloud/storage/template/HttpTemplateDownloader.java
@@ -151,7 +151,7 @@ private void checkCredentials(String user, String password) {
client.getParams().setAuthenticationPreemptive(true);
Credentials defaultcreds = new UsernamePasswordCredentials(user, password);
client.getState().setCredentials(new AuthScope(hostAndPort.first(), hostAndPort.second(), AuthScope.ANY_REALM), defaultcreds);
- logger.info("Added username=" + user + ", password=" + password + "for host " + hostAndPort.first() + ":" + hostAndPort.second());
+ logger.info("Added username={}, password=****** for host {}:{}", user, hostAndPort.first(), hostAndPort.second());
} else {
logger.info("No credentials configured for host=" + hostAndPort.first() + ":" + hostAndPort.second());
}
diff --git a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseCreator.java b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseCreator.java
index 384826227af7..cccfbe8a0065 100644
--- a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseCreator.java
+++ b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseCreator.java
@@ -99,7 +99,7 @@ private static void initDB(String dbPropsFile, String rootPassword, String[] dat
String username = dbProperties.getProperty(String.format("db.%s.username", database));
String password = dbProperties.getProperty(String.format("db.%s.password", database));
String dbName = dbProperties.getProperty(String.format("db.%s.name", database));
- System.out.println(String.format("========> Initializing database=%s with host=%s port=%s username=%s password=%s", dbName, host, port, username, password));
+ System.out.println(String.format("========> Initializing database=%s with host=%s port=%s username=%s password=******", dbName, host, port, username));
List queries = new ArrayList();
queries.add(String.format("drop database if exists `%s`", dbName));
From a29de0ed0665ea97a8bcdf35a2651b4f5df26494 Mon Sep 17 00:00:00 2001
From: Suresh Kumar Anaparti
Date: Mon, 5 Jan 2026 21:00:39 +0530
Subject: [PATCH 067/630] Retry cloneVM task when any file access issue while
cloning from volume or template (#12335)
---
.../vmware/mo/VirtualMachineMO.java | 54 +++++++++++--------
1 file changed, 33 insertions(+), 21 deletions(-)
diff --git a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
index 9802328827aa..950ec9010cbd 100644
--- a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
+++ b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
@@ -788,11 +788,8 @@ public VirtualMachineMO createFullCloneWithSpecificDisk(String cloneName, Manage
cloneSpec.setMemory(false);
cloneSpec.setConfig(vmConfigSpec);
- ManagedObjectReference morTask = _context.getService().cloneVMTask(_mor, morFolder, cloneName, cloneSpec);
-
- boolean result = _context.getVimClient().waitForTask(morTask);
+ boolean result = cloneVM(cloneName, morFolder, cloneSpec);
if (result) {
- _context.waitForTaskProgressDone(morTask);
VirtualMachineMO clonedVm = dcMo.findVm(cloneName);
if (clonedVm == null) {
logger.error(String.format("Failed to clone Instance %s", cloneName));
@@ -802,10 +799,9 @@ public VirtualMachineMO createFullCloneWithSpecificDisk(String cloneName, Manage
clonedVm.tagAsWorkerVM();
makeSureVMHasOnlyRequiredDisk(clonedVm, requiredDisk, dsMo, dcMo);
return clonedVm;
- } else {
- logger.error("VMware cloneVM_Task failed due to " + TaskMO.getTaskFailureInfo(_context, morTask));
- return null;
}
+
+ return null;
}
private void makeSureVMHasOnlyRequiredDisk(VirtualMachineMO clonedVm, VirtualDisk requiredDisk, DatastoreMO dsMo, DatacenterMO dcMo) throws Exception {
@@ -852,16 +848,42 @@ public boolean createFullClone(String cloneName, ManagedObjectReference morFolde
setDiskProvisioningType(relocSpec, morDs, diskProvisioningType);
- ManagedObjectReference morTask = _context.getService().cloneVMTask(_mor, morFolder, cloneName, cloneSpec);
+ return cloneVM(cloneName, morFolder, cloneSpec);
+ }
+ private boolean cloneVMTask(String cloneName, ManagedObjectReference morFolder, VirtualMachineCloneSpec cloneSpec) throws Exception {
+ ManagedObjectReference morTask = _context.getService().cloneVMTask(_mor, morFolder, cloneName, cloneSpec);
boolean result = _context.getVimClient().waitForTask(morTask);
if (result) {
_context.waitForTaskProgressDone(morTask);
return true;
- } else {
- logger.error("VMware cloneVM_Task failed due to " + TaskMO.getTaskFailureInfo(_context, morTask));
}
+ logger.error("VMware cloneVM_Task failed due to {}", TaskMO.getTaskFailureInfo(_context, morTask));
+ return false;
+ }
+
+ private boolean cloneVM(final String cloneName, final ManagedObjectReference morFolder, final VirtualMachineCloneSpec cloneSpec) throws Exception {
+ final int retry = 20;
+ int retryAttempt = 0;
+ while (++retryAttempt <= retry) {
+ try {
+ logger.debug("Cloning VM {}, attempt #{}", cloneName, retryAttempt);
+ return cloneVMTask(cloneName, morFolder, cloneSpec);
+ } catch (Exception e) {
+ logger.info("Got exception while cloning VM {}", cloneName, e);
+ if (e.getMessage() != null && e.getMessage().contains("Unable to access file")) {
+ logger.debug("Failed to clone VM {}. Retrying", cloneName);
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ie) {
+ logger.debug("Waiting to clone VM {} been interrupted: ", cloneName);
+ }
+ } else {
+ throw e;
+ }
+ }
+ }
return false;
}
@@ -925,17 +947,7 @@ public boolean createLinkedClone(String cloneName, ManagedObjectReference morBas
cloneSpec.setLocation(rSpec);
cloneSpec.setSnapshot(morBaseSnapshot);
- ManagedObjectReference morTask = _context.getService().cloneVMTask(_mor, morFolder, cloneName, cloneSpec);
-
- boolean result = _context.getVimClient().waitForTask(morTask);
- if (result) {
- _context.waitForTaskProgressDone(morTask);
- return true;
- } else {
- logger.error("VMware cloneVM_Task failed due to " + TaskMO.getTaskFailureInfo(_context, morTask));
- }
-
- return false;
+ return cloneVM(cloneName, morFolder, cloneSpec);
}
public VirtualMachineRuntimeInfo getRuntimeInfo() throws Exception {
From 2d4b7ba3578a705b3a1bbc08d2a38d334b03816f Mon Sep 17 00:00:00 2001
From: Suresh Kumar Anaparti
Date: Tue, 6 Jan 2026 12:08:18 +0530
Subject: [PATCH 068/630] Add mountopts to backup repository response (#12360)
---
.../backup/repository/AddBackupRepositoryCmd.java | 3 ++-
.../api/response/BackupRepositoryResponse.java | 12 ++++++++++++
.../cloudstack/backup/BackupRepositoryService.java | 1 -
.../main/java/com/cloud/api/ApiResponseHelper.java | 3 +++
4 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/repository/AddBackupRepositoryCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/repository/AddBackupRepositoryCmd.java
index 64998a749547..7caa4ce710ff 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/repository/AddBackupRepositoryCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/repository/AddBackupRepositoryCmd.java
@@ -17,6 +17,7 @@
package org.apache.cloudstack.api.command.user.backup.repository;
+import com.cloud.utils.StringUtils;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
@@ -100,7 +101,7 @@ public String getProvider() {
}
public String getMountOptions() {
- return mountOptions == null ? "" : mountOptions;
+ return StringUtils.isBlank(mountOptions) ? "" : mountOptions;
}
public Long getZoneId() {
diff --git a/api/src/main/java/org/apache/cloudstack/api/response/BackupRepositoryResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/BackupRepositoryResponse.java
index 327bbae00512..0d3c830950b2 100644
--- a/api/src/main/java/org/apache/cloudstack/api/response/BackupRepositoryResponse.java
+++ b/api/src/main/java/org/apache/cloudstack/api/response/BackupRepositoryResponse.java
@@ -57,6 +57,10 @@ public class BackupRepositoryResponse extends BaseResponse {
@Param(description = "backup type")
private String type;
+ @SerializedName(ApiConstants.MOUNT_OPTIONS)
+ @Param(description = "mount options", since = "4.22.1")
+ private String mountOptions;
+
@SerializedName(ApiConstants.CAPACITY_BYTES)
@Param(description = "capacity of the backup repository")
private Long capacityBytes;
@@ -128,6 +132,14 @@ public void setType(String type) {
this.type = type;
}
+ public String getMountOptions() {
+ return mountOptions;
+ }
+
+ public void setMountOptions(String mountOptions) {
+ this.mountOptions = mountOptions;
+ }
+
public Long getCapacityBytes() {
return capacityBytes;
}
diff --git a/api/src/main/java/org/apache/cloudstack/backup/BackupRepositoryService.java b/api/src/main/java/org/apache/cloudstack/backup/BackupRepositoryService.java
index 875fc3b3d906..cc8144ebe403 100644
--- a/api/src/main/java/org/apache/cloudstack/backup/BackupRepositoryService.java
+++ b/api/src/main/java/org/apache/cloudstack/backup/BackupRepositoryService.java
@@ -32,5 +32,4 @@ public interface BackupRepositoryService {
BackupRepository updateBackupRepository(UpdateBackupRepositoryCmd cmd);
boolean deleteBackupRepository(DeleteBackupRepositoryCmd cmd);
Pair, Integer> listBackupRepositories(ListBackupRepositoriesCmd cmd);
-
}
diff --git a/server/src/main/java/com/cloud/api/ApiResponseHelper.java b/server/src/main/java/com/cloud/api/ApiResponseHelper.java
index 83b6e4d2bf18..f8e6753fb780 100644
--- a/server/src/main/java/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/main/java/com/cloud/api/ApiResponseHelper.java
@@ -5526,6 +5526,9 @@ public BackupRepositoryResponse createBackupRepositoryResponse(BackupRepository
response.setAddress(backupRepository.getAddress());
response.setProviderName(backupRepository.getProvider());
response.setType(backupRepository.getType());
+ if (StringUtils.isNotBlank(backupRepository.getMountOptions())) {
+ response.setMountOptions(backupRepository.getMountOptions());
+ }
response.setCapacityBytes(backupRepository.getCapacityBytes());
response.setCrossZoneInstanceCreation(backupRepository.crossZoneInstanceCreationEnabled());
response.setObjectName("backuprepository");
From c465caf81e743b1a0d6f919e472e2d82d1c71a66 Mon Sep 17 00:00:00 2001
From: dahn
Date: Tue, 6 Jan 2026 08:17:37 +0100
Subject: [PATCH 069/630] Adjust close periods (#12376)
---
.github/workflows/stale.yml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index f12fbe93de66..e90c75979b6d 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -33,9 +33,11 @@ jobs:
stale-issue-message: 'This issue is stale because it has been open for 120 days with no activity. It may be removed by administrators of this project at any time. Remove the stale label or comment to request for removal of it to prevent this.'
stale-pr-message: 'This PR is stale because it has been open for 120 days with no activity. It may be removed by administrators of this project at any time. Remove the stale label or comment to request for removal of it to prevent this.'
close-issue-message: 'This issue was closed because it has been stale for 120 days with no activity.'
- close-pr-message: 'This PR was closed because it has been stale for 120 days with no activity.'
+ close-pr-message: 'This PR was closed because it has been stale for 240 days with no activity.'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
days-before-stale: 120
+ days-before-close: -1
+ days-before-pr-close: 240
exempt-issue-labels: 'gsoc,good-first-issue,long-term-plan'
exempt-pr-labels: 'status:ready-for-merge,status:needs-testing,status:on-hold'
From 57331aca2fc4b0c7051a94a52b18969ac6920fd4 Mon Sep 17 00:00:00 2001
From: Manoj Kumar
Date: Wed, 7 Jan 2026 09:25:11 +0530
Subject: [PATCH 070/630] Skip removal of offerings if in use during domain
removal (#11780)
This PR fixes #11502
- Prevent service offering update to specific domains if any instance for the offering are outside of those
- Removal of offerings is skipped if it is in use by any Instance.
---
.../java/com/cloud/storage/dao/VolumeDao.java | 2 +
.../com/cloud/storage/dao/VolumeDaoImpl.java | 14 +++++++
.../java/com/cloud/vm/dao/VMInstanceDao.java | 3 ++
.../com/cloud/vm/dao/VMInstanceDaoImpl.java | 37 +++++++++++++++++++
.../ConfigurationManagerImpl.java | 8 +++-
.../com/cloud/user/DomainManagerImpl.java | 25 +++++++++++--
6 files changed, 84 insertions(+), 5 deletions(-)
diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDao.java b/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDao.java
index e6ffca06f9e0..4936af3caab5 100644
--- a/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDao.java
+++ b/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDao.java
@@ -162,4 +162,6 @@ public interface VolumeDao extends GenericDao, StateDao searchRemovedByVms(List vmIds, Long batchSize);
VolumeVO findOneByIScsiName(String iScsiName);
+
+ int getVolumeCountByOfferingId(long diskOfferingId);
}
diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java b/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java
index 750dbf2bee0f..5ef64b046646 100644
--- a/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java
+++ b/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java
@@ -77,6 +77,7 @@ public class VolumeDaoImpl extends GenericDaoBase implements Vol
protected GenericSearchBuilder primaryStorageSearch2;
protected GenericSearchBuilder secondaryStorageSearch;
private final SearchBuilder poolAndPathSearch;
+ final GenericSearchBuilder CountByOfferingId;
@Inject
ReservationDao reservationDao;
@@ -504,6 +505,11 @@ public VolumeDaoImpl() {
poolAndPathSearch.and("poolId", poolAndPathSearch.entity().getPoolId(), Op.EQ);
poolAndPathSearch.and("path", poolAndPathSearch.entity().getPath(), Op.EQ);
poolAndPathSearch.done();
+
+ CountByOfferingId = createSearchBuilder(Integer.class);
+ CountByOfferingId.select(null, Func.COUNT, CountByOfferingId.entity().getId());
+ CountByOfferingId.and("diskOfferingId", CountByOfferingId.entity().getDiskOfferingId(), Op.EQ);
+ CountByOfferingId.done();
}
@Override
@@ -909,4 +915,12 @@ public VolumeVO findOneByIScsiName(String iScsiName) {
sc.setParameters("iScsiName", iScsiName);
return findOneIncludingRemovedBy(sc);
}
+
+ @Override
+ public int getVolumeCountByOfferingId(long diskOfferingId) {
+ SearchCriteria sc = CountByOfferingId.create();
+ sc.setParameters("diskOfferingId", diskOfferingId);
+ List results = customSearch(sc, null);
+ return results.get(0);
+ }
}
diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDao.java b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDao.java
index 823642d8c3d7..56e16ddd871c 100755
--- a/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDao.java
+++ b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDao.java
@@ -187,4 +187,7 @@ List searchRemovedByRemoveDate(final Date startDate, final Date en
Map getNameIdMapForVmIds(Collection ids);
+ int getVmCountByOfferingId(Long serviceOfferingId);
+
+ int getVmCountByOfferingNotInDomain(Long serviceOfferingId, List domainIds);
}
diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java
index 29ab74dfbfd8..518bc3cf497c 100755
--- a/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java
+++ b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java
@@ -104,6 +104,8 @@ public class VMInstanceDaoImpl extends GenericDaoBase implem
protected SearchBuilder LastHostAndStatesSearch;
protected SearchBuilder VmsNotInClusterUsingPool;
protected SearchBuilder IdsPowerStateSelectSearch;
+ GenericSearchBuilder CountByOfferingId;
+ GenericSearchBuilder CountUserVmNotInDomain;
@Inject
ResourceTagDao tagsDao;
@@ -344,6 +346,18 @@ protected void init() {
IdsPowerStateSelectSearch.entity().getPowerStateUpdateCount(),
IdsPowerStateSelectSearch.entity().getPowerStateUpdateTime());
IdsPowerStateSelectSearch.done();
+
+ CountByOfferingId = createSearchBuilder(Integer.class);
+ CountByOfferingId.select(null, Func.COUNT, CountByOfferingId.entity().getId());
+ CountByOfferingId.and("serviceOfferingId", CountByOfferingId.entity().getServiceOfferingId(), Op.EQ);
+ CountByOfferingId.done();
+
+ CountUserVmNotInDomain = createSearchBuilder(Integer.class);
+ CountUserVmNotInDomain.select(null, Func.COUNT, CountUserVmNotInDomain.entity().getId());
+ CountUserVmNotInDomain.and("serviceOfferingId", CountUserVmNotInDomain.entity().getServiceOfferingId(), Op.EQ);
+ CountUserVmNotInDomain.and("domainIdsNotIn", CountUserVmNotInDomain.entity().getDomainId(), Op.NIN);
+ CountUserVmNotInDomain.done();
+
}
@Override
@@ -1224,4 +1238,27 @@ public Map getNameIdMapForVmIds(Collection ids) {
return vms.stream()
.collect(Collectors.toMap(VMInstanceVO::getInstanceName, VMInstanceVO::getId));
}
+
+ @Override
+ public int getVmCountByOfferingId(Long serviceOfferingId) {
+ if (serviceOfferingId == null) {
+ return 0;
+ }
+ SearchCriteria sc = CountByOfferingId.create();
+ sc.setParameters("serviceOfferingId", serviceOfferingId);
+ List count = customSearch(sc, null);
+ return count.get(0);
+ }
+
+ @Override
+ public int getVmCountByOfferingNotInDomain(Long serviceOfferingId, List domainIds) {
+ if (serviceOfferingId == null || CollectionUtils.isEmpty(domainIds)) {
+ return 0;
+ }
+ SearchCriteria sc = CountUserVmNotInDomain.create();
+ sc.setParameters("serviceOfferingId", serviceOfferingId);
+ sc.setParameters("domainIdsNotIn", domainIds.toArray());
+ List count = customSearch(sc, null);
+ return count.get(0);
+ }
}
diff --git a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
index 246681f75851..62b3c23d27ec 100644
--- a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -50,7 +50,7 @@
import javax.inject.Inject;
import javax.naming.ConfigurationException;
-
+import com.cloud.exception.UnsupportedServiceException;
import com.cloud.network.as.AutoScaleManager;
import com.cloud.user.AccountManagerImpl;
import org.apache.cloudstack.acl.RoleType;
@@ -3722,6 +3722,12 @@ public ServiceOffering updateServiceOffering(final UpdateServiceOfferingCmd cmd)
List filteredDomainIds = filterChildSubDomains(domainIds);
Collections.sort(filteredDomainIds);
+ // avoid domain update of service offering if any instance is associated to it
+ int instanceCount = _vmInstanceDao.getVmCountByOfferingNotInDomain(offeringHandle.getId(), filteredDomainIds);
+ if (instanceCount > 0) {
+ throw new UnsupportedServiceException("There are Instances associated to this service offering outside of the specified domains.");
+ }
+
List filteredZoneIds = new ArrayList<>();
if (CollectionUtils.isNotEmpty(zoneIds)) {
filteredZoneIds.addAll(zoneIds);
diff --git a/server/src/main/java/com/cloud/user/DomainManagerImpl.java b/server/src/main/java/com/cloud/user/DomainManagerImpl.java
index 6fc9c6f5ef53..28f9bd3ab391 100644
--- a/server/src/main/java/com/cloud/user/DomainManagerImpl.java
+++ b/server/src/main/java/com/cloud/user/DomainManagerImpl.java
@@ -34,6 +34,8 @@
import com.cloud.api.query.vo.VpcOfferingJoinVO;
import com.cloud.configuration.Resource;
import com.cloud.domain.dao.DomainDetailsDao;
+import com.cloud.network.dao.NetworkDao;
+import com.cloud.network.vpc.dao.VpcDao;
import com.cloud.network.vpc.dao.VpcOfferingDao;
import com.cloud.network.vpc.dao.VpcOfferingDetailsDao;
import com.cloud.offerings.dao.NetworkOfferingDao;
@@ -85,6 +87,7 @@
import com.cloud.service.dao.ServiceOfferingDao;
import com.cloud.service.dao.ServiceOfferingDetailsDao;
import com.cloud.storage.dao.DiskOfferingDao;
+import com.cloud.storage.dao.VolumeDao;
import com.cloud.user.dao.AccountDao;
import com.cloud.utils.Pair;
import com.cloud.utils.component.ManagerBase;
@@ -101,6 +104,8 @@
import com.cloud.utils.net.NetUtils;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.ReservationContextImpl;
+import com.cloud.vm.dao.VMInstanceDao;
+
import org.apache.commons.lang3.StringUtils;
@Component
@@ -141,6 +146,14 @@ public class DomainManagerImpl extends ManagerBase implements DomainManager, Dom
@Inject
private ProjectDao _projectDao;
@Inject
+ private VMInstanceDao vmInstanceDao;
+ @Inject
+ private NetworkDao networkDao;
+ @Inject
+ private VolumeDao volumeDao;
+ @Inject
+ private VpcDao vpcDao;
+ @Inject
private ProjectManager _projectMgr;
@Inject
private RegionManager _regionMgr;
@@ -543,7 +556,8 @@ private void removeVpcOfferings(Long domainId, String domainIdString) {
List vpcOfferingsDetailsToRemove = new ArrayList<>();
List vpcOfferingsForThisDomain = vpcOfferingJoinDao.findByDomainId(domainId);
for (VpcOfferingJoinVO vpcOffering : vpcOfferingsForThisDomain) {
- if (domainIdString.equals(vpcOffering.getDomainId())) {
+ int vpcCount = vpcDao.getVpcCountByOfferingId(vpcOffering.getId());
+ if (vpcCount == 0) {
vpcOfferingDao.remove(vpcOffering.getId());
} else {
vpcOfferingsDetailsToRemove.add(vpcOffering.getId());
@@ -558,7 +572,8 @@ private void removeNetworkOfferings(Long domainId, String domainIdString) {
List networkOfferingsDetailsToRemove = new ArrayList<>();
List networkOfferingsForThisDomain = networkOfferingJoinDao.findByDomainId(domainId, false);
for (NetworkOfferingJoinVO networkOffering : networkOfferingsForThisDomain) {
- if (domainIdString.equals(networkOffering.getDomainId())) {
+ int networkCount = networkDao.getNetworkCountByNetworkOffId(networkOffering.getId());
+ if (networkCount == 0) {
networkOfferingDao.remove(networkOffering.getId());
} else {
networkOfferingsDetailsToRemove.add(networkOffering.getId());
@@ -573,7 +588,8 @@ private void removeServiceOfferings(Long domainId, String domainIdString) {
List serviceOfferingsDetailsToRemove = new ArrayList<>();
List serviceOfferingsForThisDomain = serviceOfferingJoinDao.findByDomainId(domainId);
for (ServiceOfferingJoinVO serviceOffering : serviceOfferingsForThisDomain) {
- if (domainIdString.equals(serviceOffering.getDomainId())) {
+ int vmCount = vmInstanceDao.getVmCountByOfferingId(serviceOffering.getId());
+ if (vmCount == 0) {
serviceOfferingDao.remove(serviceOffering.getId());
} else {
serviceOfferingsDetailsToRemove.add(serviceOffering.getId());
@@ -588,7 +604,8 @@ private void removeDiskOfferings(Long domainId, String domainIdString) {
List diskOfferingsDetailsToRemove = new ArrayList<>();
List diskOfferingsForThisDomain = diskOfferingJoinDao.findByDomainId(domainId);
for (DiskOfferingJoinVO diskOffering : diskOfferingsForThisDomain) {
- if (domainIdString.equals(diskOffering.getDomainId())) {
+ int volumeCount = volumeDao.getVolumeCountByOfferingId(diskOffering.getId());
+ if (volumeCount == 0) {
diskOfferingDao.remove(diskOffering.getId());
} else {
diskOfferingsDetailsToRemove.add(diskOffering.getId());
From 750290b8aede34c1da4012307ca8bc9ebfdb1343 Mon Sep 17 00:00:00 2001
From: Pearl Dsilva
Date: Wed, 7 Jan 2026 01:09:15 -0500
Subject: [PATCH 071/630] Prevent NPE when removing NIC from a stopped VM using
service offering with CPU cap set (#12232)
This PR fixes: #12225
---------
Co-authored-by: Abhisar Sinha <63767682+abh1sar@users.noreply.github.com>
---
server/src/main/java/com/cloud/hypervisor/KVMGuru.java | 3 ++-
server/src/test/java/com/cloud/hypervisor/KVMGuruTest.java | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/server/src/main/java/com/cloud/hypervisor/KVMGuru.java b/server/src/main/java/com/cloud/hypervisor/KVMGuru.java
index 9edaa5e6d646..62063714b891 100644
--- a/server/src/main/java/com/cloud/hypervisor/KVMGuru.java
+++ b/server/src/main/java/com/cloud/hypervisor/KVMGuru.java
@@ -132,7 +132,8 @@ protected void setVmQuotaPercentage(VirtualMachineTO to, VirtualMachineProfile v
VirtualMachine vm = vmProfile.getVirtualMachine();
HostVO host = hostDao.findById(vm.getHostId());
if (host == null) {
- throw new CloudRuntimeException("Host with id: " + vm.getHostId() + " not found");
+ logger.warn("Host is not available. Skipping setting CPU quota percentage for VM: {}", vm);
+ return;
}
logger.debug("Limiting CPU usage for VM: {} on host: {}", vm, host);
double hostMaxSpeed = getHostCPUSpeed(host);
diff --git a/server/src/test/java/com/cloud/hypervisor/KVMGuruTest.java b/server/src/test/java/com/cloud/hypervisor/KVMGuruTest.java
index eea8bb9de680..07e19d99f394 100644
--- a/server/src/test/java/com/cloud/hypervisor/KVMGuruTest.java
+++ b/server/src/test/java/com/cloud/hypervisor/KVMGuruTest.java
@@ -32,7 +32,6 @@
import com.cloud.storage.dao.GuestOSDao;
import com.cloud.storage.dao.GuestOSHypervisorDao;
import com.cloud.utils.Pair;
-import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
import org.apache.cloudstack.api.ApiConstants;
@@ -141,10 +140,11 @@ public void testSetVmQuotaPercentage() {
Mockito.verify(vmTO).setCpuQuotaPercentage(Mockito.anyDouble());
}
- @Test(expected = CloudRuntimeException.class)
+ @Test
public void testSetVmQuotaPercentageNullHost() {
Mockito.when(hostDao.findById(hostId)).thenReturn(null);
guru.setVmQuotaPercentage(vmTO, vmProfile);
+ Mockito.verify(vmTO, Mockito.never()).setCpuQuotaPercentage(Mockito.anyDouble());
}
@Test
From e47d7bc6ff12167f97932c922475ce8cb6593abe Mon Sep 17 00:00:00 2001
From: John Bampton
Date: Thu, 8 Jan 2026 02:22:52 +1000
Subject: [PATCH 072/630] [CI] Dependabot: add a cooldown period for new
releases (#12384)
---
.github/dependabot.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 88985cbdef1e..41b307863fc3 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -26,3 +26,5 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "daily"
+ cooldown:
+ default-days: 7
From fd1c67f47390d2d4ff8e121d83de7284e0211c1b Mon Sep 17 00:00:00 2001
From: John Bampton
Date: Thu, 8 Jan 2026 20:26:40 +1000
Subject: [PATCH 073/630] Standardize and auto add license headers to
properties files (#12231)
---
.pre-commit-config.yaml | 10 +++++++
.../hypervisors/ovm3/sonar-project.properties | 28 +++++++++----------
.../ovm3/src/test/resources/log4j.properties | 28 +++++++++----------
.../src/test/resources/log4j.properties | 26 +++++++++--------
systemvm/agent/conf/environment.properties | 17 +++++++++++
5 files changed, 69 insertions(+), 40 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index ef0b0c204ebd..26adafcbf268 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -62,6 +62,16 @@ repos:
- .github/workflows/license-templates/LICENSE.txt
- --fuzzy-match-generates-todo
exclude: ^(CHANGES|ISSUE_TEMPLATE|PULL_REQUEST_TEMPLATE)\.md$|^ui/docs/(full|smoke)-test-plan\.template\.md$
+ - id: insert-license
+ name: add license for all properties files
+ description: automatically adds a licence header to all properties files that don't have a license header
+ files: \.properties$
+ args:
+ - --comment-style
+ - '|#|'
+ - --license-filepath
+ - .github/workflows/license-templates/LICENSE.txt
+ - --fuzzy-match-generates-todo
- id: insert-license
name: add license for all Shell files
description: automatically adds a licence header to all Shell files that don't have a license header
diff --git a/plugins/hypervisors/ovm3/sonar-project.properties b/plugins/hypervisors/ovm3/sonar-project.properties
index d632dfb9f916..7355f1df4f78 100644
--- a/plugins/hypervisors/ovm3/sonar-project.properties
+++ b/plugins/hypervisors/ovm3/sonar-project.properties
@@ -1,19 +1,19 @@
-#Licensed to the Apache Software Foundation (ASF) under one
-#or more contributor license agreements. See the NOTICE file
-#distributed with this work for additional information
-#regarding copyright ownership. The ASF licenses this file
-#to you under the Apache License, Version 2.0 (the
-#"License"); you may not use this file except in compliance
-#with the License. You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# http://www.apache.org/licenses/LICENSE-2.0
#
-#Unless required by applicable law or agreed to in writing,
-#software distributed under the License is distributed on an
-#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#KIND, either express or implied. See the License for the
-#specific language governing permissions and limitations
-#under the License.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
# Required metadata
sonar.projectKey=cloud-plugin-hypervisor-ovm3
diff --git a/plugins/hypervisors/ovm3/src/test/resources/log4j.properties b/plugins/hypervisors/ovm3/src/test/resources/log4j.properties
index 82ee5c55c4c0..0f72e39d8554 100644
--- a/plugins/hypervisors/ovm3/src/test/resources/log4j.properties
+++ b/plugins/hypervisors/ovm3/src/test/resources/log4j.properties
@@ -1,19 +1,19 @@
-#Licensed to the Apache Software Foundation (ASF) under one
-#or more contributor license agreements. See the NOTICE file
-#distributed with this work for additional information
-#regarding copyright ownership. The ASF licenses this file
-#to you under the Apache License, Version 2.0 (the
-#"License"); you may not use this file except in compliance
-#with the License. You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# http://www.apache.org/licenses/LICENSE-2.0
#
-#Unless required by applicable law or agreed to in writing,
-#software distributed under the License is distributed on an
-#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#KIND, either express or implied. See the License for the
-#specific language governing permissions and limitations
-#under the License.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
# Root logger option
log4j.rootLogger=DEBUG, stdout
diff --git a/plugins/network-elements/globodns/src/test/resources/log4j.properties b/plugins/network-elements/globodns/src/test/resources/log4j.properties
index 1bac606ff63d..8b1d961f7b63 100644
--- a/plugins/network-elements/globodns/src/test/resources/log4j.properties
+++ b/plugins/network-elements/globodns/src/test/resources/log4j.properties
@@ -1,17 +1,19 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# http://www.apache.org/licenses/LICENSE-2.0
#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
# Define the root logger with appender file
#log = /var/log/log4j
diff --git a/systemvm/agent/conf/environment.properties b/systemvm/agent/conf/environment.properties
index 269acad91525..20ca1a2b4322 100644
--- a/systemvm/agent/conf/environment.properties
+++ b/systemvm/agent/conf/environment.properties
@@ -1,2 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
paths.script=../../scripts/storage/secondary/
paths.pid=.
From bc76f2042d74ecee12a4cbea95e70b4bd75aae85 Mon Sep 17 00:00:00 2001
From: Tonitzpp <134986282+Tonitzpp@users.noreply.github.com>
Date: Thu, 8 Jan 2026 09:55:34 -0300
Subject: [PATCH 074/630] Change migration volume exception messages (#12367)
Co-authored-by: toni.zamparetti
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---
.../main/java/com/cloud/storage/VolumeApiServiceImpl.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
index 4f03e7881737..bdf9bc1bc1d2 100644
--- a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
@@ -2179,14 +2179,16 @@ public Volume changeDiskOfferingForVolumeInternal(Long volumeId, Long newDiskOff
}
Collections.shuffle(suitableStoragePoolsWithEnoughSpace);
MigrateVolumeCmd migrateVolumeCmd = new MigrateVolumeCmd(volume.getId(), suitableStoragePoolsWithEnoughSpace.get(0).getId(), newDiskOffering.getId(), true);
+ String volumeUuid = volume.getUuid();
try {
Volume result = migrateVolume(migrateVolumeCmd);
volume = (result != null) ? _volsDao.findById(result.getId()) : null;
if (volume == null) {
- throw new CloudRuntimeException(String.format("Volume change offering operation failed for volume: %s migration failed to storage pool %s", volume, suitableStoragePools.get(0)));
+ throw new CloudRuntimeException("Change offering for the volume failed.");
}
} catch (Exception e) {
- throw new CloudRuntimeException(String.format("Volume change offering operation failed for volume: %s migration failed to storage pool %s due to %s", volume, suitableStoragePools.get(0), e.getMessage()));
+ logger.error("Volume change offering operation failed for volume ID: {} migration failed to storage pool {} due to {}", volumeUuid, suitableStoragePoolsWithEnoughSpace.get(0).getId(), e.getMessage());
+ throw new CloudRuntimeException("Change offering for the volume failed.", e);
}
}
@@ -2199,7 +2201,7 @@ public Volume changeDiskOfferingForVolumeInternal(Long volumeId, Long newDiskOff
if (volumeMigrateRequired) {
logger.warn(String.format("Volume change offering operation succeeded for volume ID: %s but volume resize operation failed, so please try resize volume operation separately", volume.getUuid()));
} else {
- throw new CloudRuntimeException(String.format("Volume change offering operation failed for volume ID: %s due to resize volume operation failed", volume.getUuid()));
+ throw new CloudRuntimeException(String.format("Volume disk offering change operation failed for volume ID [%s] because the volume resize operation failed.", volume.getUuid()));
}
}
}
From bc3d7c314bb61af7dfb822a644c3032ff8d5c0aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernardo=20De=20Marco=20Gon=C3=A7alves?=
Date: Fri, 9 Jan 2026 05:17:44 -0300
Subject: [PATCH 075/630] Change the `value` parameter of the
`updateConfiguration` API to be required (#10790)
---
.../com/cloud/configuration/ConfigurationManagerImpl.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
index 705e7dea1580..e6abc21e7da5 100644
--- a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -1031,6 +1031,10 @@ public Configuration updateConfiguration(final UpdateCfgCmd cmd) throws InvalidP
category = config.getCategory();
}
+ if (value == null) {
+ throw new InvalidParameterValueException(String.format("The new value for the [%s] configuration must be given.", name));
+ }
+
validateIpAddressRelatedConfigValues(name, value);
validateConflictingConfigValue(name, value);
@@ -1039,10 +1043,6 @@ public Configuration updateConfiguration(final UpdateCfgCmd cmd) throws InvalidP
throw new CloudRuntimeException("Only Root Admin is allowed to edit this configuration.");
}
- if (value == null) {
- return _configDao.findByName(name);
- }
-
ConfigKey.Scope scope = null;
Long id = null;
int paramCountCheck = 0;
From 1ef636577167cc7cc7a6ce63c54b54c1ab32aabf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Erik=20B=C3=B6ck?=
<89930804+erikbocks@users.noreply.github.com>
Date: Fri, 9 Jan 2026 05:23:46 -0300
Subject: [PATCH 076/630] Change internal ID to UUID in user disable event
(#11824)
---
.../cloudstack/api/command/admin/user/DisableUserCmd.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
index 974c1c7bebed..6ce669d8523d 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
@@ -78,12 +78,12 @@ public long getEntityOwnerId() {
@Override
public String getEventDescription() {
- return "disabling user: " + getId();
+ return "disabling user: " + this._uuidMgr.getUuid(User.class, getId());
}
@Override
public void execute() {
- CallContext.current().setEventDetails("UserId: " + getId());
+ CallContext.current().setEventDetails("User ID: " + this._uuidMgr.getUuid(User.class, getId()));
UserAccount user = _regionService.disableUser(this);
if (user != null) {
From 1b861dad48fe4987b691eab7ed102638d5c1f550 Mon Sep 17 00:00:00 2001
From: "Suyang(Dawson) Chen"
Date: Fri, 9 Jan 2026 03:30:17 -0500
Subject: [PATCH 077/630] Cleanup: Standardize logger message formatting in
ApiServer.java (#11188)
---
.../src/main/java/com/cloud/api/ApiServer.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/server/src/main/java/com/cloud/api/ApiServer.java b/server/src/main/java/com/cloud/api/ApiServer.java
index 5a3c8c2c7179..95aca28b53f2 100644
--- a/server/src/main/java/com/cloud/api/ApiServer.java
+++ b/server/src/main/java/com/cloud/api/ApiServer.java
@@ -461,14 +461,14 @@ public boolean start() {
final Long snapshotLimit = ConcurrentSnapshotsThresholdPerHost.value();
if (snapshotLimit == null || snapshotLimit <= 0) {
- logger.debug("Global concurrent snapshot config parameter " + ConcurrentSnapshotsThresholdPerHost.value() + " is less or equal 0; defaulting to unlimited");
+ logger.debug("Global concurrent snapshot config parameter {} is less or equal 0; defaulting to unlimited", ConcurrentSnapshotsThresholdPerHost.value());
} else {
dispatcher.setCreateSnapshotQueueSizeLimit(snapshotLimit);
}
final Long migrationLimit = VolumeApiService.ConcurrentMigrationsThresholdPerDatastore.value();
if (migrationLimit == null || migrationLimit <= 0) {
- logger.debug("Global concurrent migration config parameter " + VolumeApiService.ConcurrentMigrationsThresholdPerDatastore.value() + " is less or equal 0; defaulting to unlimited");
+ logger.debug("Global concurrent migration config parameter {} is less or equal 0; defaulting to unlimited", VolumeApiService.ConcurrentMigrationsThresholdPerDatastore.value());
} else {
dispatcher.setMigrateQueueSizeLimit(migrationLimit);
}
@@ -647,7 +647,7 @@ public String handleRequest(final Map params, final String responseType, final S
logValue = (value == null) ? "'null'" : value[0];
}
- logger.trace(" key: " + keyStr + ", value: " + logValue);
+ logger.trace(" key: {}, value: {}", keyStr, logValue);
}
}
throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, "Invalid request, no command sent");
@@ -707,7 +707,7 @@ public String handleRequest(final Map params, final String responseType, final S
buf.append(obj.getUuid());
buf.append(" ");
}
- logger.info("PermissionDenied: " + ex.getMessage() + " on objs: [" + buf + "]");
+ logger.info("PermissionDenied: {} on objs: [{}]", ex.getMessage(), buf);
} else {
logger.info("PermissionDenied: {}", ex.getMessage());
}
@@ -1035,7 +1035,7 @@ public boolean verifyRequest(final Map requestParameters, fina
// if api/secret key are passed to the parameters
if ((signature == null) || (apiKey == null)) {
- logger.debug("Expired session, missing signature, or missing apiKey -- ignoring request. Signature: " + signature + ", apiKey: " + apiKey);
+ logger.warn("Expired session, missing signature, or missing apiKey -- ignoring request. Signature: {}, apiKey: {}", signature, apiKey);
return false; // no signature, bad request
}
@@ -1258,7 +1258,7 @@ public ResponseObject loginUser(final HttpSession session, final String username
float offsetInHrs = 0f;
if (timezone != null) {
final TimeZone t = TimeZone.getTimeZone(timezone);
- logger.info("Current user logged in under " + timezone + " timezone");
+ logger.info("Current user logged in under {} timezone", timezone);
final java.util.Date date = new java.util.Date();
final long longDate = date.getTime();
@@ -1410,9 +1410,9 @@ private void checkCommandAvailable(final User user, final String commandName, fi
final Boolean apiSourceCidrChecksEnabled = ApiServiceConfiguration.ApiSourceCidrChecksEnabled.value();
if (apiSourceCidrChecksEnabled) {
- logger.debug("CIDRs from which account '" + account.toString() + "' is allowed to perform API calls: " + accessAllowedCidrs);
+ logger.debug("CIDRs from which account '{}' is allowed to perform API calls: {}", account.toString(), accessAllowedCidrs);
if (!NetUtils.isIpInCidrList(remoteAddress, accessAllowedCidrs.split(","))) {
- logger.warn("Request by account '" + account.toString() + "' was denied since " + remoteAddress + " does not match " + accessAllowedCidrs);
+ logger.warn("Request by account '{}' was denied since {} does not match {}", account.toString(), remoteAddress, accessAllowedCidrs);
throw new OriginDeniedException("Calls from disallowed origin", account, remoteAddress);
}
}
From 9a38e75abdffdc22568c57f4abcb7519b7933ea9 Mon Sep 17 00:00:00 2001
From: Nicolas Vazquez
Date: Fri, 9 Jan 2026 05:48:04 -0300
Subject: [PATCH 078/630] Fix Linstor shrink qcow2 volumes (#12387)
---
.../src/main/java/com/cloud/storage/VolumeApiServiceImpl.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
index 0faf9f1e2c0a..4f8b55d16fb8 100644
--- a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
@@ -2420,7 +2420,8 @@ private void validateVolumeResizeWithSize(VolumeVO volume, long currentSize, Lon
}
}
- if (volume != null && ImageFormat.QCOW2.equals(volume.getFormat()) && !Volume.State.Allocated.equals(volume.getState()) && !StoragePoolType.StorPool.equals(volume.getPoolType())) {
+ if (volume != null && ImageFormat.QCOW2.equals(volume.getFormat()) && !Volume.State.Allocated.equals(volume.getState()) &&
+ !Arrays.asList(StoragePoolType.StorPool, StoragePoolType.Linstor).contains(volume.getPoolType())) {
String message = "Unable to shrink volumes of type QCOW2";
logger.warn(message);
throw new InvalidParameterValueException(message);
From c91e84c6d8b1b440d8c6af49f7b8f728c406e701 Mon Sep 17 00:00:00 2001
From: Abhisar Sinha <63767682+abh1sar@users.noreply.github.com>
Date: Fri, 9 Jan 2026 18:00:24 +0530
Subject: [PATCH 079/630] Avoid double counting primary storage allocated
capacity for storage pools having a parent (#12181)
---
.../java/com/cloud/capacity/dao/CapacityDaoImpl.java | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDaoImpl.java b/engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDaoImpl.java
index 5e7eee4566c1..7bd3df103b1f 100644
--- a/engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDaoImpl.java
+++ b/engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDaoImpl.java
@@ -213,6 +213,8 @@ public class CapacityDaoImpl extends GenericDaoBase implements
private static final String LEFT_JOIN_VM_TEMPLATE = "LEFT JOIN vm_template ON vm_template.id = vi.vm_template_id ";
+ private static final String STORAGE_POOLS_WITH_CHILDREN = "SELECT DISTINCT parent FROM storage_pool WHERE parent != 0 AND removed IS NULL";
+
public CapacityDaoImpl() {
_hostIdTypeSearch = createSearchBuilder();
_hostIdTypeSearch.and("hostId", _hostIdTypeSearch.entity().getHostOrPoolId(), SearchCriteria.Op.EQ);
@@ -379,6 +381,11 @@ public List listCapacitiesGroupedByLevelAndType(Integer capacity
finalQuery.append(" AND capacity_type = ?");
resourceIdList.add(capacityType.longValue());
}
+
+ // Exclude storage pools with children from capacity calculations to avoid double counting
+ finalQuery.append(" AND NOT (capacity.capacity_type = ").append(Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED)
+ .append(" AND capacity.host_id IN (").append(STORAGE_POOLS_WITH_CHILDREN).append("))");
+
if (CollectionUtils.isNotEmpty(hostIds)) {
finalQuery.append(String.format(" AND capacity.host_id IN (%s)", StringUtils.join(hostIds, ",")));
if (capacityType == null) {
@@ -541,6 +548,10 @@ public List findFilteredCapacityBy(Integer capacityType, Long zo
StringBuilder sql = new StringBuilder(LIST_CAPACITY_GROUP_BY_CAPACITY_PART1);
List resourceIdList = new ArrayList();
+ // Exclude storage pools with children from capacity calculations to avoid double counting
+ sql.append(" AND NOT (capacity.capacity_type = ").append(Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED)
+ .append(" AND capacity.host_id IN (").append(STORAGE_POOLS_WITH_CHILDREN).append("))");
+
if (zoneId != null) {
sql.append(" AND capacity.data_center_id = ?");
resourceIdList.add(zoneId);
From ef1aaa0551d3d372e3ac7295b7f87dc203212a80 Mon Sep 17 00:00:00 2001
From: Abhishek Kumar
Date: Fri, 9 Jan 2026 18:26:39 +0530
Subject: [PATCH 080/630] kvm: allow skip forcing disk controller (#11750)
---
.../java/com/cloud/vm/VmDetailConstants.java | 3 +
.../resource/LibvirtComputingResource.java | 52 +++++++++++----
.../LibvirtComputingResourceTest.java | 65 +++++++++++++++++--
.../com/cloud/api/query/QueryManagerImpl.java | 1 +
4 files changed, 106 insertions(+), 15 deletions(-)
diff --git a/api/src/main/java/com/cloud/vm/VmDetailConstants.java b/api/src/main/java/com/cloud/vm/VmDetailConstants.java
index a6c9b6eba16b..3d0152b0e438 100644
--- a/api/src/main/java/com/cloud/vm/VmDetailConstants.java
+++ b/api/src/main/java/com/cloud/vm/VmDetailConstants.java
@@ -54,6 +54,9 @@ public interface VmDetailConstants {
String NIC_MULTIQUEUE_NUMBER = "nic.multiqueue.number";
String NIC_PACKED_VIRTQUEUES_ENABLED = "nic.packed.virtqueues.enabled";
+ // KVM specific, disk controllers
+ String KVM_SKIP_FORCE_DISK_CONTROLLER = "skip.force.disk.controller";
+
// Mac OSX guest specific (internal)
String SMC_PRESENT = "smc.present";
String FIRMWARE = "firmware";
diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 87ea55ca7669..b66a838a3a52 100644
--- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -107,7 +107,6 @@
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
-
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.HostVmStateReportEntry;
@@ -188,8 +187,8 @@
import com.cloud.network.Networks.RouterPrivateIpStrategy;
import com.cloud.network.Networks.TrafficType;
import com.cloud.resource.AgentStatusUpdater;
-import com.cloud.resource.ResourceStatusUpdater;
import com.cloud.resource.RequestWrapper;
+import com.cloud.resource.ResourceStatusUpdater;
import com.cloud.resource.ServerResource;
import com.cloud.resource.ServerResourceBase;
import com.cloud.storage.JavaStorageLayer;
@@ -3083,6 +3082,44 @@ public static DiskDef.DiskType getDiskType(KVMPhysicalDisk physicalDisk) {
return useBLOCKDiskType(physicalDisk) ? DiskDef.DiskType.BLOCK : DiskDef.DiskType.FILE;
}
+ /**
+ * Defines the disk configuration for the default pool type based on the provided parameters.
+ * It determines the appropriate disk settings depending on whether the disk is a data disk, whether
+ * it's a Windows template, whether UEFI is enabled, and whether secure boot is active.
+ *
+ * @param disk The disk definition object that will be configured with the disk settings.
+ * @param volume The volume (disk) object, containing information about the type of disk.
+ * @param isWindowsTemplate Flag indicating whether the template is a Windows template.
+ * @param isUefiEnabled Flag indicating whether UEFI is enabled.
+ * @param isSecureBoot Flag indicating whether secure boot is enabled.
+ * @param physicalDisk The physical disk object that contains the path to the disk.
+ * @param devId The device ID for the disk.
+ * @param diskBusType The disk bus type to use if not skipping force disk controller.
+ * @param diskBusTypeData The disk bus type to use for data disks, if applicable.
+ * @param details A map of VM details containing additional configuration values, such as whether to skip force
+ * disk controller.
+ */
+ protected void defineDiskForDefaultPoolType(DiskDef disk, DiskTO volume, boolean isWindowsTemplate,
+ boolean isUefiEnabled, boolean isSecureBoot, KVMPhysicalDisk physicalDisk, int devId,
+ DiskDef.DiskBus diskBusType, DiskDef.DiskBus diskBusTypeData, Map details) {
+ boolean skipForceDiskController = MapUtils.getBoolean(details, VmDetailConstants.KVM_SKIP_FORCE_DISK_CONTROLLER,
+ false);
+ if (skipForceDiskController) {
+ disk.defFileBasedDisk(physicalDisk.getPath(), devId, Volume.Type.DATADISK.equals(volume.getType()) ?
+ diskBusTypeData : diskBusType, DiskDef.DiskFmtType.QCOW2);
+ return;
+ }
+ if (volume.getType() == Volume.Type.DATADISK && !(isWindowsTemplate && isUefiEnabled)) {
+ disk.defFileBasedDisk(physicalDisk.getPath(), devId, diskBusTypeData, DiskDef.DiskFmtType.QCOW2);
+ } else {
+ if (isSecureBoot) {
+ disk.defFileBasedDisk(physicalDisk.getPath(), devId, DiskDef.DiskFmtType.QCOW2, isWindowsTemplate);
+ } else {
+ disk.defFileBasedDisk(physicalDisk.getPath(), devId, diskBusType, DiskDef.DiskFmtType.QCOW2);
+ }
+ }
+ }
+
public void createVbd(final Connect conn, final VirtualMachineTO vmSpec, final String vmName, final LibvirtVMDef vm) throws InternalErrorException, LibvirtException, URISyntaxException {
final Map details = vmSpec.getDetails();
final List disks = Arrays.asList(vmSpec.getDisks());
@@ -3244,15 +3281,8 @@ public int compare(final DiskTO arg0, final DiskTO arg1) {
disk.setDiscard(DiscardType.UNMAP);
}
} else {
- if (volume.getType() == Volume.Type.DATADISK && !(isWindowsTemplate && isUefiEnabled)) {
- disk.defFileBasedDisk(physicalDisk.getPath(), devId, diskBusTypeData, DiskDef.DiskFmtType.QCOW2);
- } else {
- if (isSecureBoot) {
- disk.defFileBasedDisk(physicalDisk.getPath(), devId, DiskDef.DiskFmtType.QCOW2, isWindowsTemplate);
- } else {
- disk.defFileBasedDisk(physicalDisk.getPath(), devId, diskBusType, DiskDef.DiskFmtType.QCOW2);
- }
- }
+ defineDiskForDefaultPoolType(disk, volume, isWindowsTemplate, isUefiEnabled, isSecureBoot,
+ physicalDisk, devId, diskBusType, diskBusTypeData, details);
}
pool.customizeLibvirtDiskDef(disk);
}
diff --git a/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java
index 88e0983b63e6..ed163787b112 100644
--- a/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java
+++ b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java
@@ -56,9 +56,6 @@
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
-import com.cloud.utils.net.NetUtils;
-
-import com.cloud.vm.VmDetailConstants;
import org.apache.cloudstack.api.ApiConstants.IoDriverPolicy;
import org.apache.cloudstack.storage.command.AttachAnswer;
import org.apache.cloudstack.storage.command.AttachCommand;
@@ -217,13 +214,15 @@
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
import com.cloud.utils.Pair;
import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
+import com.cloud.utils.net.NetUtils;
import com.cloud.utils.script.OutputInterpreter.OneLineParser;
+import com.cloud.utils.script.Script;
import com.cloud.utils.ssh.SshHelper;
import com.cloud.vm.DiskProfile;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.PowerState;
import com.cloud.vm.VirtualMachine.Type;
+import com.cloud.vm.VmDetailConstants;
@RunWith(MockitoJUnitRunner.class)
public class LibvirtComputingResourceTest {
@@ -240,6 +239,19 @@ public class LibvirtComputingResourceTest {
Connect connMock;
@Mock
LibvirtDomainXMLParser parserMock;
+ @Mock
+ private DiskDef diskDef;
+ @Mock
+ private DiskTO volume;
+ @Mock
+ private KVMPhysicalDisk physicalDisk;
+ @Mock
+ private Map details;
+
+ private static final String PHYSICAL_DISK_PATH = "/path/to/disk";
+ private static final int DEV_ID = 1;
+ private static final DiskDef.DiskBus DISK_BUS_TYPE = DiskDef.DiskBus.VIRTIO;
+ private static final DiskDef.DiskBus DISK_BUS_TYPE_DATA = DiskDef.DiskBus.SCSI;
@Spy
private LibvirtComputingResource libvirtComputingResourceSpy = Mockito.spy(new LibvirtComputingResource());
@@ -6565,4 +6577,49 @@ public void testCreateTpmDefWithInvalidVersion() {
assertEquals(LibvirtVMDef.TpmDef.TpmModel.CRB, tpmDef.getModel());
assertEquals(LibvirtVMDef.TpmDef.TpmVersion.V2_0, tpmDef.getVersion());
}
+
+ @Test
+ public void defineDiskForDefaultPoolTypeSkipsForceDiskController() {
+ Map details = new HashMap<>();
+ details.put(VmDetailConstants.KVM_SKIP_FORCE_DISK_CONTROLLER, "true");
+ Mockito.when(volume.getType()).thenReturn(Volume.Type.DATADISK);
+ Mockito.when(physicalDisk.getPath()).thenReturn(PHYSICAL_DISK_PATH);
+ libvirtComputingResourceSpy.defineDiskForDefaultPoolType(diskDef, volume, false, false, false, physicalDisk, DEV_ID, DISK_BUS_TYPE, DISK_BUS_TYPE_DATA, details);
+ Mockito.verify(diskDef).defFileBasedDisk(PHYSICAL_DISK_PATH, DEV_ID, DISK_BUS_TYPE_DATA, DiskDef.DiskFmtType.QCOW2);
+ }
+
+ @Test
+ public void defineDiskForDefaultPoolTypeUsesDiskBusTypeDataForDataDiskWithoutWindowsAndUefi() {
+ Map details = new HashMap<>();
+ Mockito.when(volume.getType()).thenReturn(Volume.Type.DATADISK);
+ Mockito.when(physicalDisk.getPath()).thenReturn(PHYSICAL_DISK_PATH);
+ libvirtComputingResourceSpy.defineDiskForDefaultPoolType(diskDef, volume, false, false, false, physicalDisk, DEV_ID, DISK_BUS_TYPE, DISK_BUS_TYPE_DATA, details);
+ Mockito.verify(diskDef).defFileBasedDisk(PHYSICAL_DISK_PATH, DEV_ID, DISK_BUS_TYPE_DATA, DiskDef.DiskFmtType.QCOW2);
+ }
+
+ @Test
+ public void defineDiskForDefaultPoolTypeUsesDiskBusTypeForRootDisk() {
+ Map details = new HashMap<>();
+ Mockito.when(volume.getType()).thenReturn(Volume.Type.ROOT);
+ Mockito.when(physicalDisk.getPath()).thenReturn(PHYSICAL_DISK_PATH);
+ libvirtComputingResourceSpy.defineDiskForDefaultPoolType(diskDef, volume, false, false, false, physicalDisk, DEV_ID, DISK_BUS_TYPE, DISK_BUS_TYPE_DATA, details);
+ Mockito.verify(diskDef).defFileBasedDisk(PHYSICAL_DISK_PATH, DEV_ID, DISK_BUS_TYPE, DiskDef.DiskFmtType.QCOW2);
+ }
+
+ @Test
+ public void defineDiskForDefaultPoolTypeUsesSecureBootConfiguration() {
+ Map details = new HashMap<>();
+ Mockito.when(volume.getType()).thenReturn(Volume.Type.ROOT);
+ Mockito.when(physicalDisk.getPath()).thenReturn(PHYSICAL_DISK_PATH);
+ libvirtComputingResourceSpy.defineDiskForDefaultPoolType(diskDef, volume, true, true, true, physicalDisk, DEV_ID, DISK_BUS_TYPE, DISK_BUS_TYPE_DATA, details);
+ Mockito.verify(diskDef).defFileBasedDisk(PHYSICAL_DISK_PATH, DEV_ID, DiskDef.DiskFmtType.QCOW2, true);
+ }
+
+ @Test
+ public void defineDiskForDefaultPoolTypeHandlesNullDetails() {
+ Mockito.when(volume.getType()).thenReturn(Volume.Type.DATADISK);
+ Mockito.when(physicalDisk.getPath()).thenReturn(PHYSICAL_DISK_PATH);
+ libvirtComputingResourceSpy.defineDiskForDefaultPoolType(diskDef, volume, false, false, false, physicalDisk, DEV_ID, DISK_BUS_TYPE, DISK_BUS_TYPE_DATA, null);
+ Mockito.verify(diskDef).defFileBasedDisk(PHYSICAL_DISK_PATH, DEV_ID, DISK_BUS_TYPE_DATA, DiskDef.DiskFmtType.QCOW2);
+ }
}
diff --git a/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java b/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
index 8641eb7ffc3c..5833ede550e7 100644
--- a/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
@@ -5072,6 +5072,7 @@ private void fillVMOrTemplateDetailOptions(final Map> optio
options.put(VmDetailConstants.VIRTUAL_TPM_VERSION, Arrays.asList("1.2", "2.0"));
options.put(VmDetailConstants.GUEST_CPU_MODE, Arrays.asList("custom", "host-model", "host-passthrough"));
options.put(VmDetailConstants.GUEST_CPU_MODEL, Collections.emptyList());
+ options.put(VmDetailConstants.KVM_SKIP_FORCE_DISK_CONTROLLER, Arrays.asList("true", "false"));
}
if (HypervisorType.VMware.equals(hypervisorType)) {
From 04875f151771b6b6fdf97d4a4f2690fbeda025d2 Mon Sep 17 00:00:00 2001
From: Nicolas Vazquez
Date: Fri, 9 Jan 2026 13:50:27 -0300
Subject: [PATCH 081/630] Improve logs for VM migrations (#12332)
---
.../cloud/vm/VirtualMachineManagerImpl.java | 29 ++++++++++++++-----
.../wrapper/LibvirtMigrateCommandWrapper.java | 9 +++++-
...virtPrepareForMigrationCommandWrapper.java | 4 +++
.../java/com/cloud/vm/UserVmManagerImpl.java | 2 ++
4 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
index f9238fa0e717..86f456306110 100755
--- a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -3053,7 +3053,7 @@ private void orchestrateMigrate(final String vmUuid, final long srcHostId, final
}
protected void migrate(final VMInstanceVO vm, final long srcHostId, final DeployDestination dest) throws ResourceUnavailableException, ConcurrentOperationException {
- logger.info("Migrating {} to {}", vm, dest);
+ logger.info("Start preparing migration of the VM: {} to {}", vm, dest);
final long dstHostId = dest.getHost().getId();
final Host fromHost = _hostDao.findById(srcHostId);
if (fromHost == null) {
@@ -3118,9 +3118,11 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
if (pfma == null || !pfma.getResult()) {
final String details = pfma != null ? pfma.getDetails() : "null answer returned";
final String msg = "Unable to prepare for migration due to " + details;
+ logger.error("Failed to prepare destination host {} for migration of VM {} : {}", dstHostId, vm.getInstanceName(), details);
pfma = null;
throw new AgentUnavailableException(msg, dstHostId);
}
+ logger.debug("Successfully prepared destination host {} for migration of VM {} ", dstHostId, vm.getInstanceName());
} catch (final OperationTimedoutException e1) {
throw new AgentUnavailableException("Operation timed out", dstHostId);
} finally {
@@ -3141,18 +3143,23 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
volumeMgr.release(vm.getId(), dstHostId);
}
- logger.info("Migration cancelled because state has changed: {}", vm);
- throw new ConcurrentOperationException("Migration cancelled because state has changed: " + vm);
+ String msg = "Migration cancelled because state has changed: " + vm;
+ logger.warn(msg);
+ throw new ConcurrentOperationException(msg);
}
} catch (final NoTransitionException e1) {
_networkMgr.rollbackNicForMigration(vmSrc, profile);
volumeMgr.release(vm.getId(), dstHostId);
- logger.info("Migration cancelled because {}", e1.getMessage());
+ String msg = String.format("Migration cancelled for VM %s due to state transition failure: %s",
+ vm.getInstanceName(), e1.getMessage());
+ logger.warn(msg, e1);
throw new ConcurrentOperationException("Migration cancelled because " + e1.getMessage());
} catch (final CloudRuntimeException e2) {
_networkMgr.rollbackNicForMigration(vmSrc, profile);
volumeMgr.release(vm.getId(), dstHostId);
- logger.info("Migration cancelled because {}", e2.getMessage());
+ String msg = String.format("Migration cancelled for VM %s due to runtime exception: %s",
+ vm.getInstanceName(), e2.getMessage());
+ logger.error(msg, e2);
work.setStep(Step.Done);
_workDao.update(work.getId(), work);
try {
@@ -3172,8 +3179,12 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
final Answer ma = _agentMgr.send(vm.getLastHostId(), mc);
if (ma == null || !ma.getResult()) {
final String details = ma != null ? ma.getDetails() : "null answer returned";
+ String msg = String.format("Migration command failed for VM %s on source host id=%s to destination host %s: %s",
+ vm.getInstanceName(), vm.getLastHostId(), dstHostId, details);
+ logger.error(msg);
throw new CloudRuntimeException(details);
}
+ logger.info("Migration command successful for VM {}", vm.getInstanceName());
} catch (final OperationTimedoutException e) {
boolean success = false;
if (HypervisorType.KVM.equals(vm.getHypervisorType())) {
@@ -3210,7 +3221,7 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
try {
if (!checkVmOnHost(vm, dstHostId)) {
- logger.error("Unable to complete migration for {}", vm);
+ logger.error("Migration verification failed for VM {} : VM not found on destination host {} ", vm.getInstanceName(), dstHostId);
try {
_agentMgr.send(srcHostId, new Commands(cleanup(vm, dpdkInterfaceMapping)), null);
} catch (final AgentUnavailableException e) {
@@ -3225,7 +3236,7 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
migrated = true;
} finally {
if (!migrated) {
- logger.info("Migration was unsuccessful. Cleaning up: {}", vm);
+ logger.info("Migration was unsuccessful. Cleaning up: {}", vm);
_networkMgr.rollbackNicForMigration(vmSrc, profile);
volumeMgr.release(vm.getId(), dstHostId);
// deallocate GPU devices for the VM on the destination host
@@ -3237,7 +3248,7 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
try {
_agentMgr.send(dstHostId, new Commands(cleanup(vm, dpdkInterfaceMapping)), null);
} catch (final AgentUnavailableException ae) {
- logger.warn("Looks like the destination Host is unavailable for cleanup", ae);
+ logger.warn("Destination host {} unavailable for cleanup after failed migration of VM {}", dstHostId, vm.getInstanceName(), ae);
}
_networkMgr.setHypervisorHostname(profile, dest, false);
try {
@@ -3246,6 +3257,7 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
logger.warn(e.getMessage());
}
} else {
+ logger.info("Migration completed successfully for VM %s" + vm);
_networkMgr.commitNicForMigration(vmSrc, profile);
volumeMgr.release(vm.getId(), srcHostId);
// deallocate GPU devices for the VM on the src host after migration is complete
@@ -3276,6 +3288,7 @@ protected MigrateCommand buildMigrateCommand(VMInstanceVO vmInstance, VirtualMac
migrateCommand.setVlanToPersistenceMap(vlanToPersistenceMap);
}
+ logger.debug("Setting auto convergence to: {}", StorageManager.KvmAutoConvergence.value());
migrateCommand.setAutoConvergence(StorageManager.KvmAutoConvergence.value());
migrateCommand.setHostGuid(destination.getHost().getGuid());
diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java
index 859de5143f9b..81328d6ffb9d 100644
--- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java
+++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java
@@ -278,17 +278,20 @@ Use VIR_DOMAIN_XML_SECURE (value = 1) prior to v1.0.0.
// abort the vm migration if the job is executed more than vm.migrate.wait
final int migrateWait = libvirtComputingResource.getMigrateWait();
+ logger.info("vm.migrate.wait value set to: {}for VM: {}", migrateWait, vmName);
if (migrateWait > 0 && sleeptime > migrateWait * 1000) {
DomainState state = null;
try {
state = dm.getInfo().state;
+ logger.info("VM domain state when trying to abort migration : {}", state);
} catch (final LibvirtException e) {
logger.info("Couldn't get VM domain state after " + sleeptime + "ms: " + e.getMessage());
}
if (state != null && state == DomainState.VIR_DOMAIN_RUNNING) {
try {
DomainJobInfo job = dm.getJobInfo();
- logger.info(String.format("Aborting migration of VM [%s] with domain job [%s] due to time out after %d seconds.", vmName, job, migrateWait));
+ logger.warn("Aborting migration of VM {} with domain job [{}] due to timeout after {} seconds. " +
+ "Job stats: data processed={} bytes, data remaining={} bytes", vmName, job, migrateWait, job.getDataProcessed(), job.getDataRemaining());
dm.abortJob();
result = String.format("Migration of VM [%s] was cancelled by CloudStack due to time out after %d seconds.", vmName, migrateWait);
commandState = Command.State.FAILED;
@@ -303,10 +306,12 @@ Use VIR_DOMAIN_XML_SECURE (value = 1) prior to v1.0.0.
// pause vm if we meet the vm.migrate.pauseafter threshold and not already paused
final int migratePauseAfter = libvirtComputingResource.getMigratePauseAfter();
+ logger.info("vm.migrate.pauseafter value set to: {} for VM: {}", migratePauseAfter, vmName);
if (migratePauseAfter > 0 && sleeptime > migratePauseAfter) {
DomainState state = null;
try {
state = dm.getInfo().state;
+ logger.info("VM domain state when trying to pause VM for migration: {}", state);
} catch (final LibvirtException e) {
logger.info("Couldn't get VM domain state after " + sleeptime + "ms: " + e.getMessage());
}
@@ -381,6 +386,7 @@ Use VIR_DOMAIN_XML_SECURE (value = 1) prior to v1.0.0.
}
if (result == null) {
+ logger.info("Post-migration cleanup for VM {}: ", vmName);
libvirtComputingResource.destroyNetworkRulesForVM(conn, vmName);
for (final InterfaceDef iface : ifaces) {
String vlanId = libvirtComputingResource.getVlanIdFromBridgeName(iface.getBrName());
@@ -394,6 +400,7 @@ Use VIR_DOMAIN_XML_SECURE (value = 1) prior to v1.0.0.
commandState = Command.State.COMPLETED;
libvirtComputingResource.createOrUpdateLogFileForCommand(command, commandState);
} else if (commandState == null) {
+ logger.error("Migration of VM {} failed with result: {}", vmName, result);
commandState = Command.State.FAILED;
libvirtComputingResource.createOrUpdateLogFileForCommand(command, commandState);
}
diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtPrepareForMigrationCommandWrapper.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtPrepareForMigrationCommandWrapper.java
index 8d7ee14dc13f..d9323df4477d 100644
--- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtPrepareForMigrationCommandWrapper.java
+++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtPrepareForMigrationCommandWrapper.java
@@ -56,6 +56,7 @@ public Answer execute(final PrepareForMigrationCommand command, final LibvirtCom
final VirtualMachineTO vm = command.getVirtualMachine();
if (command.isRollback()) {
+ logger.info("Handling rollback for PrepareForMigration of VM {}", vm.getName());
return handleRollback(command, libvirtComputingResource);
}
@@ -83,6 +84,7 @@ public Answer execute(final PrepareForMigrationCommand command, final LibvirtCom
if (interfaceDef != null && interfaceDef.getNetType() == GuestNetType.VHOSTUSER) {
DpdkTO to = new DpdkTO(interfaceDef.getDpdkOvsPath(), interfaceDef.getDpdkSourcePort(), interfaceDef.getInterfaceMode());
dpdkInterfaceMapping.put(nic.getMac(), to);
+ logger.debug("Configured DPDK interface for VM {}", vm.getName());
}
}
@@ -122,6 +124,7 @@ public Answer execute(final PrepareForMigrationCommand command, final LibvirtCom
return new PrepareForMigrationAnswer(command, "failed to connect physical disks to host");
}
+ logger.info("Successfully prepared destination host for migration of VM {}", vm.getName());
return createPrepareForMigrationAnswer(command, dpdkInterfaceMapping, libvirtComputingResource, vm);
} catch (final LibvirtException | CloudRuntimeException | InternalErrorException | URISyntaxException e) {
if (MapUtils.isNotEmpty(dpdkInterfaceMapping)) {
@@ -157,6 +160,7 @@ private Answer handleRollback(PrepareForMigrationCommand command, LibvirtComputi
KVMStoragePoolManager storagePoolMgr = libvirtComputingResource.getStoragePoolMgr();
VirtualMachineTO vmTO = command.getVirtualMachine();
+ logger.info("Rolling back PrepareForMigration for VM {}: disconnecting physical disks", vmTO.getName());
if (!storagePoolMgr.disconnectPhysicalDisksViaVmSpec(vmTO)) {
return new PrepareForMigrationAnswer(command, "failed to disconnect physical disks from host");
}
diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
index 1ae609c7961b..17a893c4400a 100644
--- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
@@ -7189,6 +7189,7 @@ public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost) thr
throw new CloudRuntimeException("Unable to find suitable destination to migrate VM " + vm.getInstanceName());
}
+ logger.info("Starting migration of VM {} from host {} to host {} ", vm.getInstanceName(), srcHostId, dest.getHost().getId());
collectVmDiskAndNetworkStatistics(vmId, State.Running);
_itMgr.migrate(vm.getUuid(), srcHostId, dest);
return findMigratedVm(vm.getId(), vm.getType());
@@ -7260,6 +7261,7 @@ protected void validateStrictHostTagCheck(VMInstanceVO vm, HostVO host) {
private DeployDestination checkVmMigrationDestination(VMInstanceVO vm, Host srcHost, Host destinationHost) throws VirtualMachineMigrationException {
if (destinationHost == null) {
+ logger.error("Destination host is null for migration of VM: {}", vm.getInstanceName());
return null;
}
if (destinationHost.getId() == srcHost.getId()) {
From 2399edd3807b8704a555e43e6d9ab63893f05cda Mon Sep 17 00:00:00 2001
From: Suresh Kumar Anaparti
Date: Mon, 12 Jan 2026 12:11:45 +0530
Subject: [PATCH 082/630] [UI] Fix for the login url with nested redirect
parameters (#12356)
---
ui/src/utils/request.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/src/utils/request.js b/ui/src/utils/request.js
index 42b26c9785b1..2317aac04465 100644
--- a/ui/src/utils/request.js
+++ b/ui/src/utils/request.js
@@ -54,7 +54,7 @@ const err = (error) => {
if (response.config && response.config.params && ['forgotPassword', 'listIdps', 'cloudianIsEnabled'].includes(response.config.params.command)) {
return
}
- const originalPath = router.currentRoute.value.fullPath
+ const originalPath = router.currentRoute.value.path
for (const key in response.data) {
if (key.includes('response')) {
if (response.data[key].errortext.includes('not available for user')) {
From 2358632253a0a0da74b81028e6c63aeb49df7e84 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Erik=20B=C3=B6ck?=
<89930804+erikbocks@users.noreply.github.com>
Date: Mon, 12 Jan 2026 04:20:31 -0300
Subject: [PATCH 083/630] Fixed User type accounts being able to change
resource limits of their own domain and account (#12046)
Co-authored-by: Lucas Martins <56271185+lucas-a-martins@users.noreply.github.com>
---
.../com/cloud/resourcelimit/ResourceLimitManagerImpl.java | 5 +++++
.../cloud/resourcelimit/ResourceLimitManagerImplTest.java | 1 +
2 files changed, 6 insertions(+)
diff --git a/server/src/main/java/com/cloud/resourcelimit/ResourceLimitManagerImpl.java b/server/src/main/java/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
index 9a6c8a85f18e..648abf0d9384 100644
--- a/server/src/main/java/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
+++ b/server/src/main/java/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
@@ -903,6 +903,11 @@ protected void addTaggedResourceLimits(List limits, ResourceTyp
public ResourceLimitVO updateResourceLimit(Long accountId, Long domainId, Integer typeId, Long max, String tag) {
Account caller = CallContext.current().getCallingAccount();
+ if (caller.getType().equals(Account.Type.NORMAL)) {
+ logger.info("Throwing exception because only root admins and domain admins are allowed to update resource limits.");
+ throw new PermissionDeniedException("Your account does not have the permission to update resource limits.");
+ }
+
if (max == null) {
max = (long)Resource.RESOURCE_UNLIMITED;
} else if (max < Resource.RESOURCE_UNLIMITED) {
diff --git a/server/src/test/java/com/cloud/resourcelimit/ResourceLimitManagerImplTest.java b/server/src/test/java/com/cloud/resourcelimit/ResourceLimitManagerImplTest.java
index a968a2da0b7d..0b0b8c5e43fe 100644
--- a/server/src/test/java/com/cloud/resourcelimit/ResourceLimitManagerImplTest.java
+++ b/server/src/test/java/com/cloud/resourcelimit/ResourceLimitManagerImplTest.java
@@ -147,6 +147,7 @@ public void setUp() throws Exception {
overrideDefaultConfigValue(ResourceLimitService.ResourceLimitStorageTags, "_defaultValue", StringUtils.join(storageTags, ","));
Account account = mock(Account.class);
+ when(account.getType()).thenReturn(Account.Type.ADMIN);
User user = mock(User.class);
CallContext.register(user, account);
}
From db1c7d678cc5505a926193e119991eb87d86cf33 Mon Sep 17 00:00:00 2001
From: Suresh Kumar Anaparti
Date: Mon, 12 Jan 2026 12:51:19 +0530
Subject: [PATCH 084/630] Updated protobuf version to 3.25.5, and protobuf &
jackson maven dependencies (#12389)
---
plugins/hypervisors/kvm/pom.xml | 25 +++++++++++++++++++++++++
pom.xml | 12 ++++++++++++
utils/pom.xml | 5 +++++
3 files changed, 42 insertions(+)
diff --git a/plugins/hypervisors/kvm/pom.xml b/plugins/hypervisors/kvm/pom.xml
index 096c0362ee4e..e2e1721b3a7b 100644
--- a/plugins/hypervisors/kvm/pom.xml
+++ b/plugins/hypervisors/kvm/pom.xml
@@ -67,6 +67,31 @@
java-linstor
${cs.java-linstor.version}
+
+ com.fasterxml.jackson.core
+ jackson-core
+ ${cs.jackson.version}
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+ ${cs.jackson.version}
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ ${cs.jackson.version}
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-jsr310
+ ${cs.jackson.version}
+
+
+ com.fasterxml.jackson.module
+ jackson-module-jaxb-annotations
+ ${cs.jackson.version}
+
net.java.dev.jna
jna
diff --git a/pom.xml b/pom.xml
index b51ed12fdedd..6985108302df 100644
--- a/pom.xml
+++ b/pom.xml
@@ -190,6 +190,7 @@
5.3.26
0.5.4
3.1.7
+ 3.25.5
@@ -727,6 +728,17 @@
xml-apis
2.0.2
+
+
+ com.google.protobuf
+ protobuf-java
+ ${cs.protobuf.version}
+
+
+ com.google.protobuf
+ protobuf-java-util
+ ${cs.protobuf.version}
+
com.linbit.linstor.api
java-linstor
diff --git a/utils/pom.xml b/utils/pom.xml
index 6c3673646002..6b8b1249423c 100755
--- a/utils/pom.xml
+++ b/utils/pom.xml
@@ -196,6 +196,11 @@
jackson-databind
${cs.jackson.version}
+
+ com.fasterxml.jackson.dataformat
+ jackson-dataformat-cbor
+ ${cs.jackson.version}
+
org.apache.commons
commons-compress
From 0e6d2d986b7022648bdb5550060aeb7b7fe76bf4 Mon Sep 17 00:00:00 2001
From: Abhishek Kumar
Date: Mon, 12 Jan 2026 13:23:37 +0530
Subject: [PATCH 085/630] ui: prevent calling listConfigurations when not
allowed (#11704)
By default, normal users won't have access to listConfigurations API,
therefore, UI should not call it when access is not there.
Signed-off-by: Abhishek Kumar
---
ui/src/store/modules/user.js | 18 ++++++++++--------
.../views/image/RegisterOrUploadTemplate.vue | 3 +++
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/ui/src/store/modules/user.js b/ui/src/store/modules/user.js
index fc1b0dc25a97..21cd603e378c 100644
--- a/ui/src/store/modules/user.js
+++ b/ui/src/store/modules/user.js
@@ -539,14 +539,16 @@ const user = {
reject(error)
})
- api('listConfigurations', { name: 'hypervisor.custom.display.name' }).then(json => {
- if (json.listconfigurationsresponse.configuration !== null) {
- const config = json.listconfigurationsresponse.configuration[0]
- commit('SET_CUSTOM_HYPERVISOR_NAME', config.value)
- }
- }).catch(error => {
- reject(error)
- })
+ if ('listConfigurations' in store.getters.apis) {
+ api('listConfigurations', { name: 'hypervisor.custom.display.name' }).then(json => {
+ if (json.listconfigurationsresponse.configuration !== null) {
+ const config = json.listconfigurationsresponse.configuration[0]
+ commit('SET_CUSTOM_HYPERVISOR_NAME', config.value)
+ }
+ }).catch(error => {
+ reject(error)
+ })
+ }
})
},
UpdateConfiguration ({ commit }) {
diff --git a/ui/src/views/image/RegisterOrUploadTemplate.vue b/ui/src/views/image/RegisterOrUploadTemplate.vue
index c3f812773be5..76df7b246aa1 100644
--- a/ui/src/views/image/RegisterOrUploadTemplate.vue
+++ b/ui/src/views/image/RegisterOrUploadTemplate.vue
@@ -646,6 +646,9 @@ export default {
})
},
fetchCustomHypervisorName () {
+ if (!('listConfigurations' in this.$store.getters.apis)) {
+ return
+ }
const params = {
name: 'hypervisor.custom.display.name'
}
From c7cfeb5caa1a5d40864ae7f7530bf6563cea6f31 Mon Sep 17 00:00:00 2001
From: Abhisar Sinha <63767682+abh1sar@users.noreply.github.com>
Date: Mon, 12 Jan 2026 13:43:12 +0530
Subject: [PATCH 086/630] fix location constraint ceph error (#12285)
---
.../storage/datastore/driver/CephObjectStoreDriverImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/storage/object/ceph/src/main/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImpl.java b/plugins/storage/object/ceph/src/main/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImpl.java
index 12920e37907d..9af558cf6e3c 100644
--- a/plugins/storage/object/ceph/src/main/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImpl.java
+++ b/plugins/storage/object/ceph/src/main/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImpl.java
@@ -350,7 +350,7 @@ protected AmazonS3 getS3Client(String url, String accessKey, String secretKey) {
new AWSStaticCredentialsProvider(
new BasicAWSCredentials(accessKey, secretKey)))
.withEndpointConfiguration(
- new AwsClientBuilder.EndpointConfiguration(url, null))
+ new AwsClientBuilder.EndpointConfiguration(url, "us-east-1"))
.build();
if (client == null) {
From 2b373a4659526a43db0ed30ca39927b0183c95de Mon Sep 17 00:00:00 2001
From: Suresh Kumar Anaparti
Date: Mon, 12 Jan 2026 14:18:35 +0530
Subject: [PATCH 087/630] [UI] Fix primary storage details display when the
uuid has divergent pattern (#12307)
* [UI] Fix primary storage details display when the uuid has different pattern (eg. for pools with SolidFireShared provider)
* Fix on refresh
---------
Co-authored-by: vishesh92
---
ui/src/components/view/InfoCard.vue | 2 +-
ui/src/components/view/ListView.vue | 4 ++--
ui/src/components/view/VolumesTab.vue | 2 +-
ui/src/components/widgets/Breadcrumb.vue | 2 +-
ui/src/config/router.js | 4 ++--
ui/src/views/image/IsoZones.vue | 2 +-
ui/src/views/image/TemplateZones.vue | 2 +-
ui/src/views/storage/SnapshotZones.vue | 2 +-
8 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/ui/src/components/view/InfoCard.vue b/ui/src/components/view/InfoCard.vue
index f1efcaef281e..0272df028a35 100644
--- a/ui/src/components/view/InfoCard.vue
+++ b/ui/src/components/view/InfoCard.vue
@@ -622,7 +622,7 @@
{{ $t('label.storagepool') }}
-
{{ resource.storage || resource.storageid }}
+
{{ resource.storage || resource.storageid }}
{{ resource.storage || resource.storageid }}
{{ resource.storagetype }}
diff --git a/ui/src/components/view/ListView.vue b/ui/src/components/view/ListView.vue
index 0109784047a5..a02fb5569ed7 100644
--- a/ui/src/components/view/ListView.vue
+++ b/ui/src/components/view/ListView.vue
@@ -94,7 +94,7 @@
{{ $t(text.toLowerCase()) }}
- {{ text }}
+ {{ text }}
{{ text }}
@@ -306,7 +306,7 @@
{{ text }}
- {{ text }}
+ {{ text }}
{{ text }}
diff --git a/ui/src/components/view/VolumesTab.vue b/ui/src/components/view/VolumesTab.vue
index 7805e5b8d87f..498640dcd460 100644
--- a/ui/src/components/view/VolumesTab.vue
+++ b/ui/src/components/view/VolumesTab.vue
@@ -41,7 +41,7 @@
{{ parseFloat(record.size / (1024.0 * 1024.0 * 1024.0)).toFixed(2) }} GB
- {{ text }}
+ {{ text }}
{{ text }}
diff --git a/ui/src/components/widgets/Breadcrumb.vue b/ui/src/components/widgets/Breadcrumb.vue
index 147e779502bf..4723417f5398 100644
--- a/ui/src/components/widgets/Breadcrumb.vue
+++ b/ui/src/components/widgets/Breadcrumb.vue
@@ -100,7 +100,7 @@ export default {
this.breadList = []
this.$route.matched.forEach((item, idx) => {
const parent = this.$route.matched[idx - 1]
- if (item && parent && parent.name !== 'index' && !item.path.endsWith(':id')) {
+ if (item && parent && parent.name !== 'index' && !item.path.endsWith(':id') && !item.path.endsWith(':id(.*)')) {
this.breadList.pop()
}
this.breadList.push(item)
diff --git a/ui/src/config/router.js b/ui/src/config/router.js
index aa85f452b734..f8ff3e001385 100644
--- a/ui/src/config/router.js
+++ b/ui/src/config/router.js
@@ -90,7 +90,7 @@ function generateRouterMap (section) {
hideChildrenInMenu: true,
children: [
{
- path: '/' + child.name + '/:id',
+ path: '/' + child.name + '/:id(.*)',
hidden: child.hidden,
meta: {
title: child.title,
@@ -145,7 +145,7 @@ function generateRouterMap (section) {
map.meta.tabs = section.tabs
map.children = [{
- path: '/' + section.name + '/:id',
+ path: '/' + section.name + '/:id(.*)',
actions: section.actions ? section.actions : [],
meta: {
title: section.title,
diff --git a/ui/src/views/image/IsoZones.vue b/ui/src/views/image/IsoZones.vue
index 75eac8fd97f5..f14ec92b3f66 100644
--- a/ui/src/views/image/IsoZones.vue
+++ b/ui/src/views/image/IsoZones.vue
@@ -90,7 +90,7 @@
:rowKey="record => record.zoneid">
-
+
{{ text }}
diff --git a/ui/src/views/image/TemplateZones.vue b/ui/src/views/image/TemplateZones.vue
index 655e43c91555..27c5949ec8f1 100644
--- a/ui/src/views/image/TemplateZones.vue
+++ b/ui/src/views/image/TemplateZones.vue
@@ -80,7 +80,7 @@
:rowKey="record => record.datastoreId">
-
+
{{ text }}
diff --git a/ui/src/views/storage/SnapshotZones.vue b/ui/src/views/storage/SnapshotZones.vue
index 66bd0f3a9d08..c8cac588988b 100644
--- a/ui/src/views/storage/SnapshotZones.vue
+++ b/ui/src/views/storage/SnapshotZones.vue
@@ -38,7 +38,7 @@
-
+
From 8dcfc7c7678dadfe8f0d3974888871b53f2d48c7 Mon Sep 17 00:00:00 2001
From: Rene Peinthor
Date: Mon, 12 Jan 2026 11:29:31 +0100
Subject: [PATCH 088/630] Linstor fix host picking (#12047)
---
.../LinstorPrimaryDataStoreDriverImpl.java | 101 ++++++++++--------
1 file changed, 55 insertions(+), 46 deletions(-)
diff --git a/plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java b/plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java
index 306e92599366..c2bce6e5a046 100644
--- a/plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java
+++ b/plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java
@@ -63,6 +63,8 @@
import com.cloud.api.storage.LinstorRevertBackupSnapshotCommand;
import com.cloud.configuration.Config;
import com.cloud.host.Host;
+import com.cloud.host.HostVO;
+import com.cloud.host.Status;
import com.cloud.host.dao.HostDao;
import com.cloud.resource.ResourceState;
import com.cloud.storage.DataStoreRole;
@@ -921,9 +923,10 @@ private String revertSnapshotFromImageStore(
_backupsnapshotwait,
VirtualMachineManager.ExecuteInSequence.value());
- Optional optEP = getDiskfullEP(linstorApi, rscName);
+ final StoragePool pool = (StoragePool) volumeInfo.getDataStore();
+ Optional optEP = getDiskfullEP(linstorApi, pool, rscName);
if (optEP.isEmpty()) {
- optEP = getLinstorEP(linstorApi, rscName);
+ optEP = getLinstorEP(linstorApi, pool, rscName);
}
if (optEP.isPresent()) {
@@ -1063,13 +1066,29 @@ public void copyAsync(DataObject srcData, DataObject dstData, AsyncCompletionCal
Answer answer = copyVolume(srcData, dstData);
res = new CopyCommandResult(null, answer);
} else {
- Answer answer = new Answer(null, false, "noimpl");
- res = new CopyCommandResult(null, answer);
- res.setResult("Not implemented yet");
+ throw new CloudRuntimeException("Not implemented for Linstor primary storage.");
}
callback.complete(res);
}
+ private Host getEnabledClusterHost(StoragePool storagePool, List linstorNodeNames) {
+ List csHosts;
+ if (storagePool.getClusterId() != null) {
+ csHosts = _hostDao.findByClusterId(storagePool.getClusterId());
+ } else {
+ csHosts = _hostDao.findByDataCenterId(storagePool.getDataCenterId());
+ }
+ Collections.shuffle(csHosts); // so we do not always pick the same host for operations
+ for (HostVO host : csHosts) {
+ if (host.getResourceState() == ResourceState.Enabled &&
+ host.getStatus() == Status.Up &&
+ linstorNodeNames.contains(host.getName())) {
+ return host;
+ }
+ }
+ return null;
+ }
+
/**
* Tries to get a Linstor cloudstack end point, that is at least diskless.
*
@@ -1078,47 +1097,37 @@ public void copyAsync(DataObject srcData, DataObject dstData, AsyncCompletionCal
* @return Optional RemoteHostEndPoint if one could get found.
* @throws ApiException
*/
- private Optional getLinstorEP(DevelopersApi api, String rscName) throws ApiException {
+ private Optional getLinstorEP(DevelopersApi api, StoragePool storagePool, String rscName)
+ throws ApiException {
List linstorNodeNames = LinstorUtil.getLinstorNodeNames(api);
- Collections.shuffle(linstorNodeNames); // do not always pick the first linstor node
-
- Host host = null;
- for (String nodeName : linstorNodeNames) {
- host = _hostDao.findByName(nodeName);
- if (host != null && host.getResourceState() == ResourceState.Enabled) {
- logger.info(String.format("Linstor: Make resource %s available on node %s ...", rscName, nodeName));
- ApiCallRcList answers = api.resourceMakeAvailableOnNode(rscName, nodeName, new ResourceMakeAvailable());
- if (!answers.hasError()) {
- break; // found working host
- } else {
- logger.error(
- String.format("Linstor: Unable to make resource %s on node %s available: %s",
- rscName,
- nodeName,
- LinstorUtil.getBestErrorMessage(answers)));
- }
+ Host host = getEnabledClusterHost(storagePool, linstorNodeNames);
+ if (host != null) {
+ logger.info("Linstor: Make resource {} available on node {} ...", rscName, host.getName());
+ ApiCallRcList answers = api.resourceMakeAvailableOnNode(
+ rscName, host.getName(), new ResourceMakeAvailable());
+ if (answers.hasError()) {
+ logger.error("Linstor: Unable to make resource {} on node {} available: {}",
+ rscName, host.getName(), LinstorUtil.getBestErrorMessage(answers));
+ return Optional.empty();
+ } else {
+ return Optional.of(RemoteHostEndPoint.getHypervisorHostEndPoint(host));
}
}
- if (host == null)
- {
- logger.error("Linstor: Couldn't create a resource on any cloudstack host.");
- return Optional.empty();
- }
- else
- {
- return Optional.of(RemoteHostEndPoint.getHypervisorHostEndPoint(host));
- }
+ logger.error("Linstor: Couldn't create a resource on any cloudstack host.");
+ return Optional.empty();
}
- private Optional getDiskfullEP(DevelopersApi api, String rscName) throws ApiException {
+ private Optional getDiskfullEP(DevelopersApi api, StoragePool storagePool, String rscName)
+ throws ApiException {
List linSPs = LinstorUtil.getDiskfulStoragePools(api, rscName);
if (linSPs != null) {
- for (com.linbit.linstor.api.model.StoragePool sp : linSPs) {
- Host host = _hostDao.findByName(sp.getNodeName());
- if (host != null && host.getResourceState() == ResourceState.Enabled) {
- return Optional.of(RemoteHostEndPoint.getHypervisorHostEndPoint(host));
- }
+ List linstorNodeNames = linSPs.stream()
+ .map(com.linbit.linstor.api.model.StoragePool::getNodeName)
+ .collect(Collectors.toList());
+ Host host = getEnabledClusterHost(storagePool, linstorNodeNames);
+ if (host != null) {
+ return Optional.of(RemoteHostEndPoint.getHypervisorHostEndPoint(host));
}
}
logger.error("Linstor: No diskfull host found.");
@@ -1199,12 +1208,12 @@ private Answer copyTemplate(DataObject srcData, DataObject dstData) {
VirtualMachineManager.ExecuteInSequence.value());
try {
- Optional optEP = getLinstorEP(api, rscName);
+ Optional optEP = getLinstorEP(api, pool, rscName);
if (optEP.isPresent()) {
answer = optEP.get().sendMessage(cmd);
} else {
- answer = new Answer(cmd, false, "Unable to get matching Linstor endpoint.");
deleteResourceDefinition(pool, rscName);
+ throw new CloudRuntimeException("Unable to get matching Linstor endpoint.");
}
} catch (ApiException exc) {
logger.error("copy template failed: ", exc);
@@ -1241,12 +1250,12 @@ private Answer copyVolume(DataObject srcData, DataObject dstData) {
Answer answer;
try {
- Optional optEP = getLinstorEP(api, rscName);
+ Optional optEP = getLinstorEP(api, pool, rscName);
if (optEP.isPresent()) {
answer = optEP.get().sendMessage(cmd);
}
else {
- answer = new Answer(cmd, false, "Unable to get matching Linstor endpoint.");
+ throw new CloudRuntimeException("Unable to get matching Linstor endpoint.");
}
} catch (ApiException exc) {
logger.error("copy volume failed: ", exc);
@@ -1279,14 +1288,14 @@ private Answer copyFromTemporaryResource(
try {
String devName = restoreResourceFromSnapshot(api, pool, rscName, snapshotName, restoreName);
- Optional optEPAny = getLinstorEP(api, restoreName);
+ Optional optEPAny = getLinstorEP(api, pool, restoreName);
if (optEPAny.isPresent()) {
// patch the src device path to the temporary linstor resource
snapshotObject.setPath(devName);
origCmd.setSrcTO(snapshotObject.getTO());
answer = optEPAny.get().sendMessage(origCmd);
- } else{
- answer = new Answer(origCmd, false, "Unable to get matching Linstor endpoint.");
+ } else {
+ throw new CloudRuntimeException("Unable to get matching Linstor endpoint.");
}
} finally {
// delete the temporary resource, noop if already gone
@@ -1348,7 +1357,7 @@ protected Answer copySnapshot(DataObject srcData, DataObject destData) {
VirtualMachineManager.ExecuteInSequence.value());
cmd.setOptions(options);
- Optional optEP = getDiskfullEP(api, rscName);
+ Optional optEP = getDiskfullEP(api, pool, rscName);
Answer answer;
if (optEP.isPresent()) {
answer = optEP.get().sendMessage(cmd);
From b8813c7b243787b8b33080d7fea3327d709bcccf Mon Sep 17 00:00:00 2001
From: Suresh Kumar Anaparti
Date: Mon, 12 Jan 2026 16:50:15 +0530
Subject: [PATCH 089/630] UI: Add info for 'Use primary storage replication' in
snapshot view(s) (#11943)
---
.../api/command/user/snapshot/CopySnapshotCmd.java | 6 +++++-
.../api/command/user/snapshot/CreateSnapshotCmd.java | 5 ++++-
.../command/user/snapshot/CreateSnapshotPolicyCmd.java | 6 +++++-
.../com/cloud/storage/snapshot/SnapshotManager.java | 4 +++-
ui/src/views/storage/FormSchedule.vue | 8 +++++++-
ui/src/views/storage/SnapshotZones.vue | 7 ++++++-
ui/src/views/storage/TakeSnapshot.vue | 10 ++++++++--
7 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CopySnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CopySnapshotCmd.java
index ac54ebbd8f8c..519f9876b960 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CopySnapshotCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CopySnapshotCmd.java
@@ -97,7 +97,11 @@ public class CopySnapshotCmd extends BaseAsyncCmd implements UserCmd {
"The snapshot will always be made available in the zone in which the volume is present. Currently supported for StorPool only")
protected List storagePoolIds;
- @Parameter (name = ApiConstants.USE_STORAGE_REPLICATION, type=CommandType.BOOLEAN, required = false, since = "4.21.0", description = "This parameter enables the option the snapshot to be copied to supported primary storage")
+ @Parameter (name = ApiConstants.USE_STORAGE_REPLICATION,
+ type=CommandType.BOOLEAN,
+ since = "4.21.0",
+ description = "Enables the snapshot to be copied to the supported primary storages when the config 'use.storage.replication' is set to true for the storage or globally. " +
+ "This is supported only for StorPool storage for now.")
protected Boolean useStorageReplication;
/////////////////////////////////////////////////////
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
index 3a49bad8fcb9..f78112d679fe 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
@@ -112,7 +112,10 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
since = "4.21.0")
protected List storagePoolIds;
- @Parameter (name = ApiConstants.USE_STORAGE_REPLICATION, type=CommandType.BOOLEAN, required = false, description = "This parameter enables the option the snapshot to be copied to supported primary storage")
+ @Parameter (name = ApiConstants.USE_STORAGE_REPLICATION,
+ type=CommandType.BOOLEAN,
+ description = "Enables the snapshot to be copied to the supported primary storages when the config 'use.storage.replication' is set to true for the storage or globally. " +
+ "This is supported only for StorPool storage for now.")
protected Boolean useStorageReplication;
private String syncObjectType = BaseAsyncCmd.snapshotHostSyncObject;
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
index 24d756befaba..b1e7b2a00040 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
@@ -94,7 +94,11 @@ public class CreateSnapshotPolicyCmd extends BaseCmd {
since = "4.21.0")
protected List storagePoolIds;
- @Parameter (name = ApiConstants.USE_STORAGE_REPLICATION, type=CommandType.BOOLEAN, required = false, since = "4.21.0", description = "This parameter enables the option the snapshot to be copied to supported primary storage")
+ @Parameter (name = ApiConstants.USE_STORAGE_REPLICATION,
+ type=CommandType.BOOLEAN,
+ since = "4.21.0",
+ description = "Enables the snapshot to be copied to the supported primary storages when the config 'use.storage.replication' is set to true for the storage or globally. " +
+ "This is supported only for StorPool storage for now.")
protected Boolean useStorageReplication;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
diff --git a/server/src/main/java/com/cloud/storage/snapshot/SnapshotManager.java b/server/src/main/java/com/cloud/storage/snapshot/SnapshotManager.java
index b245a3719694..10dcc2683de8 100644
--- a/server/src/main/java/com/cloud/storage/snapshot/SnapshotManager.java
+++ b/server/src/main/java/com/cloud/storage/snapshot/SnapshotManager.java
@@ -68,7 +68,9 @@ public interface SnapshotManager extends Configurable {
"Whether to show chain size (sum of physical size of snapshot and all its parents) for incremental snapshots in the snapshot response",
true, ConfigKey.Scope.Global, null);
- public static final ConfigKey UseStorageReplication = new ConfigKey(Boolean.class, "use.storage.replication", "Snapshots", "false", "For snapshot copy to another primary storage in a different zone. Supports only StorPool storage for now", true, ConfigKey.Scope.StoragePool, null);
+ ConfigKey UseStorageReplication = new ConfigKey<>(Boolean.class, "use.storage.replication", "Snapshots", "false",
+ "For snapshot copy to another primary storage in a different zone. This is supported only for StorPool storage for now.",
+ true, ConfigKey.Scope.StoragePool, null);
void deletePoliciesForVolume(Long volumeId);
diff --git a/ui/src/views/storage/FormSchedule.vue b/ui/src/views/storage/FormSchedule.vue
index 433e399d2a8c..baecd3bb5be8 100644
--- a/ui/src/views/storage/FormSchedule.vue
+++ b/ui/src/views/storage/FormSchedule.vue
@@ -174,7 +174,10 @@
-
+
+
+
+
@@ -310,6 +313,9 @@ export default {
storagePools: []
}
},
+ beforeCreate () {
+ this.apiParams = this.$getApiParams('createSnapshotPolicy')
+ },
created () {
this.initForm()
this.volumeId = this.resource.id
diff --git a/ui/src/views/storage/SnapshotZones.vue b/ui/src/views/storage/SnapshotZones.vue
index ed46ce4172ad..f37996a3f293 100644
--- a/ui/src/views/storage/SnapshotZones.vue
+++ b/ui/src/views/storage/SnapshotZones.vue
@@ -137,7 +137,10 @@
-
+
+
+
+
@@ -236,6 +239,7 @@ import { isAdmin } from '@/role'
import OsLogo from '@/components/widgets/OsLogo'
import ResourceIcon from '@/components/view/ResourceIcon'
import TooltipButton from '@/components/widgets/TooltipButton'
+import TooltipLabel from '@/components/widgets/TooltipLabel'
import BulkActionProgress from '@/components/view/BulkActionProgress'
import Status from '@/components/widgets/Status'
import eventBus from '@/config/eventBus'
@@ -244,6 +248,7 @@ export default {
name: 'SnapshotZones',
components: {
TooltipButton,
+ TooltipLabel,
OsLogo,
ResourceIcon,
BulkActionProgress,
diff --git a/ui/src/views/storage/TakeSnapshot.vue b/ui/src/views/storage/TakeSnapshot.vue
index fc80e6d775f9..9e17e0683b83 100644
--- a/ui/src/views/storage/TakeSnapshot.vue
+++ b/ui/src/views/storage/TakeSnapshot.vue
@@ -66,7 +66,10 @@
-
+
+
+
+
@@ -93,7 +96,10 @@
-
+
+
+
+
From 8627c60b9517e53510c612104fc5925c79a4797d Mon Sep 17 00:00:00 2001
From: Abhishek Kumar
Date: Mon, 12 Jan 2026 18:57:04 +0530
Subject: [PATCH 090/630] ui: option to migrate vm with volumes to same pool
(#11703)
Signed-off-by: Abhishek Kumar
---
ui/public/locales/en.json | 2 +
...stanceVolumesStoragePoolSelectListView.vue | 12 +++-
.../view/VolumeStoragePoolSelectForm.vue | 16 ++++-
ui/src/views/compute/MigrateWizard.vue | 60 +++++++++++++++----
.../unit/views/compute/MigrateWizard.spec.js | 52 ++++++++--------
5 files changed, 101 insertions(+), 41 deletions(-)
diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json
index 624a13d1e216..791091e8e2aa 100644
--- a/ui/public/locales/en.json
+++ b/ui/public/locales/en.json
@@ -380,6 +380,7 @@
"label.app.name": "CloudStack",
"label.application.policy.set": "Application Policy Set",
"label.apply": "Apply",
+"label.apply.to.all": "Apply to all",
"label.apply.tungsten.firewall.policy": "Apply Firewall Policy",
"label.apply.tungsten.network.policy": "Apply Network Policy",
"label.apply.tungsten.tag": "Apply tag",
@@ -3692,6 +3693,7 @@
"message.vnf.nic.move.down.fail": "Failed to move down this NIC",
"message.vnf.no.credentials": "No credentials found for the VNF appliance.",
"message.vnf.select.networks": "Please select the relevant network for each VNF NIC.",
+"message.volume.pool.apply.to.all": "Selected storage pool will be applied to all existing volumes of the instance.",
"message.volume.state.allocated": "The volume is allocated but has not been created yet.",
"message.volume.state.attaching": "The volume is attaching to a volume from Ready state.",
"message.volume.state.copying": "The volume is being copied from the image store to primary storage, in case it's an uploaded volume.",
diff --git a/ui/src/components/view/InstanceVolumesStoragePoolSelectListView.vue b/ui/src/components/view/InstanceVolumesStoragePoolSelectListView.vue
index 77f3e8f91f47..67a2bceb23e5 100644
--- a/ui/src/components/view/InstanceVolumesStoragePoolSelectListView.vue
+++ b/ui/src/components/view/InstanceVolumesStoragePoolSelectListView.vue
@@ -206,13 +206,19 @@ export default {
closeVolumeStoragePoolSelector () {
this.selectedVolumeForStoragePoolSelection = {}
},
- handleVolumeStoragePoolSelection (volumeId, storagePool) {
+ handleVolumeStoragePoolSelection (volumeId, storagePool, applyToAll) {
for (const volume of this.volumes) {
- if (volume.id === volumeId) {
+ if (applyToAll) {
volume.selectedstorageid = storagePool.id
volume.selectedstoragename = storagePool.name
volume.selectedstorageclusterid = storagePool.clusterid
- break
+ } else {
+ if (volume.id === volumeId) {
+ volume.selectedstorageid = storagePool.id
+ volume.selectedstoragename = storagePool.name
+ volume.selectedstorageclusterid = storagePool.clusterid
+ break
+ }
}
}
this.updateVolumeToStoragePoolSelection()
diff --git a/ui/src/components/view/VolumeStoragePoolSelectForm.vue b/ui/src/components/view/VolumeStoragePoolSelectForm.vue
index eea416faa1a4..9981418ee14d 100644
--- a/ui/src/components/view/VolumeStoragePoolSelectForm.vue
+++ b/ui/src/components/view/VolumeStoragePoolSelectForm.vue
@@ -25,6 +25,15 @@
:autoAssignAllowed="autoAssignAllowed"
@select="handleSelect" />
+
+
+
+
+
+
+
@@ -36,11 +45,13 @@
-
diff --git a/ui/src/views/network/UpdateVpnCustomerGateway.vue b/ui/src/views/network/UpdateVpnCustomerGateway.vue
new file mode 100644
index 000000000000..2d54e8e031ed
--- /dev/null
+++ b/ui/src/views/network/UpdateVpnCustomerGateway.vue
@@ -0,0 +1,129 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+
+
+
diff --git a/ui/src/views/network/VpnCustomerGateway.vue b/ui/src/views/network/VpnCustomerGateway.vue
new file mode 100644
index 000000000000..c1b1ed78ce06
--- /dev/null
+++ b/ui/src/views/network/VpnCustomerGateway.vue
@@ -0,0 +1,581 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ algo }}
+
+
+
+
+
+
+
+
+ {{ form.ikeEncryption }} {{ $t('message.vpn.customer.gateway.excluded.parameter') }}
+
+
+
+
+
+ {{ form.ikeEncryption }} {{ $t('message.vpn.customer.gateway.obsolete.parameter') }}
+
+
+
+
+
+
+ {{ h }}
+
+
+
+
+
+
+
+
+ {{ form.ikeHash }} {{ $t('message.vpn.customer.gateway.excluded.parameter') }}
+
+
+
+
+
+ {{ form.ikeHash }} {{ $t('message.vpn.customer.gateway.obsolete.parameter') }}
+
+
+
+
+
+
+
+
+
+ {{ vers }}
+
+
+
+
+
+
+
+
+ {{ form.ikeversion }} {{ $t('message.vpn.customer.gateway.excluded.parameter') }}
+
+
+
+
+
+ {{ form.ikeversion }} {{ $t('message.vpn.customer.gateway.obsolete.parameter') }}
+
+
+
+
+
+
+
+ {{ group+"("+DHGroups[group]+")" }}
+
+
+
+
+
+
+
+
+
+ {{ form.ikeDh }} {{ $t('message.vpn.customer.gateway.excluded.parameter') }}
+
+
+
+
+
+ {{ form.ikeDh }} {{ $t('message.vpn.customer.gateway.obsolete.parameter') }}
+
+
+
+
+
+
+ {{ algo }}
+
+
+
+
+
+
+
+
+ {{ form.espEncryption }} {{ $t('message.vpn.customer.gateway.excluded.parameter') }}
+
+
+
+
+
+ {{ form.espEncryption }} {{ $t('message.vpn.customer.gateway.obsolete.parameter') }}
+
+
+
+
+
+
+ {{ h }}
+
+
+
+
+
+
+
+
+ {{ form.espHash }} {{ $t('message.vpn.customer.gateway.excluded.parameter') }}
+
+
+
+
+
+ {{ form.espHash }} {{ $t('message.vpn.customer.gateway.obsolete.parameter') }}
+
+
+
+
+
+
+
+ {{ DHGroups[group] }}
+
+
+ {{ group+"("+DHGroups[group]+")" }}
+
+
+
+
+
+
+
+
+
+ {{ form.perfectForwardSecrecy }} {{ $t('message.vpn.customer.gateway.excluded.parameter') }}
+
+
+
+
+
+ {{ form.perfectForwardSecrecy }} {{ $t('message.vpn.customer.gateway.obsolete.parameter') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From a4b1a27c7d2d93a1da698a7115900b3205c1077e Mon Sep 17 00:00:00 2001
From: Abhishek Kumar
Date: Mon, 19 Jan 2026 13:20:07 +0530
Subject: [PATCH 101/630] ui: fix 404 on login after forgot password (#12448)
Signed-off-by: Abhishek Kumar
---
ui/src/views/auth/ForgotPassword.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/src/views/auth/ForgotPassword.vue b/ui/src/views/auth/ForgotPassword.vue
index 87f2d1d0c33e..1e817e01a6e3 100644
--- a/ui/src/views/auth/ForgotPassword.vue
+++ b/ui/src/views/auth/ForgotPassword.vue
@@ -162,7 +162,7 @@ export default {
api('forgotPassword', {}, 'POST', loginParams)
.finally(() => {
this.$message.success(this.$t('message.forgot.password.success'))
- this.$router.push({ path: '/login' }).catch(() => {})
+ this.$router.replace({ path: '/user/login' })
})
}).catch(error => {
this.formRef.value.scrollToField(error.errorFields[0].name)
From 8b2f1f19c27bebf908f9cda53ec1fadd005e2520 Mon Sep 17 00:00:00 2001
From: Pearl Dsilva
Date: Mon, 19 Jan 2026 03:51:47 -0500
Subject: [PATCH 102/630] Support dedicating backup offerings to domains
(#12194)
* Add support for dedicating backup offerings to domains
* Add tests and UI support and update response params
* add license header
* exclude backupofferingdetailsvo from sonar
* fix pre-commit checks - missing / extra EOF line
* add test
* EOF
* filter backup offerings by domain id
* add unit tests
* add more unit tests and remove response file from code coverage check
* update checks
* address review comments: extract common code, fix tests
* added bean definition
* address comments
* add unit tests to increase coverage
* pre-commit check failure fix
* address merge issue
* allow updating backup offering when only domain id is modified
---
.../java/com/cloud/user/AccountService.java | 3 +
.../cloudstack/acl/SecurityChecker.java | 4 +
.../cloudstack/api/BaseBackupListCmd.java | 2 +-
.../admin/backup/ImportBackupOfferingCmd.java | 22 ++
.../admin/backup/UpdateBackupOfferingCmd.java | 28 +-
.../network/UpdateNetworkOfferingCmd.java | 65 +---
.../admin/offering/UpdateDiskOfferingCmd.java | 62 +--
.../offering/UpdateServiceOfferingCmd.java | 62 +--
.../admin/vpc/UpdateVPCOfferingCmd.java | 64 +--
.../offering/DomainAndZoneIdResolver.java | 114 ++++++
.../api/response/BackupOfferingResponse.java | 19 +
.../cloudstack/backup/BackupManager.java | 2 +
.../offering/DomainAndZoneIdResolverTest.java | 149 +++++++
.../backup/BackupOfferingDetailsVO.java | 86 ++++
.../cloudstack/backup/BackupOfferingVO.java | 7 +
.../backup/dao/BackupOfferingDaoImpl.java | 23 +-
.../backup/dao/BackupOfferingDetailsDao.java | 32 ++
.../dao/BackupOfferingDetailsDaoImpl.java | 101 +++++
...s-between-management-and-usage-context.xml | 3 +-
.../META-INF/db/schema-42210to42300.sql | 10 +
.../dao/BackupOfferingDetailsDaoImplTest.java | 251 ++++++++++++
.../hypervisors/ovm3/sonar-project.properties | 2 +-
.../management/MockAccountManager.java | 6 +
pom.xml | 2 +
.../java/com/cloud/acl/DomainChecker.java | 33 ++
.../ConfigurationManagerImpl.java | 47 +--
.../com/cloud/network/vpc/VpcManagerImpl.java | 31 +-
.../com/cloud/user/AccountManagerImpl.java | 16 +
.../java/com/cloud/utils/DomainHelper.java | 63 +++
.../cloudstack/backup/BackupManagerImpl.java | 117 +++++-
.../core/spring-server-core-misc-context.xml | 2 +
.../java/com/cloud/acl/DomainCheckerTest.java | 45 +++
.../ConfigurationManagerImplTest.java | 3 +
.../com/cloud/vm/UserVmManagerImplTest.java | 3 +-
.../cloudstack/backup/BackupManagerTest.java | 366 +++++++++++++++++-
.../CreateNetworkOfferingTest.java | 4 +
tools/marvin/setup.py | 2 +-
ui/src/config/section/offering.js | 6 +-
.../views/offering/ImportBackupOffering.vue | 69 +++-
39 files changed, 1610 insertions(+), 316 deletions(-)
create mode 100644 api/src/main/java/org/apache/cloudstack/api/command/offering/DomainAndZoneIdResolver.java
create mode 100644 api/src/test/java/org/apache/cloudstack/api/command/offering/DomainAndZoneIdResolverTest.java
create mode 100644 engine/schema/src/main/java/org/apache/cloudstack/backup/BackupOfferingDetailsVO.java
create mode 100644 engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDao.java
create mode 100644 engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDaoImpl.java
create mode 100644 engine/schema/src/test/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDaoImplTest.java
create mode 100644 server/src/main/java/com/cloud/utils/DomainHelper.java
diff --git a/api/src/main/java/com/cloud/user/AccountService.java b/api/src/main/java/com/cloud/user/AccountService.java
index 09fe5ffc0590..8f29a2fbc428 100644
--- a/api/src/main/java/com/cloud/user/AccountService.java
+++ b/api/src/main/java/com/cloud/user/AccountService.java
@@ -36,6 +36,7 @@
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.ServiceOffering;
import org.apache.cloudstack.auth.UserTwoFactorAuthenticator;
+import org.apache.cloudstack.backup.BackupOffering;
public interface AccountService {
@@ -115,6 +116,8 @@ User createUser(String userName, String password, String firstName, String lastN
void checkAccess(Account account, VpcOffering vof, DataCenter zone) throws PermissionDeniedException;
+ void checkAccess(Account account, BackupOffering bof) throws PermissionDeniedException;
+
void checkAccess(User user, ControlledEntity entity);
void checkAccess(Account account, AccessType accessType, boolean sameOwner, String apiName, ControlledEntity... entities) throws PermissionDeniedException;
diff --git a/api/src/main/java/org/apache/cloudstack/acl/SecurityChecker.java b/api/src/main/java/org/apache/cloudstack/acl/SecurityChecker.java
index 82a8ec5fe932..fa17df7c6ed4 100644
--- a/api/src/main/java/org/apache/cloudstack/acl/SecurityChecker.java
+++ b/api/src/main/java/org/apache/cloudstack/acl/SecurityChecker.java
@@ -27,6 +27,8 @@
import com.cloud.user.User;
import com.cloud.utils.component.Adapter;
+import org.apache.cloudstack.backup.BackupOffering;
+
/**
* SecurityChecker checks the ownership and access control to objects within
*/
@@ -145,4 +147,6 @@ boolean checkAccess(Account caller, AccessType accessType, String action, Contro
boolean checkAccess(Account account, NetworkOffering nof, DataCenter zone) throws PermissionDeniedException;
boolean checkAccess(Account account, VpcOffering vof, DataCenter zone) throws PermissionDeniedException;
+
+ boolean checkAccess(Account account, BackupOffering bof) throws PermissionDeniedException;
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseBackupListCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseBackupListCmd.java
index 0aa8366bcd5c..2a64a1fb6fd8 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseBackupListCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseBackupListCmd.java
@@ -25,7 +25,7 @@
import org.apache.cloudstack.backup.BackupOffering;
import org.apache.cloudstack.context.CallContext;
-public abstract class BaseBackupListCmd extends BaseListCmd {
+public abstract class BaseBackupListCmd extends BaseListAccountResourcesCmd {
protected void setupResponseBackupOfferingsList(final List offerings, final Integer count) {
final ListResponse response = new ListResponse<>();
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ImportBackupOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ImportBackupOfferingCmd.java
index 2e73698e7aa1..5e702585a2c3 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ImportBackupOfferingCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ImportBackupOfferingCmd.java
@@ -27,6 +27,7 @@
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.BackupOfferingResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.backup.BackupManager;
import org.apache.cloudstack.backup.BackupOffering;
@@ -40,6 +41,11 @@
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.utils.exception.CloudRuntimeException;
+import org.apache.commons.collections.CollectionUtils;
+
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
@APICommand(name = "importBackupOffering",
description = "Imports a backup offering using a backup provider",
@@ -76,6 +82,13 @@ public class ImportBackupOfferingCmd extends BaseAsyncCmd {
description = "Whether users are allowed to create adhoc backups and backup schedules", required = true)
private Boolean userDrivenBackups;
+ @Parameter(name = ApiConstants.DOMAIN_ID,
+ type = CommandType.LIST,
+ collectionType = CommandType.UUID,
+ entityType = DomainResponse.class,
+ description = "the ID of the containing domain(s), null for public offerings")
+ private List domainIds;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -100,6 +113,15 @@ public Boolean getUserDrivenBackups() {
return userDrivenBackups == null ? false : userDrivenBackups;
}
+ public List getDomainIds() {
+ if (CollectionUtils.isNotEmpty(domainIds)) {
+ Set set = new LinkedHashSet<>(domainIds);
+ domainIds.clear();
+ domainIds.addAll(set);
+ }
+ return domainIds;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/UpdateBackupOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/UpdateBackupOfferingCmd.java
index a645b1e0c8db..2f0dd6acd0e1 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/UpdateBackupOfferingCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/UpdateBackupOfferingCmd.java
@@ -25,19 +25,24 @@
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.offering.DomainAndZoneIdResolver;
import org.apache.cloudstack.api.response.BackupOfferingResponse;
import org.apache.cloudstack.backup.BackupManager;
import org.apache.cloudstack.backup.BackupOffering;
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.Account;
import com.cloud.utils.exception.CloudRuntimeException;
+import java.util.List;
+import java.util.function.LongFunction;
+
@APICommand(name = "updateBackupOffering", description = "Updates a backup offering.", responseObject = BackupOfferingResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.16.0")
-public class UpdateBackupOfferingCmd extends BaseCmd {
+public class UpdateBackupOfferingCmd extends BaseCmd implements DomainAndZoneIdResolver {
@Inject
private BackupManager backupManager;
@@ -57,6 +62,13 @@ public class UpdateBackupOfferingCmd extends BaseCmd {
@Parameter(name = ApiConstants.ALLOW_USER_DRIVEN_BACKUPS, type = CommandType.BOOLEAN, description = "Whether to allow user driven backups or not")
private Boolean allowUserDrivenBackups;
+ @Parameter(name = ApiConstants.DOMAIN_ID,
+ type = CommandType.STRING,
+ description = "the ID of the containing domain(s) as comma separated string, public for public offerings",
+ since = "4.23.0",
+ length = 4096)
+ private String domainIds;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -82,7 +94,7 @@ public Boolean getAllowUserDrivenBackups() {
@Override
public void execute() {
try {
- if (StringUtils.isAllEmpty(getName(), getDescription()) && getAllowUserDrivenBackups() == null) {
+ if (StringUtils.isAllEmpty(getName(), getDescription()) && getAllowUserDrivenBackups() == null && CollectionUtils.isEmpty(getDomainIds())) {
throw new InvalidParameterValueException(String.format("Can't update Backup Offering [id: %s] because there are no parameters to be updated, at least one of the",
"following should be informed: name, description or allowUserDrivenBackups.", id));
}
@@ -103,6 +115,18 @@ public void execute() {
}
}
+ public List getDomainIds() {
+ // backupManager may be null in unit tests where the command is spied without injection.
+ // Avoid creating a method reference to a null receiver which causes NPE. When backupManager
+ // is null, pass null as the defaultDomainsProvider so resolveDomainIds will simply return
+ // an empty list or parse the explicit domainIds string.
+ LongFunction> defaultDomainsProvider = null;
+ if (backupManager != null) {
+ defaultDomainsProvider = backupManager::getBackupOfferingDomains;
+ }
+ return resolveDomainIds(domainIds, id, defaultDomainsProvider, "backup offering");
+ }
+
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
index 9af10262b2d5..e3fac81a7932 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
@@ -16,7 +16,6 @@
// under the License.
package org.apache.cloudstack.api.command.admin.network;
-import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
@@ -26,18 +25,16 @@
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.offering.DomainAndZoneIdResolver;
import org.apache.cloudstack.api.response.NetworkOfferingResponse;
-import org.apache.commons.lang3.StringUtils;
-import com.cloud.dc.DataCenter;
-import com.cloud.domain.Domain;
-import com.cloud.exception.InvalidParameterValueException;
+
import com.cloud.offering.NetworkOffering;
import com.cloud.user.Account;
@APICommand(name = "updateNetworkOffering", description = "Updates a network offering.", responseObject = NetworkOfferingResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
-public class UpdateNetworkOfferingCmd extends BaseCmd {
+public class UpdateNetworkOfferingCmd extends BaseCmd implements DomainAndZoneIdResolver {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -129,63 +126,11 @@ public String getTags() {
}
public List getDomainIds() {
- List validDomainIds = new ArrayList<>();
- if (StringUtils.isNotEmpty(domainIds)) {
- if (domainIds.contains(",")) {
- String[] domains = domainIds.split(",");
- for (String domain : domains) {
- Domain validDomain = _entityMgr.findByUuid(Domain.class, domain.trim());
- if (validDomain != null) {
- validDomainIds.add(validDomain.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create network offering because invalid domain has been specified.");
- }
- }
- } else {
- domainIds = domainIds.trim();
- if (!domainIds.matches("public")) {
- Domain validDomain = _entityMgr.findByUuid(Domain.class, domainIds.trim());
- if (validDomain != null) {
- validDomainIds.add(validDomain.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create network offering because invalid domain has been specified.");
- }
- }
- }
- } else {
- validDomainIds.addAll(_configService.getNetworkOfferingDomains(id));
- }
- return validDomainIds;
+ return resolveDomainIds(domainIds, id, _configService::getNetworkOfferingDomains, "network offering");
}
public List getZoneIds() {
- List validZoneIds = new ArrayList<>();
- if (StringUtils.isNotEmpty(zoneIds)) {
- if (zoneIds.contains(",")) {
- String[] zones = zoneIds.split(",");
- for (String zone : zones) {
- DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zone.trim());
- if (validZone != null) {
- validZoneIds.add(validZone.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create network offering because invalid zone has been specified.");
- }
- }
- } else {
- zoneIds = zoneIds.trim();
- if (!zoneIds.matches("all")) {
- DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zoneIds.trim());
- if (validZone != null) {
- validZoneIds.add(validZone.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create network offering because invalid zone has been specified.");
- }
- }
- }
- } else {
- validZoneIds.addAll(_configService.getNetworkOfferingZones(id));
- }
- return validZoneIds;
+ return resolveZoneIds(zoneIds, id, _configService::getNetworkOfferingZones, "network offering");
}
/////////////////////////////////////////////////////
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java
index 2f07f85f9836..917d7ff42d82 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java
@@ -16,7 +16,6 @@
// under the License.
package org.apache.cloudstack.api.command.admin.offering;
-import java.util.ArrayList;
import java.util.List;
import com.cloud.offering.DiskOffering.State;
@@ -27,19 +26,18 @@
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.offering.DomainAndZoneIdResolver;
import org.apache.cloudstack.api.response.DiskOfferingResponse;
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.StringUtils;
-import com.cloud.dc.DataCenter;
-import com.cloud.domain.Domain;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.offering.DiskOffering;
import com.cloud.user.Account;
@APICommand(name = "updateDiskOffering", description = "Updates a disk offering.", responseObject = DiskOfferingResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
-public class UpdateDiskOfferingCmd extends BaseCmd {
+public class UpdateDiskOfferingCmd extends BaseCmd implements DomainAndZoneIdResolver {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -151,63 +149,11 @@ public Boolean getDisplayOffering() {
}
public List getDomainIds() {
- List validDomainIds = new ArrayList<>();
- if (StringUtils.isNotEmpty(domainIds)) {
- if (domainIds.contains(",")) {
- String[] domains = domainIds.split(",");
- for (String domain : domains) {
- Domain validDomain = _entityMgr.findByUuid(Domain.class, domain.trim());
- if (validDomain != null) {
- validDomainIds.add(validDomain.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create disk offering because invalid domain has been specified.");
- }
- }
- } else {
- domainIds = domainIds.trim();
- if (!domainIds.matches("public")) {
- Domain validDomain = _entityMgr.findByUuid(Domain.class, domainIds.trim());
- if (validDomain != null) {
- validDomainIds.add(validDomain.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create disk offering because invalid domain has been specified.");
- }
- }
- }
- } else {
- validDomainIds.addAll(_configService.getDiskOfferingDomains(id));
- }
- return validDomainIds;
+ return resolveDomainIds(domainIds, id, _configService::getDiskOfferingDomains, "disk offering");
}
public List getZoneIds() {
- List validZoneIds = new ArrayList<>();
- if (StringUtils.isNotEmpty(zoneIds)) {
- if (zoneIds.contains(",")) {
- String[] zones = zoneIds.split(",");
- for (String zone : zones) {
- DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zone.trim());
- if (validZone != null) {
- validZoneIds.add(validZone.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create disk offering because invalid zone has been specified.");
- }
- }
- } else {
- zoneIds = zoneIds.trim();
- if (!zoneIds.matches("all")) {
- DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zoneIds.trim());
- if (validZone != null) {
- validZoneIds.add(validZone.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create disk offering because invalid zone has been specified.");
- }
- }
- }
- } else {
- validZoneIds.addAll(_configService.getDiskOfferingZones(id));
- }
- return validZoneIds;
+ return resolveZoneIds(zoneIds, id, _configService::getDiskOfferingZones, "disk offering");
}
public String getTags() {
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java
index 4027662574ab..3a6d6639a5b4 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java
@@ -16,7 +16,6 @@
// under the License.
package org.apache.cloudstack.api.command.admin.offering;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -28,19 +27,18 @@
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.offering.DomainAndZoneIdResolver;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.StringUtils;
-import com.cloud.dc.DataCenter;
-import com.cloud.domain.Domain;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
@APICommand(name = "updateServiceOffering", description = "Updates a service offering.", responseObject = ServiceOfferingResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
-public class UpdateServiceOfferingCmd extends BaseCmd {
+public class UpdateServiceOfferingCmd extends BaseCmd implements DomainAndZoneIdResolver {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -130,63 +128,11 @@ public Integer getSortKey() {
}
public List getDomainIds() {
- List validDomainIds = new ArrayList<>();
- if (StringUtils.isNotEmpty(domainIds)) {
- if (domainIds.contains(",")) {
- String[] domains = domainIds.split(",");
- for (String domain : domains) {
- Domain validDomain = _entityMgr.findByUuid(Domain.class, domain.trim());
- if (validDomain != null) {
- validDomainIds.add(validDomain.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create service offering because invalid domain has been specified.");
- }
- }
- } else {
- domainIds = domainIds.trim();
- if (!domainIds.matches("public")) {
- Domain validDomain = _entityMgr.findByUuid(Domain.class, domainIds.trim());
- if (validDomain != null) {
- validDomainIds.add(validDomain.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create service offering because invalid domain has been specified.");
- }
- }
- }
- } else {
- validDomainIds.addAll(_configService.getServiceOfferingDomains(id));
- }
- return validDomainIds;
+ return resolveDomainIds(domainIds, id, _configService::getServiceOfferingDomains, "service offering");
}
public List getZoneIds() {
- List validZoneIds = new ArrayList<>();
- if (StringUtils.isNotEmpty(zoneIds)) {
- if (zoneIds.contains(",")) {
- String[] zones = zoneIds.split(",");
- for (String zone : zones) {
- DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zone.trim());
- if (validZone != null) {
- validZoneIds.add(validZone.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create service offering because invalid zone has been specified.");
- }
- }
- } else {
- zoneIds = zoneIds.trim();
- if (!zoneIds.matches("all")) {
- DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zoneIds.trim());
- if (validZone != null) {
- validZoneIds.add(validZone.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create service offering because invalid zone has been specified.");
- }
- }
- }
- } else {
- validZoneIds.addAll(_configService.getServiceOfferingZones(id));
- }
- return validZoneIds;
+ return resolveZoneIds(zoneIds, id, _configService::getServiceOfferingZones, "service offering");
}
public String getStorageTags() {
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
index b8a8077b30b5..300584428eae 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
@@ -16,7 +16,6 @@
// under the License.
package org.apache.cloudstack.api.command.admin.vpc;
-import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
@@ -26,19 +25,16 @@
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.offering.DomainAndZoneIdResolver;
import org.apache.cloudstack.api.response.VpcOfferingResponse;
-import org.apache.commons.lang3.StringUtils;
-import com.cloud.dc.DataCenter;
-import com.cloud.domain.Domain;
import com.cloud.event.EventTypes;
-import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.vpc.VpcOffering;
import com.cloud.user.Account;
@APICommand(name = "updateVPCOffering", description = "Updates VPC offering", responseObject = VpcOfferingResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
-public class UpdateVPCOfferingCmd extends BaseAsyncCmd {
+public class UpdateVPCOfferingCmd extends BaseAsyncCmd implements DomainAndZoneIdResolver {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -92,63 +88,11 @@ public String getState() {
}
public List getDomainIds() {
- List validDomainIds = new ArrayList<>();
- if (StringUtils.isNotEmpty(domainIds)) {
- if (domainIds.contains(",")) {
- String[] domains = domainIds.split(",");
- for (String domain : domains) {
- Domain validDomain = _entityMgr.findByUuid(Domain.class, domain.trim());
- if (validDomain != null) {
- validDomainIds.add(validDomain.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create VPC offering because invalid domain has been specified.");
- }
- }
- } else {
- domainIds = domainIds.trim();
- if (!domainIds.matches("public")) {
- Domain validDomain = _entityMgr.findByUuid(Domain.class, domainIds.trim());
- if (validDomain != null) {
- validDomainIds.add(validDomain.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create VPC offering because invalid domain has been specified.");
- }
- }
- }
- } else {
- validDomainIds.addAll(_vpcProvSvc.getVpcOfferingDomains(id));
- }
- return validDomainIds;
+ return resolveDomainIds(domainIds, id, _vpcProvSvc::getVpcOfferingDomains, "VPC offering");
}
public List getZoneIds() {
- List validZoneIds = new ArrayList<>();
- if (StringUtils.isNotEmpty(zoneIds)) {
- if (zoneIds.contains(",")) {
- String[] zones = zoneIds.split(",");
- for (String zone : zones) {
- DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zone.trim());
- if (validZone != null) {
- validZoneIds.add(validZone.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create VPC offering because invalid zone has been specified.");
- }
- }
- } else {
- zoneIds = zoneIds.trim();
- if (!zoneIds.matches("all")) {
- DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zoneIds.trim());
- if (validZone != null) {
- validZoneIds.add(validZone.getId());
- } else {
- throw new InvalidParameterValueException("Failed to create VPC offering because invalid zone has been specified.");
- }
- }
- }
- } else {
- validZoneIds.addAll(_vpcProvSvc.getVpcOfferingZones(id));
- }
- return validZoneIds;
+ return resolveZoneIds(zoneIds, id, _vpcProvSvc::getVpcOfferingZones, "VPC offering");
}
public Integer getSortKey() {
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/offering/DomainAndZoneIdResolver.java b/api/src/main/java/org/apache/cloudstack/api/command/offering/DomainAndZoneIdResolver.java
new file mode 100644
index 000000000000..b302c4a9beec
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/offering/DomainAndZoneIdResolver.java
@@ -0,0 +1,114 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.offering;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.LongFunction;
+
+import com.cloud.dc.DataCenter;
+import com.cloud.domain.Domain;
+import com.cloud.exception.InvalidParameterValueException;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+/**
+ * Helper for commands that accept a domainIds or zoneIds string and need to
+ * resolve them to lists of IDs, falling back to an offering-specific
+ * default provider.
+ */
+public interface DomainAndZoneIdResolver {
+ /**
+ * Parse the provided domainIds string and return a list of domain IDs.
+ * If domainIds is empty, the defaultDomainsProvider will be invoked with the
+ * provided resource id to obtain the current domains.
+ */
+ default List resolveDomainIds(final String domainIds, final Long id, final LongFunction> defaultDomainsProvider, final String resourceTypeName) {
+ final List validDomainIds = new ArrayList<>();
+ final BaseCmd base = (BaseCmd) this;
+ final Logger logger = LogManager.getLogger(base.getClass());
+
+ if (StringUtils.isEmpty(domainIds)) {
+ if (defaultDomainsProvider != null) {
+ final List defaults = defaultDomainsProvider.apply(id);
+ if (defaults != null) {
+ validDomainIds.addAll(defaults);
+ }
+ }
+ return validDomainIds;
+ }
+
+ final String[] domains = domainIds.split(",");
+ final String type = (resourceTypeName == null || resourceTypeName.isEmpty()) ? "offering" : resourceTypeName;
+ for (String domain : domains) {
+ final String trimmed = domain == null ? "" : domain.trim();
+ if (trimmed.isEmpty() || "public".equalsIgnoreCase(trimmed)) {
+ continue;
+ }
+
+ final Domain validDomain = base._entityMgr.findByUuid(Domain.class, trimmed);
+ if (validDomain == null) {
+ logger.warn("Invalid domain specified for {}", type);
+ throw new InvalidParameterValueException("Failed to create " + type + " because invalid domain has been specified.");
+ }
+ validDomainIds.add(validDomain.getId());
+ }
+
+ return validDomainIds;
+ }
+
+ /**
+ * Parse the provided zoneIds string and return a list of zone IDs.
+ * If zoneIds is empty, the defaultZonesProvider will be invoked with the
+ * provided resource id to obtain the current zones.
+ */
+ default List resolveZoneIds(final String zoneIds, final Long id, final LongFunction> defaultZonesProvider, final String resourceTypeName) {
+ final List validZoneIds = new ArrayList<>();
+ final BaseCmd base = (BaseCmd) this;
+ final Logger logger = LogManager.getLogger(base.getClass());
+
+ if (StringUtils.isEmpty(zoneIds)) {
+ if (defaultZonesProvider != null) {
+ final List defaults = defaultZonesProvider.apply(id);
+ if (defaults != null) {
+ validZoneIds.addAll(defaults);
+ }
+ }
+ return validZoneIds;
+ }
+
+ final String[] zones = zoneIds.split(",");
+ final String type = (resourceTypeName == null || resourceTypeName.isEmpty()) ? "offering" : resourceTypeName;
+ for (String zone : zones) {
+ final String trimmed = zone == null ? "" : zone.trim();
+ if (trimmed.isEmpty() || "all".equalsIgnoreCase(trimmed)) {
+ continue;
+ }
+
+ final DataCenter validZone = base._entityMgr.findByUuid(DataCenter.class, trimmed);
+ if (validZone == null) {
+ logger.warn("Invalid zone specified for {}: {}", type, trimmed);
+ throw new InvalidParameterValueException("Failed to create " + type + " because invalid zone has been specified.");
+ }
+ validZoneIds.add(validZone.getId());
+ }
+
+ return validZoneIds;
+ }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/response/BackupOfferingResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/BackupOfferingResponse.java
index b3a7d0362198..c4f3ee31dadc 100644
--- a/api/src/main/java/org/apache/cloudstack/api/response/BackupOfferingResponse.java
+++ b/api/src/main/java/org/apache/cloudstack/api/response/BackupOfferingResponse.java
@@ -61,6 +61,16 @@ public class BackupOfferingResponse extends BaseResponse {
@Param(description = "Zone name")
private String zoneName;
+ @SerializedName(ApiConstants.DOMAIN_ID)
+ @Param(description = "the domain ID(s) this backup offering belongs to.",
+ since = "4.23.0")
+ private String domainId;
+
+ @SerializedName(ApiConstants.DOMAIN)
+ @Param(description = "the domain name(s) this backup offering belongs to.",
+ since = "4.23.0")
+ private String domain;
+
@SerializedName(ApiConstants.CROSS_ZONE_INSTANCE_CREATION)
@Param(description = "the backups with this offering can be used to create Instances on all Zones", since = "4.22.0")
private Boolean crossZoneInstanceCreation;
@@ -108,4 +118,13 @@ public void setCrossZoneInstanceCreation(Boolean crossZoneInstanceCreation) {
public void setCreated(Date created) {
this.created = created;
}
+
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ public void setDomain(String domain) {
+ this.domain = domain;
+ }
+
}
diff --git a/api/src/main/java/org/apache/cloudstack/backup/BackupManager.java b/api/src/main/java/org/apache/cloudstack/backup/BackupManager.java
index db051313d962..cbaf61405970 100644
--- a/api/src/main/java/org/apache/cloudstack/backup/BackupManager.java
+++ b/api/src/main/java/org/apache/cloudstack/backup/BackupManager.java
@@ -136,6 +136,8 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer
*/
BackupOffering importBackupOffering(final ImportBackupOfferingCmd cmd);
+ List getBackupOfferingDomains(final Long offeringId);
+
/**
* List backup offerings
* @param ListBackupOfferingsCmd API cmd
diff --git a/api/src/test/java/org/apache/cloudstack/api/command/offering/DomainAndZoneIdResolverTest.java b/api/src/test/java/org/apache/cloudstack/api/command/offering/DomainAndZoneIdResolverTest.java
new file mode 100644
index 000000000000..e679bbf2d1f1
--- /dev/null
+++ b/api/src/test/java/org/apache/cloudstack/api/command/offering/DomainAndZoneIdResolverTest.java
@@ -0,0 +1,149 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.offering;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.function.LongFunction;
+
+import com.cloud.dc.DataCenter;
+import com.cloud.domain.Domain;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.utils.db.EntityManager;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.ServerApiException;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class DomainAndZoneIdResolverTest {
+ static class TestCmd extends BaseCmd implements DomainAndZoneIdResolver {
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
+ // No implementation needed for tests
+ }
+
+ @Override
+ public String getCommandName() {
+ return "test";
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return 1L;
+ }
+ }
+
+ private void setEntityMgr(final BaseCmd cmd, final EntityManager entityMgr) throws Exception {
+ Field f = BaseCmd.class.getDeclaredField("_entityMgr");
+ f.setAccessible(true);
+ f.set(cmd, entityMgr);
+ }
+
+ @Test
+ public void resolveDomainIds_usesDefaultProviderWhenEmpty() {
+ TestCmd cmd = new TestCmd();
+
+ final LongFunction> defaultsProvider = id -> Arrays.asList(100L, 200L);
+
+ List result = cmd.resolveDomainIds("", 42L, defaultsProvider, "offering");
+ Assert.assertEquals(Arrays.asList(100L, 200L), result);
+ }
+
+ @Test
+ public void resolveDomainIds_resolvesValidUuids() throws Exception {
+ TestCmd cmd = new TestCmd();
+
+ EntityManager em = mock(EntityManager.class);
+ setEntityMgr(cmd, em);
+
+ Domain d1 = mock(Domain.class);
+ when(d1.getId()).thenReturn(10L);
+ Domain d2 = mock(Domain.class);
+ when(d2.getId()).thenReturn(20L);
+
+ when(em.findByUuid(Domain.class, "uuid1")).thenReturn(d1);
+ when(em.findByUuid(Domain.class, "uuid2")).thenReturn(d2);
+
+ List ids = cmd.resolveDomainIds("uuid1, public, uuid2", null, null, "template");
+ Assert.assertEquals(Arrays.asList(10L, 20L), ids);
+ }
+
+ @Test
+ public void resolveDomainIds_invalidUuid_throws() throws Exception {
+ TestCmd cmd = new TestCmd();
+
+ EntityManager em = mock(EntityManager.class);
+ setEntityMgr(cmd, em);
+
+ when(em.findByUuid(Domain.class, "bad-uuid")).thenReturn(null);
+
+ Assert.assertThrows(InvalidParameterValueException.class,
+ () -> cmd.resolveDomainIds("bad-uuid", null, null, "offering"));
+ }
+
+ @Test
+ public void resolveZoneIds_usesDefaultProviderWhenEmpty() {
+ TestCmd cmd = new TestCmd();
+
+ final LongFunction> defaultsProvider = id -> Collections.singletonList(300L);
+
+ List result = cmd.resolveZoneIds("", 99L, defaultsProvider, "offering");
+ Assert.assertEquals(Collections.singletonList(300L), result);
+ }
+
+ @Test
+ public void resolveZoneIds_resolvesValidUuids() throws Exception {
+ TestCmd cmd = new TestCmd();
+
+ EntityManager em = mock(EntityManager.class);
+ setEntityMgr(cmd, em);
+
+ DataCenter z1 = mock(DataCenter.class);
+ when(z1.getId()).thenReturn(30L);
+ DataCenter z2 = mock(DataCenter.class);
+ when(z2.getId()).thenReturn(40L);
+
+ when(em.findByUuid(DataCenter.class, "zone-1")).thenReturn(z1);
+ when(em.findByUuid(DataCenter.class, "zone-2")).thenReturn(z2);
+
+ List ids = cmd.resolveZoneIds("zone-1, all, zone-2", null, null, "service");
+ Assert.assertEquals(Arrays.asList(30L, 40L), ids);
+ }
+
+ @Test
+ public void resolveZoneIds_invalidUuid_throws() throws Exception {
+ TestCmd cmd = new TestCmd();
+
+ EntityManager em = mock(EntityManager.class);
+ setEntityMgr(cmd, em);
+
+ when(em.findByUuid(DataCenter.class, "bad-zone")).thenReturn(null);
+
+ Assert.assertThrows(InvalidParameterValueException.class,
+ () -> cmd.resolveZoneIds("bad-zone", null, null, "offering"));
+ }
+}
diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupOfferingDetailsVO.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupOfferingDetailsVO.java
new file mode 100644
index 000000000000..6bdf7602a9d4
--- /dev/null
+++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupOfferingDetailsVO.java
@@ -0,0 +1,86 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.backup;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.ResourceDetail;
+
+@Entity
+@Table(name = "backup_offering_details")
+public class BackupOfferingDetailsVO implements ResourceDetail {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "id")
+ private long id;
+
+ @Column(name = "backup_offering_id")
+ private long resourceId;
+
+ @Column(name = "name")
+ private String name;
+
+ @Column(name = "value")
+ private String value;
+
+ @Column(name = "display")
+ private boolean display = true;
+
+ protected BackupOfferingDetailsVO() {
+ }
+
+ public BackupOfferingDetailsVO(long backupOfferingId, String name, String value, boolean display) {
+ this.resourceId = backupOfferingId;
+ this.name = name;
+ this.value = value;
+ this.display = display;
+ }
+
+ @Override
+ public long getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(long backupOfferingId) {
+ this.resourceId = backupOfferingId;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public long getId() {
+ return id;
+ }
+
+ @Override
+ public boolean isDisplay() {
+ return display;
+ }
+}
diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupOfferingVO.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupOfferingVO.java
index d30385af575d..ebeb7d4a2d59 100644
--- a/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupOfferingVO.java
+++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupOfferingVO.java
@@ -17,6 +17,8 @@
package org.apache.cloudstack.backup;
+import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
+
import java.util.Date;
import java.util.UUID;
@@ -131,4 +133,9 @@ public void setDescription(String description) {
public Date getCreated() {
return created;
}
+
+ @Override
+ public String toString() {
+ return String.format("Backup offering %s.", ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "id", "name", "uuid"));
+ }
}
diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDaoImpl.java
index a41e4e70d339..708faeef4643 100644
--- a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDaoImpl.java
+++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDaoImpl.java
@@ -20,6 +20,8 @@
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+import com.cloud.domain.DomainVO;
+import com.cloud.domain.dao.DomainDao;
import org.apache.cloudstack.api.response.BackupOfferingResponse;
import org.apache.cloudstack.backup.BackupOffering;
import org.apache.cloudstack.backup.BackupOfferingVO;
@@ -30,10 +32,16 @@
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
+import java.util.List;
+
public class BackupOfferingDaoImpl extends GenericDaoBase implements BackupOfferingDao {
@Inject
DataCenterDao dataCenterDao;
+ @Inject
+ BackupOfferingDetailsDao backupOfferingDetailsDao;
+ @Inject
+ DomainDao domainDao;
private SearchBuilder backupPoliciesSearch;
@@ -51,8 +59,9 @@ protected void init() {
@Override
public BackupOfferingResponse newBackupOfferingResponse(BackupOffering offering, Boolean crossZoneInstanceCreation) {
- DataCenterVO zone = dataCenterDao.findById(offering.getZoneId());
+ DataCenterVO zone = dataCenterDao.findById(offering.getZoneId());
+ List domainIds = backupOfferingDetailsDao.findDomainIds(offering.getId());
BackupOfferingResponse response = new BackupOfferingResponse();
response.setId(offering.getUuid());
response.setName(offering.getName());
@@ -64,6 +73,18 @@ public BackupOfferingResponse newBackupOfferingResponse(BackupOffering offering,
response.setZoneId(zone.getUuid());
response.setZoneName(zone.getName());
}
+ if (domainIds != null && !domainIds.isEmpty()) {
+ String domainUUIDs = domainIds.stream().map(Long::valueOf).map(domainId -> {
+ DomainVO domain = domainDao.findById(domainId);
+ return domain != null ? domain.getUuid() : "";
+ }).filter(name -> !name.isEmpty()).reduce((a, b) -> a + "," + b).orElse("");
+ String domainNames = domainIds.stream().map(Long::valueOf).map(domainId -> {
+ DomainVO domain = domainDao.findById(domainId);
+ return domain != null ? domain.getName() : "";
+ }).filter(name -> !name.isEmpty()).reduce((a, b) -> a + "," + b).orElse("");
+ response.setDomain(domainNames);
+ response.setDomainId(domainUUIDs);
+ }
if (crossZoneInstanceCreation) {
response.setCrossZoneInstanceCreation(true);
}
diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDao.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDao.java
new file mode 100644
index 000000000000..390fcba1e0e7
--- /dev/null
+++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDao.java
@@ -0,0 +1,32 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.backup.dao;
+
+import java.util.List;
+
+import org.apache.cloudstack.backup.BackupOfferingDetailsVO;
+import org.apache.cloudstack.resourcedetail.ResourceDetailsDao;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface BackupOfferingDetailsDao extends GenericDao, ResourceDetailsDao {
+ List findDomainIds(final long resourceId);
+ List findZoneIds(final long resourceId);
+ String getDetail(Long backupOfferingId, String key);
+ List findOfferingIdsByDomainIds(List domainIds);
+ void updateBackupOfferingDomainIdsDetail(long backupOfferingId, List filteredDomainIds);
+}
diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDaoImpl.java
new file mode 100644
index 000000000000..f052c93f9817
--- /dev/null
+++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDaoImpl.java
@@ -0,0 +1,101 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.backup.dao;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.backup.BackupOfferingDetailsVO;
+import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
+import org.springframework.stereotype.Component;
+
+@Component
+public class BackupOfferingDetailsDaoImpl extends ResourceDetailsDaoBase implements BackupOfferingDetailsDao {
+
+ @Override
+ public void addDetail(long resourceId, String key, String value, boolean display) {
+ super.addDetail(new BackupOfferingDetailsVO(resourceId, key, value, display));
+ }
+
+ @Override
+ public List findDomainIds(long resourceId) {
+ final List domainIds = new ArrayList<>();
+ for (final BackupOfferingDetailsVO detail: findDetails(resourceId, ApiConstants.DOMAIN_ID)) {
+ final Long domainId = Long.valueOf(detail.getValue());
+ if (domainId > 0) {
+ domainIds.add(domainId);
+ }
+ }
+ return domainIds;
+ }
+
+ @Override
+ public List findZoneIds(long resourceId) {
+ final List zoneIds = new ArrayList<>();
+ for (final BackupOfferingDetailsVO detail: findDetails(resourceId, ApiConstants.ZONE_ID)) {
+ final Long zoneId = Long.valueOf(detail.getValue());
+ if (zoneId > 0) {
+ zoneIds.add(zoneId);
+ }
+ }
+ return zoneIds;
+ }
+
+ @Override
+ public String getDetail(Long backupOfferingId, String key) {
+ String detailValue = null;
+ BackupOfferingDetailsVO backupOfferingDetail = findDetail(backupOfferingId, key);
+ if (backupOfferingDetail != null) {
+ detailValue = backupOfferingDetail.getValue();
+ }
+ return detailValue;
+ }
+
+ @Override
+ public List findOfferingIdsByDomainIds(List domainIds) {
+ Object[] dIds = domainIds.stream().map(s -> String.valueOf(s)).collect(Collectors.toList()).toArray();
+ return findResourceIdsByNameAndValueIn("domainid", dIds);
+ }
+
+ @DB
+ @Override
+ public void updateBackupOfferingDomainIdsDetail(long backupOfferingId, List filteredDomainIds) {
+ SearchBuilder sb = createSearchBuilder();
+ List detailsVO = new ArrayList<>();
+ sb.and("offeringId", sb.entity().getResourceId(), SearchCriteria.Op.EQ);
+ sb.and("detailName", sb.entity().getName(), SearchCriteria.Op.EQ);
+ sb.done();
+ SearchCriteria sc = sb.create();
+ sc.setParameters("offeringId", String.valueOf(backupOfferingId));
+ sc.setParameters("detailName", ApiConstants.DOMAIN_ID);
+ remove(sc);
+ for (Long domainId : filteredDomainIds) {
+ detailsVO.add(new BackupOfferingDetailsVO(backupOfferingId, ApiConstants.DOMAIN_ID, String.valueOf(domainId), false));
+ }
+ if (!detailsVO.isEmpty()) {
+ for (BackupOfferingDetailsVO detailVO : detailsVO) {
+ persist(detailVO);
+ }
+ }
+ }
+}
diff --git a/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-common-daos-between-management-and-usage-context.xml b/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-common-daos-between-management-and-usage-context.xml
index d308a9e5aaf9..1846c3c62a0e 100644
--- a/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-common-daos-between-management-and-usage-context.xml
+++ b/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-common-daos-between-management-and-usage-context.xml
@@ -71,6 +71,7 @@
-
+
+
diff --git a/engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql b/engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql
index 07f394b19c90..d330ecd0c0d5 100644
--- a/engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql
+++ b/engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql
@@ -19,6 +19,16 @@
-- Schema upgrade from 4.22.1.0 to 4.23.0.0
--;
+CREATE TABLE `cloud`.`backup_offering_details` (
+ `id` bigint unsigned NOT NULL auto_increment,
+ `backup_offering_id` bigint unsigned NOT NULL COMMENT 'Backup offering id',
+ `name` varchar(255) NOT NULL,
+ `value` varchar(1024) NOT NULL,
+ `display` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should detail be displayed to the end user',
+ PRIMARY KEY (`id`),
+ CONSTRAINT `fk_offering_details__backup_offering_id` FOREIGN KEY `fk_offering_details__backup_offering_id`(`backup_offering_id`) REFERENCES `backup_offering`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
-- Update value to random for the config 'vm.allocation.algorithm' or 'volume.allocation.algorithm' if configured as userconcentratedpod_random
-- Update value to firstfit for the config 'vm.allocation.algorithm' or 'volume.allocation.algorithm' if configured as userconcentratedpod_firstfit
UPDATE `cloud`.`configuration` SET value='random' WHERE name IN ('vm.allocation.algorithm', 'volume.allocation.algorithm') AND value='userconcentratedpod_random';
diff --git a/engine/schema/src/test/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDaoImplTest.java b/engine/schema/src/test/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDaoImplTest.java
new file mode 100644
index 000000000000..fc8f2d0fcf71
--- /dev/null
+++ b/engine/schema/src/test/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDaoImplTest.java
@@ -0,0 +1,251 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.backup.dao;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.backup.BackupOfferingDetailsVO;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.mockito.InjectMocks;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import com.cloud.utils.db.SearchCriteria;
+
+@RunWith(MockitoJUnitRunner.class)
+public class BackupOfferingDetailsDaoImplTest {
+
+ @Spy
+ @InjectMocks
+ private BackupOfferingDetailsDaoImpl backupOfferingDetailsDao;
+
+ private static final long RESOURCE_ID = 1L;
+ private static final long OFFERING_ID = 100L;
+ private static final String TEST_KEY = "testKey";
+ private static final String TEST_VALUE = "testValue";
+
+ @Test
+ public void testAddDetail() {
+ BackupOfferingDetailsVO detailVO = new BackupOfferingDetailsVO(RESOURCE_ID, TEST_KEY, TEST_VALUE, true);
+
+ Assert.assertEquals("Resource ID should match", RESOURCE_ID, detailVO.getResourceId());
+ Assert.assertEquals("Detail name/key should match", TEST_KEY, detailVO.getName());
+ Assert.assertEquals("Detail value should match", TEST_VALUE, detailVO.getValue());
+ Assert.assertTrue("Display flag should be true", detailVO.isDisplay());
+
+ BackupOfferingDetailsVO detailVOHidden = new BackupOfferingDetailsVO(RESOURCE_ID, "hiddenKey", "hiddenValue", false);
+ Assert.assertFalse("Display flag should be false", detailVOHidden.isDisplay());
+ }
+
+ @Test
+ public void testFindDomainIdsWithMultipleDomains() {
+ List mockDetails = Arrays.asList(
+ createDetailVO(RESOURCE_ID, ApiConstants.DOMAIN_ID, "1", false),
+ createDetailVO(RESOURCE_ID, ApiConstants.DOMAIN_ID, "2", false),
+ createDetailVO(RESOURCE_ID, ApiConstants.DOMAIN_ID, "3", false)
+ );
+
+ Mockito.doReturn(mockDetails).when(backupOfferingDetailsDao)
+ .findDetails(RESOURCE_ID, ApiConstants.DOMAIN_ID);
+
+ List domainIds = backupOfferingDetailsDao.findDomainIds(RESOURCE_ID);
+
+ Assert.assertNotNull(domainIds);
+ Assert.assertEquals(3, domainIds.size());
+ Assert.assertEquals(Arrays.asList(1L, 2L, 3L), domainIds);
+ }
+
+ @Test
+ public void testFindDomainIdsWithEmptyList() {
+ Mockito.doReturn(Collections.emptyList()).when(backupOfferingDetailsDao)
+ .findDetails(RESOURCE_ID, ApiConstants.DOMAIN_ID);
+
+ List domainIds = backupOfferingDetailsDao.findDomainIds(RESOURCE_ID);
+
+ Assert.assertNotNull(domainIds);
+ Assert.assertTrue(domainIds.isEmpty());
+ }
+
+ @Test
+ public void testFindDomainIdsExcludesZeroOrNegativeValues() {
+ List mockDetails = Arrays.asList(
+ createDetailVO(RESOURCE_ID, ApiConstants.DOMAIN_ID, "1", false),
+ createDetailVO(RESOURCE_ID, ApiConstants.DOMAIN_ID, "0", false),
+ createDetailVO(RESOURCE_ID, ApiConstants.DOMAIN_ID, "-1", false),
+ createDetailVO(RESOURCE_ID, ApiConstants.DOMAIN_ID, "2", false)
+ );
+
+ Mockito.doReturn(mockDetails).when(backupOfferingDetailsDao)
+ .findDetails(RESOURCE_ID, ApiConstants.DOMAIN_ID);
+
+ List