Skip to content

Commit 2dd8e2c

Browse files
committed
add getStoreTO into each DataStoreDriver, and add implementation for 3
data store plugins.
1 parent 2ff01a7 commit 2dd8e2c

47 files changed

Lines changed: 240 additions & 91 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreTO.java renamed to api/src/com/cloud/agent/api/to/DataStoreTO.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
package org.apache.cloudstack.engine.subsystem.api.storage;
19+
package com.cloud.agent.api.to;
20+
21+
import com.cloud.storage.DataStoreRole;
22+
2023

2124
public interface DataStoreTO {
2225
public DataStoreRole getRole();

api/src/com/cloud/agent/api/to/S3TO.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818

1919
import java.util.Date;
2020

21+
import com.cloud.storage.DataStoreRole;
2122
import com.cloud.utils.S3Utils;
2223

23-
public final class S3TO implements S3Utils.ClientOptions {
24+
public final class S3TO implements S3Utils.ClientOptions, DataStoreTO {
2425

2526
private Long id;
2627
private String uuid;
@@ -249,4 +250,10 @@ public void setCreated(final Date created) {
249250
this.created = created;
250251
}
251252

253+
@Override
254+
public DataStoreRole getRole() {
255+
return DataStoreRole.Image;
256+
}
257+
258+
252259
}

api/src/com/cloud/agent/api/to/SwiftTO.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
// under the License.
1717
package com.cloud.agent.api.to;
1818

19-
public class SwiftTO {
19+
import com.cloud.storage.DataStoreRole;
20+
21+
public class SwiftTO implements DataStoreTO {
2022
Long id;
2123
String url;
2224
String account;
@@ -54,5 +56,11 @@ public String getKey() {
5456
return key;
5557
}
5658

59+
@Override
60+
public DataStoreRole getRole() {
61+
return DataStoreRole.Image;
62+
}
63+
64+
5765

5866
}

engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreRole.java renamed to api/src/com/cloud/storage/DataStoreRole.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
package org.apache.cloudstack.engine.subsystem.api.storage;
19+
package com.cloud.storage;
2020

2121
import com.cloud.utils.exception.CloudRuntimeException;
2222

engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStore.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
// under the License.
1717
package org.apache.cloudstack.engine.subsystem.api.storage;
1818

19+
import com.cloud.agent.api.to.DataStoreTO;
20+
import com.cloud.storage.DataStoreRole;
21+
1922
public interface DataStore {
2023
DataStoreDriver getDriver();
2124
DataStoreRole getRole();

engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
2424

25+
import com.cloud.agent.api.to.DataStoreTO;
26+
2527
public interface DataStoreDriver {
2628
public String grantAccess(DataObject data, EndPoint ep);
2729
public boolean revokeAccess(DataObject data, EndPoint ep);
@@ -32,4 +34,5 @@ public interface DataStoreDriver {
3234
public boolean canCopy(DataObject srcData, DataObject destData);
3335
public void resize(DataObject data, AsyncCompletionCallback<CreateCmdResult> callback);
3436
public DataTO getTO(DataObject data);
37+
public DataStoreTO getStoreTO(DataStore store);
3538
}

engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import java.util.List;
2222
import java.util.Map;
2323

24+
import com.cloud.storage.DataStoreRole;
25+
2426

2527
public interface DataStoreManager {
2628
public DataStore getDataStore(long storeId, DataStoreRole role);

engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataTO.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
package org.apache.cloudstack.engine.subsystem.api.storage;
2020

21+
import com.cloud.agent.api.to.DataStoreTO;
22+
2123
public interface DataTO {
2224
public DataObjectType getObjectType();
2325
public DataStoreTO getDataStore();

engine/api/src/org/apache/cloudstack/storage/datastore/db/ImageStoreVO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
import javax.persistence.Table;
2929
import javax.persistence.TableGenerator;
3030

31-
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
3231

3332

3433

34+
import com.cloud.storage.DataStoreRole;
3535
import com.cloud.storage.ImageStore;
3636
import com.cloud.storage.ScopeType;
3737
import com.cloud.utils.db.GenericDao;

engine/storage/image/src/org/apache/cloudstack/storage/image/ImageDataFactoryImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType;
2626
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
2727
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
28-
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
2928
import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory;
3029
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
3130
import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager;
3231
import org.apache.cloudstack.storage.image.store.TemplateObject;
3332
import org.apache.log4j.Logger;
3433
import org.springframework.stereotype.Component;
3534

35+
import com.cloud.storage.DataStoreRole;
3636
import com.cloud.storage.VMTemplateStoragePoolVO;
3737
import com.cloud.storage.VMTemplateVO;
3838
import com.cloud.storage.dao.VMTemplateDao;

0 commit comments

Comments
 (0)