Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
50 changes: 50 additions & 0 deletions api/src/main/java/com/cloud/agent/api/to/BucketTO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// 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.agent.api.to;

import org.apache.cloudstack.storage.object.Bucket;

public final class BucketTO {

private String name;

private String accessKey;

private String secretKey;

public BucketTO(Bucket bucket) {
this.name = bucket.getName();
this.accessKey = bucket.getAccessKey();
this.secretKey = bucket.getSecretKey();
}

public BucketTO(String name) {
this.name = name;
}

public String getName() {
return this.name;
}

public String getAccessKey() {
return this.accessKey;
}

public String getSecretKey() {
return this.secretKey;
}
}
5 changes: 5 additions & 0 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,11 @@
<artifactId>cloud-plugin-storage-object-minio</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-storage-object-ceph</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-storage-object-simulator</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.cloudstack.storage.object;

import com.cloud.agent.api.to.BucketTO;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;

import java.util.List;
Expand All @@ -30,19 +31,19 @@ public interface ObjectStoreEntity extends DataStore, ObjectStore {

boolean createUser(long accountId);

boolean deleteBucket(String name);
boolean deleteBucket(BucketTO bucket);

boolean setBucketEncryption(String name);
boolean setBucketEncryption(BucketTO bucket);

boolean deleteBucketEncryption(String name);
boolean deleteBucketEncryption(BucketTO bucket);

boolean setBucketVersioning(String name);
boolean setBucketVersioning(BucketTO bucket);

boolean deleteBucketVersioning(String name);
boolean deleteBucketVersioning(BucketTO bucket);

void setBucketPolicy(String name, String policy);
void setBucketPolicy(BucketTO bucket, String policy);

void setQuota(String name, int quota);
void setQuota(BucketTO bucket, int quota);

Map<String, Long> getAllBucketsUsage();
}
14 changes: 10 additions & 4 deletions engine/schema/src/main/java/com/cloud/storage/BucketVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,23 @@ public class BucketVO implements Bucket {
String uuid;

public BucketVO() {
this.uuid = UUID.randomUUID().toString();
}

public BucketVO(String name) {
this.uuid = UUID.randomUUID().toString();
this.name = name;
this.state = State.Allocated;
}

public BucketVO(long accountId, long domainId, long objectStoreId, String name, Integer quota, boolean versioning,
boolean encryption, boolean objectLock, String policy)
{
boolean encryption, boolean objectLock, String policy) {
this.accountId = accountId;
this.domainId = domainId;
this.objectStoreId = objectStoreId;
this.name = name;
state = State.Allocated;
uuid = UUID.randomUUID().toString();
this.state = State.Allocated;
this.uuid = UUID.randomUUID().toString();
this.quota = quota;
this.versioning = versioning;
this.encryption = encryption;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.cloudstack.storage.object.store;

import com.cloud.agent.api.to.BucketTO;
import com.cloud.agent.api.to.DataStoreTO;
import org.apache.cloudstack.storage.object.Bucket;
import com.cloud.storage.DataStoreRole;
Expand Down Expand Up @@ -107,38 +108,38 @@ public Bucket createBucket(Bucket bucket, boolean objectLock) {
}

@Override
public boolean deleteBucket(String bucketName) {
return driver.deleteBucket(bucketName, objectStoreVO.getId());
public boolean deleteBucket(BucketTO bucket) {
return driver.deleteBucket(bucket, objectStoreVO.getId());
}

@Override
public boolean setBucketEncryption(String bucketName) {
return driver.setBucketEncryption(bucketName, objectStoreVO.getId());
public boolean setBucketEncryption(BucketTO bucket) {
return driver.setBucketEncryption(bucket, objectStoreVO.getId());
}

@Override
public boolean deleteBucketEncryption(String bucketName) {
return driver.deleteBucketEncryption(bucketName, objectStoreVO.getId());
public boolean deleteBucketEncryption(BucketTO bucket) {
return driver.deleteBucketEncryption(bucket, objectStoreVO.getId());
}

@Override
public boolean setBucketVersioning(String bucketName) {
return driver.setBucketVersioning(bucketName, objectStoreVO.getId());
public boolean setBucketVersioning(BucketTO bucket) {
return driver.setBucketVersioning(bucket, objectStoreVO.getId());
}

@Override
public boolean deleteBucketVersioning(String bucketName) {
return driver.deleteBucketVersioning(bucketName, objectStoreVO.getId());
public boolean deleteBucketVersioning(BucketTO bucket) {
return driver.deleteBucketVersioning(bucket, objectStoreVO.getId());
}

@Override
public void setBucketPolicy(String bucketName, String policy) {
driver.setBucketPolicy(bucketName, policy, objectStoreVO.getId());
public void setBucketPolicy(BucketTO bucket, String policy) {
driver.setBucketPolicy(bucket, policy, objectStoreVO.getId());
}

@Override
public void setQuota(String bucketName, int quota) {
driver.setBucketQuota(bucketName, objectStoreVO.getId(), quota);
public void setQuota(BucketTO bucket, int quota) {
driver.setBucketQuota(bucket, objectStoreVO.getId(), quota);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.amazonaws.services.s3.model.AccessControlList;
import com.amazonaws.services.s3.model.BucketPolicy;
import com.cloud.agent.api.to.BucketTO;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;

import java.util.List;
Expand All @@ -30,30 +31,30 @@ public interface ObjectStoreDriver extends DataStoreDriver {

List<Bucket> listBuckets(long storeId);

boolean deleteBucket(String bucketName, long storeId);
boolean deleteBucket(BucketTO bucket, long storeId);

AccessControlList getBucketAcl(String bucketName, long storeId);
AccessControlList getBucketAcl(BucketTO bucket, long storeId);

void setBucketAcl(String bucketName, AccessControlList acl, long storeId);
void setBucketAcl(BucketTO bucket, AccessControlList acl, long storeId);

void setBucketPolicy(String bucketName, String policyType, long storeId);
void setBucketPolicy(BucketTO bucket, String policyType, long storeId);

BucketPolicy getBucketPolicy(String bucketName, long storeId);
BucketPolicy getBucketPolicy(BucketTO bucket, long storeId);

void deleteBucketPolicy(String bucketName, long storeId);
void deleteBucketPolicy(BucketTO bucket, long storeId);

boolean createUser(long accountId, long storeId);

boolean setBucketEncryption(String bucketName, long storeId);
boolean setBucketEncryption(BucketTO bucket, long storeId);

boolean deleteBucketEncryption(String bucketName, long storeId);
boolean deleteBucketEncryption(BucketTO bucket, long storeId);


boolean setBucketVersioning(String bucketName, long storeId);
boolean setBucketVersioning(BucketTO bucket, long storeId);

boolean deleteBucketVersioning(String bucketName, long storeId);
boolean deleteBucketVersioning(BucketTO bucket, long storeId);

void setBucketQuota(String bucketName, long storeId, long size);
void setBucketQuota(BucketTO bucket, long storeId, long size);

Map<String, Long> getAllBucketsUsage(long storeId);
}
1 change: 1 addition & 0 deletions plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
<module>storage/volume/flasharray</module>
<module>storage/volume/primera</module>
<module>storage/object/minio</module>
<module>storage/object/ceph</module>
<module>storage/object/simulator</module>


Expand Down
52 changes: 52 additions & 0 deletions plugins/storage/object/ceph/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!--
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-ceph</artifactId>
<name>Apache CloudStack Plugin - Ceph RGW object storage provider</name>
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
<version>4.20.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>
<dependency>
<groupId>io.github.twonote</groupId>
<artifactId>radosgw-admin4j</artifactId>
<version>2.0.9</version>
</dependency>
</dependencies>
</project>
Loading