From e07f8449f430a1bcdf0449a582083f218c0c7bcd Mon Sep 17 00:00:00 2001 From: Edison Su Date: Fri, 24 Aug 2012 18:24:26 -0700 Subject: [PATCH] add storage interface --- framework/ipc/pom.xml | 6 +++ platform/api/pom.xml | 13 +++++ .../api/storage/DataMigrationSubSystem.java | 23 +++++++++ .../subsystem/api/storage/DataObject.java | 42 +++++++++++++++++ .../subsystem/api/storage/DataStore.java | 47 +++++++++++++++++++ .../api/storage/DataStoreDriver.java | 28 +++++++++++ .../api/storage/DistributedFileSystem.java | 23 +++++++++ .../subsystem/api/storage/FileSystem.java | 31 ++++++++++++ .../subsystem/api/storage/Snapshot.java | 23 +++++++++ .../api/storage/StorageSubSystem.java | 13 +++++ .../subsystem/api/storage/Template.java | 23 +++++++++ .../subsystem/api/storage/Volume.java | 22 +++++++++ platform/compute/pom.xml | 13 +++++ 13 files changed, 307 insertions(+) create mode 100644 framework/ipc/pom.xml create mode 100644 platform/api/pom.xml create mode 100755 platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataMigrationSubSystem.java create mode 100644 platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataObject.java create mode 100644 platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataStore.java create mode 100644 platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreDriver.java create mode 100644 platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DistributedFileSystem.java create mode 100644 platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/FileSystem.java create mode 100644 platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Snapshot.java create mode 100755 platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java create mode 100644 platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Template.java create mode 100644 platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Volume.java create mode 100644 platform/compute/pom.xml diff --git a/framework/ipc/pom.xml b/framework/ipc/pom.xml new file mode 100644 index 00000000000..c376acdd1d9 --- /dev/null +++ b/framework/ipc/pom.xml @@ -0,0 +1,6 @@ + + 4.0.0 + cloudstack + cloud-framework-ipc + 0.0.1-SNAPSHOT + \ No newline at end of file diff --git a/platform/api/pom.xml b/platform/api/pom.xml new file mode 100644 index 00000000000..9d59e0bc143 --- /dev/null +++ b/platform/api/pom.xml @@ -0,0 +1,13 @@ + + 4.0.0 + cloudstack + cloud-platform-api + 0.0.1-SNAPSHOT + + + com.cloud + cloud-api + 4.0.0-SNAPSHOT + + + \ No newline at end of file diff --git a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataMigrationSubSystem.java b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataMigrationSubSystem.java new file mode 100755 index 00000000000..30185b7835f --- /dev/null +++ b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataMigrationSubSystem.java @@ -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. + */ +package org.apache.cloudstack.platform.subsystem.api.storage; + +public interface DataMigrationSubSystem { + void migrate(String volume, String storagePool, String reservationId); +} diff --git a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataObject.java b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataObject.java new file mode 100644 index 00000000000..c861bc40a2a --- /dev/null +++ b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataObject.java @@ -0,0 +1,42 @@ +/* + * 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.platform.subsystem.api.storage; + +import java.util.List; + +import org.apache.cloudstack.platform.subsystem.api.storage.DataStore.DataStoreRef; + +/* + * Logic entity + */ +public interface DataObject { + String getURI(); + String getUUID(); + DataStoreRef getStoreRef(); + long getSize(); + //volume/snapshot/template + String getType(); + //db id + Long getId(); + DataObject getParent(); + void setParent(DataObject obj); + List getChidren(); + boolean lock(); + boolean unlock(); +} diff --git a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataStore.java b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataStore.java new file mode 100644 index 00000000000..3415a716fce --- /dev/null +++ b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataStore.java @@ -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. + */ +package org.apache.cloudstack.platform.subsystem.api.storage; + +public interface DataStore { + public class DataStoreRef { + + } + + public class DataStoreDriverRef { + + } + + public enum StoreType { + Primary, + Backup; + } + public class StoreScope { + public long zoneId; + private long clusterId; + private long hostId; + } + + String getURI(); + String getUUID(); + StoreType getType(); + StoreScope getScope(); + Long getId(); + DataStoreDriverRef getDataStoreDriver(); + FileSystem getFileSystem(); +} diff --git a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreDriver.java b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreDriver.java new file mode 100644 index 00000000000..f8987f71508 --- /dev/null +++ b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreDriver.java @@ -0,0 +1,28 @@ +/* + * 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.platform.subsystem.api.storage; + +public interface DataStoreDriver { + String getDriverType(); + DataObject create(DataObject obj); + DataObject copy(DataObject src, DataStore dest); + DataObject copy(DataObject src, DataObject dest); + DataObject move(DataObject src, DataObject dest); + boolean delete(DataObject obj); +} diff --git a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DistributedFileSystem.java b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DistributedFileSystem.java new file mode 100644 index 00000000000..84eb8ad68d0 --- /dev/null +++ b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DistributedFileSystem.java @@ -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. + */ +package org.apache.cloudstack.platform.subsystem.api.storage; + +public interface DistributedFileSystem { + +} diff --git a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/FileSystem.java b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/FileSystem.java new file mode 100644 index 00000000000..b0fba44761a --- /dev/null +++ b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/FileSystem.java @@ -0,0 +1,31 @@ +/* + * 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.platform.subsystem.api.storage; + +public interface FileSystem { + DataObject create(DataObject obj); + DataObject copy(DataObject Obj, DataStore destStore); + DataObject copy(DataObject obj, DataObject destObj); + DataObject move(DataObject srcObj, DataObject destObj); + boolean delete(DataObject obj); + long getStats(DataObject obj); + String getFileType(); + boolean isWritable(DataObject obj); + boolean contains(DataObject obj); +} diff --git a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Snapshot.java b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Snapshot.java new file mode 100644 index 00000000000..5702e4c4717 --- /dev/null +++ b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Snapshot.java @@ -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. + */ +package org.apache.cloudstack.platform.subsystem.api.storage; + +public interface Snapshot extends DataObject { + +} diff --git a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java new file mode 100755 index 00000000000..e12ff797ad4 --- /dev/null +++ b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java @@ -0,0 +1,13 @@ +package org.apache.cloudstack.platform.subsystem.api.storage; + +import java.net.URI; + +import com.cloud.org.Grouping; + +public interface StorageSubSystem { + String getType(); + Class getScope(); + + URI grantAccess(String vol, String reservationId); + URI RemoveAccess(String vol, String reservationId); +} diff --git a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Template.java b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Template.java new file mode 100644 index 00000000000..efa7538abf4 --- /dev/null +++ b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Template.java @@ -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. + */ +package org.apache.cloudstack.platform.subsystem.api.storage; + +public interface Template extends DataObject { + +} diff --git a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Volume.java b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Volume.java new file mode 100644 index 00000000000..dc72d8f654e --- /dev/null +++ b/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Volume.java @@ -0,0 +1,22 @@ +/* + * 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.platform.subsystem.api.storage; + +public interface Volume extends DataObject { +} diff --git a/platform/compute/pom.xml b/platform/compute/pom.xml new file mode 100644 index 00000000000..23bd8e74c47 --- /dev/null +++ b/platform/compute/pom.xml @@ -0,0 +1,13 @@ + + 4.0.0 + cloudstack + cloud-platform-compute + 0.0.1-SNAPSHOT + + + cloudstack + cloud-framework-ipc + 0.0.1-SNAPSHOT + + + \ No newline at end of file