Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8f36ebf
Adding New Dell ECS Plugin to the API & editing Frontend for the ECS …
Nov 18, 2025
f131d41
Update AddObjectStorage.vue ECS Field Names and desc.
mhkadhum Nov 20, 2025
625fb4e
Merge branch 'apache:main' into main
mhkadhum Nov 24, 2025
124649f
add missing license
Nov 26, 2025
ce40daf
reverting update by pre-commit on tools/marvin/setup.py
mhkadhum Nov 28, 2025
7dd1bf2
adding ECS Module in the Plugins pom.xml
mhkadhum Nov 28, 2025
6e3fb3e
Update ECS Driver, split to small helpers , remove SuppressWarnings f…
Dec 3, 2025
a10e06e
Merge branch 'apache:main' into main
mhkadhum Dec 28, 2025
6019139
Update ECS Plugin: address reviewer comments for ECS Plugin
Dec 28, 2025
1ab9434
adding license to ecs new files
mhkadhum Dec 29, 2025
268eb21
adding license to ecs new files
mhkadhum Dec 29, 2025
9941137
adding license to ecs new files
mhkadhum Dec 29, 2025
af3e8cf
fixing spaces
mhkadhum Dec 29, 2025
ba4af0c
Update EcsObjectStoreDriverImpl.java
mhkadhum Dec 29, 2025
7c86383
Update EcsObjectStoreDriverImpl.java
mhkadhum Dec 29, 2025
b1d5ecd
Update versioning logic, adress the reviwer comment for the UI
Jan 4, 2026
03a7134
add missing lice.
Jan 4, 2026
6f3efbe
remove no-needed try blocks
mhkadhum Jan 14, 2026
f027c64
Merge branch 'apache:main' into main
mhkadhum Jan 14, 2026
60730c4
running pre-commit
Jan 14, 2026
3aed821
Merge branch 'main' into main
mhkadhum Jan 15, 2026
d689d9f
Merge branch 'apache:main' into main
mhkadhum Apr 23, 2026
f867823
adding mhkadhum as maintainer for the ECS Storage Plugin
mhkadhum Apr 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,11 @@
<artifactId>cloud-plugin-storage-object-minio</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-storage-object-ecs</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-storage-object-ceph</artifactId>
Expand Down
47 changes: 47 additions & 0 deletions plugins/storage/object/ECS/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>cloud-plugin-storage-object-ecs</artifactId>
<name>Apache CloudStack Plugin - ECS object storage provider</name>
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
<version>4.23.0.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine-storage</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine-storage-object</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine-schema</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
Comment thread
mhkadhum marked this conversation as resolved.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.cloudstack.storage.datastore.lifecycle;

import java.util.HashMap;
import java.util.Map;

import javax.inject.Inject;
import javax.net.ssl.SSLContext;

import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
import org.apache.cloudstack.engine.subsystem.api.storage.HostScope;
import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
import org.apache.cloudstack.storage.datastore.db.ObjectStoreVO;
import org.apache.cloudstack.storage.object.datastore.ObjectStoreHelper;
import org.apache.cloudstack.storage.object.datastore.ObjectStoreProviderManager;
import org.apache.cloudstack.storage.object.store.lifecycle.ObjectStoreLifeCycle;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet; // change to POST if ECS needs it
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.impl.auth.BasicScheme;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.ssl.TrustStrategy;

import com.cloud.agent.api.StoragePoolInfo;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.utils.exception.CloudRuntimeException;

