You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pe...@apache.org on 2025/08/18 13:30:38 UTC
(cloudstack) 01/01: Add UUID field for LDAP configuration
This is an automated email from the ASF dual-hosted git repository.
pearl11594 pushed a commit to branch add-uuid-ldap-conf
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit 6b590b6175da82cb19deeccdbc0a98c8dbc7503d
Author: Pearl Dsilva <pe...@gmail.com>
AuthorDate: Mon Aug 18 09:30:13 2025 -0400
Add UUID field for LDAP configuration
---
.../engine/orchestration/NetworkOrchestrator.java | 2 +-
.../main/resources/META-INF/db/schema-42010to42100.sql | 7 +++++++
.../api/response/LdapConfigurationResponse.java | 15 ++++++++++++++-
.../org/apache/cloudstack/ldap/LdapConfigurationVO.java | 11 +++++++++++
.../java/org/apache/cloudstack/ldap/LdapManagerImpl.java | 2 +-
5 files changed, 34 insertions(+), 3 deletions(-)
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..97146aac89e 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
@@ -1154,7 +1154,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
final Integer networkRate = _networkModel.getNetworkRate(network.getId(), vm.getId());
final NicProfile vmNic = new NicProfile(vo, network, vo.getBroadcastUri(), vo.getIsolationUri(), networkRate, _networkModel.isSecurityGroupSupportedInNetwork(network),
_networkModel.getNetworkTag(vm.getHypervisorType(), network));
- if (vm.getType() == Type.DomainRouter) {
+ if (vm.getType() == Type.DomainRouter) {l
Pair<NetworkVO, VpcVO> networks = getGuestNetworkRouterAndVpcDetails(vm.getId());
setMtuDetailsInVRNic(networks, network, vo);
_nicDao.update(vo.getId(), vo);
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 167dd92730c..206e2080024 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
@@ -757,3 +757,10 @@ SET `cs`.`domain_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';
+
+-- Move to 4.22
+-- Add uuid column to ldap_configuration table
+CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.ldap_configuration', 'uuid', 'VARCHAR(40) NOT NULL');
+
+-- Populate uuid for existing rows where uuid is NULL or empty
+UPDATE `cloud`.`ldap_configuration` SET uuid = UUID() WHERE uuid IS NULL OR uuid = '';
diff --git a/plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/api/response/LdapConfigurationResponse.java b/plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/api/response/LdapConfigurationResponse.java
index 744c73d8e77..7fe068fb549 100644
--- a/plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/api/response/LdapConfigurationResponse.java
+++ b/plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/api/response/LdapConfigurationResponse.java
@@ -27,6 +27,10 @@ import org.apache.cloudstack.ldap.LdapConfiguration;
@EntityReference(value = LdapConfiguration.class)
public class LdapConfigurationResponse extends BaseResponse {
+ @SerializedName("id")
+ @Param(description = "the ID of the LDAP configuration")
+ private String id;
+
@SerializedName(ApiConstants.HOST_NAME)
@Param(description = "name of the host running the ldap server")
private String hostname;
@@ -53,9 +57,18 @@ public class LdapConfigurationResponse extends BaseResponse {
setPort(port);
}
- public LdapConfigurationResponse(final String hostname, final int port, final String domainId) {
+ public LdapConfigurationResponse(final String hostname, final int port, final String domainId, final String id) {
this(hostname, port);
setDomainId(domainId);
+ setId(id);
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
}
public String getHostname() {
diff --git a/plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapConfigurationVO.java b/plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapConfigurationVO.java
index ee9f0930c47..9381297c21f 100644
--- a/plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapConfigurationVO.java
+++ b/plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapConfigurationVO.java
@@ -25,6 +25,8 @@ import javax.persistence.Table;
import org.apache.cloudstack.api.InternalIdentity;
+import java.util.UUID;
+
@Entity
@Table(name = "ldap_configuration")
public class LdapConfigurationVO implements InternalIdentity {
@@ -36,6 +38,9 @@ public class LdapConfigurationVO implements InternalIdentity {
@Column(name = "id")
private Long id;
+ @Column(name = "uuid")
+ private String uuid;
+
@Column(name = "port")
private int port;
@@ -43,12 +48,14 @@ public class LdapConfigurationVO implements InternalIdentity {
private Long domainId;
public LdapConfigurationVO() {
+ this.uuid = UUID.randomUUID().toString();
}
public LdapConfigurationVO(final String hostname, final int port, final Long domainId) {
this.hostname = hostname;
this.port = port;
this.domainId = domainId;
+ this.uuid = UUID.randomUUID().toString();
}
public String getHostname() {
@@ -60,6 +67,10 @@ public class LdapConfigurationVO implements InternalIdentity {
return id;
}
+ public String getUuid() {
+ return uuid;
+ }
+
public int getPort() {
return port;
}
diff --git a/plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapManagerImpl.java b/plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapManagerImpl.java
index 05b8578bb42..b51907f005f 100644
--- a/plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapManagerImpl.java
+++ b/plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapManagerImpl.java
@@ -240,7 +240,7 @@ public class LdapManagerImpl extends ComponentLifecycleBase implements LdapManag
domainUuid = domain.getUuid();
}
}
- return new LdapConfigurationResponse(configuration.getHostname(), configuration.getPort(), domainUuid);
+ return new LdapConfigurationResponse(configuration.getHostname(), configuration.getPort(), domainUuid, configuration.getUuid());
}
@Override