diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd3c8f8ac67..06f9f424c7f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,13 +32,12 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '11' - distribution: 'adopt' - architecture: x64 - cache: maven + distribution: 'temurin' + java-version: '17' + cache: 'maven' - name: Set up Python uses: actions/setup-python@v5 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c61ca8e4dd..471e56e3f07 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -220,13 +220,12 @@ jobs: with: fetch-depth: 0 - - name: Set up JDK + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '11' - distribution: 'adopt' - architecture: x64 - cache: maven + distribution: 'temurin' + java-version: '17' + cache: 'maven' - name: Set up Python uses: actions/setup-python@v5 diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties index cd31b0db56d..2a083de6fe5 100644 --- a/agent/conf/agent.properties +++ b/agent/conf/agent.properties @@ -213,8 +213,9 @@ hypervisor.type=kvm # If null (default), defaults to the VM's OS architecture #guest.cpu.arch= -# This param will require CPU features on the CPU section. -# The features listed in this property must be separated by a blank space (e.g.: vmx vme) +# Specifies required CPU features for end-user and system VMs. +# These features must be present on the host CPU for VM deployment. +# Multiple features should be separated by whitespace (e.g.: vmx vme). #guest.cpu.features= # Disables memory ballooning on VM guests for overcommit. diff --git a/agent/pom.xml b/agent/pom.xml index 76c37cd87be..0fd7d35823e 100644 --- a/agent/pom.xml +++ b/agent/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT diff --git a/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java b/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java index 847d1bb2396..57dc607b920 100644 --- a/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java +++ b/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java @@ -425,8 +425,9 @@ public class AgentProperties{ public static final Property GUEST_CPU_ARCH = new Property<>("guest.cpu.arch", null, String.class); /** - * This param will require CPU features on the CPU section.
- * The features listed in this property must be separated by a blank space (see example below).
+ * Specifies required CPU features for end-user and system VMs.
+ * These features must be present on the host CPU for VM deployment.
+ * Multiple features should be separated by whitespace (see example below).
* Possible values: vmx vme
* Data type: String.
* Default value: null diff --git a/agent/src/main/java/com/cloud/agent/resource/DummyResource.java b/agent/src/main/java/com/cloud/agent/resource/DummyResource.java index fe519ca9497..4002e53b585 100644 --- a/agent/src/main/java/com/cloud/agent/resource/DummyResource.java +++ b/agent/src/main/java/com/cloud/agent/resource/DummyResource.java @@ -20,7 +20,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; import com.cloud.agent.IAgentControl; import com.cloud.agent.api.Answer; @@ -40,6 +39,7 @@ import com.cloud.resource.ServerResource; import com.cloud.storage.Storage; import com.cloud.storage.Storage.StoragePoolType; import com.cloud.utils.StringUtils; +import com.cloud.utils.UuidUtils; public class DummyResource implements ServerResource { String _name; @@ -133,7 +133,7 @@ public class DummyResource implements ServerResource { String hostIp = getConfiguredProperty("private.ip.address", "127.0.0.1"); String localStoragePath = getConfiguredProperty("local.storage.path", "/mnt"); String lh = hostIp + localStoragePath; - String uuid = UUID.nameUUIDFromBytes(lh.getBytes(StringUtils.getPreferredCharset())).toString(); + String uuid = UuidUtils.nameUUIDFromBytes(lh.getBytes(StringUtils.getPreferredCharset())).toString(); String capacity = getConfiguredProperty("local.storage.capacity", "1000000000"); String available = getConfiguredProperty("local.storage.avail", "10000000"); diff --git a/api/pom.xml b/api/pom.xml index ec68e24c7e5..6270eb2dead 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java index 06e57674c53..d822d4fc26e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java @@ -74,7 +74,7 @@ public class ScaleSystemVMCmd extends BaseAsyncCmd { } public Map getDetails() { - return details; + return convertDetailsToMap(details); } ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java index 5abe90e3f58..a42f0052249 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java @@ -68,7 +68,7 @@ public class UpgradeSystemVMCmd extends BaseCmd { } public Map getDetails() { - return details; + return convertDetailsToMap(details); } ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/response/StatsResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/StatsResponse.java index 5dd76fa5eef..287d78bb612 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/StatsResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/StatsResponse.java @@ -27,7 +27,7 @@ import com.google.gson.annotations.SerializedName; public class StatsResponse extends BaseResponse { @SerializedName("timestamp") - @Param(description = "the time when the VM stats were collected. The format is \"yyyy-MM-dd hh:mm:ss\"") + @Param(description = "the time when the VM stats were collected. The format is 'yyyy-MM-dd hh:mm:ss'") private Date timestamp; @SerializedName("cpuused") diff --git a/client/conf/server.properties.in b/client/conf/server.properties.in index fd75c9d3ea0..5958486b4df 100644 --- a/client/conf/server.properties.in +++ b/client/conf/server.properties.in @@ -58,3 +58,7 @@ access.log=/var/log/cloudstack/management/access.log # The deployment mode for the extensions extensions.deployment.mode=@EXTENSIONSDEPLOYMENTMODE@ + +# Thread pool configuration +#threads.min=10 +#threads.max=500 diff --git a/client/pom.xml b/client/pom.xml index 81e2b780934..605487404a8 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT diff --git a/client/src/main/java/org/apache/cloudstack/ServerDaemon.java b/client/src/main/java/org/apache/cloudstack/ServerDaemon.java index 259a99330df..196695e1fc6 100644 --- a/client/src/main/java/org/apache/cloudstack/ServerDaemon.java +++ b/client/src/main/java/org/apache/cloudstack/ServerDaemon.java @@ -24,12 +24,15 @@ import java.io.IOException; import java.io.InputStream; import java.lang.management.ManagementFactory; import java.net.URL; +import java.util.Arrays; import java.util.Properties; +import com.cloud.api.ApiServer; import org.apache.commons.daemon.Daemon; import org.apache.commons.daemon.DaemonContext; import org.apache.commons.lang3.StringUtils; import org.eclipse.jetty.jmx.MBeanContainer; +import org.eclipse.jetty.server.ForwardedRequestCustomizer; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.RequestLog; @@ -83,6 +86,8 @@ public class ServerDaemon implements Daemon { private static final int DEFAULT_REQUEST_CONTENT_SIZE = 1048576; private static final String REQUEST_MAX_FORM_KEYS_KEY = "request.max.form.keys"; private static final int DEFAULT_REQUEST_MAX_FORM_KEYS = 5000; + private static final String THREADS_MIN = "threads.min"; + private static final String THREADS_MAX = "threads.max"; //////////////////////////////////////////////////////// /////////////// Server Configuration /////////////////// @@ -103,6 +108,8 @@ public class ServerDaemon implements Daemon { private String keystoreFile; private String keystorePassword; private String webAppLocation; + private int minThreads; + private int maxThreads; ////////////////////////////////////////////////// /////////////// Public methods /////////////////// @@ -144,6 +151,8 @@ public class ServerDaemon implements Daemon { setSessionTimeout(Integer.valueOf(properties.getProperty(SESSION_TIMEOUT, "30"))); setMaxFormContentSize(Integer.valueOf(properties.getProperty(REQUEST_CONTENT_SIZE_KEY, String.valueOf(DEFAULT_REQUEST_CONTENT_SIZE)))); setMaxFormKeys(Integer.valueOf(properties.getProperty(REQUEST_MAX_FORM_KEYS_KEY, String.valueOf(DEFAULT_REQUEST_MAX_FORM_KEYS)))); + setMinThreads(Integer.valueOf(properties.getProperty(THREADS_MIN, "10"))); + setMaxThreads(Integer.valueOf(properties.getProperty(THREADS_MAX, "500"))); } catch (final IOException e) { logger.warn("Failed to read configuration from server.properties file", e); } finally { @@ -161,8 +170,8 @@ public class ServerDaemon implements Daemon { public void start() throws Exception { // Thread pool final QueuedThreadPool threadPool = new QueuedThreadPool(); - threadPool.setMinThreads(10); - threadPool.setMaxThreads(500); + threadPool.setMinThreads(minThreads); + threadPool.setMaxThreads(maxThreads); // Jetty Server server = new Server(threadPool); @@ -184,6 +193,7 @@ public class ServerDaemon implements Daemon { httpConfig.setResponseHeaderSize(8192); httpConfig.setSendServerVersion(false); httpConfig.setSendDateHeader(false); + addForwardingCustomiser(httpConfig); // HTTP Connector createHttpConnector(httpConfig); @@ -206,6 +216,21 @@ public class ServerDaemon implements Daemon { server.join(); } + /** + * Adds a ForwardedRequestCustomizer to the HTTP configuration to handle forwarded headers. + * The header used for forwarding is determined by the ApiServer.listOfForwardHeaders property. + * Only non empty headers are considered and only the first of the comma-separated list is used. + * @param httpConfig the HTTP configuration to which the customizer will be added + */ + private static void addForwardingCustomiser(HttpConfiguration httpConfig) { + ForwardedRequestCustomizer customiser = new ForwardedRequestCustomizer(); + String header = Arrays.stream(ApiServer.listOfForwardHeaders.value().split(",")).findFirst().orElse(null); + if (com.cloud.utils.StringUtils.isNotEmpty(header)) { + customiser.setForwardedForHeader(header); + } + httpConfig.addCustomizer(customiser); + } + @Override public void stop() throws Exception { server.stop(); @@ -375,4 +400,12 @@ public class ServerDaemon implements Daemon { public void setMaxFormKeys(int maxFormKeys) { this.maxFormKeys = maxFormKeys; } + + public void setMinThreads(int minThreads) { + this.minThreads = minThreads; + } + + public void setMaxThreads(int maxThreads) { + this.maxThreads = maxThreads; + } } diff --git a/core/pom.xml b/core/pom.xml index 25ac46518b3..e4cd84357d1 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT diff --git a/core/src/main/java/com/cloud/agent/api/DeleteStoragePoolCommand.java b/core/src/main/java/com/cloud/agent/api/DeleteStoragePoolCommand.java index 969dd2eb801..84ca39f1546 100644 --- a/core/src/main/java/com/cloud/agent/api/DeleteStoragePoolCommand.java +++ b/core/src/main/java/com/cloud/agent/api/DeleteStoragePoolCommand.java @@ -21,10 +21,10 @@ package com.cloud.agent.api; import java.io.File; import java.util.Map; -import java.util.UUID; import com.cloud.agent.api.to.StorageFilerTO; import com.cloud.storage.StoragePool; +import com.cloud.utils.UuidUtils; public class DeleteStoragePoolCommand extends Command { public static final String DATASTORE_NAME = "datastoreName"; @@ -49,7 +49,7 @@ public class DeleteStoragePoolCommand extends Command { } public DeleteStoragePoolCommand(StoragePool pool) { - this(pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes())); + this(pool, LOCAL_PATH_PREFIX + File.separator + UuidUtils.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes())); } public void setPool(StoragePool pool) { diff --git a/core/src/main/java/com/cloud/agent/api/ModifyStoragePoolCommand.java b/core/src/main/java/com/cloud/agent/api/ModifyStoragePoolCommand.java index 06940266b53..a72000d7399 100644 --- a/core/src/main/java/com/cloud/agent/api/ModifyStoragePoolCommand.java +++ b/core/src/main/java/com/cloud/agent/api/ModifyStoragePoolCommand.java @@ -21,10 +21,10 @@ package com.cloud.agent.api; import java.io.File; import java.util.Map; -import java.util.UUID; import com.cloud.agent.api.to.StorageFilerTO; import com.cloud.storage.StoragePool; +import com.cloud.utils.UuidUtils; public class ModifyStoragePoolCommand extends Command { public static final String LOCAL_PATH_PREFIX = "/mnt/"; @@ -47,11 +47,11 @@ public class ModifyStoragePoolCommand extends Command { } public ModifyStoragePoolCommand(boolean add, StoragePool pool, Map details) { - this(add, pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes()), details); + this(add, pool, LOCAL_PATH_PREFIX + File.separator + UuidUtils.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes()), details); } public ModifyStoragePoolCommand(boolean add, StoragePool pool) { - this(add, pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes())); + this(add, pool, LOCAL_PATH_PREFIX + File.separator + UuidUtils.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes())); } public boolean getAdd() { diff --git a/debian/changelog b/debian/changelog index d17676ef268..cb53b473fc2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +cloudstack (4.22.0.0-SNAPSHOT) unstable; urgency=low + + * Update the version to 4.22.0.0-SNAPSHOT + + -- the Apache CloudStack project Thu, Aug 28 11:58:36 2025 +0530 + +cloudstack (4.21.0.0) unstable; urgency=low + + * Update the version to 4.21.0.0 + + -- the Apache CloudStack project Fri, 22 Aug 2025 11:42:37 +0530 + cloudstack (4.21.0.0-SNAPSHOT) unstable; urgency=low * Update the version to 4.21.0.0-SNAPSHOT diff --git a/debian/rules b/debian/rules index 89943408544..4c3023aeae2 100755 --- a/debian/rules +++ b/debian/rules @@ -87,7 +87,7 @@ override_dh_auto_install: cp client/target/lib/*jar $(DESTDIR)/usr/share/$(PACKAGE)-management/lib/ cp -r engine/schema/dist/systemvm-templates/* $(DESTDIR)/usr/share/$(PACKAGE)-management/templates/systemvm/ cp -r plugins/integrations/kubernetes-service/src/main/resources/conf/* $(DESTDIR)/usr/share/$(PACKAGE)-management/cks/conf/ - rm -rf $(DESTDIR)/usr/share/$(PACKAGE)-management/templates/systemvm/md5sum.txt + rm -rf $(DESTDIR)/usr/share/$(PACKAGE)-management/templates/systemvm/sha512sum.txt # Bundle cmk in cloudstack-management wget https://github.com/apache/cloudstack-cloudmonkey/releases/download/$(CMK_REL)/cmk.linux.x86-64 -O $(DESTDIR)/usr/bin/cmk diff --git a/developer/pom.xml b/developer/pom.xml index c573c03d008..c11415e04fa 100644 --- a/developer/pom.xml +++ b/developer/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT diff --git a/engine/api/pom.xml b/engine/api/pom.xml index 25aaa1365df..9dcdb8e8f52 100644 --- a/engine/api/pom.xml +++ b/engine/api/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/engine/components-api/pom.xml b/engine/components-api/pom.xml index 0b30decffda..ed67de2e0d8 100644 --- a/engine/components-api/pom.xml +++ b/engine/components-api/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/engine/orchestration/pom.xml b/engine/orchestration/pom.xml index 151f95ff944..c5040b6382b 100755 --- a/engine/orchestration/pom.xml +++ b/engine/orchestration/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java index 07d1a60b7f8..146643bae22 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; +import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; @@ -1310,6 +1311,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra IPAddressVO lockedIpVO = _ipAddressDao.acquireInLockTable(ipVO.getId()); validateLockedRequestedIp(ipVO, lockedIpVO); lockedIpVO.setState(IPAddressVO.State.Allocated); + lockedIpVO.setAllocatedTime(new Date()); _ipAddressDao.update(lockedIpVO.getId(), lockedIpVO); } finally { _ipAddressDao.releaseFromLockTable(ipVO.getId()); 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 e98a5b78a94..ba50d5ff9fa 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 @@ -581,12 +581,16 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati DataStore store = dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary); DataStoreRole dataStoreRole = snapshotHelper.getDataStoreRole(snapshot, zoneId); SnapshotInfo snapInfo = snapshotFactory.getSnapshotWithRoleAndZone(snapshot.getId(), dataStoreRole, zoneId); + boolean kvmSnapshotOnlyInPrimaryStorage = snapshotHelper.isKvmSnapshotOnlyInPrimaryStorage(snapshot, dataStoreRole, zoneId); + logger.debug("Creating volume from snapshot, with dataStore role {} and on primary storage: {}", dataStoreRole, kvmSnapshotOnlyInPrimaryStorage); - boolean kvmSnapshotOnlyInPrimaryStorage = snapshotHelper.isKvmSnapshotOnlyInPrimaryStorage(snapshot, dataStoreRole, volume.getDataCenterId()); - boolean storageSupportSnapshotToTemplateEnabled = snapshotHelper.isStorageSupportSnapshotToTemplate(snapInfo); - + boolean storageSupportSnapshotToTemplateEnabled = snapshotHelper.isStorageSupportSnapshotToTemplate(snapInfo); // storageSupportSnapshotToTemplateEnabled is true only for StorPool now [TODO: Update to check storage supports snapshot to volume (DataStoreCapabilities.CAN_CREATE_VOLUME_FROM_SNAPSHOT) - may impact other storages, or StorPool storage type only] try { if (!storageSupportSnapshotToTemplateEnabled) { + dataStoreRole = snapshotHelper.getDataStoreRole(snapshot); + snapInfo = snapshotFactory.getSnapshotWithRoleAndZone(snapshot.getId(), dataStoreRole, zoneId); + kvmSnapshotOnlyInPrimaryStorage = snapshotHelper.isKvmSnapshotOnlyInPrimaryStorage(snapshot, dataStoreRole); + logger.debug("Creating volume from snapshot, with dataStore role {} and on primary storage: {}", dataStoreRole, kvmSnapshotOnlyInPrimaryStorage); snapInfo = snapshotHelper.backupSnapshotToSecondaryStorageIfNotExists(snapInfo, dataStoreRole, snapshot, kvmSnapshotOnlyInPrimaryStorage); } } catch (CloudRuntimeException e) { @@ -600,7 +604,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati } // don't try to perform a sync if the DataStoreRole of the snapshot is equal to DataStoreRole.Primary - if (!DataStoreRole.Primary.equals(dataStoreRole) || !storageSupportSnapshotToTemplateEnabled) { + if (!DataStoreRole.Primary.equals(dataStoreRole) || (kvmSnapshotOnlyInPrimaryStorage && !storageSupportSnapshotToTemplateEnabled)) { try { // sync snapshot to region store if necessary DataStore snapStore = snapInfo.getDataStore(); diff --git a/engine/pom.xml b/engine/pom.xml index 1df7d84284f..b771138dc8c 100644 --- a/engine/pom.xml +++ b/engine/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/engine/schema/pom.xml b/engine/schema/pom.xml index b888b5dd474..2f216884c8b 100644 --- a/engine/schema/pom.xml +++ b/engine/schema/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml @@ -106,7 +106,7 @@ templateList.add("systemvmtemplate-${csVersion}.${patch}-x86_64-xen") templateList.add("systemvmtemplate-${csVersion}.${patch}-x86_64-ovm") templateList.add("systemvmtemplate-${csVersion}.${patch}-x86_64-hyperv") - File file = new File("./engine/schema/dist/systemvm-templates/md5sum.txt") + File file = new File("./engine/schema/dist/systemvm-templates/sha512sum.txt") def lines = file.readLines() for (template in templateList) { def data = lines.findAll { it.contains(template) } @@ -135,7 +135,7 @@ wget - ${project.systemvm.template.location}/${cs.version}/md5sum.txt + ${project.systemvm.template.location}/${cs.version}/sha512sum.txt ${basedir}/dist/systemvm-templates/ true true @@ -205,7 +205,7 @@ true ${project.systemvm.template.location}/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-x86_64-kvm.qcow2.bz2 ${basedir}/dist/systemvm-templates/ - ${kvm.checksum} + ${kvm.checksum} @@ -241,7 +241,7 @@ true ${project.systemvm.template.location}/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-x86_64-vmware.ova ${basedir}/dist/systemvm-templates/ - ${vmware.checksum} + ${vmware.checksum} @@ -277,7 +277,7 @@ true ${project.systemvm.template.location}/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-x86_64-xen.vhd.bz2 ${basedir}/dist/systemvm-templates/ - ${xen.checksum} + ${xen.checksum} @@ -313,7 +313,7 @@ true ${project.systemvm.template.location}/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-x86_64-ovm.raw.bz2 ${basedir}/dist/systemvm-templates/ - ${ovm.checksum} + ${ovm.checksum} @@ -349,7 +349,7 @@ true ${project.systemvm.template.location}/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-x86_64-hyperv.vhd.zip ${basedir}/dist/systemvm-templates/ - ${hyperv.checksum} + ${hyperv.checksum} diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDao.java b/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDao.java index 1745f5380e2..6cfd2608f5d 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDao.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDao.java @@ -34,7 +34,7 @@ public interface ClusterDao extends GenericDao { List getAvailableHypervisorInZone(Long zoneId); - List> listDistinctHypervisorsArchAcrossClusters(Long zoneId); + List> listDistinctHypervisorsAndArchExcludingExternalType(Long zoneId); List listByDcHyType(long dcId, String hyType); diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDaoImpl.java b/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDaoImpl.java index ea82a10f9c9..c63af0a237b 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDaoImpl.java @@ -168,16 +168,26 @@ public class ClusterDaoImpl extends GenericDaoBase implements C .collect(Collectors.toList()); } + /** + * Returns distinct (HypervisorType, CPUArch) pairs from clusters in the given zone, + * excluding clusters with {@link HypervisorType#External}. + * + * @param zoneId the zone ID to filter by, or {@code null} to include all zones + * @return list of unique hypervisor type and CPU architecture pairs + */ @Override - public List> listDistinctHypervisorsArchAcrossClusters(Long zoneId) { + public List> listDistinctHypervisorsAndArchExcludingExternalType(Long zoneId) { SearchBuilder sb = createSearchBuilder(); sb.select(null, Func.DISTINCT_PAIR, sb.entity().getHypervisorType(), sb.entity().getArch()); sb.and("zoneId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ); + sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.NEQ); sb.done(); SearchCriteria sc = sb.create(); if (zoneId != null) { sc.setParameters("zoneId", zoneId); } + sc.setParameters("hypervisorType", HypervisorType.External); + final List clusters = search(sc, null); return clusters.stream() .map(c -> new Pair<>(c.getHypervisorType(), c.getArch())) diff --git a/engine/schema/src/main/java/com/cloud/network/security/SecurityGroupVMMapVO.java b/engine/schema/src/main/java/com/cloud/network/security/SecurityGroupVMMapVO.java index d12b9f9443f..59699cba1d4 100644 --- a/engine/schema/src/main/java/com/cloud/network/security/SecurityGroupVMMapVO.java +++ b/engine/schema/src/main/java/com/cloud/network/security/SecurityGroupVMMapVO.java @@ -50,6 +50,9 @@ public class SecurityGroupVMMapVO implements InternalIdentity { @Column(name = "ip4_address", table = "nics", insertable = false, updatable = false) private String guestIpAddress; + @Column(name = "ip6_address", table = "nics", insertable = false, updatable = false) + private String guestIpv6Address; + @Column(name = "state", table = "vm_instance", insertable = false, updatable = false) private State vmState; @@ -77,6 +80,10 @@ public class SecurityGroupVMMapVO implements InternalIdentity { return guestIpAddress; } + public String getGuestIpv6Address() { + return guestIpv6Address; + } + public long getInstanceId() { return instanceId; } diff --git a/engine/schema/src/main/java/com/cloud/storage/VMTemplateVO.java b/engine/schema/src/main/java/com/cloud/storage/VMTemplateVO.java index 3486bac010e..88d3b7ba2d8 100644 --- a/engine/schema/src/main/java/com/cloud/storage/VMTemplateVO.java +++ b/engine/schema/src/main/java/com/cloud/storage/VMTemplateVO.java @@ -34,6 +34,7 @@ import javax.persistence.Transient; import com.cloud.cpu.CPU; import com.cloud.user.UserData; +import com.cloud.utils.UuidUtils; import org.apache.cloudstack.util.CPUArchConverter; import org.apache.cloudstack.util.HypervisorTypeConverter; import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; @@ -344,7 +345,7 @@ public class VMTemplateVO implements VirtualMachineTemplate { name.append("-"); name.append(userId); name.append("-"); - name.append(UUID.nameUUIDFromBytes((displayName + System.currentTimeMillis()).getBytes()).toString()); + name.append(UuidUtils.nameUUIDFromBytes((displayName + System.currentTimeMillis()).getBytes()).toString()); return name.toString(); } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java index 1e3b3a7e5ec..c211b3e9728 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java @@ -90,6 +90,7 @@ import com.cloud.upgrade.dao.Upgrade41900to41910; import com.cloud.upgrade.dao.Upgrade41910to42000; import com.cloud.upgrade.dao.Upgrade42000to42010; import com.cloud.upgrade.dao.Upgrade42010to42100; +import com.cloud.upgrade.dao.Upgrade42100to42200; import com.cloud.upgrade.dao.Upgrade420to421; import com.cloud.upgrade.dao.Upgrade421to430; import com.cloud.upgrade.dao.Upgrade430to440; @@ -234,6 +235,7 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker { .next("4.19.1.0", new Upgrade41910to42000()) .next("4.20.0.0", new Upgrade42000to42010()) .next("4.20.1.0", new Upgrade42010to42100()) + .next("4.21.0.0", new Upgrade42100to42200()) .build(); } @@ -379,6 +381,9 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker { } finally { txn.close(); } + if (upgrade.refreshPoolConnectionsAfterUpgrade()) { + TransactionLegacy.refreshConnections(TransactionLegacy.CLOUD_DB); + } return version; } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java b/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java index 26b033c8d79..9b1420f22c3 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java @@ -917,7 +917,7 @@ public class SystemVmTemplateRegistration { String nfsVersion = getNfsVersion(storeUrlAndId.second()); mountStore(storeUrlAndId.first(), filePath, nfsVersion); List> hypervisorArchList = - clusterDao.listDistinctHypervisorsArchAcrossClusters(zoneId); + clusterDao.listDistinctHypervisorsAndArchExcludingExternalType(zoneId); for (Pair hypervisorArch : hypervisorArchList) { Hypervisor.HypervisorType hypervisorType = hypervisorArch.first(); MetadataTemplateDetails templateDetails = getMetadataTemplateDetails(hypervisorType, @@ -1065,7 +1065,7 @@ public class SystemVmTemplateRegistration { public void doInTransactionWithoutResult(final TransactionStatus status) { List> hypervisorsInUse; try { - hypervisorsInUse = clusterDao.listDistinctHypervisorsArchAcrossClusters(null); + hypervisorsInUse = clusterDao.listDistinctHypervisorsAndArchExcludingExternalType(null); } catch (final Exception e) { throw new CloudRuntimeException("Exception while getting hypervisor types from clusters", e); } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgrade.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgrade.java index 02c401c8155..fa0d0506ac1 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgrade.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgrade.java @@ -16,6 +16,8 @@ // under the License. package com.cloud.upgrade.dao; +import com.cloud.utils.exception.CloudRuntimeException; + import java.io.InputStream; import java.sql.Connection; @@ -24,18 +26,45 @@ public interface DbUpgrade { String getUpgradedVersion(); - boolean supportsRollingUpgrade(); + default boolean supportsRollingUpgrade() { + return false; + } /** * @return the script to prepare the database schema for the * data migration step. */ - InputStream[] getPrepareScripts(); + default InputStream[] getPrepareScripts() { + String fromVersion = getUpgradableVersionRange()[0]; + String toVersion = getUpgradableVersionRange()[1]; + final String scriptFile = String.format("META-INF/db/schema-%sto%s.sql", fromVersion.replace(".", ""), toVersion.replace(".", "")); + final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); + if (script == null) { + throw new CloudRuntimeException("Unable to find " + scriptFile); + } + + return new InputStream[]{script}; + } /** * Performs the actual data migration. */ - void performDataMigration(Connection conn); + default void performDataMigration(Connection conn) { + } - InputStream[] getCleanupScripts(); + default InputStream[] getCleanupScripts() { + String fromVersion = getUpgradableVersionRange()[0]; + String toVersion = getUpgradableVersionRange()[1]; + final String scriptFile = String.format("META-INF/db/schema-%sto%s-cleanup.sql", fromVersion.replace(".", ""), toVersion.replace(".", "")); + final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); + if (script == null) { + throw new CloudRuntimeException("Unable to find " + scriptFile); + } + + return new InputStream[]{script}; + } + + default boolean refreshPoolConnectionsAfterUpgrade() { + return false; + } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgradeSystemVmTemplate.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgradeSystemVmTemplate.java index 4211898adc7..a8d2436672e 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgradeSystemVmTemplate.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgradeSystemVmTemplate.java @@ -17,9 +17,23 @@ package com.cloud.upgrade.dao; +import com.cloud.upgrade.SystemVmTemplateRegistration; +import com.cloud.utils.exception.CloudRuntimeException; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import java.sql.Connection; public interface DbUpgradeSystemVmTemplate { - void updateSystemVmTemplates(Connection conn); + default void updateSystemVmTemplates(Connection conn) { + Logger logger = LogManager.getLogger(getClass()); + logger.debug("Updating System Vm template IDs"); + try { + SystemVmTemplateRegistration systemVmTemplateRegistration = new SystemVmTemplateRegistration(""); + systemVmTemplateRegistration.updateSystemVmTemplates(conn); + } catch (Exception e) { + throw new CloudRuntimeException("Failed to find / register SystemVM template(s)"); + } + } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42010to42100.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42010to42100.java index fd52782e57c..786ee5afbc8 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42010to42100.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42010to42100.java @@ -16,10 +16,6 @@ // under the License. package com.cloud.upgrade.dao; -import com.cloud.upgrade.SystemVmTemplateRegistration; -import com.cloud.utils.db.TransactionLegacy; -import com.cloud.utils.exception.CloudRuntimeException; - import java.io.InputStream; import java.sql.Connection; import java.sql.PreparedStatement; @@ -32,6 +28,10 @@ import java.util.Map; import org.apache.cloudstack.framework.config.ConfigKey; +import com.cloud.upgrade.SystemVmTemplateRegistration; +import com.cloud.utils.db.TransactionLegacy; +import com.cloud.utils.exception.CloudRuntimeException; + public class Upgrade42010to42100 extends DbUpgradeAbstractImpl implements DbUpgrade, DbUpgradeSystemVmTemplate { private SystemVmTemplateRegistration systemVmTemplateRegistration; @@ -212,4 +212,9 @@ public class Upgrade42010to42100 extends DbUpgradeAbstractImpl implements DbUpgr throw new CloudRuntimeException(String.format("Failed to migrate existing configuration scope values to bitmask due to: %s", e.getMessage())); } } + + @Override + public boolean refreshPoolConnectionsAfterUpgrade() { + return true; + } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42100to42200.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42100to42200.java new file mode 100644 index 00000000000..c2cfd02c15c --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42100to42200.java @@ -0,0 +1,30 @@ +// 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.upgrade.dao; + +public class Upgrade42100to42200 extends DbUpgradeAbstractImpl implements DbUpgrade, DbUpgradeSystemVmTemplate { + + @Override + public String[] getUpgradableVersionRange() { + return new String[]{"4.21.0.0", "4.22.0.0"}; + } + + @Override + public String getUpgradedVersion() { + return "4.22.0.0"; + } +} diff --git a/engine/schema/src/main/resources/META-INF/db/schema-42010to42100.sql b/engine/schema/src/main/resources/META-INF/db/schema-42010to42100.sql index 6b2b27f3361..167dd92730c 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-42010to42100.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-42010to42100.sql @@ -754,3 +754,6 @@ SET `cs`.`domain_id` = ( FROM `cloud`.`account` `acc` WHERE `acc`.`id` = `cs`.`account_id` ); + +-- Re-apply VPC: update default network offering for vpc tier to conserve_mode=1 (#8309) +UPDATE `cloud`.`network_offerings` SET conserve_mode = 1 WHERE name = 'DefaultIsolatedNetworkOfferingForVpcNetworks'; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-42100to42200-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/schema-42100to42200-cleanup.sql new file mode 100644 index 00000000000..0546613dfa3 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/schema-42100to42200-cleanup.sql @@ -0,0 +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. + +--; +-- Schema upgrade cleanup from 4.21.0.0 to 4.22.0.0 +--; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-42100to42200.sql b/engine/schema/src/main/resources/META-INF/db/schema-42100to42200.sql new file mode 100644 index 00000000000..cf3fe2ed772 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/schema-42100to42200.sql @@ -0,0 +1,23 @@ +-- 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. + +--; +-- Schema upgrade from 4.21.0.0 to 4.22.0.0 +--; + +-- Increase length of scripts_version column to 128 due to md5sum to sha512sum change +CALL `cloud`.`IDEMPOTENT_CHANGE_COLUMN`('cloud.domain_router', 'scripts_version', 'scripts_version', 'VARCHAR(128)'); diff --git a/engine/schema/src/test/java/com/cloud/dc/dao/ClusterDaoImplTest.java b/engine/schema/src/test/java/com/cloud/dc/dao/ClusterDaoImplTest.java index f8673fa9c9f..c1a558a72b3 100644 --- a/engine/schema/src/test/java/com/cloud/dc/dao/ClusterDaoImplTest.java +++ b/engine/schema/src/test/java/com/cloud/dc/dao/ClusterDaoImplTest.java @@ -92,7 +92,7 @@ public class ClusterDaoImplTest { when(cluster2.getArch()).thenReturn(CPU.CPUArch.arm64); List dummyHosts = Arrays.asList(cluster1, cluster2); doReturn(dummyHosts).when(clusterDao).search(any(SearchCriteria.class), isNull()); - List> result = clusterDao.listDistinctHypervisorsArchAcrossClusters(zoneId); + List> result = clusterDao.listDistinctHypervisorsAndArchExcludingExternalType(zoneId); assertNotNull(result); assertEquals(2, result.size()); assertEquals(Hypervisor.HypervisorType.XenServer, result.get(0).first()); @@ -109,7 +109,7 @@ public class ClusterDaoImplTest { when(cluster.getArch()).thenReturn(CPU.CPUArch.amd64); List dummyHosts = Collections.singletonList(cluster); doReturn(dummyHosts).when(clusterDao).search(any(SearchCriteria.class), isNull()); - List> result = clusterDao.listDistinctHypervisorsArchAcrossClusters(zoneId); + List> result = clusterDao.listDistinctHypervisorsAndArchExcludingExternalType(zoneId); assertNotNull(result); assertEquals(1, result.size()); assertEquals(Hypervisor.HypervisorType.VMware, result.get(0).first()); diff --git a/engine/schema/src/test/java/com/cloud/upgrade/SystemVmTemplateRegistrationTest.java b/engine/schema/src/test/java/com/cloud/upgrade/SystemVmTemplateRegistrationTest.java index 6573a5565f3..dceb8e07b07 100644 --- a/engine/schema/src/test/java/com/cloud/upgrade/SystemVmTemplateRegistrationTest.java +++ b/engine/schema/src/test/java/com/cloud/upgrade/SystemVmTemplateRegistrationTest.java @@ -404,7 +404,7 @@ public class SystemVmTemplateRegistrationTest { Hypervisor.HypervisorType hypervisorType = Hypervisor.HypervisorType.KVM; CPU.CPUArch arch = CPU.CPUArch.getDefault(); hypervisorArchList.add(new Pair<>(hypervisorType, arch)); - doReturn(hypervisorArchList).when(clusterDao).listDistinctHypervisorsArchAcrossClusters(zoneId); + doReturn(hypervisorArchList).when(clusterDao).listDistinctHypervisorsAndArchExcludingExternalType(zoneId); SystemVmTemplateRegistration.MetadataTemplateDetails details = Mockito.mock(SystemVmTemplateRegistration.MetadataTemplateDetails.class); String name = "existing"; diff --git a/engine/schema/templateConfig.sh b/engine/schema/templateConfig.sh index d10b8668b12..d6d1809c24d 100644 --- a/engine/schema/templateConfig.sh +++ b/engine/schema/templateConfig.sh @@ -94,5 +94,5 @@ PARENTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/dist/systemvm- mkdir -p $PARENTPATH METADATAFILE=${PARENTPATH}"metadata.ini" echo > $METADATAFILE -SOURCEFILE=${PARENTPATH}'md5sum.txt' +SOURCEFILE=${PARENTPATH}'sha512sum.txt' createMetadataFile diff --git a/engine/service/pom.xml b/engine/service/pom.xml index 83179d2db65..3ea24cfd4af 100644 --- a/engine/service/pom.xml +++ b/engine/service/pom.xml @@ -22,7 +22,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT cloud-engine-service war diff --git a/engine/storage/cache/pom.xml b/engine/storage/cache/pom.xml index 60822f761bc..fbdb7d2c548 100644 --- a/engine/storage/cache/pom.xml +++ b/engine/storage/cache/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/engine/storage/configdrive/pom.xml b/engine/storage/configdrive/pom.xml index e66f38cd6c3..3ba607a6ad9 100644 --- a/engine/storage/configdrive/pom.xml +++ b/engine/storage/configdrive/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/engine/storage/datamotion/pom.xml b/engine/storage/datamotion/pom.xml index ff1859a99d8..9652f804f1d 100644 --- a/engine/storage/datamotion/pom.xml +++ b/engine/storage/datamotion/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/engine/storage/image/pom.xml b/engine/storage/image/pom.xml index c5023e24534..d286a0ec920 100644 --- a/engine/storage/image/pom.xml +++ b/engine/storage/image/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/engine/storage/integration-test/pom.xml b/engine/storage/integration-test/pom.xml index ff0b64f5eaf..3ecd86f4f5d 100644 --- a/engine/storage/integration-test/pom.xml +++ b/engine/storage/integration-test/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/SnapshotTest.java b/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/SnapshotTest.java index 0185c0d1934..f07866c8353 100644 --- a/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/SnapshotTest.java +++ b/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/SnapshotTest.java @@ -100,6 +100,7 @@ import com.cloud.storage.VolumeVO; import com.cloud.storage.dao.SnapshotDao; import com.cloud.storage.dao.VMTemplateDao; import com.cloud.storage.dao.VolumeDao; +import com.cloud.utils.UuidUtils; import com.cloud.utils.component.ComponentContext; import junit.framework.Assert; @@ -287,7 +288,7 @@ public class SnapshotTest extends CloudStackTestNGBase { public DataStore createPrimaryDataStore() { try { - String uuid = UUID.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString(); + String uuid = UuidUtils.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString(); List pools = primaryDataStoreDao.findPoolByName(this.primaryName); if (pools.size() > 0) { return this.dataStoreMgr.getPrimaryDataStore(pools.get(0).getId()); 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 5ed0cc3f1fa..c478e2e7c63 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 @@ -82,6 +82,7 @@ import com.cloud.storage.Volume; import com.cloud.storage.VolumeVO; import com.cloud.storage.dao.VMTemplateDao; import com.cloud.storage.dao.VolumeDao; +import com.cloud.utils.UuidUtils; import com.cloud.utils.component.ComponentContext; @ContextConfiguration(locations = {"classpath:/storageContext.xml"}) @@ -281,7 +282,7 @@ public class VolumeServiceTest extends CloudStackTestNGBase { params.put("name", this.primaryName); params.put("port", "1"); params.put("roles", DataStoreRole.Primary.toString()); - params.put("uuid", UUID.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString()); + params.put("uuid", UuidUtils.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString()); params.put("providerName", String.valueOf(provider.getName())); DataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle(); @@ -324,7 +325,7 @@ public class VolumeServiceTest extends CloudStackTestNGBase { params.put("name", this.primaryName); params.put("port", "1"); params.put("roles", DataStoreRole.Primary.toString()); - params.put("uuid", UUID.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString()); + params.put("uuid", UuidUtils.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString()); params.put("providerName", String.valueOf(provider.getName())); DataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle(); diff --git a/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/VolumeTestVmware.java b/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/VolumeTestVmware.java index 98af170356f..c0f43da122b 100644 --- a/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/VolumeTestVmware.java +++ b/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/VolumeTestVmware.java @@ -86,6 +86,7 @@ import com.cloud.storage.Volume; import com.cloud.storage.VolumeVO; import com.cloud.storage.dao.VMTemplateDao; import com.cloud.storage.dao.VolumeDao; +import com.cloud.utils.UuidUtils; import com.cloud.utils.component.ComponentContext; @ContextConfiguration(locations = {"classpath:/storageContext.xml"}) @@ -264,7 +265,7 @@ public class VolumeTestVmware extends CloudStackTestNGBase { public DataStore createPrimaryDataStore() { try { - String uuid = UUID.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString(); + String uuid = UuidUtils.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString(); List pools = primaryDataStoreDao.findPoolByName(this.primaryName); if (pools.size() > 0) { return this.dataStoreMgr.getPrimaryDataStore(pools.get(0).getId()); diff --git a/engine/storage/object/pom.xml b/engine/storage/object/pom.xml index 97859ec68db..334383070f1 100644 --- a/engine/storage/object/pom.xml +++ b/engine/storage/object/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/engine/storage/pom.xml b/engine/storage/pom.xml index 7588b61eb39..d8415d0842b 100644 --- a/engine/storage/pom.xml +++ b/engine/storage/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/engine/storage/snapshot/pom.xml b/engine/storage/snapshot/pom.xml index db70d53647a..368b1d3c3a6 100644 --- a/engine/storage/snapshot/pom.xml +++ b/engine/storage/snapshot/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/SnapshotObject.java b/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/SnapshotObject.java index 6cec193cd0a..8264fcd4286 100644 --- a/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/SnapshotObject.java +++ b/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/SnapshotObject.java @@ -202,10 +202,15 @@ public class SnapshotObject implements SnapshotInfo { @Override public long getPhysicalSize() { long physicalSize = 0; - SnapshotDataStoreVO snapshotStore = snapshotStoreDao.findByStoreSnapshot(DataStoreRole.Image, store.getId(), snapshot.getId()); - if (snapshotStore != null) { - physicalSize = snapshotStore.getPhysicalSize(); + for (DataStoreRole role : List.of(DataStoreRole.Image, DataStoreRole.Primary)) { + logger.trace("Retrieving snapshot [{}] size from {} storage.", snapshot.getUuid(), role); + SnapshotDataStoreVO snapshotStore = snapshotStoreDao.findByStoreSnapshot(role, store.getId(), snapshot.getId()); + if (snapshotStore != null) { + return snapshotStore.getPhysicalSize(); + } + logger.trace("Snapshot [{}] size not found on {} storage.", snapshot.getUuid(), role); } + logger.warn("Snapshot [{}] reference not found in any storage. There may be an inconsistency on the database.", snapshot.getUuid()); return physicalSize; } diff --git a/engine/storage/volume/pom.xml b/engine/storage/volume/pom.xml index 7709a7c2c5b..3c9d3c246f2 100644 --- a/engine/storage/volume/pom.xml +++ b/engine/storage/volume/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml 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 3a7b7da7768..e2264629952 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 @@ -2795,6 +2795,8 @@ public class VolumeServiceImpl implements VolumeService { } catch (CloudRuntimeException cre) { logger.error("Take snapshot: {} failed", volume, cre); throw cre; + } catch (UnsupportedOperationException ex) { + throw ex; } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("unknown exception while taking snapshot for volume {} was caught", volume, e); diff --git a/engine/userdata/cloud-init/pom.xml b/engine/userdata/cloud-init/pom.xml index 70e2d70f94b..2a6b61e40c1 100644 --- a/engine/userdata/cloud-init/pom.xml +++ b/engine/userdata/cloud-init/pom.xml @@ -23,7 +23,7 @@ cloud-engine org.apache.cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/engine/userdata/pom.xml b/engine/userdata/pom.xml index a97a308c1ab..48788ddf8a7 100644 --- a/engine/userdata/pom.xml +++ b/engine/userdata/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/extensions/HyperV/hyperv.py b/extensions/HyperV/hyperv.py index 83109ebb03a..8ae2c7ff797 100755 --- a/extensions/HyperV/hyperv.py +++ b/extensions/HyperV/hyperv.py @@ -16,6 +16,9 @@ # specific language governing permissions and limitations # under the License. +import warnings +warnings.filterwarnings('ignore') + import json import sys import winrm @@ -200,12 +203,11 @@ class HyperVManager: def status(self): command = f'(Get-VM -Name "{self.data["vmname"]}").State' state = self.run_ps(command) - if state.lower() == "running": + power_state = "unknown" + if state.strip().lower() == "running": power_state = "poweron" - elif state.lower() == "off": + elif state.strip().lower() == "off": power_state = "poweroff" - else: - power_state = "unknown" succeed({"status": "success", "power_state": power_state}) def delete(self): diff --git a/extensions/Proxmox/proxmox.sh b/extensions/Proxmox/proxmox.sh index dbfdae1b972..7f363a6b9a0 100755 --- a/extensions/Proxmox/proxmox.sh +++ b/extensions/Proxmox/proxmox.sh @@ -334,7 +334,11 @@ restore_snapshot() { execute_and_wait POST "/nodes/${node}/qemu/${vmid}/snapshot/${snap_name}/rollback" - execute_and_wait POST "/nodes/${node}/qemu/${vmid}/status/start" + status_response=$(call_proxmox_api GET "/nodes/${node}/qemu/${vmid}/status/current") + vm_status=$(echo "$status_response" | jq -r '.data.status') + if [ "$vm_status" = "stopped" ];then + execute_and_wait POST "/nodes/${node}/qemu/${vmid}/status/start" + fi echo '{"status": "success", "message": "Instance Snapshot restored"}' } diff --git a/framework/agent-lb/pom.xml b/framework/agent-lb/pom.xml index 14b692d6a45..fb57d0b8135 100644 --- a/framework/agent-lb/pom.xml +++ b/framework/agent-lb/pom.xml @@ -24,7 +24,7 @@ cloudstack-framework org.apache.cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/framework/ca/pom.xml b/framework/ca/pom.xml index 691e9e3a9da..118abcfda12 100644 --- a/framework/ca/pom.xml +++ b/framework/ca/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-framework - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/framework/cluster/pom.xml b/framework/cluster/pom.xml index b2e89704c89..806236c5a4e 100644 --- a/framework/cluster/pom.xml +++ b/framework/cluster/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-framework - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/framework/config/pom.xml b/framework/config/pom.xml index 403429380b6..a289095431b 100644 --- a/framework/config/pom.xml +++ b/framework/config/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-framework - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/framework/config/src/test/java/org/apache/cloudstack/framework/config/impl/ConfigDepotImplTest.java b/framework/config/src/test/java/org/apache/cloudstack/framework/config/impl/ConfigDepotImplTest.java index a6e62902e15..f4012b43fa8 100644 --- a/framework/config/src/test/java/org/apache/cloudstack/framework/config/impl/ConfigDepotImplTest.java +++ b/framework/config/src/test/java/org/apache/cloudstack/framework/config/impl/ConfigDepotImplTest.java @@ -107,7 +107,6 @@ public class ConfigDepotImplTest { String result = configDepotImpl.getConfigStringValue(key, ConfigKey.Scope.Global, null); Assert.assertEquals(value, result); Mockito.verify(_configDao, Mockito.times(configDBRetrieval)).findById(key); - } @Test diff --git a/framework/db/pom.xml b/framework/db/pom.xml index db6421a4717..dbc22be18ee 100644 --- a/framework/db/pom.xml +++ b/framework/db/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-framework - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java b/framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java index 88af397c06a..18a90749e49 100644 --- a/framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java +++ b/framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java @@ -605,6 +605,15 @@ public class TransactionLegacy implements Closeable { return _conn; } + public static void refreshConnections(final short dbId) { + if (dbId != CLOUD_DB) { + return; + } + if (s_ds instanceof HikariDataSource) { + ((HikariDataSource)s_ds).getHikariPoolMXBean().softEvictConnections(); + } + } + protected boolean takeOver(final String name, final boolean create) { if (_stack.size() != 0) { if (!create) { diff --git a/framework/direct-download/pom.xml b/framework/direct-download/pom.xml index eeb6049285a..42e4caa9e06 100644 --- a/framework/direct-download/pom.xml +++ b/framework/direct-download/pom.xml @@ -32,7 +32,7 @@ cloudstack-framework org.apache.cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/framework/events/pom.xml b/framework/events/pom.xml index 20e2a02fd45..a63af7087c6 100644 --- a/framework/events/pom.xml +++ b/framework/events/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-framework - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/framework/extensions/pom.xml b/framework/extensions/pom.xml index d3b8f81bc71..66a6b5edac9 100644 --- a/framework/extensions/pom.xml +++ b/framework/extensions/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-framework - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml @@ -41,13 +41,13 @@ org.apache.cloudstack cloud-engine-schema - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT compile org.apache.cloudstack cloud-engine-components-api - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT compile diff --git a/framework/ipc/pom.xml b/framework/ipc/pom.xml index 66812b1051c..14ef793cd34 100644 --- a/framework/ipc/pom.xml +++ b/framework/ipc/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-framework - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/framework/jobs/pom.xml b/framework/jobs/pom.xml index a7c8699d0c7..c6e3926ed4d 100644 --- a/framework/jobs/pom.xml +++ b/framework/jobs/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-framework - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/framework/managed-context/pom.xml b/framework/managed-context/pom.xml index 32c07bc701d..c74b12d6657 100644 --- a/framework/managed-context/pom.xml +++ b/framework/managed-context/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/framework/pom.xml b/framework/pom.xml index 3b534a4bb5a..38fa6857456 100644 --- a/framework/pom.xml +++ b/framework/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT diff --git a/framework/quota/pom.xml b/framework/quota/pom.xml index a44ac18f2f9..bbf08ad37dd 100644 --- a/framework/quota/pom.xml +++ b/framework/quota/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-framework - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/framework/rest/pom.xml b/framework/rest/pom.xml index 37a9791bd38..05b96731008 100644 --- a/framework/rest/pom.xml +++ b/framework/rest/pom.xml @@ -22,7 +22,7 @@ org.apache.cloudstack cloudstack-framework - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml cloud-framework-rest diff --git a/framework/security/pom.xml b/framework/security/pom.xml index 05a108b4d45..e2a06c5d5af 100644 --- a/framework/security/pom.xml +++ b/framework/security/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-framework - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/framework/spring/lifecycle/pom.xml b/framework/spring/lifecycle/pom.xml index 7c648d225cf..acc3ee3395c 100644 --- a/framework/spring/lifecycle/pom.xml +++ b/framework/spring/lifecycle/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/framework/spring/module/pom.xml b/framework/spring/module/pom.xml index 0a2280bff44..5485e6d6e7f 100644 --- a/framework/spring/module/pom.xml +++ b/framework/spring/module/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/packaging/el8/cloud.spec b/packaging/el8/cloud.spec index b1f49ae5a08..9c2f8d29bed 100644 --- a/packaging/el8/cloud.spec +++ b/packaging/el8/cloud.spec @@ -317,7 +317,7 @@ install -D plugins/integrations/kubernetes-service/src/main/resources/conf/k8s-n # SystemVM template mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/templates/systemvm cp -r engine/schema/dist/systemvm-templates/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/templates/systemvm -rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/templates/systemvm/md5sum.txt +rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/templates/systemvm/sha512sum.txt # Sample Extensions mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/extensions diff --git a/packaging/systemd/cloudstack-agent.service b/packaging/systemd/cloudstack-agent.service index 5e2e5db0b21..5b1c7cce8c7 100644 --- a/packaging/systemd/cloudstack-agent.service +++ b/packaging/systemd/cloudstack-agent.service @@ -28,6 +28,7 @@ After=libvirtd.service [Service] Type=simple EnvironmentFile=/etc/default/cloudstack-agent +ExecStartPre=/usr/share/cloudstack-common/scripts/installer/pre-check.sh ExecStart=/usr/bin/java $JAVA_OPTS $JAVA_DEBUG -cp $CLASSPATH $JAVA_CLASS Restart=always RestartSec=10s diff --git a/packaging/systemd/cloudstack-management.service b/packaging/systemd/cloudstack-management.service index 55780af7a5c..ef8b608c098 100644 --- a/packaging/systemd/cloudstack-management.service +++ b/packaging/systemd/cloudstack-management.service @@ -34,6 +34,7 @@ User=cloud EnvironmentFile=/etc/default/cloudstack-management WorkingDirectory=/var/log/cloudstack/management PIDFile=/var/run/cloudstack-management.pid +ExecStartPre=/usr/share/cloudstack-common/scripts/installer/pre-check.sh ExecStart=/usr/bin/java $JAVA_DEBUG $JAVA_OPTS -cp $CLASSPATH $BOOTSTRAP_CLASS StandardOutput=append:/var/log/cloudstack/management/management-server.out StandardError=append:/var/log/cloudstack/management/management-server.err diff --git a/packaging/systemd/cloudstack-usage.service b/packaging/systemd/cloudstack-usage.service index bf5bd2a189b..76af47c746e 100644 --- a/packaging/systemd/cloudstack-usage.service +++ b/packaging/systemd/cloudstack-usage.service @@ -32,6 +32,7 @@ After=network.target network-online.target mariadb.service mysqld.service mysql. Type=simple EnvironmentFile=/etc/default/cloudstack-usage Environment=JAVA_PID=$$ +ExecStartPre=/usr/share/cloudstack-common/scripts/installer/pre-check.sh ExecStart=/bin/sh -ec '/usr/bin/java -Dpid=${JAVA_PID} $JAVA_OPTS $JAVA_DEBUG -cp $CLASSPATH $JAVA_CLASS' Restart=always RestartSec=10s diff --git a/plugins/acl/dynamic-role-based/pom.xml b/plugins/acl/dynamic-role-based/pom.xml index 15150a26288..2c7e099f9b5 100644 --- a/plugins/acl/dynamic-role-based/pom.xml +++ b/plugins/acl/dynamic-role-based/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/acl/project-role-based/pom.xml b/plugins/acl/project-role-based/pom.xml index 4745936fc8b..6327ffe400d 100644 --- a/plugins/acl/project-role-based/pom.xml +++ b/plugins/acl/project-role-based/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/acl/static-role-based/pom.xml b/plugins/acl/static-role-based/pom.xml index 158add1395b..cdd58bb113a 100644 --- a/plugins/acl/static-role-based/pom.xml +++ b/plugins/acl/static-role-based/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/affinity-group-processors/explicit-dedication/pom.xml b/plugins/affinity-group-processors/explicit-dedication/pom.xml index d7535ba5925..97afc9ca375 100644 --- a/plugins/affinity-group-processors/explicit-dedication/pom.xml +++ b/plugins/affinity-group-processors/explicit-dedication/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/affinity-group-processors/host-affinity/pom.xml b/plugins/affinity-group-processors/host-affinity/pom.xml index 68c66c41f39..e0e1f967ef3 100644 --- a/plugins/affinity-group-processors/host-affinity/pom.xml +++ b/plugins/affinity-group-processors/host-affinity/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/affinity-group-processors/host-anti-affinity/pom.xml b/plugins/affinity-group-processors/host-anti-affinity/pom.xml index ba0dde5949d..c2534fae2d0 100644 --- a/plugins/affinity-group-processors/host-anti-affinity/pom.xml +++ b/plugins/affinity-group-processors/host-anti-affinity/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/affinity-group-processors/non-strict-host-affinity/pom.xml b/plugins/affinity-group-processors/non-strict-host-affinity/pom.xml index 352cf299dd7..887abf726ee 100644 --- a/plugins/affinity-group-processors/non-strict-host-affinity/pom.xml +++ b/plugins/affinity-group-processors/non-strict-host-affinity/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/affinity-group-processors/non-strict-host-anti-affinity/pom.xml b/plugins/affinity-group-processors/non-strict-host-anti-affinity/pom.xml index 8896eba19e7..cccd00547da 100644 --- a/plugins/affinity-group-processors/non-strict-host-anti-affinity/pom.xml +++ b/plugins/affinity-group-processors/non-strict-host-anti-affinity/pom.xml @@ -32,7 +32,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/alert-handlers/snmp-alerts/pom.xml b/plugins/alert-handlers/snmp-alerts/pom.xml index a64fc56ecbf..797471e60fa 100644 --- a/plugins/alert-handlers/snmp-alerts/pom.xml +++ b/plugins/alert-handlers/snmp-alerts/pom.xml @@ -24,7 +24,7 @@ cloudstack-plugins org.apache.cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/alert-handlers/syslog-alerts/pom.xml b/plugins/alert-handlers/syslog-alerts/pom.xml index 957d99fd522..98ee0f99a5a 100644 --- a/plugins/alert-handlers/syslog-alerts/pom.xml +++ b/plugins/alert-handlers/syslog-alerts/pom.xml @@ -24,7 +24,7 @@ cloudstack-plugins org.apache.cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/api/discovery/pom.xml b/plugins/api/discovery/pom.xml index e947834c3fa..83ea736267d 100644 --- a/plugins/api/discovery/pom.xml +++ b/plugins/api/discovery/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/api/rate-limit/pom.xml b/plugins/api/rate-limit/pom.xml index 2daba3ff488..7c93459dc33 100644 --- a/plugins/api/rate-limit/pom.xml +++ b/plugins/api/rate-limit/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/api/solidfire-intg-test/pom.xml b/plugins/api/solidfire-intg-test/pom.xml index c2385a705c6..04f42ad4b37 100644 --- a/plugins/api/solidfire-intg-test/pom.xml +++ b/plugins/api/solidfire-intg-test/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/api/vmware-sioc/pom.xml b/plugins/api/vmware-sioc/pom.xml index 858e7ea69a0..cb5c6f78ce3 100644 --- a/plugins/api/vmware-sioc/pom.xml +++ b/plugins/api/vmware-sioc/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/backup/dummy/pom.xml b/plugins/backup/dummy/pom.xml index 3a3749e50a8..2446e43a512 100644 --- a/plugins/backup/dummy/pom.xml +++ b/plugins/backup/dummy/pom.xml @@ -23,7 +23,7 @@ cloudstack-plugins org.apache.cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/backup/dummy/src/main/java/org/apache/cloudstack/backup/DummyBackupProvider.java b/plugins/backup/dummy/src/main/java/org/apache/cloudstack/backup/DummyBackupProvider.java index 05b4b52ccb8..48082c1c8a4 100644 --- a/plugins/backup/dummy/src/main/java/org/apache/cloudstack/backup/DummyBackupProvider.java +++ b/plugins/backup/dummy/src/main/java/org/apache/cloudstack/backup/DummyBackupProvider.java @@ -191,7 +191,7 @@ public class DummyBackupProvider extends AdapterBase implements BackupProvider { @Override public Pair getBackupStorageStats(Long zoneId) { - return new Pair<>(8L * 1024 * 1024 * 1024, 10L * 1024 * 1024 * 1024); + return new Pair<>(0L, 0L); } @Override diff --git a/plugins/backup/nas/pom.xml b/plugins/backup/nas/pom.xml index 8160826e573..5b86d01df0c 100644 --- a/plugins/backup/nas/pom.xml +++ b/plugins/backup/nas/pom.xml @@ -25,7 +25,7 @@ cloudstack-plugins org.apache.cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/backup/networker/pom.xml b/plugins/backup/networker/pom.xml index fd1247ee58e..a8a2b090a11 100644 --- a/plugins/backup/networker/pom.xml +++ b/plugins/backup/networker/pom.xml @@ -25,7 +25,7 @@ cloudstack-plugins org.apache.cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/backup/veeam/pom.xml b/plugins/backup/veeam/pom.xml index 0e8f8c708a6..0626c5f8e84 100644 --- a/plugins/backup/veeam/pom.xml +++ b/plugins/backup/veeam/pom.xml @@ -23,7 +23,7 @@ cloudstack-plugins org.apache.cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/ca/root-ca/pom.xml b/plugins/ca/root-ca/pom.xml index da42fd9083c..1cc97f88e13 100644 --- a/plugins/ca/root-ca/pom.xml +++ b/plugins/ca/root-ca/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/database/mysql-ha/pom.xml b/plugins/database/mysql-ha/pom.xml index b23719df14f..c2ac585dce2 100644 --- a/plugins/database/mysql-ha/pom.xml +++ b/plugins/database/mysql-ha/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/database/quota/pom.xml b/plugins/database/quota/pom.xml index 3439f2f855c..b6910079f95 100644 --- a/plugins/database/quota/pom.xml +++ b/plugins/database/quota/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/dedicated-resources/pom.xml b/plugins/dedicated-resources/pom.xml index cffeddec7a7..31ce6da7e46 100644 --- a/plugins/dedicated-resources/pom.xml +++ b/plugins/dedicated-resources/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/plugins/deployment-planners/implicit-dedication/pom.xml b/plugins/deployment-planners/implicit-dedication/pom.xml index 12454d37270..322d4a7aa75 100644 --- a/plugins/deployment-planners/implicit-dedication/pom.xml +++ b/plugins/deployment-planners/implicit-dedication/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/deployment-planners/user-concentrated-pod/pom.xml b/plugins/deployment-planners/user-concentrated-pod/pom.xml index ad3ac14a5b5..258d11e0c35 100644 --- a/plugins/deployment-planners/user-concentrated-pod/pom.xml +++ b/plugins/deployment-planners/user-concentrated-pod/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/deployment-planners/user-dispersing/pom.xml b/plugins/deployment-planners/user-dispersing/pom.xml index a05577ed04b..b18281a1cd4 100644 --- a/plugins/deployment-planners/user-dispersing/pom.xml +++ b/plugins/deployment-planners/user-dispersing/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/drs/cluster/balanced/pom.xml b/plugins/drs/cluster/balanced/pom.xml index 4db1bd796f8..51cbfc632b1 100644 --- a/plugins/drs/cluster/balanced/pom.xml +++ b/plugins/drs/cluster/balanced/pom.xml @@ -27,7 +27,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/drs/cluster/condensed/pom.xml b/plugins/drs/cluster/condensed/pom.xml index 29a8ae2081d..38a9cd48eab 100644 --- a/plugins/drs/cluster/condensed/pom.xml +++ b/plugins/drs/cluster/condensed/pom.xml @@ -27,7 +27,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/event-bus/inmemory/pom.xml b/plugins/event-bus/inmemory/pom.xml index d3b389d9b3f..d6a3a02ec2c 100644 --- a/plugins/event-bus/inmemory/pom.xml +++ b/plugins/event-bus/inmemory/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/event-bus/kafka/pom.xml b/plugins/event-bus/kafka/pom.xml index 95667c5cc79..5784434735f 100644 --- a/plugins/event-bus/kafka/pom.xml +++ b/plugins/event-bus/kafka/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/event-bus/rabbitmq/pom.xml b/plugins/event-bus/rabbitmq/pom.xml index 5ccc2a813ed..d5037b13408 100644 --- a/plugins/event-bus/rabbitmq/pom.xml +++ b/plugins/event-bus/rabbitmq/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/event-bus/rabbitmq/src/main/java/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java b/plugins/event-bus/rabbitmq/src/main/java/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java index e8067e75b40..224e49f91a3 100644 --- a/plugins/event-bus/rabbitmq/src/main/java/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java +++ b/plugins/event-bus/rabbitmq/src/main/java/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java @@ -32,6 +32,7 @@ import java.util.concurrent.TimeoutException; import javax.naming.ConfigurationException; +import com.cloud.utils.UuidUtils; import com.cloud.utils.exception.CloudRuntimeException; import com.rabbitmq.client.BlockedListener; @@ -254,7 +255,7 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus { logger.debug("unsubscribing '{}'", subscriberId); try { String classname = subscriber.getClass().getName(); - String queueName = UUID.nameUUIDFromBytes(classname.getBytes()).toString(); + String queueName = UuidUtils.nameUUIDFromBytes(classname.getBytes()).toString(); Ternary queueDetails = s_subscribers.get(queueName); Channel channel = queueDetails.second(); channel.basicCancel(queueName); diff --git a/plugins/event-bus/webhook/pom.xml b/plugins/event-bus/webhook/pom.xml index e9dc24804f5..a2f915c9e5f 100644 --- a/plugins/event-bus/webhook/pom.xml +++ b/plugins/event-bus/webhook/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/ha-planners/skip-heurestics/pom.xml b/plugins/ha-planners/skip-heurestics/pom.xml index 4f47bf7ee75..d40f3fac648 100644 --- a/plugins/ha-planners/skip-heurestics/pom.xml +++ b/plugins/ha-planners/skip-heurestics/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/host-allocators/random/pom.xml b/plugins/host-allocators/random/pom.xml index 8f04ec9b63b..28b4df56ec2 100644 --- a/plugins/host-allocators/random/pom.xml +++ b/plugins/host-allocators/random/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/hypervisors/baremetal/pom.xml b/plugins/hypervisors/baremetal/pom.xml index 84754a27c72..cefb0cb1d11 100755 --- a/plugins/hypervisors/baremetal/pom.xml +++ b/plugins/hypervisors/baremetal/pom.xml @@ -22,7 +22,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml cloud-plugin-hypervisor-baremetal diff --git a/plugins/hypervisors/baremetal/src/main/java/com/cloud/baremetal/manager/BareMetalDiscoverer.java b/plugins/hypervisors/baremetal/src/main/java/com/cloud/baremetal/manager/BareMetalDiscoverer.java index f918f66941e..f12d701d2e2 100644 --- a/plugins/hypervisors/baremetal/src/main/java/com/cloud/baremetal/manager/BareMetalDiscoverer.java +++ b/plugins/hypervisors/baremetal/src/main/java/com/cloud/baremetal/manager/BareMetalDiscoverer.java @@ -51,6 +51,7 @@ import com.cloud.resource.DiscovererBase; import com.cloud.resource.ResourceStateAdapter; import com.cloud.resource.ServerResource; import com.cloud.resource.UnableDeleteHostException; +import com.cloud.utils.UuidUtils; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.Script; import com.cloud.utils.script.Script2; @@ -121,7 +122,7 @@ public class BareMetalDiscoverer extends DiscovererBase implements Discoverer, R String hostname = url.getHost(); InetAddress ia = InetAddress.getByName(hostname); String ipmiIp = ia.getHostAddress(); - String guid = UUID.nameUUIDFromBytes(ipmiIp.getBytes()).toString(); + String guid = UuidUtils.nameUUIDFromBytes(ipmiIp.getBytes()).toString(); String injectScript = "scripts/util/ipmi.py"; String scriptPath = Script.findScript("", injectScript); diff --git a/plugins/hypervisors/external/pom.xml b/plugins/hypervisors/external/pom.xml index 05a22cd2f9d..ca5ca7b9b82 100644 --- a/plugins/hypervisors/external/pom.xml +++ b/plugins/hypervisors/external/pom.xml @@ -22,7 +22,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml cloud-plugin-hypervisor-external diff --git a/plugins/hypervisors/external/src/main/java/org/apache/cloudstack/hypervisor/external/discoverer/ExternalServerDiscoverer.java b/plugins/hypervisors/external/src/main/java/org/apache/cloudstack/hypervisor/external/discoverer/ExternalServerDiscoverer.java index 643a29fe3ee..fd7b15dc5e5 100644 --- a/plugins/hypervisors/external/src/main/java/org/apache/cloudstack/hypervisor/external/discoverer/ExternalServerDiscoverer.java +++ b/plugins/hypervisors/external/src/main/java/org/apache/cloudstack/hypervisor/external/discoverer/ExternalServerDiscoverer.java @@ -54,6 +54,7 @@ import com.cloud.resource.DiscovererBase; import com.cloud.resource.ResourceStateAdapter; import com.cloud.resource.ServerResource; import com.cloud.resource.UnableDeleteHostException; +import com.cloud.utils.UuidUtils; public class ExternalServerDiscoverer extends DiscovererBase implements Discoverer, Listener, ResourceStateAdapter { @@ -133,7 +134,7 @@ public class ExternalServerDiscoverer extends DiscovererBase implements Discover } protected String getResourceGuidFromName(String name) { - return "External:" + UUID.nameUUIDFromBytes(name.getBytes()); + return "External:" + UuidUtils.nameUUIDFromBytes(name.getBytes()); } protected void addExtensionDataToResourceParams(ExtensionVO extension, Map params) { diff --git a/plugins/hypervisors/hyperv/pom.xml b/plugins/hypervisors/hyperv/pom.xml index 76026b31845..83157ce4c65 100644 --- a/plugins/hypervisors/hyperv/pom.xml +++ b/plugins/hypervisors/hyperv/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/hypervisors/hyperv/src/main/java/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java b/plugins/hypervisors/hyperv/src/main/java/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java index a5947238bf6..a5fe1442e56 100644 --- a/plugins/hypervisors/hyperv/src/main/java/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java +++ b/plugins/hypervisors/hyperv/src/main/java/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java @@ -24,7 +24,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; -import java.util.UUID; import javax.inject.Inject; import javax.naming.ConfigurationException; @@ -64,6 +63,7 @@ import com.cloud.resource.ResourceStateAdapter; import com.cloud.resource.ServerResource; import com.cloud.resource.UnableDeleteHostException; import com.cloud.storage.StorageLayer; +import com.cloud.utils.UuidUtils; /** * Methods to discover and managem a Hyper-V agent. Prepares a @@ -264,7 +264,7 @@ public class HypervServerDiscoverer extends DiscovererBase implements Discoverer // pool in the database // This GUID may change. if (cluster.getGuid() == null) { - cluster.setGuid(UUID.nameUUIDFromBytes(String.valueOf(clusterId).getBytes(Charset.forName("UTF-8"))).toString()); + cluster.setGuid(UuidUtils.nameUUIDFromBytes(String.valueOf(clusterId).getBytes(Charset.forName("UTF-8"))).toString()); _clusterDao.update(clusterId, cluster); } @@ -322,7 +322,7 @@ public class HypervServerDiscoverer extends DiscovererBase implements Discoverer /** * Encapsulate GUID calculation in public method to allow access to test * programs. Works by converting a string to a GUID using - * UUID.nameUUIDFromBytes + * UuidUtils.nameUUIDFromBytes * * @param uuidSeed * string to use to generate GUID @@ -330,7 +330,7 @@ public class HypervServerDiscoverer extends DiscovererBase implements Discoverer * @return GUID in form of a string. */ public static String calcServerResourceGuid(final String uuidSeed) { - String guid = UUID.nameUUIDFromBytes(uuidSeed.getBytes(Charset.forName("UTF-8"))).toString(); + String guid = UuidUtils.nameUUIDFromBytes(uuidSeed.getBytes(Charset.forName("UTF-8"))).toString(); return guid; } diff --git a/plugins/hypervisors/kvm/pom.xml b/plugins/hypervisors/kvm/pom.xml index b2ed85c9bb3..ab25aa0ccc9 100644 --- a/plugins/hypervisors/kvm/pom.xml +++ b/plugins/hypervisors/kvm/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java index 10012fba658..98107c8609e 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java @@ -211,7 +211,7 @@ public class BridgeVifDriver extends VifDriverBase { String trafficLabel = nic.getName(); Integer networkRateKBps = 0; if (libvirtVersion > ((10 * 1000 + 10))) { - networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0; + networkRateKBps = getNetworkRateKbps(nic); } if (nic.getType() == Networks.TrafficType.Guest) { diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/DirectVifDriver.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/DirectVifDriver.java index 71afc940932..580621b39a7 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/DirectVifDriver.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/DirectVifDriver.java @@ -30,7 +30,6 @@ import java.util.Map; public class DirectVifDriver extends VifDriverBase { - /** * Experimental driver to configure direct networking in libvirt. This should only * be used on an LXC cluster that does not run any system VMs. @@ -42,13 +41,14 @@ public class DirectVifDriver extends VifDriverBase { * @throws InternalErrorException * @throws LibvirtException */ + @Override public LibvirtVMDef.InterfaceDef plug(NicTO nic, String guestOsType, String nicAdapter, Map extraConfig) throws InternalErrorException, LibvirtException { LibvirtVMDef.InterfaceDef intf = new LibvirtVMDef.InterfaceDef(); if (Sets.newHashSet(Networks.TrafficType.Guest, Networks.TrafficType.Public).contains(nic.getType())) { - Integer networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0; + Integer networkRateKBps = getNetworkRateKbps(nic); intf.defDirectNet(_libvirtComputingResource.getNetworkDirectDevice(), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), _libvirtComputingResource.getNetworkDirectSourceMode(), networkRateKBps); } diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/IvsVifDriver.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/IvsVifDriver.java index 2386e7d2d59..bbe87aa1373 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/IvsVifDriver.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/IvsVifDriver.java @@ -93,7 +93,7 @@ public class IvsVifDriver extends VifDriverBase { vlanId = NetUtils.getPrimaryPvlanFromUri(nic.getBroadcastUri()); } String trafficLabel = nic.getName(); - Integer networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0; + Integer networkRateKBps = getNetworkRateKbps(nic); if (nic.getType() == Networks.TrafficType.Guest) { if ((nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan || nic.getBroadcastType() == Networks.BroadcastDomainType.Pvlan) && !vlanId.equalsIgnoreCase("untagged")) { 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 14fa2b080d0..096ec26e878 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 @@ -1316,15 +1316,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv params.put("guest.cpu.model", guestCpuModel); } - final String cpuFeatures = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.GUEST_CPU_FEATURES); - if (cpuFeatures != null) { - this.cpuFeatures = new ArrayList(); - for (final String feature: cpuFeatures.split(" ")) { - if (!feature.isEmpty()) { - this.cpuFeatures.add(feature); - } - } - } + this.cpuFeatures = parseCpuFeatures(AgentPropertiesFileHandler.getPropertyValue(AgentProperties.GUEST_CPU_FEATURES)); final String[] info = NetUtils.getNetworkParams(privateNic); @@ -1430,6 +1422,22 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv return true; } + /** + * Parses a string containing whitespace-separated CPU feature names and converts it into a list. + * + * @param features A string containing whitespace-separated CPU feature names to be parsed. + * @return A list of CPU feature strings. Returns an empty list if {@code features} is null. + */ + protected List parseCpuFeatures(String features) { + if (features == null) { + return new ArrayList<>(); + } + + return Arrays.stream(features.split(" ")) + .filter(feature -> !feature.isEmpty()) + .collect(Collectors.toList()); + } + /** * Gets the ID list of the VMs to set memory balloon stats period. * @param conn the Libvirt connection. @@ -3210,9 +3218,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv String cpuModel = MapUtils.isNotEmpty(details) && details.get(VmDetailConstants.GUEST_CPU_MODEL) != null ? details.get(VmDetailConstants.GUEST_CPU_MODEL) : guestCpuModel; cmd.setMode(cpuMode); cmd.setModel(cpuModel); - if (VirtualMachine.Type.User.equals(vmTO.getType())) { - cmd.setFeatures(cpuFeatures); - } + cmd.setFeatures(cpuFeatures); int vCpusInDef = vmTO.getVcpuMaxLimit() == null ? vcpus : vmTO.getVcpuMaxLimit(); setCpuTopology(cmd, vCpusInDef, vmTO.getDetails()); return cmd; @@ -3869,10 +3875,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv public synchronized String attachOrDetachISO(final Connect conn, final String vmName, String isoPath, final boolean isAttach, final Integer diskSeq) throws LibvirtException, URISyntaxException, InternalErrorException { final DiskDef iso = new DiskDef(); - if (isAttach && StringUtils.isNotBlank(isoPath) && isoPath.lastIndexOf("/") > 0) { - if (isoPath.startsWith(getConfigPath() + "/" + ConfigDrive.CONFIGDRIVEDIR) && isoPath.contains(vmName)) { + if (isAttach && StringUtils.isNotBlank(isoPath)) { + if (isoPath.startsWith(getConfigPath() + "/" + ConfigDrive.CONFIGDRIVEDIR) || isoPath.contains(vmName)) { iso.defISODisk(isoPath, diskSeq, DiskDef.DiskType.FILE); - } else { + } else if (isoPath.lastIndexOf("/") > 0) { final int index = isoPath.lastIndexOf("/"); final String path = isoPath.substring(0, index); final String name = isoPath.substring(index + 1); @@ -3896,7 +3902,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv cleanupDisk(disk); } } - } return result; } @@ -6091,7 +6096,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } public static String generateSecretUUIDFromString(String seed) { - return UUID.nameUUIDFromBytes(seed.getBytes()).toString(); + return UuidUtils.nameUUIDFromBytes(seed.getBytes()).toString(); } /** diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtGpuDef.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtGpuDef.java index 06457b1d071..08086859fb7 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtGpuDef.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtGpuDef.java @@ -47,7 +47,7 @@ public class LibvirtGpuDef { private void generateMdevXml(StringBuilder gpuBuilder) { String mdevUuid = vgpuType.getBusAddress(); // For MDEV devices, busAddress contains the UUID - String displayAttribute = vgpuType.isDisplay() ? "on" : "off"; + String displayAttribute = vgpuType.isDisplay() ? "on' ramfb='on" : "off"; gpuBuilder.append("\n"); gpuBuilder.append(" \n"); @@ -65,11 +65,16 @@ public class LibvirtGpuDef { // - UEFI/OVMF firmware environments // - ARM64 hosts (cache coherency issues with traditional VGA) // - Multi-monitor VDI setups (primary display) + String managed = "yes"; + // To support passthrough NVIDIA GPUs with SR-IOV & vendor specific GPU integration + if (vgpuType.getVendorId().equals("10de") && !vgpuType.getModelName().equals("passthrough")) { + managed = "no"; + } if (vgpuType.isDisplay()) { - gpuBuilder.append("\n"); + gpuBuilder.append("\n"); } else { // Compute-only workloads don't need display or ramfb - gpuBuilder.append("\n"); + gpuBuilder.append("\n"); } gpuBuilder.append(" \n"); gpuBuilder.append(" \n"); diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java index e3ce9f4b8a6..4c0482c5384 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java @@ -130,7 +130,7 @@ public class OvsVifDriver extends VifDriverBase { } String trafficLabel = nic.getName(); if (nic.getType() == Networks.TrafficType.Guest) { - Integer networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0; + Integer networkRateKBps = getNetworkRateKbps(nic); if ((nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan || nic.getBroadcastType() == Networks.BroadcastDomainType.Pvlan) && !vlanId.equalsIgnoreCase("untagged")) { if (trafficLabel != null && !trafficLabel.isEmpty()) { @@ -162,7 +162,7 @@ public class OvsVifDriver extends VifDriverBase { createControlNetwork(_bridges.get("linklocal")); intf.defBridgeNet(_bridges.get("linklocal"), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter)); } else if (nic.getType() == Networks.TrafficType.Public) { - Integer networkRateKBps = (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0; + Integer networkRateKBps = getNetworkRateKbps(nic); if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan && !vlanId.equalsIgnoreCase("untagged")) { if (trafficLabel != null && !trafficLabel.isEmpty()) { logger.debug("creating a vlan dev and bridge for public traffic per traffic label " + trafficLabel); diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/VifDriverBase.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/VifDriverBase.java index c227ca69453..2ad2b8a6d4c 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/VifDriverBase.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/VifDriverBase.java @@ -40,6 +40,8 @@ public abstract class VifDriverBase implements VifDriver { protected Map _pifs; protected Map _bridges; + protected static final int bitsPerMbpsToKbps = 125; + @Override public void configure(Map params) throws ConfigurationException { _libvirtComputingResource = (LibvirtComputingResource)params.get("libvirt.computing.resource"); @@ -78,4 +80,11 @@ public abstract class VifDriverBase implements VifDriver { public boolean isExistingBridge(String bridgeName) { return false; } + + protected static int getNetworkRateKbps(NicTO nic) { + if (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) { + return nic.getNetworkRateMbps().intValue() * bitsPerMbpsToKbps; + } + return 0; + } } 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 94e60327253..220789bdce9 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 @@ -1018,7 +1018,7 @@ public final class LibvirtMigrateCommandWrapper extends CommandWrapper acceptedSchemes = List.of("nfs", "networkfilesystem", "filesystem"); - if (acceptedSchemes.contains(scheme)) { - sourcePath = storageUri.getPath(); - sourcePath = sourcePath.replace("//", "/"); - sourceHost = storageUri.getHost(); - uuid = UUID.nameUUIDFromBytes(new String(sourceHost + sourcePath).getBytes()).toString(); - protocol = scheme.equals("filesystem") ? StoragePoolType.Filesystem: StoragePoolType.NetworkFilesystem; + if (storageUri.getScheme() == null || !acceptedSchemes.contains(storageUri.getScheme().toLowerCase())) { + throw new CloudRuntimeException("Empty or unsupported storage pool uri scheme"); } - // secondary storage registers itself through here + final String scheme = storageUri.getScheme().toLowerCase(); + sourcePath = storageUri.getPath(); + sourcePath = sourcePath.replace("//", "/"); + sourceHost = storageUri.getHost(); + uuid = UuidUtils.nameUUIDFromBytes(new String(sourceHost + sourcePath).getBytes()).toString(); + protocol = scheme.equals("filesystem") ? StoragePoolType.Filesystem: StoragePoolType.NetworkFilesystem; + + // storage registers itself through here return createStoragePool(uuid, sourceHost, 0, sourcePath, "", protocol, null, false); } diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java index 0de4e11817e..3d95157d45c 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java @@ -99,9 +99,8 @@ import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; - +import org.apache.logging.log4j.Logger; import org.libvirt.Connect; import org.libvirt.Domain; import org.libvirt.DomainInfo; @@ -2950,7 +2949,9 @@ public class KVMStorageProcessor implements StorageProcessor { if (template != null) { templatePath = template.getPath(); } - if (StringUtils.isEmpty(templatePath)) { + if (ImageFormat.ISO.equals(cmd.getFormat())) { + logger.debug("Skipping template validations as image format is {}", cmd.getFormat()); + } else if (StringUtils.isEmpty(templatePath)) { logger.warn("Skipped validation whether downloaded file is QCOW2 for template {}, due to downloaded template path is empty", template.getName()); } else if (!new File(templatePath).exists()) { logger.warn("Skipped validation whether downloaded file is QCOW2 for template {}, due to downloaded template path is not valid: {}", template.getName(), templatePath); 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 bf851831cd0..d5119ea55b7 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 @@ -761,10 +761,9 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { @Override public KVMStoragePool createStoragePool(String name, String host, int port, String path, String userInfo, StoragePoolType type, Map details, boolean isPrimaryStorage) { - logger.info("Attempting to create storage pool " + name + " (" + type.toString() + ") in libvirt"); - - StoragePool sp = null; - Connect conn = null; + logger.info("Attempting to create storage pool {} ({}) in libvirt", name, type); + StoragePool sp; + Connect conn; try { conn = LibvirtConnection.getConnection(); } catch (LibvirtException e) { diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/ScaleIOStorageAdaptor.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/ScaleIOStorageAdaptor.java index 46e6068a837..efa8024a34b 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/ScaleIOStorageAdaptor.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/ScaleIOStorageAdaptor.java @@ -653,10 +653,24 @@ public class ScaleIOStorageAdaptor implements StorageAdaptor { if (!ScaleIOUtil.startSDCService()) { return new Ternary<>(false, null, "Couldn't start SDC service on host"); } - } else { - logger.debug("SDC service is active on host, re-starting it"); - if (!ScaleIOUtil.restartSDCService()) { - return new Ternary<>(false, null, "Couldn't restart SDC service on host"); + } + + if (MapUtils.isNotEmpty(details) && details.containsKey(ScaleIOGatewayClient.STORAGE_POOL_MDMS)) { + // Assuming SDC service is started, add mdms + String mdms = details.get(ScaleIOGatewayClient.STORAGE_POOL_MDMS); + String[] mdmAddresses = mdms.split(","); + if (mdmAddresses.length > 0) { + if (ScaleIOUtil.isMdmPresent(mdmAddresses[0])) { + return new Ternary<>(true, getSDCDetails(details), "MDM added, no need to prepare the SDC client"); + } + + ScaleIOUtil.addMdms(mdmAddresses); + if (!ScaleIOUtil.isMdmPresent(mdmAddresses[0])) { + return new Ternary<>(false, null, "Failed to add MDMs"); + } else { + logger.debug(String.format("MDMs %s added to storage pool %s", mdms, uuid)); + applyMdmsChangeWaitTime(details); + } } } @@ -784,12 +798,12 @@ public class ScaleIOStorageAdaptor implements StorageAdaptor { if (sdcId != null) { sdcDetails.put(ScaleIOGatewayClient.SDC_ID, sdcId); return sdcDetails; - } else { - String sdcGuId = ScaleIOUtil.getSdcGuid(); - if (sdcGuId != null) { - sdcDetails.put(ScaleIOGatewayClient.SDC_GUID, sdcGuId); - return sdcDetails; - } + } + + String sdcGuId = ScaleIOUtil.getSdcGuid(); + if (sdcGuId != null) { + sdcDetails.put(ScaleIOGatewayClient.SDC_GUID, sdcGuId); + return sdcDetails; } try { 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 fc4ec048d49..f721c723ea0 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 @@ -7126,4 +7126,20 @@ public class LibvirtComputingResourceTest { assertEquals("2g.10gb", vfInstance2.getModelName()); assertNull(vfInstance2.getVmName()); } + + @Test + public void parseCpuFeaturesTestReturnEmptyListWhenFeaturesIsNull() { + List cpuFeatures = libvirtComputingResourceSpy.parseCpuFeatures(null); + Assert.assertEquals(0, cpuFeatures.size()); + } + + @Test + public void parseCpuFeaturesTestReturnListOfCpuFeaturesAndIgnoreMultipleWhitespacesAlongsideEachOther() { + List cpuFeatures = libvirtComputingResourceSpy.parseCpuFeatures(" -mca mce -mmx hle "); + Assert.assertEquals(4, cpuFeatures.size()); + Assert.assertEquals("-mca", cpuFeatures.get(0)); + Assert.assertEquals("mce", cpuFeatures.get(1)); + Assert.assertEquals("-mmx", cpuFeatures.get(2)); + Assert.assertEquals("hle", cpuFeatures.get(3)); + } } diff --git a/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/storage/ScaleIOStorageAdaptorTest.java b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/storage/ScaleIOStorageAdaptorTest.java index dba31f84dbd..eddaa8f6499 100644 --- a/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/storage/ScaleIOStorageAdaptorTest.java +++ b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/storage/ScaleIOStorageAdaptorTest.java @@ -92,34 +92,6 @@ public class ScaleIOStorageAdaptorTest { Assert.assertEquals("SDC service not enabled on host", result.third()); } - @Test - public void testPrepareStorageClient_SDCServiceNotRestarted() { - when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl status scini"))).thenReturn(3); - when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl is-enabled scini"))).thenReturn(0); - when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl is-active scini"))).thenReturn(0); - when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl restart scini"))).thenReturn(1); - - Ternary, String> result = scaleIOStorageAdaptor.prepareStorageClient(poolUuid, new HashMap<>()); - - Assert.assertFalse(result.first()); - Assert.assertNull(result.second()); - Assert.assertEquals("Couldn't restart SDC service on host", result.third()); - } - - @Test - public void testPrepareStorageClient_SDCServiceRestarted() { - when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl status scini"))).thenReturn(3); - when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl is-enabled scini"))).thenReturn(0); - when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl is-active scini"))).thenReturn(0); - when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl restart scini"))).thenReturn(0); - - Ternary, String> result = scaleIOStorageAdaptor.prepareStorageClient(poolUuid, new HashMap<>()); - - Assert.assertFalse(result.first()); - Assert.assertNull(result.second()); - Assert.assertEquals("Couldn't get the SDC details on the host", result.third()); - } - @Test public void testPrepareStorageClient_SDCServiceNotStarted() { when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl status scini"))).thenReturn(3); diff --git a/plugins/hypervisors/ovm/pom.xml b/plugins/hypervisors/ovm/pom.xml index 4603ecd0617..46dd6ef498d 100644 --- a/plugins/hypervisors/ovm/pom.xml +++ b/plugins/hypervisors/ovm/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/hypervisor/OvmDiscoverer.java b/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/hypervisor/OvmDiscoverer.java index 82cb61d7a1f..7dfd98301d7 100644 --- a/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/hypervisor/OvmDiscoverer.java +++ b/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/hypervisor/OvmDiscoverer.java @@ -46,6 +46,7 @@ import com.cloud.resource.ResourceManager; import com.cloud.resource.ResourceStateAdapter; import com.cloud.resource.ServerResource; import com.cloud.resource.UnableDeleteHostException; +import com.cloud.utils.UuidUtils; import com.cloud.utils.db.QueryBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.exception.CloudRuntimeException; @@ -131,7 +132,7 @@ public class OvmDiscoverer extends DiscovererBase implements Discoverer, Resourc String hostname = url.getHost(); InetAddress ia = InetAddress.getByName(hostname); String hostIp = ia.getHostAddress(); - String guid = UUID.nameUUIDFromBytes(hostIp.getBytes()).toString(); + String guid = UuidUtils.nameUUIDFromBytes(hostIp.getBytes()).toString(); if (checkIfExisted(guid)) { throw new CloudRuntimeException("The host " + hostIp + " has been added before"); diff --git a/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/hypervisor/OvmResourceBase.java b/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/hypervisor/OvmResourceBase.java index 9d958a9894a..951741cbb59 100644 --- a/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/hypervisor/OvmResourceBase.java +++ b/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/hypervisor/OvmResourceBase.java @@ -24,7 +24,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import javax.naming.ConfigurationException; @@ -127,6 +126,7 @@ import com.cloud.storage.template.TemplateProp; import com.cloud.template.VirtualMachineTemplate.BootloaderType; import com.cloud.utils.Pair; import com.cloud.utils.Ternary; +import com.cloud.utils.UuidUtils; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.Script; import com.cloud.utils.ssh.SSHCmdHelper; @@ -507,7 +507,7 @@ public class OvmResourceBase implements ServerResource, HypervisorResource { vm.name = spec.getName(); vm.memory = spec.getMinRam(); vm.cpuNum = spec.getCpus(); - vm.uuid = UUID.nameUUIDFromBytes(spec.getName().getBytes()).toString(); + vm.uuid = UuidUtils.nameUUIDFromBytes(spec.getName().getBytes()).toString(); if (spec.getBootloader() == BootloaderType.CD) { vm.bootDev = OvmVm.CD; vm.type = OvmVm.HVM; diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml index 54c5b0e33c5..ea591c89126 100644 --- a/plugins/hypervisors/ovm3/pom.xml +++ b/plugins/hypervisors/ovm3/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/objects/OvmObject.java b/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/objects/OvmObject.java index 3b7354c34c5..d98f3bb6d3f 100644 --- a/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/objects/OvmObject.java +++ b/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/objects/OvmObject.java @@ -35,6 +35,7 @@ import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; +import com.cloud.utils.UuidUtils; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; import org.apache.xmlrpc.XmlRpcException; @@ -71,7 +72,7 @@ public class OvmObject { /* generate a uuid */ public String newUuid(String str) { - return UUID.nameUUIDFromBytes(str.getBytes(Charset.defaultCharset())).toString(); + return UuidUtils.nameUUIDFromBytes(str.getBytes(Charset.defaultCharset())).toString(); } /* capture most of the calls here */ diff --git a/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3Discoverer.java b/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3Discoverer.java index 2305dbb6c26..52cc419ad2e 100755 --- a/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3Discoverer.java +++ b/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3Discoverer.java @@ -58,6 +58,7 @@ import com.cloud.resource.ResourceManager; import com.cloud.resource.ResourceStateAdapter; import com.cloud.resource.ServerResource; import com.cloud.resource.UnableDeleteHostException; +import com.cloud.utils.UuidUtils; import com.cloud.utils.db.QueryBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.exception.CloudRuntimeException; @@ -186,7 +187,7 @@ public class Ovm3Discoverer extends DiscovererBase implements Discoverer, InetAddress ia = InetAddress.getByName(hostname); String hostIp = ia.getHostAddress(); - String guid = UUID.nameUUIDFromBytes(hostIp.getBytes("UTF8")) + String guid = UuidUtils.nameUUIDFromBytes(hostIp.getBytes("UTF8")) .toString(); if (checkIfExisted(guid)) { diff --git a/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3HypervisorResource.java b/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3HypervisorResource.java index ba4304d349c..d01738ea086 100644 --- a/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3HypervisorResource.java +++ b/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3HypervisorResource.java @@ -19,7 +19,6 @@ package com.cloud.hypervisor.ovm3.resources; import java.nio.charset.Charset; import java.util.Map; -import java.util.UUID; import javax.inject.Inject; import javax.naming.ConfigurationException; @@ -95,6 +94,7 @@ import com.cloud.resource.hypervisor.HypervisorResource; import com.cloud.storage.resource.StorageSubsystemCommandHandler; import com.cloud.storage.resource.StorageSubsystemCommandHandlerBase; import com.cloud.template.VirtualMachineTemplate.BootloaderType; +import com.cloud.utils.UuidUtils; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine.State; @@ -369,7 +369,7 @@ public class Ovm3HypervisorResource extends ServerResourceBase implements Hyperv vm.setVmCpus(vmSpec.getCpus()); /* in mb not in bytes */ vm.setVmMemory(vmSpec.getMinRam() / 1024 / 1024); - vm.setVmUuid(UUID.nameUUIDFromBytes(vmSpec.getName().getBytes(Charset.defaultCharset())).toString()); + vm.setVmUuid(UuidUtils.nameUUIDFromBytes(vmSpec.getName().getBytes(Charset.defaultCharset())).toString()); vm.setVmName(vmName); String domType = guesttypes.getOvm3GuestType(vmSpec.getOs()); diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XenTest.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XenTest.java index c76f2feccdc..34f67df2d25 100644 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XenTest.java +++ b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XenTest.java @@ -17,8 +17,7 @@ package com.cloud.hypervisor.ovm3.objects; -import java.util.UUID; - +import com.cloud.utils.UuidUtils; import org.junit.Test; public class XenTest { @@ -697,7 +696,7 @@ public class XenTest { domU.setVmCpus(1); domU.setVmMemory(512); domU.setVmDomainType("default"); - domU.setVmUuid(UUID.nameUUIDFromBytes(VMNAME.getBytes()).toString()); + domU.setVmUuid(UuidUtils.nameUUIDFromBytes(VMNAME.getBytes()).toString()); domU.setVmName(VMNAME); domU.addRootDisk(VMROOTDISK); domU.setPrimaryPoolUuid(REPOID); diff --git a/plugins/hypervisors/simulator/pom.xml b/plugins/hypervisors/simulator/pom.xml index 5fb3ccdd652..87d692e5b29 100644 --- a/plugins/hypervisors/simulator/pom.xml +++ b/plugins/hypervisors/simulator/pom.xml @@ -22,7 +22,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml cloud-plugin-hypervisor-simulator diff --git a/plugins/hypervisors/simulator/src/main/java/com/cloud/agent/manager/MockStorageManagerImpl.java b/plugins/hypervisors/simulator/src/main/java/com/cloud/agent/manager/MockStorageManagerImpl.java index 4ade80a8fb2..5d0fe3b50c3 100644 --- a/plugins/hypervisors/simulator/src/main/java/com/cloud/agent/manager/MockStorageManagerImpl.java +++ b/plugins/hypervisors/simulator/src/main/java/com/cloud/agent/manager/MockStorageManagerImpl.java @@ -103,6 +103,7 @@ import com.cloud.storage.VMTemplateStorageResourceAssoc; import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; import com.cloud.storage.dao.VMTemplateDao; import com.cloud.storage.template.TemplateProp; +import com.cloud.utils.UuidUtils; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.db.TransactionLegacy; import com.cloud.utils.exception.CloudRuntimeException; @@ -886,7 +887,7 @@ public class MockStorageManagerImpl extends ManagerBase implements MockStorageMa String nfsHost = uri.getHost(); String nfsPath = uri.getPath(); String path = nfsHost + ":" + nfsPath; - String dir = "/mnt/" + UUID.nameUUIDFromBytes(path.getBytes()).toString() + File.separator; + String dir = "/mnt/" + UuidUtils.nameUUIDFromBytes(path.getBytes()).toString() + File.separator; storage.setUrl(url); storage.setCapacity(DEFAULT_HOST_STORAGE_SIZE); diff --git a/plugins/hypervisors/ucs/pom.xml b/plugins/hypervisors/ucs/pom.xml index 576a4a4ab74..fd287cd3c7f 100644 --- a/plugins/hypervisors/ucs/pom.xml +++ b/plugins/hypervisors/ucs/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml cloud-plugin-hypervisor-ucs diff --git a/plugins/hypervisors/vmware/pom.xml b/plugins/hypervisors/vmware/pom.xml index d54410ebe93..445822085de 100644 --- a/plugins/hypervisors/vmware/pom.xml +++ b/plugins/hypervisors/vmware/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java index 1be381dcd54..a5d1127e331 100644 --- a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java +++ b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java @@ -22,7 +22,6 @@ import java.net.URLDecoder; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; import javax.inject.Inject; import javax.naming.ConfigurationException; @@ -75,6 +74,7 @@ import com.cloud.template.TemplateManager; import com.cloud.user.Account; import com.cloud.utils.Pair; import com.cloud.utils.UriUtils; +import com.cloud.utils.UuidUtils; import com.vmware.vim25.ManagedObjectReference; public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer, ResourceStateAdapter { @@ -397,7 +397,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer // place a place holder guid derived from cluster ID try{ - cluster.setGuid(UUID.nameUUIDFromBytes(String.valueOf(clusterId).getBytes("UTF-8")).toString()); + cluster.setGuid(UuidUtils.nameUUIDFromBytes(String.valueOf(clusterId).getBytes("UTF-8")).toString()); }catch(UnsupportedEncodingException e){ throw new DiscoveredWithErrorException("Unable to create UUID based on string " + String.valueOf(clusterId) + ". Bad clusterId or UTF-8 encoding error."); } diff --git a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java index 6203d5b9a94..7147ae18581 100644 --- a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java +++ b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java @@ -81,6 +81,7 @@ import com.cloud.storage.template.OVAProcessor; import com.cloud.utils.NumbersUtil; import com.cloud.utils.Pair; import com.cloud.utils.Ternary; +import com.cloud.utils.UuidUtils; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.Script; import com.cloud.vm.VirtualMachine; @@ -277,7 +278,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { try { VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, cmd); - String templateUuidName = UUID.nameUUIDFromBytes((templateName + "@" + cmd.getPoolUuid() + "-" + hyperHost.getMor().getValue()).getBytes("UTF-8")).toString(); + String templateUuidName = UuidUtils.nameUUIDFromBytes((templateName + "@" + cmd.getPoolUuid() + "-" + hyperHost.getMor().getValue()).getBytes("UTF-8")).toString(); // truncate template name to 32 chars to ensure they work well with vSphere API's. templateUuidName = templateUuidName.replace("-", ""); diff --git a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java index aecfb58d708..289dae42e91 100644 --- a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -294,6 +294,7 @@ import com.cloud.utils.NumbersUtil; import com.cloud.utils.Pair; import com.cloud.utils.StringUtils; import com.cloud.utils.Ternary; +import com.cloud.utils.UuidUtils; import com.cloud.utils.db.DB; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.exception.ExceptionUtil; @@ -5309,7 +5310,7 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes poolInfo.setHostPath(childPath); String uuid = childDsMo.getCustomFieldValue(CustomFieldConstants.CLOUD_UUID); if (uuid == null || !uuid.contains("-")) { - uuid = UUID.nameUUIDFromBytes(((pool.getHost() + childPath)).getBytes()).toString(); + uuid = UuidUtils.nameUUIDFromBytes(((pool.getHost() + childPath)).getBytes()).toString(); } poolInfo.setUuid(uuid); poolInfo.setLocalPath(cmd.LOCAL_PATH_PREFIX + File.separator + uuid); @@ -5544,7 +5545,7 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes private String getSecondaryDatastoreUUID(String storeUrl) { String uuid = null; try { - uuid = UUID.nameUUIDFromBytes(storeUrl.getBytes("UTF-8")).toString(); + uuid = UuidUtils.nameUUIDFromBytes(storeUrl.getBytes("UTF-8")).toString(); } catch (UnsupportedEncodingException e) { logger.warn("Failed to create UUID from string " + storeUrl + ". Bad storeUrl or UTF-8 encoding error."); } diff --git a/plugins/hypervisors/vmware/src/main/java/com/cloud/storage/resource/VmwareStorageProcessor.java b/plugins/hypervisors/vmware/src/main/java/com/cloud/storage/resource/VmwareStorageProcessor.java index e4b3282defb..e4fd5d24f43 100644 --- a/plugins/hypervisors/vmware/src/main/java/com/cloud/storage/resource/VmwareStorageProcessor.java +++ b/plugins/hypervisors/vmware/src/main/java/com/cloud/storage/resource/VmwareStorageProcessor.java @@ -101,6 +101,7 @@ import com.cloud.template.TemplateManager; import com.cloud.utils.LogUtils; import com.cloud.utils.Pair; import com.cloud.utils.Ternary; +import com.cloud.utils.UuidUtils; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.Script; import com.cloud.vm.VirtualMachine.PowerState; @@ -2286,7 +2287,7 @@ public class VmwareStorageProcessor implements StorageProcessor { private String getSecondaryDatastoreUUID(String storeUrl) { String uuid = null; try{ - uuid=UUID.nameUUIDFromBytes(storeUrl.getBytes("UTF-8")).toString(); + uuid=UuidUtils.nameUUIDFromBytes(storeUrl.getBytes("UTF-8")).toString(); }catch(UnsupportedEncodingException e){ logger.warn("Failed to create UUID from string " + storeUrl + ". Bad storeUrl or UTF-8 encoding error." ); } @@ -3740,10 +3741,10 @@ public class VmwareStorageProcessor implements StorageProcessor { private String deriveTemplateUuidOnHost(VmwareHypervisorHost hyperHost, String storeIdentifier, String templateName) { String templateUuid; try { - templateUuid = UUID.nameUUIDFromBytes((templateName + "@" + storeIdentifier + "-" + hyperHost.getMor().getValue()).getBytes("UTF-8")).toString(); + templateUuid = UuidUtils.nameUUIDFromBytes((templateName + "@" + storeIdentifier + "-" + hyperHost.getMor().getValue()).getBytes("UTF-8")).toString(); } catch(UnsupportedEncodingException e){ logger.warn("unexpected encoding error, using default Charset: " + e.getLocalizedMessage()); - templateUuid = UUID.nameUUIDFromBytes((templateName + "@" + storeIdentifier + "-" + hyperHost.getMor().getValue()).getBytes(Charset.defaultCharset())) + templateUuid = UuidUtils.nameUUIDFromBytes((templateName + "@" + storeIdentifier + "-" + hyperHost.getMor().getValue()).getBytes(Charset.defaultCharset())) .toString(); } templateUuid = templateUuid.replaceAll("-", ""); diff --git a/plugins/hypervisors/xenserver/pom.xml b/plugins/hypervisors/xenserver/pom.xml index daf0d548124..11861b3aeeb 100644 --- a/plugins/hypervisors/xenserver/pom.xml +++ b/plugins/hypervisors/xenserver/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java index 5f86c9574d5..4658b0eb4e5 100644 --- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java @@ -142,6 +142,7 @@ import com.cloud.utils.Pair; import com.cloud.utils.PropertiesUtil; import com.cloud.utils.StringUtils; import com.cloud.utils.Ternary; +import com.cloud.utils.UuidUtils; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.NetUtils; import com.cloud.utils.script.Script; @@ -1047,7 +1048,7 @@ public abstract class CitrixResourceBase extends ServerResourceBase implements S path = path.replace("//", "/"); deviceConfig.put("server", uri.getHost()); deviceConfig.put("serverpath", path); - final String name = UUID.nameUUIDFromBytes((uri.getHost() + path).getBytes()).toString(); + final String name = UuidUtils.nameUUIDFromBytes((uri.getHost() + path).getBytes()).toString(); if (!shared) { final Set srs = SR.getByNameLabel(conn, name); for (final SR sr : srs) { @@ -5763,7 +5764,7 @@ public abstract class CitrixResourceBase extends ServerResourceBase implements S try { URI uri = new URI(secondaryStorageUrl); secondaryStorageMountPath = uri.getHost() + ":" + uri.getPath(); - localDir = BASE_MOUNT_POINT_ON_REMOTE + UUID.nameUUIDFromBytes(secondaryStorageMountPath.getBytes()); + localDir = BASE_MOUNT_POINT_ON_REMOTE + UuidUtils.nameUUIDFromBytes(secondaryStorageMountPath.getBytes()); String mountPoint = mountNfs(conn, secondaryStorageMountPath, localDir, nfsVersion); if (StringUtils.isBlank(mountPoint)) { return new CopyToSecondaryStorageAnswer(cmd, false, "Could not mount secondary storage " + secondaryStorageMountPath + " on host " + localDir); @@ -5793,7 +5794,7 @@ public abstract class CitrixResourceBase extends ServerResourceBase implements S private String mountNfs(Connection conn, String remoteDir, String localDir, String nfsVersion) { if (localDir == null) { - localDir = BASE_MOUNT_POINT_ON_REMOTE + UUID.nameUUIDFromBytes(remoteDir.getBytes()); + localDir = BASE_MOUNT_POINT_ON_REMOTE + UuidUtils.nameUUIDFromBytes(remoteDir.getBytes()); } return callHostPlugin(conn, "cloud-plugin-storage", "mountNfsSecondaryStorage", "localDir", localDir, "remoteDir", remoteDir, "nfsVersion", nfsVersion); } @@ -5801,7 +5802,7 @@ public abstract class CitrixResourceBase extends ServerResourceBase implements S // Unmount secondary storage from host private void umountNfs(Connection conn, String remoteDir, String localDir) { if (localDir == null) { - localDir = BASE_MOUNT_POINT_ON_REMOTE + UUID.nameUUIDFromBytes(remoteDir.getBytes()); + localDir = BASE_MOUNT_POINT_ON_REMOTE + UuidUtils.nameUUIDFromBytes(remoteDir.getBytes()); } String result = callHostPlugin(conn, "cloud-plugin-storage", "umountNfsSecondaryStorage", "localDir", localDir, "remoteDir", remoteDir); if (StringUtils.isBlank(result)) { diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java index 1d405316ad7..a214131c47d 100644 --- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java @@ -77,6 +77,7 @@ import com.cloud.storage.DataStoreRole; import com.cloud.storage.Storage; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.resource.StorageProcessor; +import com.cloud.utils.UuidUtils; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.storage.S3.ClientOptions; import com.google.common.annotations.VisibleForTesting; @@ -1255,7 +1256,7 @@ public class XenServerStorageProcessor implements StorageProcessor { final String folder = destPath; String finalPath = null; - final String localMountPoint = BaseMountPointOnHost + File.separator + UUID.nameUUIDFromBytes(secondaryStorageUrl.getBytes()).toString(); + final String localMountPoint = BaseMountPointOnHost + File.separator + UuidUtils.nameUUIDFromBytes(secondaryStorageUrl.getBytes()).toString(); if (fullbackup) { // the first snapshot is always a full snapshot diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java index 773b443a57e..c7b288ef8c7 100644 --- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java @@ -51,6 +51,7 @@ import com.cloud.agent.api.to.SwiftTO; import com.cloud.exception.InternalErrorException; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.Storage; +import com.cloud.utils.UuidUtils; import com.cloud.utils.exception.CloudRuntimeException; import com.xensource.xenapi.Connection; import com.xensource.xenapi.Host; @@ -73,7 +74,7 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor { private void mountNfs(Connection conn, String remoteDir, String localDir, String nfsVersion) { if (localDir == null) { - localDir = BASE_MOUNT_POINT_ON_REMOTE + UUID.nameUUIDFromBytes(remoteDir.getBytes()); + localDir = BASE_MOUNT_POINT_ON_REMOTE + UuidUtils.nameUUIDFromBytes(remoteDir.getBytes()); } String result = hypervisorResource.callHostPluginAsync(conn, "cloud-plugin-storage", "mountNfsSecondaryStorage", 100 * 1000, "localDir", localDir, "remoteDir", remoteDir, "nfsVersion", nfsVersion); if (StringUtils.isBlank(result)) { @@ -110,7 +111,7 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor { /** * Creates a new file SR for the given path. If any of XenServer's checked exception occurs, we use method {@link #removeSrAndPbdIfPossible(Connection, SR, PBD)} to clean the created PBD and SR entries. - * To avoid race conditions between management servers, we are using a deterministic srUuid for the file SR to be created (we are leaving XenServer with the burden of managing race conditions). The UUID is based on the SR file path, and is generated using {@link UUID#nameUUIDFromBytes(byte[])}. + * To avoid race conditions between management servers, we are using a deterministic srUuid for the file SR to be created (we are leaving XenServer with the burden of managing race conditions). The UUID is based on the SR file path, and is generated using {@link UuidUtils.nameUUIDFromBytes(byte[])}. * If there is an SR with the generated UUID, this means that some other management server has just created it. An exception will occur and this exception will be an {@link InternalError}. The exception will contain {@link InternalError#message} a message saying 'Db_exn.Uniqueness_constraint_violation'. * For cases where the previous described error happens, we catch the exception and use the method {@link #retrieveAlreadyConfiguredSrWithoutException(Connection, String)}. */ @@ -121,7 +122,7 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor { PBD pbd = null; try { Host host = Host.getByUuid(conn, hostUuid); - String srUuid = UUID.nameUUIDFromBytes(srPath.getBytes()).toString(); + String srUuid = UuidUtils.nameUUIDFromBytes(srPath.getBytes()).toString(); Map smConfig = new HashMap(); sr = SR.introduce(conn, srUuid, srPath, srPath, "file", "file", false, smConfig); @@ -243,7 +244,7 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor { } protected SR createFileSr(Connection conn, String remotePath, String dir, String nfsVersion) { - String localDir = BASE_MOUNT_POINT_ON_REMOTE + UUID.nameUUIDFromBytes(remotePath.getBytes()); + String localDir = BASE_MOUNT_POINT_ON_REMOTE + UuidUtils.nameUUIDFromBytes(remotePath.getBytes()); mountNfs(conn, remotePath, localDir, nfsVersion); return createFileSR(conn, localDir + "/" + dir); } @@ -563,12 +564,12 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor { final String folder = destPath; String finalPath = null; - final String localMountPoint = BaseMountPointOnHost + File.separator + UUID.nameUUIDFromBytes(secondaryStorageUrl.getBytes()).toString(); + final String localMountPoint = BaseMountPointOnHost + File.separator + UuidUtils.nameUUIDFromBytes(secondaryStorageUrl.getBytes()).toString(); if (fullbackup) { SR snapshotSr = null; Task task = null; try { - final String localDir = BASE_MOUNT_POINT_ON_REMOTE + UUID.nameUUIDFromBytes(secondaryStorageMountPath.getBytes()); + final String localDir = BASE_MOUNT_POINT_ON_REMOTE + UuidUtils.nameUUIDFromBytes(secondaryStorageMountPath.getBytes()); mountNfs(conn, secondaryStorageMountPath, localDir, nfsVersion); final boolean result = makeDirectory(conn, localDir + "/" + folder); if (!result) { @@ -1097,7 +1098,7 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor { srcSr = createFileSr(conn, srcUri.getHost() + ":" + srcUri.getPath(), srcDir, srcNfsVersion); final String destNfsPath = destUri.getHost() + ":" + destUri.getPath(); - final String localDir = BASE_MOUNT_POINT_ON_REMOTE + UUID.nameUUIDFromBytes(destNfsPath.getBytes()); + final String localDir = BASE_MOUNT_POINT_ON_REMOTE + UuidUtils.nameUUIDFromBytes(destNfsPath.getBytes()); String destNfsVersion = destStore.getNfsVersion(); mountNfs(conn, destUri.getHost() + ":" + destUri.getPath(), localDir, destNfsVersion); @@ -1240,7 +1241,7 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor { srcSr = hypervisorResource.getIscsiSR(conn, iScsiName, storageHost, iScsiName, chapInitiatorUsername, chapInitiatorSecret, false, srType, true); final String destNfsPath = destUri.getHost() + ":" + destUri.getPath(); - final String localDir = BASE_MOUNT_POINT_ON_REMOTE + UUID.nameUUIDFromBytes(destNfsPath.getBytes()); + final String localDir = BASE_MOUNT_POINT_ON_REMOTE + UuidUtils.nameUUIDFromBytes(destNfsPath.getBytes()); String nfsVersion = destStore.getNfsVersion(); mountNfs(conn, destNfsPath, localDir, nfsVersion); diff --git a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessorTest.java b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessorTest.java index 5f2ae88faa7..ba7b88ea229 100644 --- a/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessorTest.java +++ b/plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessorTest.java @@ -26,7 +26,6 @@ import static org.mockito.Mockito.times; import java.util.HashSet; import java.util.Set; -import java.util.UUID; import org.apache.commons.lang3.StringUtils; import org.apache.xmlrpc.XmlRpcException; @@ -41,6 +40,7 @@ import org.mockito.MockedStatic; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; +import com.cloud.utils.UuidUtils; import com.cloud.utils.exception.CloudRuntimeException; import com.xensource.xenapi.Connection; import com.xensource.xenapi.Host; @@ -310,7 +310,7 @@ public class Xenserver625StorageProcessorTest { String uuid = "hostUuid"; Mockito.when(citrixResourceBase._host.getUuid()).thenReturn(uuid); - String srUuid = UUID.nameUUIDFromBytes(pathMock.getBytes()).toString(); + String srUuid = UuidUtils.nameUUIDFromBytes(pathMock.getBytes()).toString(); Host hostMock = Mockito.mock(Host.class); @@ -337,7 +337,7 @@ public class Xenserver625StorageProcessorTest { SR srMock = Mockito.mock(SR.class); Mockito.doReturn(srMock).when(xenserver625StorageProcessor).retrieveAlreadyConfiguredSrWithoutException(connectionMock, pathMock); - String srUuid = UUID.nameUUIDFromBytes(pathMock.getBytes()).toString(); + String srUuid = UuidUtils.nameUUIDFromBytes(pathMock.getBytes()).toString(); Host hostMock = Mockito.mock(Host.class); @@ -368,7 +368,7 @@ public class Xenserver625StorageProcessorTest { Mockito.when(citrixResourceBase._host.getUuid()).thenReturn(uuid); SR srMock = Mockito.mock(SR.class); - String srUuid = UUID.nameUUIDFromBytes(pathMock.getBytes()).toString(); + String srUuid = UuidUtils.nameUUIDFromBytes(pathMock.getBytes()).toString(); Host hostMock = Mockito.mock(Host.class); diff --git a/plugins/integrations/cloudian/pom.xml b/plugins/integrations/cloudian/pom.xml index 0cb809d2bd9..bebf04f21a8 100644 --- a/plugins/integrations/cloudian/pom.xml +++ b/plugins/integrations/cloudian/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/integrations/kubernetes-service/pom.xml b/plugins/integrations/kubernetes-service/pom.xml index 48052071ee8..4ea372343a3 100644 --- a/plugins/integrations/kubernetes-service/pom.xml +++ b/plugins/integrations/kubernetes-service/pom.xml @@ -26,7 +26,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/integrations/prometheus/pom.xml b/plugins/integrations/prometheus/pom.xml index af5f7f74a51..43c45d8bd30 100644 --- a/plugins/integrations/prometheus/pom.xml +++ b/plugins/integrations/prometheus/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/maintenance/pom.xml b/plugins/maintenance/pom.xml index fb8f64cd16c..03f75d09200 100644 --- a/plugins/maintenance/pom.xml +++ b/plugins/maintenance/pom.xml @@ -26,7 +26,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/plugins/metrics/pom.xml b/plugins/metrics/pom.xml index 1a392fb6638..6ae71da98bc 100644 --- a/plugins/metrics/pom.xml +++ b/plugins/metrics/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/plugins/metrics/src/main/java/org/apache/cloudstack/response/VmMetricsStatsResponse.java b/plugins/metrics/src/main/java/org/apache/cloudstack/response/VmMetricsStatsResponse.java index 33dc51de870..0205ddc686a 100644 --- a/plugins/metrics/src/main/java/org/apache/cloudstack/response/VmMetricsStatsResponse.java +++ b/plugins/metrics/src/main/java/org/apache/cloudstack/response/VmMetricsStatsResponse.java @@ -40,7 +40,7 @@ public class VmMetricsStatsResponse extends BaseResponse { private String displayName; @SerializedName("stats") - @Param(description = "the list of VM stats") + @Param(description = "the list of VM stats", responseObject = StatsResponse.class) private List stats; public void setId(String id) { diff --git a/plugins/network-elements/bigswitch/pom.xml b/plugins/network-elements/bigswitch/pom.xml index 56e1bf6c921..b0bbb1db9cd 100644 --- a/plugins/network-elements/bigswitch/pom.xml +++ b/plugins/network-elements/bigswitch/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/brocade-vcs/pom.xml b/plugins/network-elements/brocade-vcs/pom.xml index 5251efa030c..77721c6c732 100644 --- a/plugins/network-elements/brocade-vcs/pom.xml +++ b/plugins/network-elements/brocade-vcs/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/cisco-vnmc/pom.xml b/plugins/network-elements/cisco-vnmc/pom.xml index ab76ae547b2..87ac0a79732 100644 --- a/plugins/network-elements/cisco-vnmc/pom.xml +++ b/plugins/network-elements/cisco-vnmc/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/dns-notifier/pom.xml b/plugins/network-elements/dns-notifier/pom.xml index 40c8b8495f2..26cb5a39d00 100644 --- a/plugins/network-elements/dns-notifier/pom.xml +++ b/plugins/network-elements/dns-notifier/pom.xml @@ -22,7 +22,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml cloud-plugin-example-dns-notifier diff --git a/plugins/network-elements/elastic-loadbalancer/pom.xml b/plugins/network-elements/elastic-loadbalancer/pom.xml index a5bb3c804b7..1b43b805ebd 100644 --- a/plugins/network-elements/elastic-loadbalancer/pom.xml +++ b/plugins/network-elements/elastic-loadbalancer/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/globodns/pom.xml b/plugins/network-elements/globodns/pom.xml index 1e3b8bd880a..e817a398251 100644 --- a/plugins/network-elements/globodns/pom.xml +++ b/plugins/network-elements/globodns/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/internal-loadbalancer/pom.xml b/plugins/network-elements/internal-loadbalancer/pom.xml index 7de31524e2f..4600dba9cb7 100644 --- a/plugins/network-elements/internal-loadbalancer/pom.xml +++ b/plugins/network-elements/internal-loadbalancer/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/juniper-contrail/pom.xml b/plugins/network-elements/juniper-contrail/pom.xml index 51321cb214c..d2414853384 100644 --- a/plugins/network-elements/juniper-contrail/pom.xml +++ b/plugins/network-elements/juniper-contrail/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/netris/pom.xml b/plugins/network-elements/netris/pom.xml index b49a92d9c54..e8ca26c243b 100644 --- a/plugins/network-elements/netris/pom.xml +++ b/plugins/network-elements/netris/pom.xml @@ -26,7 +26,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/netscaler/pom.xml b/plugins/network-elements/netscaler/pom.xml index 674915718df..e69837d6a01 100644 --- a/plugins/network-elements/netscaler/pom.xml +++ b/plugins/network-elements/netscaler/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/nicira-nvp/pom.xml b/plugins/network-elements/nicira-nvp/pom.xml index b520584b016..72c69c53050 100644 --- a/plugins/network-elements/nicira-nvp/pom.xml +++ b/plugins/network-elements/nicira-nvp/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/nsx/pom.xml b/plugins/network-elements/nsx/pom.xml index d5559d0f3cc..27b4062d768 100644 --- a/plugins/network-elements/nsx/pom.xml +++ b/plugins/network-elements/nsx/pom.xml @@ -26,7 +26,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/opendaylight/pom.xml b/plugins/network-elements/opendaylight/pom.xml index fbb6495dfdc..5312ee1cbd0 100644 --- a/plugins/network-elements/opendaylight/pom.xml +++ b/plugins/network-elements/opendaylight/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/ovs/pom.xml b/plugins/network-elements/ovs/pom.xml index 4b3d6f156e1..80f57e82c5d 100644 --- a/plugins/network-elements/ovs/pom.xml +++ b/plugins/network-elements/ovs/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/palo-alto/pom.xml b/plugins/network-elements/palo-alto/pom.xml index cb8bf4e0afe..868e231a36a 100644 --- a/plugins/network-elements/palo-alto/pom.xml +++ b/plugins/network-elements/palo-alto/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/stratosphere-ssp/pom.xml b/plugins/network-elements/stratosphere-ssp/pom.xml index d6c6e3fa553..6f5d300f123 100644 --- a/plugins/network-elements/stratosphere-ssp/pom.xml +++ b/plugins/network-elements/stratosphere-ssp/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/tungsten/pom.xml b/plugins/network-elements/tungsten/pom.xml index 76d946f23b1..de5ab3f1ade 100644 --- a/plugins/network-elements/tungsten/pom.xml +++ b/plugins/network-elements/tungsten/pom.xml @@ -26,7 +26,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/vxlan/pom.xml b/plugins/network-elements/vxlan/pom.xml index c43e0f1b9ba..88c5882178e 100644 --- a/plugins/network-elements/vxlan/pom.xml +++ b/plugins/network-elements/vxlan/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/outofbandmanagement-drivers/ipmitool/pom.xml b/plugins/outofbandmanagement-drivers/ipmitool/pom.xml index 94a2fb982d1..d647575ef78 100644 --- a/plugins/outofbandmanagement-drivers/ipmitool/pom.xml +++ b/plugins/outofbandmanagement-drivers/ipmitool/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/outofbandmanagement-drivers/nested-cloudstack/pom.xml b/plugins/outofbandmanagement-drivers/nested-cloudstack/pom.xml index f01b6ee46b0..e91e103e252 100644 --- a/plugins/outofbandmanagement-drivers/nested-cloudstack/pom.xml +++ b/plugins/outofbandmanagement-drivers/nested-cloudstack/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/outofbandmanagement-drivers/redfish/pom.xml b/plugins/outofbandmanagement-drivers/redfish/pom.xml index 11ad81feb82..03e4e2adc4c 100644 --- a/plugins/outofbandmanagement-drivers/redfish/pom.xml +++ b/plugins/outofbandmanagement-drivers/redfish/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/pom.xml b/plugins/pom.xml index 6a1a13fb5b1..d665f90b623 100755 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT diff --git a/plugins/storage-allocators/random/pom.xml b/plugins/storage-allocators/random/pom.xml index a18f282222f..5dbd571c2fa 100644 --- a/plugins/storage-allocators/random/pom.xml +++ b/plugins/storage-allocators/random/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/storage/image/default/pom.xml b/plugins/storage/image/default/pom.xml index e104e085142..5a7d236a8a6 100644 --- a/plugins/storage/image/default/pom.xml +++ b/plugins/storage/image/default/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/image/s3/pom.xml b/plugins/storage/image/s3/pom.xml index 93f367f8889..70927f60804 100644 --- a/plugins/storage/image/s3/pom.xml +++ b/plugins/storage/image/s3/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/image/sample/pom.xml b/plugins/storage/image/sample/pom.xml index 11b56814b2a..999640392b2 100644 --- a/plugins/storage/image/sample/pom.xml +++ b/plugins/storage/image/sample/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/image/swift/pom.xml b/plugins/storage/image/swift/pom.xml index 45cfa5addf1..761461b2bf1 100644 --- a/plugins/storage/image/swift/pom.xml +++ b/plugins/storage/image/swift/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/object/ceph/pom.xml b/plugins/storage/object/ceph/pom.xml index 34477d6318f..053450148d3 100644 --- a/plugins/storage/object/ceph/pom.xml +++ b/plugins/storage/object/ceph/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/object/cloudian/pom.xml b/plugins/storage/object/cloudian/pom.xml index 3d9a0c7ee8c..4c5e5185f34 100644 --- a/plugins/storage/object/cloudian/pom.xml +++ b/plugins/storage/object/cloudian/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/object/minio/pom.xml b/plugins/storage/object/minio/pom.xml index de79ca56eb5..d7044fc6859 100644 --- a/plugins/storage/object/minio/pom.xml +++ b/plugins/storage/object/minio/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/object/simulator/pom.xml b/plugins/storage/object/simulator/pom.xml index 152cf95ec87..edb6261fa1c 100644 --- a/plugins/storage/object/simulator/pom.xml +++ b/plugins/storage/object/simulator/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/sharedfs/storagevm/pom.xml b/plugins/storage/sharedfs/storagevm/pom.xml index 7ccbc3216c4..513a3ecf157 100644 --- a/plugins/storage/sharedfs/storagevm/pom.xml +++ b/plugins/storage/sharedfs/storagevm/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/volume/adaptive/pom.xml b/plugins/storage/volume/adaptive/pom.xml index 8ec18a4382d..44adf2e28cc 100644 --- a/plugins/storage/volume/adaptive/pom.xml +++ b/plugins/storage/volume/adaptive/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/volume/cloudbyte/pom.xml b/plugins/storage/volume/cloudbyte/pom.xml index c9857d0de09..2e4d219783a 100644 --- a/plugins/storage/volume/cloudbyte/pom.xml +++ b/plugins/storage/volume/cloudbyte/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/volume/datera/pom.xml b/plugins/storage/volume/datera/pom.xml index a25d033d97a..58f50d88ef7 100644 --- a/plugins/storage/volume/datera/pom.xml +++ b/plugins/storage/volume/datera/pom.xml @@ -16,7 +16,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/volume/default/pom.xml b/plugins/storage/volume/default/pom.xml index 34f6e9c1d62..b1a3a7bf8e9 100644 --- a/plugins/storage/volume/default/pom.xml +++ b/plugins/storage/volume/default/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/volume/default/src/main/java/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java b/plugins/storage/volume/default/src/main/java/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java index fbcc51e2e8c..b3cf825ea59 100644 --- a/plugins/storage/volume/default/src/main/java/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java +++ b/plugins/storage/volume/default/src/main/java/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java @@ -69,6 +69,7 @@ import com.cloud.storage.dao.VolumeDao; import com.cloud.user.dao.UserDao; import com.cloud.utils.NumbersUtil; import com.cloud.utils.Pair; +import com.cloud.utils.UuidUtils; import com.cloud.utils.db.DB; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.VirtualMachineManager; @@ -309,7 +310,7 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl extends BasePrimaryDataStor } else if ("PreSetup".equalsIgnoreCase(scheme) && !HypervisorType.VMware.equals(hypervisorType)) { uuid = hostPath.replace("/", ""); } else { - uuid = UUID.nameUUIDFromBytes((storageHost + hostPath).getBytes()).toString(); + uuid = UuidUtils.nameUUIDFromBytes((storageHost + hostPath).getBytes()).toString(); } List spHandles = primaryDataStoreDao.findIfDuplicatePoolsExistByUUID(uuid); diff --git a/plugins/storage/volume/flasharray/pom.xml b/plugins/storage/volume/flasharray/pom.xml index ac247f43f92..a25435ec8a1 100644 --- a/plugins/storage/volume/flasharray/pom.xml +++ b/plugins/storage/volume/flasharray/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/volume/linstor/CHANGELOG.md b/plugins/storage/volume/linstor/CHANGELOG.md index a96b7c75b2b..c0991a9aa2b 100644 --- a/plugins/storage/volume/linstor/CHANGELOG.md +++ b/plugins/storage/volume/linstor/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to Linstor CloudStack plugin will be documented in this file The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2025-08-05] + +### Fixed + +- getVolumeStats wasn't correctly working if multiple Linstor clusters/primary storages are used. + ## [2025-07-01] ### Fixed diff --git a/plugins/storage/volume/linstor/pom.xml b/plugins/storage/volume/linstor/pom.xml index 35708ab3faa..347a6fc39bf 100644 --- a/plugins/storage/volume/linstor/pom.xml +++ b/plugins/storage/volume/linstor/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml 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 a0999090355..306e9259936 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 @@ -137,7 +137,7 @@ public class LinstorPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver private HostDao _hostDao; @Inject private VMTemplateDao _vmTemplateDao; - private long volumeStatsLastUpdate = 0L; + private final Map volumeStatsLastUpdate = new HashMap<>(); private final Map> volumeStats = new HashMap<>(); public LinstorPrimaryDataStoreDriverImpl() @@ -1535,11 +1535,12 @@ public class LinstorPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver /** * Updates the cache map containing current allocated size data. - * @param api Linstor Developers api object + * @param linstorAddr Linstor cluster api address */ - private void fillVolumeStatsCache(DevelopersApi api) { + private void fillVolumeStatsCache(String linstorAddr) { + final DevelopersApi api = LinstorUtil.getLinstorAPI(linstorAddr); try { - logger.trace("Start volume stats cache update"); + logger.trace("Start volume stats cache update for " + linstorAddr); List resources = api.viewResources( Collections.emptyList(), Collections.emptyList(), @@ -1566,14 +1567,14 @@ public class LinstorPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver } } - volumeStats.clear(); + volumeStats.keySet().removeIf(key -> key.startsWith(linstorAddr)); for (Map.Entry entry : allocSizeMap.entrySet()) { Long reserved = resSizeMap.getOrDefault(entry.getKey(), 0L); Pair volStat = new Pair<>(entry.getValue(), reserved); - volumeStats.put(entry.getKey(), volStat); + volumeStats.put(linstorAddr + "/" + entry.getKey(), volStat); } - volumeStatsLastUpdate = System.currentTimeMillis(); - logger.trace("Done volume stats cache update: {}", volumeStats.size()); + volumeStatsLastUpdate.put(linstorAddr, System.currentTimeMillis()); + logger.debug(String.format("Done volume stats cache update for %s: %d", linstorAddr, volumeStats.size())); } catch (ApiException e) { logger.error("Unable to fetch Linstor resources: {}", e.getBestMessage()); } @@ -1581,14 +1582,19 @@ public class LinstorPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver @Override public Pair getVolumeStats(StoragePool storagePool, String volumeId) { - final DevelopersApi api = LinstorUtil.getLinstorAPI(storagePool.getHostAddress()); + String linstorAddr = storagePool.getHostAddress(); synchronized (volumeStats) { - long invalidateCacheTime = volumeStatsLastUpdate + + long invalidateCacheTime = volumeStatsLastUpdate.getOrDefault(storagePool.getHostAddress(), 0L) + LinstorConfigurationManager.VolumeStatsCacheTime.value() * 1000; if (invalidateCacheTime < System.currentTimeMillis()) { - fillVolumeStatsCache(api); + fillVolumeStatsCache(storagePool.getHostAddress()); } - return volumeStats.get(LinstorUtil.RSC_PREFIX + volumeId); + String volumeKey = linstorAddr + "/" + LinstorUtil.RSC_PREFIX + volumeId; + Pair sizePair = volumeStats.get(volumeKey); + if (sizePair == null) { + logger.warn(String.format("Volumestats for %s not found in cache", volumeKey)); + } + return sizePair; } } diff --git a/plugins/storage/volume/nexenta/pom.xml b/plugins/storage/volume/nexenta/pom.xml index f391214272b..d52836f12be 100644 --- a/plugins/storage/volume/nexenta/pom.xml +++ b/plugins/storage/volume/nexenta/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/volume/primera/pom.xml b/plugins/storage/volume/primera/pom.xml index 1faaf55e1c1..ad17a695c22 100644 --- a/plugins/storage/volume/primera/pom.xml +++ b/plugins/storage/volume/primera/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/volume/sample/pom.xml b/plugins/storage/volume/sample/pom.xml index 45ae14b9744..f0a171e83cb 100644 --- a/plugins/storage/volume/sample/pom.xml +++ b/plugins/storage/volume/sample/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/volume/scaleio/pom.xml b/plugins/storage/volume/scaleio/pom.xml index 096d4025355..79b1a328953 100644 --- a/plugins/storage/volume/scaleio/pom.xml +++ b/plugins/storage/volume/scaleio/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/volume/solidfire/pom.xml b/plugins/storage/volume/solidfire/pom.xml index 14b673c590f..008ddf137d8 100644 --- a/plugins/storage/volume/solidfire/pom.xml +++ b/plugins/storage/volume/solidfire/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/volume/storpool/pom.xml b/plugins/storage/volume/storpool/pom.xml index a36c3f014ce..4c18425f41d 100644 --- a/plugins/storage/volume/storpool/pom.xml +++ b/plugins/storage/volume/storpool/pom.xml @@ -17,7 +17,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../../pom.xml diff --git a/plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/StorPoolDownloadTemplateCommandWrapper.java b/plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/StorPoolDownloadTemplateCommandWrapper.java index 3e7118ab81d..da67812cbbe 100644 --- a/plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/StorPoolDownloadTemplateCommandWrapper.java +++ b/plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/StorPoolDownloadTemplateCommandWrapper.java @@ -103,9 +103,10 @@ public final class StorPoolDownloadTemplateCommandWrapper extends CommandWrapper final QemuImgFile srcFile = new QemuImgFile(srcDisk.getPath(), srcDisk.getFormat()); final QemuImg qemu = new QemuImg(cmd.getWaitInMillSeconds()); - StorPoolStorageAdaptor.resize( Long.toString(srcDisk.getVirtualSize()), dst.getPath()); if (dst instanceof TemplateObjectTO) { + StorPoolStorageAdaptor.resize(Long.toString(srcDisk.getVirtualSize()), dst.getPath()); + ((TemplateObjectTO) dst).setSize(srcDisk.getVirtualSize()); } diff --git a/plugins/user-authenticators/ldap/pom.xml b/plugins/user-authenticators/ldap/pom.xml index 6d59458e479..80101f05e3d 100644 --- a/plugins/user-authenticators/ldap/pom.xml +++ b/plugins/user-authenticators/ldap/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/user-authenticators/md5/pom.xml b/plugins/user-authenticators/md5/pom.xml index d8f1c14f3b9..bffcf5d43c4 100644 --- a/plugins/user-authenticators/md5/pom.xml +++ b/plugins/user-authenticators/md5/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/user-authenticators/oauth2/pom.xml b/plugins/user-authenticators/oauth2/pom.xml index 70144b99e6e..83773bc20ae 100644 --- a/plugins/user-authenticators/oauth2/pom.xml +++ b/plugins/user-authenticators/oauth2/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/user-authenticators/pbkdf2/pom.xml b/plugins/user-authenticators/pbkdf2/pom.xml index b9529d28873..b148e7b4e2c 100644 --- a/plugins/user-authenticators/pbkdf2/pom.xml +++ b/plugins/user-authenticators/pbkdf2/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/user-authenticators/plain-text/pom.xml b/plugins/user-authenticators/plain-text/pom.xml index 54933571aba..ac990df26b9 100644 --- a/plugins/user-authenticators/plain-text/pom.xml +++ b/plugins/user-authenticators/plain-text/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/user-authenticators/saml2/pom.xml b/plugins/user-authenticators/saml2/pom.xml index d20569f0418..3cf1c7fbc7c 100644 --- a/plugins/user-authenticators/saml2/pom.xml +++ b/plugins/user-authenticators/saml2/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/user-authenticators/sha256salted/pom.xml b/plugins/user-authenticators/sha256salted/pom.xml index a1ff872551a..f4da967ddfe 100644 --- a/plugins/user-authenticators/sha256salted/pom.xml +++ b/plugins/user-authenticators/sha256salted/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/user-two-factor-authenticators/static-pin/pom.xml b/plugins/user-two-factor-authenticators/static-pin/pom.xml index 040e6a2fe50..ba4680d5003 100644 --- a/plugins/user-two-factor-authenticators/static-pin/pom.xml +++ b/plugins/user-two-factor-authenticators/static-pin/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/plugins/user-two-factor-authenticators/totp/pom.xml b/plugins/user-two-factor-authenticators/totp/pom.xml index 0a25d81a728..60595853108 100644 --- a/plugins/user-two-factor-authenticators/totp/pom.xml +++ b/plugins/user-two-factor-authenticators/totp/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-plugins - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../../pom.xml diff --git a/pom.xml b/pom.xml index 06e9969a160..b33d9dfe4c6 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT pom Apache CloudStack Apache CloudStack is an IaaS ("Infrastructure as a Service") cloud orchestration platform. @@ -58,7 +58,7 @@ 11 target build/replace.properties - -Djava.security.egd=file:/dev/./urandom -noverify --add-opens=java.base/java.lang=ALL-UNNAMED --add-exports=java.base/sun.security.x509=ALL-UNNAMED --add-opens=java.base/javax.net.ssl=ALL-UNNAMED + -Djava.security.egd=file:/dev/./urandom -noverify --add-opens=java.base/java.lang=ALL-UNNAMED --add-exports=java.base/sun.security.x509=ALL-UNNAMED --add-exports=java.base/sun.security.provider=ALL-UNNAMED --add-opens=java.base/javax.net.ssl=ALL-UNNAMED 1.8 diff --git a/quickcloud/pom.xml b/quickcloud/pom.xml index 92d22c5d556..016e28e55dd 100644 --- a/quickcloud/pom.xml +++ b/quickcloud/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/scripts/installer/pre-check.sh b/scripts/installer/pre-check.sh new file mode 100755 index 00000000000..ce8772ed606 --- /dev/null +++ b/scripts/installer/pre-check.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# 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. + +if [ ! -f "/usr/bin/java" ];then + echo "ERROR: /usr/bin/java does not exist" + exit 1 +fi + +JAVA_MAJOR_VERSION=$(/usr/bin/java --version | grep -oE '[0-9]+\.[0-9]+(\.[0-9]+)?' | head -n 1 |cut -d "." -f1) + +if [ -z $JAVA_MAJOR_VERSION ];then + echo "WARNING: Cannot determine the JAVA version" + exit 0 +fi + +if [ "$JAVA_MAJOR_VERSION" != "17" ] && [ "$JAVA_MAJOR_VERSION" != "11" ];then + echo "ERROR: JAVA $JAVA_MAJOR_VERSION is not supported. Currently only JAVA 17 and JAVA 11 are supported." + exit 1 +fi + +if [ "$JAVA_MAJOR_VERSION" != "17" ];then + echo "WARNING: JAVA version is $JAVA_MAJOR_VERSION. JAVA 17 is recommended." +fi diff --git a/scripts/util/keystore-setup b/scripts/util/keystore-setup index 25bf28af008..1e1237cde04 100755 --- a/scripts/util/keystore-setup +++ b/scripts/util/keystore-setup @@ -25,45 +25,75 @@ CSR_FILE="$5" ALIAS="cloud" LIBVIRTD_FILE="/etc/libvirt/libvirtd.conf" +if type -p logger > /dev/null; then + LOGGER_CMD="$(type -p logger) -t cloudstack-keystore-setup" +else + LOG_FILE="/var/log/cloudstack/agent/cloudstack-keystore-setup.log" + log() { + if [ "${1}" != "" ]; then + __log_line="${1}" + else + read -r __log_line + fi + + echo "${__log_line}" >> "${LOG_FILE}" + echo "${__log_line}" + } + LOGGER_CMD=log +fi + +$LOGGER_CMD "$(date) - starting keystore-setup" + # Re-use existing password or use the one provided if [ -f "$PROPS_FILE" ]; then - OLD_PASS=$(sed -n '/keystore.passphrase/p' "$PROPS_FILE" 2>/dev/null | sed 's/keystore.passphrase=//g' 2>/dev/null) - if [ ! -z "${OLD_PASS// }" ]; then + $LOGGER_CMD "Previous props file exists, trying to extract password" + OLD_PASS=$(sed -n '/^keystore.passphrase/p' "$PROPS_FILE" | sed 's/^keystore.passphrase=//g') + if [ -n "${OLD_PASS// }" ]; then KS_PASS="$OLD_PASS" + $LOGGER_CMD "Password extraction successful" else - sed -i "/keystore.passphrase.*/d" $PROPS_FILE 2> /dev/null || true - echo "keystore.passphrase=$KS_PASS" >> $PROPS_FILE + sed -i "/^keystore.passphrase.*/d" "$PROPS_FILE" 2>&1 | $LOGGER_CMD || true + echo "keystore.passphrase=$KS_PASS" >> "$PROPS_FILE" + if [ $? != 0 ]; then + $LOGGER_CMD "Could not add new password to agent.properties" + else + $LOGGER_CMD "New keystore password set" + fi fi fi if [ -f "$KS_FILE" ]; then - keytool -delete -noprompt -alias "$ALIAS" -keystore "$KS_FILE" -storepass "$KS_PASS" > /dev/null 2>&1 || true + $LOGGER_CMD "keystore file exists. Deleting current entries" + keytool -delete -noprompt -alias "$ALIAS" -keystore "$KS_FILE" -storepass "$KS_PASS" 2>&1 | $LOGGER_CMD + [ $? -ne 0 ] && $LOGGER_CMD "Failed to delete current entries" fi +$LOGGER_CMD "Generating new key" CN=$(hostname --fqdn) -keytool -genkey -storepass "$KS_PASS" -keypass "$KS_PASS" -alias "$ALIAS" -keyalg RSA -validity "$KS_VALIDITY" -dname cn="$CN",ou="cloudstack",o="cloudstack",c="cloudstack" -keystore "$KS_FILE" > /dev/null 2>&1 +keytool -genkey -storepass "$KS_PASS" -keypass "$KS_PASS" -alias "$ALIAS" -keyalg RSA -validity "$KS_VALIDITY" -dname cn="$CN",ou="cloudstack",o="cloudstack",c="cloudstack" -keystore "$KS_FILE" 2>&1 | $LOGGER_CMD # Generate CSR -rm -f "$CSR_FILE" +$LOGGER_CMD "Generating CSR" +[ -f "$CSR_FILE" ] && rm -f "$CSR_FILE" addresses=$(ip address | grep inet | awk '{print $2}' | sed 's/\/.*//g' | grep -v '^169.254.' | grep -v '^127.0.0.1' | egrep -v '^::1|^fe80' | grep -v '^::1' | sed 's/^/ip:/g' | tr '\r\n' ',') -keytool -certreq -storepass "$KS_PASS" -alias "$ALIAS" -file $CSR_FILE -keystore "$KS_FILE" -ext san="$addresses" > /dev/null 2>&1 - +$LOGGER_CMD "Found following SAN addresses to add to CSR: ${addresses}" +keytool -certreq -storepass "$KS_PASS" -alias "$ALIAS" -file "$CSR_FILE" -keystore "$KS_FILE" -ext san="$addresses" 2>&1 | $LOGGER_CMD if [ $? -ne 0 ];then - echo "Failed to generate CSR file, retrying after removing existing settings" + $LOGGER_CMD "Failed to generate CSR file, retrying after removing existing settings" if [ -f "$LIBVIRTD_FILE" ]; then - echo "Reverting libvirtd to not listen on TLS" + $LOGGER_CMD "Reverting libvirtd to not listen on TLS" sed -i "s,^listen_tls=1,listen_tls=0,g" $LIBVIRTD_FILE systemctl restart libvirtd fi - echo "Removing cloud.* files in /etc/cloudstack/agent" - rm -f /etc/cloudstack/agent/cloud.* + $LOGGER_CMD "Removing cloud.* files in /etc/cloudstack/agent" + rm -f /etc/cloudstack/agent/cloud.* || $LOGGER_CMD "Could not remove /etc/cloudstack/agent/cloud.*" - echo "Retrying to generate CSR file" - keytool -certreq -storepass "$KS_PASS" -alias "$ALIAS" -file $CSR_FILE -keystore "$KS_FILE" -ext san="$addresses" >/dev/null 2>&1 + $LOGGER_CMD "Retrying to generate CSR file" + keytool -certreq -storepass "$KS_PASS" -alias "$ALIAS" -file "$CSR_FILE" -keystore "$KS_FILE" -ext san="$addresses" 2>&1 | $LOGGER_CMD if [ $? -ne 0 ];then - echo "Failed to generate CSR file while retrying" + $LOGGER_CMD "Failed to generate CSR file while retrying" exit 1 fi fi @@ -71,6 +101,6 @@ fi cat "$CSR_FILE" # Fix file permissions -chmod 600 $KS_FILE -chmod 600 $PROPS_FILE -chmod 600 $CSR_FILE +chmod 600 "$KS_FILE" || $LOGGER_CMD "Cannot chmod $KS_FILE" +chmod 600 "$PROPS_FILE" || $LOGGER_CMD "Cannot chmod $PROPS_FILE" +chmod 600 "$CSR_FILE" || $LOGGER_CMD "Cannot chmod $CSR_FILE" diff --git a/scripts/vm/hypervisor/external/provisioner/provisioner.sh b/scripts/vm/hypervisor/external/provisioner/provisioner.sh index 6aa96610ef4..63d07653c0f 100755 --- a/scripts/vm/hypervisor/external/provisioner/provisioner.sh +++ b/scripts/vm/hypervisor/external/provisioner/provisioner.sh @@ -96,7 +96,7 @@ reboot() { status() { parse_json "$1" || exit 1 - echo '{"status": "success", "power_state": "running"}' + echo '{"status": "success", "power_state": "poweron"}' } action=$1 diff --git a/scripts/vm/hypervisor/kvm/gpudiscovery.sh b/scripts/vm/hypervisor/kvm/gpudiscovery.sh index 662abaed2cb..d27f6daf8c5 100755 --- a/scripts/vm/hypervisor/kvm/gpudiscovery.sh +++ b/scripts/vm/hypervisor/kvm/gpudiscovery.sh @@ -349,6 +349,130 @@ json_escape() { # Cache for nodedev XML data to avoid repeated virsh calls declare -A nodedev_cache +# Cache for nvidia-smi vgpu profile data +declare -A nvidia_vgpu_profiles + +# Parse nvidia-smi vgpu -s -v output and populate profile cache +parse_nvidia_vgpu_profiles() { + local gpu_address="" + local profile_id="" + local profile_name="" + local max_instances="" + local fb_memory="" + local max_heads="" + local max_x_res="" + local max_y_res="" + + # Function to store current profile data + store_profile_data() { + if [[ -n "$gpu_address" && -n "$profile_id" && -n "$profile_name" ]]; then + local key="${gpu_address}:${profile_id}" + nvidia_vgpu_profiles["$key"]="$profile_name|${max_instances:-0}|${fb_memory:-0}|${max_heads:-0}|${max_x_res:-0}|${max_y_res:-0}" + fi + } + + # Skip if nvidia-smi is not available + if ! command -v nvidia-smi >/dev/null 2>&1; then + return + fi + + while IFS= read -r line; do + # Match GPU address line + if [[ $line =~ ^GPU[[:space:]]+([0-9A-Fa-f:]+\.[0-9A-Fa-f]+) ]]; then + # Store previous profile data before starting new GPU + store_profile_data + + gpu_address="${BASH_REMATCH[1]}" + # Convert from format like 00000000:AF:00.0 to AF:00.0 and normalize to lowercase + if [[ $gpu_address =~ [0-9A-Fa-f]+:([0-9A-Fa-f]+:[0-9A-Fa-f]+\.[0-9A-Fa-f]+) ]]; then + gpu_address="${BASH_REMATCH[1],,}" + else + gpu_address="${gpu_address,,}" + fi + # Reset profile variables for new GPU + profile_id="" + profile_name="" + max_instances="" + fb_memory="" + max_heads="" + max_x_res="" + max_y_res="" + elif [[ $line =~ ^[[:space:]]*vGPU[[:space:]]+Type[[:space:]]+ID[[:space:]]*:[[:space:]]*0x([0-9A-Fa-f]+) ]]; then + # Store previous profile data before starting new profile + store_profile_data + + # Normalize to lowercase hex without 0x prefix + profile_id="${BASH_REMATCH[1],,}" + # Reset profile-specific variables + profile_name="" + max_instances="" + fb_memory="" + max_heads="" + max_x_res="" + max_y_res="" + elif [[ $line =~ ^[[:space:]]*Name[[:space:]]*:[[:space:]]*(.+)$ ]]; then + profile_name="${BASH_REMATCH[1]}" + elif [[ $line =~ ^[[:space:]]*Max[[:space:]]+Instances[[:space:]]*:[[:space:]]*([0-9]+) ]]; then + max_instances="${BASH_REMATCH[1]}" + elif [[ $line =~ ^[[:space:]]*FB[[:space:]]+Memory[[:space:]]*:[[:space:]]*([0-9]+)[[:space:]]*MiB ]]; then + fb_memory="${BASH_REMATCH[1]}" + elif [[ $line =~ ^[[:space:]]*Display[[:space:]]+Heads[[:space:]]*:[[:space:]]*([0-9]+) ]]; then + max_heads="${BASH_REMATCH[1]}" + elif [[ $line =~ ^[[:space:]]*Maximum[[:space:]]+X[[:space:]]+Resolution[[:space:]]*:[[:space:]]*([0-9]+) ]]; then + max_x_res="${BASH_REMATCH[1]}" + elif [[ $line =~ ^[[:space:]]*Maximum[[:space:]]+Y[[:space:]]+Resolution[[:space:]]*:[[:space:]]*([0-9]+) ]]; then + max_y_res="${BASH_REMATCH[1]}" + fi + done < <(nvidia-smi vgpu -s -v 2>/dev/null || true) + + # Store the last profile data after processing all lines + store_profile_data +} + +# Get current vGPU type ID for a VF from sysfs +get_current_vgpu_type() { + local vf_path="$1" + local current_type_file="$vf_path/nvidia/current_vgpu_type" + + if [[ -f "$current_type_file" ]]; then + local type_id + type_id=$(<"$current_type_file") + + # Remove any whitespace + type_id="${type_id// /}" + + # Handle different input formats and normalize to lowercase hex without 0x + if [[ $type_id =~ ^0x([0-9A-Fa-f]+)$ ]]; then + # Input is hex with 0x prefix (e.g., "0x252") + echo "${BASH_REMATCH[1],,}" + elif [[ $type_id =~ ^[0-9]+$ ]]; then + # Input is decimal (e.g., "594") + printf "%x" "$type_id" + elif [[ $type_id =~ ^[0-9A-Fa-f]+$ ]]; then + # Input is hex without 0x prefix (e.g., "252") + echo "${type_id,,}" + else + # Fallback for unknown format + echo "0" + fi + else + echo "0" + fi +} + +# Get profile information from nvidia-smi cache +get_nvidia_profile_info() { + local gpu_address="$1" + local profile_id="$2" + local key="${gpu_address}:${profile_id}" + + if [[ -n "${nvidia_vgpu_profiles[$key]:-}" ]]; then + echo "${nvidia_vgpu_profiles[$key]}" + else + echo "|0|0|0|0|0" # Default empty values + fi +} + # Get nodedev name for a PCI address (e.g. "00:02.0" -> "pci_0000_00_02_0") get_nodedev_name() { local addr="$1" @@ -567,6 +691,9 @@ process_mdev_instances() { # === GPU Discovery === +# Parse nvidia-smi vgpu profiles once at the beginning +parse_nvidia_vgpu_profiles + mapfile -t LINES < <(lspci -nnm) echo '{ "gpus": [' @@ -575,7 +702,7 @@ first_gpu=true for LINE in "${LINES[@]}"; do # Parse lspci -nnm fields: SLOT "CLASS [CODE]" "VENDOR [VID]" "DEVICE [DID]" ... if [[ $LINE =~ ^([^[:space:]]+)[[:space:]]\"([^\"]+)\"[[:space:]]\"([^\"]+)\"[[:space:]]\"([^\"]+)\" ]]; then - PCI_ADDR="${BASH_REMATCH[1]}" + PCI_ADDR="${BASH_REMATCH[1],,}" # Normalize to lowercase PCI_CLASS="${BASH_REMATCH[2]}" VENDOR_FIELD="${BASH_REMATCH[3]}" DEVICE_FIELD="${BASH_REMATCH[4]}" @@ -662,12 +789,33 @@ for LINE in "${LINES[@]}"; do SLOT="0x${VF_BDF:3:2}" FUNC="0x${VF_BDF:6:1}" - # Determine vf_profile + # Determine vf_profile using nvidia-smi information VF_PROFILE="" - if VF_LINE=$(lspci -nnm -s "$VF_BDF" 2>/dev/null); then - if [[ $VF_LINE =~ \"([^\"]+)\"[[:space:]]\"([^\"]+)\"[[:space:]]\"([^\"]+)\"[[:space:]]\"([^\"]+)\" ]]; then - VF_DEVICE_FIELD="${BASH_REMATCH[4]}" - VF_PROFILE=$(sed -E 's/ \[[0-9A-Fa-f]{4}\]$//' <<<"$VF_DEVICE_FIELD") + VF_PROFILE_NAME="" + VF_MAX_INSTANCES="null" + VF_VIDEO_RAM="null" + VF_MAX_HEADS="null" + VF_MAX_RESOLUTION_X="null" + VF_MAX_RESOLUTION_Y="null" + + if [[ "$VENDOR_ID" == "10de" ]]; then + # For NVIDIA GPUs, check current vGPU type + current_vgpu_type=$(get_current_vgpu_type "$VF_PATH") + if [[ "$current_vgpu_type" != "0" ]]; then + # Get profile info from nvidia-smi cache + profile_info=$(get_nvidia_profile_info "$PCI_ADDR" "$current_vgpu_type") + IFS='|' read -r VF_PROFILE_NAME VF_MAX_INSTANCES VF_VIDEO_RAM VF_MAX_HEADS VF_MAX_RESOLUTION_X VF_MAX_RESOLUTION_Y <<< "$profile_info" + VF_PROFILE="$VF_PROFILE_NAME" + fi + fi + + # Fallback to lspci parsing if no nvidia-smi profile found + if [[ -z "$VF_PROFILE" ]]; then + if VF_LINE=$(lspci -nnm -s "$VF_BDF" 2>/dev/null); then + if [[ $VF_LINE =~ \"([^\"]+)\"[[:space:]]\"([^\"]+)\"[[:space:]]\"([^\"]+)\"[[:space:]]\"([^\"]+)\" ]]; then + VF_DEVICE_FIELD="${BASH_REMATCH[4]}" + VF_PROFILE=$(sed -E 's/ \[[0-9A-Fa-f]{4}\]$//' <<<"$VF_DEVICE_FIELD") + fi fi fi VF_PROFILE_JSON=$(json_escape "$VF_PROFILE") @@ -677,7 +825,7 @@ for LINE in "${LINES[@]}"; do USED_JSON=$(to_json_vm "$raw") flist+=( - "{\"vf_pci_address\":\"$VF_BDF\",\"vf_profile\":$VF_PROFILE_JSON,\"libvirt_address\":{\"domain\":\"$DOMAIN\",\"bus\":\"$BUS\",\"slot\":\"$SLOT\",\"function\":\"$FUNC\"},\"used_by_vm\":$USED_JSON}") + "{\"vf_pci_address\":\"$VF_BDF\",\"vf_profile\":$VF_PROFILE_JSON,\"max_instances\":$VF_MAX_INSTANCES,\"video_ram\":$VF_VIDEO_RAM,\"max_heads\":$VF_MAX_HEADS,\"max_resolution_x\":$VF_MAX_RESOLUTION_X,\"max_resolution_y\":$VF_MAX_RESOLUTION_Y,\"libvirt_address\":{\"domain\":\"$DOMAIN\",\"bus\":\"$BUS\",\"slot\":\"$SLOT\",\"function\":\"$FUNC\"},\"used_by_vm\":$USED_JSON}") done if [ ${#flist[@]} -gt 0 ]; then VF_ARRAY="[$( diff --git a/server/pom.xml b/server/pom.xml index 437d7006c33..b6ef45d1ec9 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT @@ -194,7 +194,7 @@ org.apache.cloudstack cloud-framework-extensions - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT compile diff --git a/server/src/main/java/com/cloud/api/ApiServer.java b/server/src/main/java/com/cloud/api/ApiServer.java index e0737a6891d..c78ac05102f 100644 --- a/server/src/main/java/com/cloud/api/ApiServer.java +++ b/server/src/main/java/com/cloud/api/ApiServer.java @@ -315,14 +315,14 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer , "enables/disables checking of ipaddresses from a proxy set header. See \"proxy.header.names\" for the headers to allow." , true , ConfigKey.Scope.Global); - static final ConfigKey listOfForwardHeaders = new ConfigKey<>(ConfigKey.CATEGORY_NETWORK + public static final ConfigKey listOfForwardHeaders = new ConfigKey<>(ConfigKey.CATEGORY_NETWORK , String.class , "proxy.header.names" , "X-Forwarded-For,HTTP_CLIENT_IP,HTTP_X_FORWARDED_FOR" , "a list of names to check for allowed ipaddresses from a proxy set header. See \"proxy.cidr\" for the proxies allowed to set these headers." , true , ConfigKey.Scope.Global); - static final ConfigKey proxyForwardList = new ConfigKey<>(ConfigKey.CATEGORY_NETWORK + public static final ConfigKey proxyForwardList = new ConfigKey<>(ConfigKey.CATEGORY_NETWORK , String.class , "proxy.cidr" , "" diff --git a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java index 36dfd969a7b..c4484d7fd41 100644 --- a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java @@ -43,7 +43,6 @@ import java.util.Map.Entry; import java.util.Objects; import java.util.Optional; import java.util.Set; -import java.util.UUID; import java.util.Vector; import java.util.stream.Collectors; @@ -294,6 +293,7 @@ import com.cloud.utils.NumbersUtil; import com.cloud.utils.Pair; import com.cloud.utils.Ternary; import com.cloud.utils.UriUtils; +import com.cloud.utils.UuidUtils; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.crypt.DBEncryptionUtil; import com.cloud.utils.db.DB; @@ -3107,7 +3107,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati checkZoneParameters(zoneName, dns1, dns2, internalDns1, internalDns2, true, domainId, allocationStateStr, ip6Dns1, ip6Dns2); final byte[] bytes = (zoneName + System.currentTimeMillis()).getBytes(); - final String zoneToken = UUID.nameUUIDFromBytes(bytes).toString(); + final String zoneToken = UuidUtils.nameUUIDFromBytes(bytes).toString(); // Create the new zone in the database final DataCenterVO zoneFinal = new DataCenterVO(zoneName, null, dns1, dns2, internalDns1, internalDns2, guestCidr, domain, domainId, zoneType, zoneToken, networkDomain, diff --git a/server/src/main/java/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java b/server/src/main/java/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java index a83db42f598..7e019bb39f6 100644 --- a/server/src/main/java/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java +++ b/server/src/main/java/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java @@ -26,7 +26,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.UUID; import javax.inject.Inject; import javax.naming.ConfigurationException; @@ -69,6 +68,7 @@ import com.cloud.resource.ServerResource; import com.cloud.resource.UnableDeleteHostException; import com.cloud.utils.PasswordGenerator; import com.cloud.utils.StringUtils; +import com.cloud.utils.UuidUtils; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.ssh.SSHCmdHelper; import com.trilead.ssh2.Connection; @@ -241,7 +241,7 @@ public abstract class LibvirtServerDiscoverer extends DiscovererBase implements // Set cluster GUID based on cluster ID if null if (cluster.getGuid() == null) { - cluster.setGuid(UUID.nameUUIDFromBytes(String.valueOf(clusterId).getBytes()).toString()); + cluster.setGuid(UuidUtils.nameUUIDFromBytes(String.valueOf(clusterId).getBytes()).toString()); _clusterDao.update(clusterId, cluster); } @@ -259,7 +259,7 @@ public abstract class LibvirtServerDiscoverer extends DiscovererBase implements String hostname = uri.getHost(); InetAddress ia = InetAddress.getByName(hostname); agentIp = ia.getHostAddress(); - String guid = UUID.nameUUIDFromBytes(agentIp.getBytes()).toString(); + String guid = UuidUtils.nameUUIDFromBytes(agentIp.getBytes()).toString(); List existingHosts = _resourceMgr.listAllHostsInOneZoneByType(Host.Type.Routing, dcId); if (existingHosts != null) { diff --git a/server/src/main/java/com/cloud/network/NetworkModelImpl.java b/server/src/main/java/com/cloud/network/NetworkModelImpl.java index 2ee835d844e..925ddc677c9 100644 --- a/server/src/main/java/com/cloud/network/NetworkModelImpl.java +++ b/server/src/main/java/com/cloud/network/NetworkModelImpl.java @@ -797,7 +797,7 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel, Confi NetworkVO ret_network = null; for (NetworkVO nw : networks) { try { - checkAccountNetworkPermissions(account, nw); + checkNetworkPermissions(account, nw); } catch (PermissionDeniedException e) { continue; } 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 dc408602c93..637ccabad05 100644 --- a/server/src/main/java/com/cloud/network/security/SecurityGroupManagerImpl.java +++ b/server/src/main/java/com/cloud/network/security/SecurityGroupManagerImpl.java @@ -355,6 +355,9 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro String cidr = defaultNic.getIPv4Address(); cidr = cidr + "/32"; cidrs.add(cidr); + if (defaultNic.getIPv6Address() != null) { + cidrs.add(defaultNic.getIPv6Address() + "/64"); + } } } } else if (rule.getAllowedSourceIpCidr() != null) { diff --git a/server/src/main/java/com/cloud/network/security/SecurityGroupManagerImpl2.java b/server/src/main/java/com/cloud/network/security/SecurityGroupManagerImpl2.java index 230aa0ec231..fc4fcb0090a 100644 --- a/server/src/main/java/com/cloud/network/security/SecurityGroupManagerImpl2.java +++ b/server/src/main/java/com/cloud/network/security/SecurityGroupManagerImpl2.java @@ -249,6 +249,9 @@ public class SecurityGroupManagerImpl2 extends SecurityGroupManagerImpl { //did a join with the nics table String cidr = ngmapVO.getGuestIpAddress() + "/32"; cidrs.add(cidr); + if (ngmapVO.getGuestIpv6Address() != null) { + cidrs.add(ngmapVO.getGuestIpv6Address() + "/64"); + } } } else if (rule.getAllowedSourceIpCidr() != null) { cidrs.add(rule.getAllowedSourceIpCidr()); diff --git a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java index fce848aa30d..e476c74d17d 100644 --- a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java @@ -1119,7 +1119,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio NetworkOfferingVO defaultNetworkOfferingForVpcNetworks = new NetworkOfferingVO(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks, "Offering for Isolated Vpc networks with Source Nat service enabled", TrafficType.Guest, false, false, null, null, true, Availability.Optional, - null, Network.GuestType.Isolated, false, false, false, false, true, true); + null, Network.GuestType.Isolated, true, false, false, false, true, true); defaultNetworkOfferingForVpcNetworks.setState(NetworkOffering.State.Enabled); defaultNetworkOfferingForVpcNetworks.setSupportsVmAutoScaling(true); diff --git a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java index f6bef8b2e8c..e1833397e99 100644 --- a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java @@ -4029,7 +4029,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C DataStoreRole.Image, store.getId()); if (CollectionUtils.isEmpty(stores)) { List> hypervisorTypes = - _clusterDao.listDistinctHypervisorsArchAcrossClusters(zoneId); + _clusterDao.listDistinctHypervisorsAndArchExcludingExternalType(zoneId); TransactionLegacy txn = TransactionLegacy.open("AutomaticTemplateRegister"); SystemVmTemplateRegistration systemVmTemplateRegistration = new SystemVmTemplateRegistration(); String filePath = null; @@ -4052,7 +4052,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C } } } catch (Exception e) { - logger.error("Failed to register systemVM template(s)"); + logger.error("Failed to register systemVM template(s) due to: ", e); } finally { SystemVmTemplateRegistration.unmountStore(filePath); txn.close(); diff --git a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java index 56b0ccd6723..5c5a4044909 100644 --- a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java @@ -3814,10 +3814,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic @Override @ActionEvent(eventType = EventTypes.EVENT_SNAPSHOT_CREATE, eventDescription = "taking snapshot", async = true) - public Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm, - Snapshot.LocationType locationType, boolean asyncBackup, Map tags, List zoneIds, List poolIds, Boolean useStorageReplication) - - throws ResourceAllocationException { + public Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm, Snapshot.LocationType locationType, boolean asyncBackup, + Map tags, List zoneIds, List poolIds, Boolean useStorageReplication) throws ResourceAllocationException { final Snapshot snapshot = takeSnapshotInternal(volumeId, policyId, snapshotId, account, quiescevm, locationType, asyncBackup, zoneIds, poolIds, useStorageReplication); if (snapshot != null && MapUtils.isNotEmpty(tags)) { taggedResourceService.createTags(Collections.singletonList(snapshot.getUuid()), ResourceTag.ResourceObjectType.Snapshot, tags, null); diff --git a/server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java index 818e63bbcc1..f6c8655fd66 100755 --- a/server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -1621,7 +1621,8 @@ public class SnapshotManagerImpl extends MutualExclusiveIdsManagerBase implement if (snapshotStrategy == null) { _snapshotDao.remove(snapshotId); logger.debug("No strategy found for creation of snapshot [{}], removing its record from the database.", snapshot); - throw new CloudRuntimeException(String.format("Can't find snapshot strategy to deal with snapshot:%s", snapshot.getSnapshotVO())); + throw new UnsupportedOperationException(String.format("Unable to find a snapshot strategy to create snapshot [%s] of volume [%s]. Please check the logs.", + snapshot.getSnapshotVO(), volume.getUuid())); } SnapshotInfo snapshotOnPrimary = snapshotStrategy.takeSnapshot(snapshot); @@ -1672,7 +1673,7 @@ public class SnapshotManagerImpl extends MutualExclusiveIdsManagerBase implement } catch (Exception e) { logger.debug("post process snapshot failed", e); } - } catch (CloudRuntimeException cre) { + } catch (CloudRuntimeException | UnsupportedOperationException cre) { if (logger.isDebugEnabled()) { logger.debug("Failed to create snapshot" + cre.getLocalizedMessage()); } diff --git a/server/src/main/java/com/cloud/template/TemplateManagerImpl.java b/server/src/main/java/com/cloud/template/TemplateManagerImpl.java index 9d9ec4a7c5c..5518a29955b 100755 --- a/server/src/main/java/com/cloud/template/TemplateManagerImpl.java +++ b/server/src/main/java/com/cloud/template/TemplateManagerImpl.java @@ -1692,18 +1692,17 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager, if (store == null) { throw new CloudRuntimeException("cannot find an image store for zone " + zoneId); } - AsyncCallFuture future = null; + AsyncCallFuture future; if (snapshotId != null) { DataStoreRole dataStoreRole = snapshotHelper.getDataStoreRole(snapshot, zoneId); - kvmSnapshotOnlyInPrimaryStorage = snapshotHelper.isKvmSnapshotOnlyInPrimaryStorage(snapshot, dataStoreRole, zoneId); - snapInfo = _snapshotFactory.getSnapshotWithRoleAndZone(snapshotId, dataStoreRole, zoneId); - boolean kvmIncrementalSnapshot = SnapshotManager.kvmIncrementalSnapshot.valueIn(_hostDao.findClusterIdByVolumeInfo(snapInfo.getBaseVolume())); - boolean skipCopyToSecondary = false; - boolean keepOnPrimary = snapshotHelper.isStorageSupportSnapshotToTemplate(snapInfo); - if (keepOnPrimary) { + boolean storageSupportsSnapshotToTemplate = snapshotHelper.isStorageSupportSnapshotToTemplate(snapInfo); + if (storageSupportsSnapshotToTemplate) { + kvmSnapshotOnlyInPrimaryStorage = snapshotHelper.isKvmSnapshotOnlyInPrimaryStorage(snapshot, dataStoreRole, zoneId); + logger.debug("Creating template from snapshot for storage supporting snapshot to template, with dataStore role {} and on primary storage: {}", dataStoreRole, kvmSnapshotOnlyInPrimaryStorage); + ImageStoreVO imageStore = _imgStoreDao.findOneByZoneAndProtocol(zoneId, "nfs"); if (imageStore == null) { throw new CloudRuntimeException(String.format("Could not find an NFS secondary storage pool on zone %s to use as a temporary location " + @@ -1713,15 +1712,23 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager, if (dataStore != null) { store = dataStore; } - } else if (dataStoreRole == DataStoreRole.Image) { - snapInfo = snapshotHelper.backupSnapshotToSecondaryStorageIfNotExists(snapInfo, dataStoreRole, snapshot, kvmSnapshotOnlyInPrimaryStorage); - _accountMgr.checkAccess(caller, null, true, snapInfo); - DataStore snapStore = snapInfo.getDataStore(); + } else { + dataStoreRole = snapshotHelper.getDataStoreRole(snapshot); + kvmSnapshotOnlyInPrimaryStorage = snapshotHelper.isKvmSnapshotOnlyInPrimaryStorage(snapshot, dataStoreRole); + snapInfo = _snapshotFactory.getSnapshotWithRoleAndZone(snapshotId, dataStoreRole, zoneId); + logger.debug("Creating template from snapshot, with dataStore role {} and on primary storage: {}", dataStoreRole, kvmSnapshotOnlyInPrimaryStorage); + if (dataStoreRole == DataStoreRole.Image || kvmSnapshotOnlyInPrimaryStorage) { + snapInfo = snapshotHelper.backupSnapshotToSecondaryStorageIfNotExists(snapInfo, dataStoreRole, snapshot, kvmSnapshotOnlyInPrimaryStorage); + _accountMgr.checkAccess(caller, null, true, snapInfo); + DataStore snapStore = snapInfo.getDataStore(); - if (snapStore != null) { - store = snapStore; // pick snapshot image store to create template + if (snapStore != null) { + store = snapStore; // pick snapshot image store to create template + } } } + + boolean kvmIncrementalSnapshot = SnapshotManager.kvmIncrementalSnapshot.valueIn(_hostDao.findClusterIdByVolumeInfo(snapInfo.getBaseVolume())); if (kvmIncrementalSnapshot && DataStoreRole.Image.equals(dataStoreRole)) { snapInfo = snapshotHelper.convertSnapshotIfNeeded(snapInfo); } diff --git a/server/src/main/java/com/cloud/test/DatabaseConfig.java b/server/src/main/java/com/cloud/test/DatabaseConfig.java index c48e3331a80..0f04cc71c1a 100644 --- a/server/src/main/java/com/cloud/test/DatabaseConfig.java +++ b/server/src/main/java/com/cloud/test/DatabaseConfig.java @@ -57,6 +57,7 @@ import com.cloud.storage.Storage.ProvisioningType; import com.cloud.storage.dao.DiskOfferingDaoImpl; import com.cloud.utils.DateUtil; import com.cloud.utils.PropertiesUtil; +import com.cloud.utils.UuidUtils; import com.cloud.utils.component.ComponentContext; import com.cloud.utils.db.DB; import com.cloud.utils.db.Transaction; @@ -609,7 +610,7 @@ public class DatabaseConfig { String hostAddress = _currentObjectParams.get("hostAddress"); String hostPath = _currentObjectParams.get("hostPath"); String storageType = _currentObjectParams.get("storageType"); - String uuid = UUID.nameUUIDFromBytes(new String(hostAddress + hostPath).getBytes()).toString(); + String uuid = UuidUtils.nameUUIDFromBytes(new String(hostAddress + hostPath).getBytes()).toString(); String insertSql1 = "INSERT INTO `storage_pool` (`id`, `name`, `uuid` , `pool_type` , `port`, `data_center_id` ,`available_bytes` , `capacity_bytes` ,`host_address`, `path`, `created`, `pod_id`,`status` , `cluster_id`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; diff --git a/server/src/main/java/com/cloud/user/AccountManagerImpl.java b/server/src/main/java/com/cloud/user/AccountManagerImpl.java index d93993af9ab..a73a00d9152 100644 --- a/server/src/main/java/com/cloud/user/AccountManagerImpl.java +++ b/server/src/main/java/com/cloud/user/AccountManagerImpl.java @@ -176,6 +176,7 @@ import com.cloud.utils.ConstantTimeComparator; import com.cloud.utils.NumbersUtil; import com.cloud.utils.Pair; import com.cloud.utils.Ternary; +import com.cloud.utils.UuidUtils; import com.cloud.utils.component.ComponentContext; import com.cloud.utils.component.Manager; import com.cloud.utils.component.ManagerBase; @@ -1365,7 +1366,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M if (accountType == Account.Type.RESOURCE_DOMAIN_ADMIN) { // set registration token byte[] bytes = (domainIdFinal + accountNameFinal + userName + System.currentTimeMillis()).getBytes(); - String registrationToken = UUID.nameUUIDFromBytes(bytes).toString(); + String registrationToken = UuidUtils.nameUUIDFromBytes(bytes).toString(); user.setRegistrationToken(registrationToken); } diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java index 6cdcba7e3b6..cd7d198eb61 100644 --- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java @@ -4195,15 +4195,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir } DiskOfferingVO rootDiskOffering = _diskOfferingDao.findById(rootDiskOfferingId); - long volumesSize = 0; - if (volume != null) { - volumesSize = volume.getSize(); - } else if (snapshot != null) { - VolumeVO volumeVO = _volsDao.findById(snapshot.getVolumeId()); - volumesSize = volumeVO != null ? volumeVO.getSize() : 0; - } else { - volumesSize = configureCustomRootDiskSize(customParameters, template, hypervisorType, rootDiskOffering); - } + long volumesSize = configureCustomRootDiskSize(customParameters, template, hypervisorType, rootDiskOffering); if (rootDiskOffering.getEncrypt() && hypervisorType != HypervisorType.KVM) { throw new InvalidParameterValueException("Root volume encryption is not supported for hypervisor type " + hypervisorType); @@ -6292,7 +6284,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir } _accountMgr.checkAccess(caller, null, true, volume); templateId = volume.getTemplateId(); - overrideDiskOfferingId = volume.getDiskOfferingId(); } else if (cmd.getSnapshotId() != null) { snapshot = _snapshotDao.findById(cmd.getSnapshotId()); if (snapshot == null) { @@ -6301,7 +6292,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir _accountMgr.checkAccess(caller, null, true, snapshot); VolumeInfo volumeOfSnapshot = getVolume(snapshot.getVolumeId(), templateId, true); templateId = volumeOfSnapshot.getTemplateId(); - overrideDiskOfferingId = volumeOfSnapshot.getDiskOfferingId(); } VirtualMachineTemplate template = null; diff --git a/server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java b/server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java index 2682d53dd20..112626adf4f 100644 --- a/server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java +++ b/server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java @@ -2161,6 +2161,9 @@ public class BackupManagerImpl extends ManagerBase implements BackupManager { @Override public CapacityVO getBackupStorageUsedStats(Long zoneId) { + if (isDisabled(zoneId)) { + return new CapacityVO(null, zoneId, null, null, 0L, 0L, Capacity.CAPACITY_TYPE_BACKUP_STORAGE); + } final BackupProvider backupProvider = getBackupProvider(zoneId); Pair backupUsage = backupProvider.getBackupStorageStats(zoneId); return new CapacityVO(null, zoneId, null, null, backupUsage.first(), backupUsage.second(), Capacity.CAPACITY_TYPE_BACKUP_STORAGE); diff --git a/server/src/main/java/org/apache/cloudstack/consoleproxy/ConsoleAccessManagerImpl.java b/server/src/main/java/org/apache/cloudstack/consoleproxy/ConsoleAccessManagerImpl.java index aeb5f8a8b46..dc33b3434d4 100644 --- a/server/src/main/java/org/apache/cloudstack/consoleproxy/ConsoleAccessManagerImpl.java +++ b/server/src/main/java/org/apache/cloudstack/consoleproxy/ConsoleAccessManagerImpl.java @@ -516,7 +516,7 @@ public class ConsoleAccessManagerImpl extends ManagerBase implements ConsoleAcce sb.append("/ajax?token=" + token); } else { sb.append("/resource/noVNC/vnc.html") - .append("?autoconnect=true") + .append("?autoconnect=true&show_dot=true") .append("&port=" + vncPort) .append("&token=" + token); if (requiresVncOverWebSocketConnection(vm, hostVo) && details != null && details.getValue() != null) { diff --git a/server/src/main/java/org/apache/cloudstack/snapshot/SnapshotHelper.java b/server/src/main/java/org/apache/cloudstack/snapshot/SnapshotHelper.java index e7ec8c8208f..98efe7d1c98 100644 --- a/server/src/main/java/org/apache/cloudstack/snapshot/SnapshotHelper.java +++ b/server/src/main/java/org/apache/cloudstack/snapshot/SnapshotHelper.java @@ -113,7 +113,7 @@ public class SnapshotHelper { } List snapshots = snapshotJoinDao.listBySnapshotIdAndZoneId(zoneId, snapInfo.getSnapshotId()); - if (kvmSnapshotOnlyInPrimaryStorage || snapshots.size() <= 1) { + if (snapshots.size() <= 1) { if (snapInfo != null) { logger.trace(String.format("Snapshot [{}] is not a temporary backup to create a volume from snapshot. Not expunging it.", snapInfo.getId())); } @@ -156,7 +156,8 @@ public class SnapshotHelper { public boolean isStorageSupportSnapshotToTemplate(SnapshotInfo snapInfo) { if (DataStoreRole.Primary.equals(snapInfo.getDataStore().getRole())) { Map capabilities = snapInfo.getDataStore().getDriver().getCapabilities(); - return org.apache.commons.collections4.MapUtils.isNotEmpty(capabilities) && capabilities.containsKey(DataStoreCapabilities.CAN_CREATE_TEMPLATE_FROM_SNAPSHOT.toString()); + return org.apache.commons.collections4.MapUtils.isNotEmpty(capabilities) + && Boolean.parseBoolean(capabilities.get(DataStoreCapabilities.CAN_CREATE_TEMPLATE_FROM_SNAPSHOT.toString())); } return false; } @@ -214,22 +215,24 @@ public class SnapshotHelper { * @return true if hypervisor is {@link HypervisorType#KVM} and data store role is {@link DataStoreRole#Primary} and global setting "snapshot.backup.to.secondary" is false, * else false. */ + public boolean isKvmSnapshotOnlyInPrimaryStorage(Snapshot snapshot, DataStoreRole dataStoreRole) { + return snapshot.getHypervisorType() == Hypervisor.HypervisorType.KVM && dataStoreRole == DataStoreRole.Primary && !backupSnapshotAfterTakingSnapshot; + } + public boolean isKvmSnapshotOnlyInPrimaryStorage(Snapshot snapshot, DataStoreRole dataStoreRole, Long zoneId){ List snapshots = snapshotJoinDao.listBySnapshotIdAndZoneId(zoneId, snapshot.getSnapshotId()); - boolean isKvmSnapshotOnlyInPrimaryStorage = snapshots.stream().filter(s -> s.getStoreRole().equals(DataStoreRole.Image)).count() == 0; + boolean isKvmSnapshotOnlyInPrimaryStorage = snapshots.stream().noneMatch(s -> s.getStoreRole().equals(DataStoreRole.Image)); return snapshot.getHypervisorType() == Hypervisor.HypervisorType.KVM && dataStoreRole == DataStoreRole.Primary && isKvmSnapshotOnlyInPrimaryStorage; } public DataStoreRole getDataStoreRole(Snapshot snapshot) { SnapshotDataStoreVO snapshotStore = snapshotDataStoreDao.findOneBySnapshotAndDatastoreRole(snapshot.getId(), DataStoreRole.Primary); - if (snapshotStore == null) { return DataStoreRole.Image; } long storagePoolId = snapshotStore.getDataStoreId(); - StoragePoolVO storagePoolVO = primaryDataStoreDao.findById(storagePoolId); if ((storagePoolTypesToValidateWithBackupSnapshotAfterTakingSnapshot.contains(storagePoolVO.getPoolType()) || snapshot.getHypervisorType() == HypervisorType.KVM) && !backupSnapshotAfterTakingSnapshot) { @@ -237,13 +240,11 @@ public class SnapshotHelper { } DataStore dataStore = dataStorageManager.getDataStore(storagePoolId, DataStoreRole.Primary); - if (dataStore == null) { return DataStoreRole.Image; } Map mapCapabilities = dataStore.getDriver().getCapabilities(); - if (MapUtils.isNotEmpty(mapCapabilities) && BooleanUtils.toBoolean(mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString()))) { return DataStoreRole.Primary; } @@ -255,11 +256,13 @@ public class SnapshotHelper { if (zoneId == null) { getDataStoreRole(snapshot); } + List snapshots = snapshotJoinDao.listBySnapshotIdAndZoneId(zoneId, snapshot.getId()); boolean snapshotOnPrimary = snapshots.stream().anyMatch(s -> s.getStoreRole().equals(DataStoreRole.Primary)); if (snapshotOnPrimary) { return DataStoreRole.Primary; } + return DataStoreRole.Image; } /** diff --git a/server/src/main/java/org/apache/cloudstack/user/UserPasswordResetManager.java b/server/src/main/java/org/apache/cloudstack/user/UserPasswordResetManager.java index a42faf2835a..c7ec7f0c488 100644 --- a/server/src/main/java/org/apache/cloudstack/user/UserPasswordResetManager.java +++ b/server/src/main/java/org/apache/cloudstack/user/UserPasswordResetManager.java @@ -65,6 +65,11 @@ public interface UserPasswordResetManager { "Password for SMTP server for sending emails for resetting password for ACS users", false, ConfigKey.Scope.Global); + ConfigKey UserPasswordResetDomainURL = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, + String.class, "user.password.reset.mail.domain.url", null, + "Domain URL for reset password links sent to the user via email", true, + ConfigKey.Scope.Global); + void setResetTokenAndSend(UserAccount userAccount); boolean validateAndResetPassword(UserAccount user, String token, String password); diff --git a/server/src/main/java/org/apache/cloudstack/user/UserPasswordResetManagerImpl.java b/server/src/main/java/org/apache/cloudstack/user/UserPasswordResetManagerImpl.java index 6574489c827..8a278f6e45d 100644 --- a/server/src/main/java/org/apache/cloudstack/user/UserPasswordResetManagerImpl.java +++ b/server/src/main/java/org/apache/cloudstack/user/UserPasswordResetManagerImpl.java @@ -48,7 +48,6 @@ import java.util.Map; import java.util.Set; import java.util.UUID; -import static org.apache.cloudstack.config.ApiServiceConfiguration.ManagementServerAddresses; import static org.apache.cloudstack.resourcedetail.UserDetailVO.PasswordResetToken; import static org.apache.cloudstack.resourcedetail.UserDetailVO.PasswordResetTokenExpiryDate; @@ -69,7 +68,7 @@ public class UserPasswordResetManagerImpl extends ManagerBase implements UserPas new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, String.class, "user.password.reset.mail.template", "Hello {{username}}!\n" + "You have requested to reset your password. Please click the following link to reset your password:\n" + - "http://{{{resetLink}}}\n" + + "{{{domainUrl}}}{{{resetLink}}}\n" + "If you did not request a password reset, please ignore this email.\n" + "\n" + "Regards,\n" + @@ -95,6 +94,7 @@ public class UserPasswordResetManagerImpl extends ManagerBase implements UserPas UserPasswordResetSMTPUseAuth, UserPasswordResetSMTPUsername, UserPasswordResetSMTPPassword, + UserPasswordResetDomainURL, PasswordResetMailTemplate }; } @@ -173,9 +173,10 @@ public class UserPasswordResetManagerImpl extends ManagerBase implements UserPas final String email = userAccount.getEmail(); final String username = userAccount.getUsername(); final String subject = "Password Reset Request"; + final String domainUrl = UserPasswordResetDomainURL.value(); - String resetLink = String.format("%s/client/#/user/resetPassword?username=%s&token=%s", - ManagementServerAddresses.value().split(",")[0], username, resetToken); + String resetLink = String.format("/client/#/user/resetPassword?username=%s&token=%s", + username, resetToken); String content = getMessageBody(userAccount, resetToken, resetLink); SMTPMailProperties mailProperties = new SMTPMailProperties(); diff --git a/services/console-proxy/pom.xml b/services/console-proxy/pom.xml index 66d195591f6..00678f74683 100644 --- a/services/console-proxy/pom.xml +++ b/services/console-proxy/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack-services - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/services/console-proxy/rdpconsole/pom.xml b/services/console-proxy/rdpconsole/pom.xml index e436cb834f1..4063642bd9c 100644 --- a/services/console-proxy/rdpconsole/pom.xml +++ b/services/console-proxy/rdpconsole/pom.xml @@ -26,7 +26,7 @@ org.apache.cloudstack cloudstack-service-console-proxy - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/services/console-proxy/server/pom.xml b/services/console-proxy/server/pom.xml index 89ef9b60348..8eff010d322 100644 --- a/services/console-proxy/server/pom.xml +++ b/services/console-proxy/server/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-service-console-proxy - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/services/pom.xml b/services/pom.xml index e7984bf928c..2d0e70fa419 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/services/secondary-storage/controller/pom.xml b/services/secondary-storage/controller/pom.xml index a8f3d285d7a..901f8f3a76b 100644 --- a/services/secondary-storage/controller/pom.xml +++ b/services/secondary-storage/controller/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-service-secondary-storage - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/services/secondary-storage/pom.xml b/services/secondary-storage/pom.xml index cbc7fce41c3..06aa7b83089 100644 --- a/services/secondary-storage/pom.xml +++ b/services/secondary-storage/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack-services - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/services/secondary-storage/server/pom.xml b/services/secondary-storage/server/pom.xml index 9f7134d50e0..29669623dd0 100644 --- a/services/secondary-storage/server/pom.xml +++ b/services/secondary-storage/server/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack-service-secondary-storage - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml 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 609cda693f8..500e6bf47df 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 @@ -172,6 +172,7 @@ import com.cloud.utils.NumbersUtil; import com.cloud.utils.Pair; import com.cloud.utils.StringUtils; import com.cloud.utils.SwiftUtil; +import com.cloud.utils.UuidUtils; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.NetUtils; import com.cloud.utils.script.OutputInterpreter; @@ -671,7 +672,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S } public static String getSecondaryDatastoreUUID(String storeUrl) { - return UUID.nameUUIDFromBytes(storeUrl.getBytes()).toString(); + return UuidUtils.nameUUIDFromBytes(storeUrl.getBytes()).toString(); } private static String getTemplateRelativeDirInSecStorage(long accountId, long templateId) { @@ -3029,7 +3030,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S String nfsPath = uriHostIp + ":" + uri.getPath(); // Single means of calculating mount directory regardless of scheme - String dir = UUID.nameUUIDFromBytes(nfsPath.getBytes(com.cloud.utils.StringUtils.getPreferredCharset())).toString(); + String dir = UuidUtils.nameUUIDFromBytes(nfsPath.getBytes(com.cloud.utils.StringUtils.getPreferredCharset())).toString(); String localRootPath = _parent + "/" + dir; // remote device syntax varies by scheme. @@ -3481,7 +3482,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S templateName = uploadEntity.getUuid().trim().replace(" ", "_"); } else { try { - templateName = UUID.nameUUIDFromBytes((uploadEntity.getFilename() + System.currentTimeMillis()).getBytes("UTF-8")).toString(); + templateName = UuidUtils.nameUUIDFromBytes((uploadEntity.getFilename() + System.currentTimeMillis()).getBytes("UTF-8")).toString(); } catch (UnsupportedEncodingException e) { templateName = uploadEntity.getUuid().trim().replace(" ", "_"); } 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 64bac9e43e2..599dcfa0c48 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 @@ -86,6 +86,7 @@ import com.cloud.storage.template.TemplateProp; import com.cloud.storage.template.VhdProcessor; import com.cloud.storage.template.VmdkProcessor; import com.cloud.utils.NumbersUtil; +import com.cloud.utils.UuidUtils; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.Proxy; @@ -595,7 +596,7 @@ public class DownloadManagerImpl extends ManagerBase implements DownloadManager if (extension.equals("iso")) { templateName = jobs.get(jobId).getTmpltName().trim().replace(" ", "_"); } else { - templateName = UUID.nameUUIDFromBytes((jobs.get(jobId).getTmpltName() + System.currentTimeMillis()).getBytes(com.cloud.utils.StringUtils.getPreferredCharset())).toString(); + templateName = UuidUtils.nameUUIDFromBytes((jobs.get(jobId).getTmpltName() + System.currentTimeMillis()).getBytes(com.cloud.utils.StringUtils.getPreferredCharset())).toString(); } return templateName; } diff --git a/systemvm/debian/opt/cloud/bin/checkrouter.sh b/systemvm/debian/opt/cloud/bin/checkrouter.sh index c3a73e9e5e3..f127187ceb4 100755 --- a/systemvm/debian/opt/cloud/bin/checkrouter.sh +++ b/systemvm/debian/opt/cloud/bin/checkrouter.sh @@ -18,13 +18,33 @@ STATUS=UNKNOWN +get_guest_nics() { + python3 -c " +import json +data = json.load(open('/etc/cloudstack/ips.json')) +for nic, objs in data.items(): + if isinstance(objs, list): + for obj in objs: + if obj.get('nw_type') == 'guest' and obj.get('add'): + print(nic) + " +} + +ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g') +if [ "$ROUTER_TYPE" = "vpcrouter" ];then + GUEST_NICS=$(get_guest_nics) + if [ "$GUEST_NICS" = "" ];then + echo "Status: ${STATUS}" + exit + fi +fi + if [ "$(systemctl is-active keepalived)" != "active" ] then echo "Status: FAULT" exit fi -ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g') if [ "$ROUTER_TYPE" = "router" ] then ROUTER_STATE=$(ip -4 addr show dev eth0 | grep inet | wc -l | xargs bash -c 'if [ $0 == 2 ]; then echo "PRIMARY"; else echo "BACKUP"; fi') diff --git a/systemvm/debian/opt/cloud/bin/setup/bootstrap.sh b/systemvm/debian/opt/cloud/bin/setup/bootstrap.sh index 05edc3fbf61..f7c071c8cc0 100755 --- a/systemvm/debian/opt/cloud/bin/setup/bootstrap.sh +++ b/systemvm/debian/opt/cloud/bin/setup/bootstrap.sh @@ -118,6 +118,10 @@ bootstrap() { /opt/cloud/bin/setup/default.sh fi + if [ -f /var/cache/cloud/cloud-scripts.tgz ];then + sha512sum /var/cache/cloud/cloud-scripts.tgz | awk '{print $1}' > /var/cache/cloud/cloud-scripts-signature + fi + log_it "Finished setting up systemvm" exit 0 } diff --git a/systemvm/debian/opt/cloud/bin/setup/cloud-early-config b/systemvm/debian/opt/cloud/bin/setup/cloud-early-config index 6e5cba93e5b..ee1e872f627 100755 --- a/systemvm/debian/opt/cloud/bin/setup/cloud-early-config +++ b/systemvm/debian/opt/cloud/bin/setup/cloud-early-config @@ -32,12 +32,12 @@ log_it() { } validate_checksums() { - local oldmd5= - [ -f ${1} ] && oldmd5=$(cat ${1}) - local newmd5= - [ -f ${2} ] && newmd5=$(md5sum ${2} | awk '{print $1}') - log_it "Scripts checksum detected: oldmd5=$oldmd5 newmd5=$newmd5" >> /dev/null 2>&1 - echo "oldmd5='${oldmd5}'; newmd5='${newmd5}'" + local oldchecksum= + [ -f ${1} ] && oldchecksum=$(cat ${1}) + local newchecksum= + [ -f ${2} ] && newchecksum=$(sha512sum ${2} | awk '{print $1}') + log_it "Scripts checksum detected: oldchecksum=$oldchecksum newchecksum=$newchecksum" >> /dev/null 2>&1 + echo "oldchecksum='${oldchecksum}'; newchecksum='${newchecksum}'" } patch() { @@ -46,15 +46,15 @@ patch() { local oldpatchfile=/usr/share/cloud/$PATCH_SCRIPTS local patchfile=$PATCH_MOUNT/$PATCH_SCRIPTS local privkey=$PATCH_MOUNT/authorized_keys - local md5file=/var/cache/cloud/cloud-scripts-signature + local checksumfile=/var/cache/cloud/cloud-scripts-signature mkdir -p $PATCH_MOUNT if [ -f /var/cache/cloud/authorized_keys ]; then privkey=/var/cache/cloud/authorized_keys fi - eval $(validate_checksums $md5file $oldpatchfile) - if [ "$oldmd5" == "$newmd5" ] && [ -d /usr/local/cloud/systemvm ] && [ "$(ls -A /usr/local/cloud/systemvm)" ]; then + eval $(validate_checksums $checksumfile $oldpatchfile) + if [ "$oldchecksum" == "$newchecksum" ] && [ -d /usr/local/cloud/systemvm ] && [ "$(ls -A /usr/local/cloud/systemvm)" ]; then log_it "Checksum matches, no need to patch" return 0 fi @@ -67,11 +67,11 @@ patch() { while [ $retry -gt 0 ] do if tar tf $patchfile &> /dev/null; then - eval $(validate_checksums $md5file $patchfile) - if [ "$oldmd5" != "$newmd5" ] && [ -f ${patchfile} ] && [ "$newmd5" != "" ] + eval $(validate_checksums $checksumfile $patchfile) + if [ "$oldchecksum" != "$newchecksum" ] && [ -f ${patchfile} ] && [ "$newchecksum" != "" ] then tar xzf $patchfile -C / - echo ${newmd5} > ${md5file} + echo ${newchecksum} > ${checksumfile} log_it "Patched scripts using $patchfile" touch /var/cache/cloud/patch.required fi diff --git a/systemvm/debian/opt/cloud/bin/setup/router.sh b/systemvm/debian/opt/cloud/bin/setup/router.sh index ee4972c6fa2..5c72105f47a 100755 --- a/systemvm/debian/opt/cloud/bin/setup/router.sh +++ b/systemvm/debian/opt/cloud/bin/setup/router.sh @@ -40,18 +40,18 @@ setup_router() { # To save router public interface and gw ip information touch /var/cache/cloud/ifaceGwIp - oldmd5= - [ -f "/etc/udev/rules.d/70-persistent-net.rules" ] && oldmd5=$(md5sum "/etc/udev/rules.d/70-persistent-net.rules" | awk '{print $1}') + oldchecksum= + [ -f "/etc/udev/rules.d/70-persistent-net.rules" ] && oldchecksum=$(sha512sum "/etc/udev/rules.d/70-persistent-net.rules" | awk '{print $1}') log_it "Checking udev NIC assignment order changes" if [ "$NIC_MACS" != "" ] then init_interfaces_orderby_macs "$NIC_MACS" "/tmp/interfaces" "/tmp/udev-rules" - newmd5=$(md5sum "/tmp/udev-rules" | awk '{print $1}') + newchecksum=$(sha512sum "/tmp/udev-rules" | awk '{print $1}') rm /tmp/interfaces rm /tmp/udev-rules - if [ "$oldmd5" != "$newmd5" ] + if [ "$oldchecksum" != "$newchecksum" ] then log_it "Reloading udev for new udev NIC assignment" udevadm control --reload-rules && udevadm trigger diff --git a/systemvm/patch-sysvms.sh b/systemvm/patch-sysvms.sh index f24136155f8..a0d0561a658 100644 --- a/systemvm/patch-sysvms.sh +++ b/systemvm/patch-sysvms.sh @@ -21,7 +21,7 @@ backupfolder=/var/cache/cloud/bkpup_live_patch logfile="/var/log/livepatchsystemvm.log" newpath="/var/cache/cloud/" CMDLINE=/var/cache/cloud/cmdline -md5file=/var/cache/cloud/cloud-scripts-signature +checksumfile=/var/cache/cloud/cloud-scripts-signature svcfile=/var/cache/cloud/enabled_svcs TYPE=$(grep -Po 'type=\K[a-zA-Z]*' $CMDLINE) patchfailed=0 @@ -40,7 +40,7 @@ backup_old_package() { zip -r $backupfolder/agent.zip * >> $logfile 2>&1 2>&1 cd - fi - cp $md5file $backupfolder + cp $checksumfile $backupfolder echo "Backing up cloud-scripts file" >> $logfile 2>&1 tar -zcvf $backupfolder/cloud-scripts.tgz /etc/ /var/ /opt/ /root/ >> $logfile 2>&1 } @@ -57,13 +57,13 @@ restore_backup() { fi backuprestored=1 restart_services - cp $backupfolder/cloud-scripts-signature $md5file + cp $backupfolder/cloud-scripts-signature $checksumfile } update_checksum() { - newmd5=$(md5sum $1 | awk '{print $1}') - echo "checksum: " ${newmd5} >> $logfile 2>&1 - echo ${newmd5} > ${md5file} + newchecksum=$(sha512sum $1 | awk '{print $1}') + echo "checksum: " ${newchecksum} >> $logfile 2>&1 + echo ${newchecksum} > ${checksumfile} } restart_services() { @@ -144,7 +144,7 @@ patch_systemvm cleanup_systemVM if [ $patchfailed == 0 ]; then - echo "version:$(cat ${md5file}) " + echo "version:$(cat ${checksumfile}) " fi exit $patchfailed diff --git a/systemvm/pom.xml b/systemvm/pom.xml index 235c2017564..941661082a7 100644 --- a/systemvm/pom.xml +++ b/systemvm/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/test/integration/smoke/test_network_acl.py b/test/integration/smoke/test_network_acl.py index 0914f4dc2d4..b6a660a1156 100644 --- a/test/integration/smoke/test_network_acl.py +++ b/test/integration/smoke/test_network_acl.py @@ -125,6 +125,32 @@ class TestNetworkACL(cloudstackTestCase): self.assertTrue(vm.state == 'Running', "VM is not running") self.debug("VM %s deployed in VPC %s" %(vm.id, vpc.id)) + # 6) Acquire a Public IP, and add Load Balancing Rule + public_ip = PublicIPAddress.create( + self.apiclient, + zoneid=self.zone.id, + accountid=self.account.name, + domainid=self.domain.id, + vpcid=vpc.id + ) + LoadBalancerRule.create( + self.apiclient, + self.services["lbrule"], + ipaddressid=public_ip.ipaddress.id, + accountid=self.account.name, + vpcid=vpc.id, + networkid=ntwk.id, + domainid=self.account.domainid) + + # 7) Add Port Forwarding Rule with same Public IP to test conserve mode + NATRule.create( + self.apiclient, + vm, + self.services["natrule"], + ipaddressid=public_ip.ipaddress.id, + vpcid=vpc.id, + networkid=ntwk.id) + @classmethod def tearDownClass(cls): try: diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py index 37dd87a499c..722b7127244 100644 --- a/test/integration/smoke/test_vpc_redundant.py +++ b/test/integration/smoke/test_vpc_redundant.py @@ -612,10 +612,13 @@ class TestVPCRedundancy(cloudstackTestCase): time.sleep(total_sleep) - # Router will be in FAULT state, i.e. keepalived is stopped - self.check_routers_state(status_to_check="FAULT", expected_count=2) + # Router will be in UNKNOWN state, i.e. keepalived is stopped + self.check_routers_state(status_to_check="UNKNOWN", expected_count=2) + self.start_vm() + # Routers will be in PRIMARY/BACKUP state self.check_routers_state(status_to_check="PRIMARY") + self.check_routers_state(status_to_check="BACKUP") @attr(tags=["advanced", "intervlan"], required_hardware="true") def test_05_rvpc_multi_tiers(self): diff --git a/test/pom.xml b/test/pom.xml index ec23feac70d..eb9b3bfe918 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT diff --git a/tools/apidoc/pom.xml b/tools/apidoc/pom.xml index 4f22f1eff64..8e1946e0cf9 100644 --- a/tools/apidoc/pom.xml +++ b/tools/apidoc/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloud-tools - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh b/tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh index 4467e2fff78..02a5c39dc71 100644 --- a/tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh +++ b/tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh @@ -78,7 +78,7 @@ function install_cloud_scripts() { function do_signature() { mkdir -p /var/cache/cloud/ /usr/share/cloud/ (cd ./cloud_scripts/; tar -cvf - * | gzip > /usr/share/cloud/cloud-scripts.tgz) - md5sum /usr/share/cloud/cloud-scripts.tgz | awk '{print $1}' > /var/cache/cloud/cloud-scripts-signature + sha512sum /usr/share/cloud/cloud-scripts.tgz | awk '{print $1}' > /var/cache/cloud/cloud-scripts-signature echo "Cloudstack Release $CLOUDSTACK_RELEASE $(date)" > /etc/cloudstack-release } diff --git a/tools/checkstyle/pom.xml b/tools/checkstyle/pom.xml index d3119d4f73b..1d89bd5aa80 100644 --- a/tools/checkstyle/pom.xml +++ b/tools/checkstyle/pom.xml @@ -22,7 +22,7 @@ Apache CloudStack Developer Tools - Checkstyle Configuration org.apache.cloudstack checkstyle - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT UTF-8 diff --git a/tools/devcloud-kvm/pom.xml b/tools/devcloud-kvm/pom.xml index 12744442f78..ad3e9dc7ab5 100644 --- a/tools/devcloud-kvm/pom.xml +++ b/tools/devcloud-kvm/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloud-tools - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/tools/devcloud4/pom.xml b/tools/devcloud4/pom.xml index c9a53b805ce..1167a695405 100644 --- a/tools/devcloud4/pom.xml +++ b/tools/devcloud4/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloud-tools - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 300a3080a8a..0b29c106555 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -19,7 +19,7 @@ FROM ubuntu:22.04 -LABEL Vendor="Apache.org" License="ApacheV2" Version="4.21.0.0-SNAPSHOT" Author="Apache CloudStack " +LABEL Vendor="Apache.org" License="ApacheV2" Version="4.22.0.0-SNAPSHOT" Author="Apache CloudStack " ARG DEBIAN_FRONTEND=noninteractive diff --git a/tools/docker/Dockerfile.marvin b/tools/docker/Dockerfile.marvin index a70ec90fbda..5838e5d2428 100644 --- a/tools/docker/Dockerfile.marvin +++ b/tools/docker/Dockerfile.marvin @@ -19,11 +19,11 @@ # build for cloudstack_home_dir not this folder FROM python:2 -LABEL Vendor="Apache.org" License="ApacheV2" Version="4.21.0.0-SNAPSHOT" Author="Apache CloudStack " +LABEL Vendor="Apache.org" License="ApacheV2" Version="4.22.0.0-SNAPSHOT" Author="Apache CloudStack " ENV WORK_DIR=/marvin -ENV PKG_URL=https://builds.cloudstack.org/job/build-master-marvin/lastSuccessfulBuild/artifact/tools/marvin/dist/Marvin-4.21.0.0-SNAPSHOT.tar.gz +ENV PKG_URL=https://builds.cloudstack.org/job/build-master-marvin/lastSuccessfulBuild/artifact/tools/marvin/dist/Marvin-4.22.0.0-SNAPSHOT.tar.gz RUN apt-get update && apt-get install -y vim RUN pip install --upgrade paramiko nose requests diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml index d39985b677a..9dc4fc345cc 100644 --- a/tools/marvin/pom.xml +++ b/tools/marvin/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloud-tools - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/tools/marvin/setup.py b/tools/marvin/setup.py index 11a63a96ace..f5c99b28ac9 100644 --- a/tools/marvin/setup.py +++ b/tools/marvin/setup.py @@ -27,7 +27,7 @@ except ImportError: raise RuntimeError("python setuptools is required to build Marvin") -VERSION = "4.21.0.0-SNAPSHOT" +VERSION = "4.22.0.0-SNAPSHOT" setup(name="Marvin", version=VERSION, diff --git a/tools/pom.xml b/tools/pom.xml index 6e06bcd1649..cda560bd94d 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.22.0.0-SNAPSHOT ../pom.xml diff --git a/ui/public/config.json b/ui/public/config.json index a1069218136..582f968ec0e 100644 --- a/ui/public/config.json +++ b/ui/public/config.json @@ -64,6 +64,7 @@ "sc": "label.simplified.chinese.keyboard" }, "userCard": { + "enabled": true, "title": "label.help", "icon": "question-circle-outlined", "links": [ diff --git a/ui/src/config/section/infra/zones.js b/ui/src/config/section/infra/zones.js index c957f885469..61aef1706c0 100644 --- a/ui/src/config/section/infra/zones.js +++ b/ui/src/config/section/infra/zones.js @@ -119,6 +119,7 @@ export default { label: 'label.action.edit.zone', dataView: true, popup: true, + show: (record) => { return record.networktype === 'Advanced' }, component: shallowRef(defineAsyncComponent(() => import('@/views/infra/ZoneUpdate.vue'))) }, { diff --git a/ui/src/config/section/offering.js b/ui/src/config/section/offering.js index 7bdd992039c..53dd20b2d04 100644 --- a/ui/src/config/section/offering.js +++ b/ui/src/config/section/offering.js @@ -96,7 +96,7 @@ export default { label: 'label.edit', docHelp: 'adminguide/service_offerings.html#modifying-or-deleting-a-service-offering', dataView: true, - args: ['name', 'displaytext', 'storageatags', 'hosttags', 'externaldetails'], + args: ['name', 'displaytext', 'storagetags', 'hosttags', 'externaldetails'], mapping: { externaldetails: { transformedvalue: (record) => { return getFilteredExternalDetails(record.serviceofferingdetails) } @@ -128,7 +128,7 @@ export default { show: (record) => { return record.state !== 'Active' }, groupMap: (selection) => { return selection.map(x => { return { id: x, state: 'Active' } }) } }, { - api: 'deleteServiceOffering', + api: 'updateServiceOffering', icon: 'pause-circle-outlined', label: 'label.action.disable.service.offering', message: 'message.action.disable.service.offering', @@ -136,6 +136,11 @@ export default { dataView: true, groupAction: true, popup: true, + mapping: { + state: { + value: (record) => { return 'Inactive' } + } + }, show: (record) => { return record.state === 'Active' }, groupMap: (selection) => { return selection.map(x => { return { id: x } }) } }] @@ -204,7 +209,7 @@ export default { show: (record) => { return record.state !== 'Active' }, groupMap: (selection) => { return selection.map(x => { return { id: x, state: 'Active' } }) } }, { - api: 'deleteServiceOffering', + api: 'updateServiceOffering', icon: 'pause-circle-outlined', label: 'label.action.disable.system.service.offering', message: 'message.action.disable.system.service.offering', @@ -213,6 +218,11 @@ export default { params: { issystem: 'true' }, groupAction: true, popup: true, + mapping: { + state: { + value: (record) => { return 'Inactive' } + } + }, show: (record) => { return record.state === 'Active' }, groupMap: (selection) => { return selection.map(x => { return { id: x } }) } }] @@ -307,7 +317,7 @@ export default { show: (record) => { return record.state !== 'Active' }, groupMap: (selection) => { return selection.map(x => { return { id: x, state: 'Active' } }) } }, { - api: 'deleteDiskOffering', + api: 'updateDiskOffering', icon: 'pause-circle-outlined', label: 'label.action.disable.disk.offering', message: 'message.action.disable.disk.offering', @@ -315,6 +325,11 @@ export default { dataView: true, groupAction: true, popup: true, + mapping: { + state: { + value: (record) => { return 'Inactive' } + } + }, show: (record) => { return record.state === 'Active' }, groupMap: (selection) => { return selection.map(x => { return { id: x } }) } }] diff --git a/ui/src/config/section/storage.js b/ui/src/config/section/storage.js index 3dd5a731666..4308832bcf2 100644 --- a/ui/src/config/section/storage.js +++ b/ui/src/config/section/storage.js @@ -228,7 +228,7 @@ export default { label: 'label.change.offering.for.volume', args: ['id', 'diskofferingid', 'size', 'miniops', 'maxiops', 'automigrate'], dataView: true, - show: (record, store) => { return ['Allocated', 'Ready'].includes(record.state) && ['Admin'].includes(store.userInfo.roletype) }, + show: (record, store) => { return ['Allocated', 'Ready'].includes(record.state) }, popup: true, component: shallowRef(defineAsyncComponent(() => import('@/views/storage/ChangeOfferingForVolume.vue'))) }, diff --git a/ui/src/views/dashboard/CapacityDashboard.vue b/ui/src/views/dashboard/CapacityDashboard.vue index 9b374628886..bf25b706306 100644 --- a/ui/src/views/dashboard/CapacityDashboard.vue +++ b/ui/src/views/dashboard/CapacityDashboard.vue @@ -673,6 +673,7 @@ export default { .dashboard-storage { width: 100%; + min-height: 370px; overflow-x:hidden; overflow-y: scroll; max-height: 370px; diff --git a/ui/src/views/dashboard/UsageDashboard.vue b/ui/src/views/dashboard/UsageDashboard.vue index 6ca7577f037..8e567f40b42 100644 --- a/ui/src/views/dashboard/UsageDashboard.vue +++ b/ui/src/views/dashboard/UsageDashboard.vue @@ -299,7 +299,14 @@ - +