public class EcsObjectStoreLifeCycleImpl implements ObjectStoreLifeCycle {

private static final Logger LOG = LogManager.getLogger(EcsObjectStoreLifeCycleImpl.class);

// detail keys coming from the API
private static final String MGMT_URL = "mgmt_url";
private static final String SA_USER = "sa_user";
private static final String SA_PASS = "sa_password";
private static final String INSECURE = "insecure";

// optional details (currently not used in persistence logic but accepted)
private static final String S3_HOST = "s3_host";
private static final String NAMESPACE = "namespace";

private static final String PROVIDER_NAME = "ECS";

@Inject
ObjectStoreHelper objectStoreHelper;

@Inject
ObjectStoreProviderManager objectStoreMgr;

public EcsObjectStoreLifeCycleImpl() {
}

@SuppressWarnings("unchecked")
@Override
public DataStore initialize(Map<String, Object> dsInfos) {
Comment thread
mhkadhum marked this conversation as resolved.
Outdated
if (objectStoreHelper == null) {
throw new CloudRuntimeException("ECS: ObjectStoreHelper is not injected");
}
if (objectStoreMgr == null) {
throw new CloudRuntimeException("ECS: ObjectStoreProviderManager is not injected");
}

// Top-level params (follow Ceph pattern)
String url = (String) dsInfos.get("url");
String name = (String) dsInfos.get("name");
Long size = (Long) dsInfos.get("size"); // may be null
String providerName = (String) dsInfos.get("providerName"); // should be "ECS"

Map<String, String> details = (Map<String, String>) dsInfos.get("details");
if (details == null) {
throw new CloudRuntimeException("ECS: details map is missing");
}

// Validate required details
String mgmtUrl = trim(details.get(MGMT_URL));
String saUser = safe(details.get(SA_USER));
String saPass = safe(details.get(SA_PASS));
boolean insecure = Boolean.parseBoolean(details.getOrDefault(INSECURE, "false"));

if (mgmtUrl == null || mgmtUrl.isEmpty()) {
throw new CloudRuntimeException("ECS: missing required detail '" + MGMT_URL + "'");
}
if (saUser.isEmpty()) {
throw new CloudRuntimeException("ECS: missing required detail '" + SA_USER + "'");
}
if (saPass.isEmpty()) {
throw new CloudRuntimeException("ECS: missing required detail '" + SA_PASS + "'");
}

if (providerName == null || providerName.isEmpty()) {
providerName = PROVIDER_NAME;
}

LOG.info("ECS initialize: provider='{}', name='{}', url='{}', mgmt_url='{}', insecure={}, s3_host='{}', namespace='{}'",
providerName, name, url, mgmtUrl, insecure,
details.get(S3_HOST), details.get(NAMESPACE));

// Try ECS login up-front so we fail fast on bad config
loginAndGetToken(mgmtUrl, saUser, saPass, insecure);

// Put “canonical” values back into details (so DB keeps what we validated)
details.put(MGMT_URL, mgmtUrl);
details.put(SA_USER, saUser);
details.put(SA_PASS, saPass);
details.put(INSECURE, Boolean.toString(insecure));

// Build objectStore parameters exactly like Ceph does
Map<String, Object> objectStoreParameters = new HashMap<>();
objectStoreParameters.put("name", name);
objectStoreParameters.put("url", url);
objectStoreParameters.put("size", size);
objectStoreParameters.put("providerName", providerName);

try {
LOG.info("ECS: creating ObjectStore in DB: name='{}', provider='{}', url='{}'",
name, providerName, url);
ObjectStoreVO objectStore = objectStoreHelper.createObjectStore(objectStoreParameters, details);
if (objectStore == null) {
throw new CloudRuntimeException("ECS: createObjectStore returned null");
}

DataStore store = objectStoreMgr.getObjectStore(objectStore.getId());
if (store == null) {
throw new CloudRuntimeException("ECS: getObjectStore returned null for id=" + objectStore.getId());
}

LOG.info("ECS: object store created: id={}, name='{}'", objectStore.getId(), name);
return store;
} catch (RuntimeException e) {
String msg = "ECS: failed to persist object store '" + name + "': " + safeMsg(e);
LOG.error(msg, e);
throw new CloudRuntimeException(msg, e);
}
}

@Override
public boolean attachCluster(DataStore store, ClusterScope scope) {
return false;
}

@Override
public boolean attachHost(DataStore store, HostScope scope, StoragePoolInfo existingInfo) {
return false;
}

@Override
public boolean attachZone(DataStore dataStore, ZoneScope scope, HypervisorType hypervisorType) {
return false;
}

@Override
public boolean maintain(DataStore store) {
return false;
}

@Override
public boolean cancelMaintain(DataStore store) {
return false;
}

@Override
public boolean deleteDataStore(DataStore store) {
return false;
}

@Override
public boolean migrateToObjectStore(DataStore store) {
return false;
}

// ---------- helpers ----------

private static String safe(String v) {
return v == null ? "" : v.trim();
}

private static String trim(String v) {
if (v == null) {
return null;
}
v = v.trim();
return v.endsWith("/") ? v.substring(0, v.length() - 1) : v;
}

private static String safeMsg(Throwable t) {
if (t == null) {
return "unknown";
}
String m = t.getMessage();
return (m == null || m.isEmpty()) ? t.getClass().getSimpleName() : m;
}

private CloseableHttpClient buildHttpClient(boolean insecure) {
if (!insecure) {
return HttpClients.createDefault();
}
try {
TrustStrategy trustAll = (chain, authType) -> true;
SSLContext sslContext = SSLContextBuilder.create()
.loadTrustMaterial(null, trustAll)
.build();
return HttpClients.custom()
.setSSLContext(sslContext)
.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
.build();
} catch (Exception e) {
throw new CloudRuntimeException("ECS: failed to build HttpClient", e);
}
}

private String loginAndGetToken(String mgmtUrl, String user, String pass, boolean insecure) {
try (CloseableHttpClient http = buildHttpClient(insecure)) {
HttpGet get = new HttpGet(mgmtUrl + "/login");
get.addHeader(new BasicScheme().authenticate(
new UsernamePasswordCredentials(user, pass), get, null));
try (CloseableHttpResponse resp = http.execute(get)) {
int status = resp.getStatusLine().getStatusCode();
if (status != 200 && status != 201) {
throw new CloudRuntimeException("ECS /login failed: HTTP " + status);
}
if (resp.getFirstHeader("X-SDS-AUTH-TOKEN") == null) {
throw new CloudRuntimeException("ECS /login missing X-SDS-AUTH-TOKEN");
}
return resp.getFirstHeader("X-SDS-AUTH-TOKEN").getValue();
}
} catch (Exception e) {
String msg = "ECS: management login error: " + safeMsg(e);
LOG.error(msg, e);
throw new CloudRuntimeException(msg, e);
}
}
}
Loading
Loading