You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2012/08/27 09:02:46 UTC
git commit: remodel storeage
Updated Branches:
refs/heads/javelin e07f8449f -> 6701d6bec
remodel storeage
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/6701d6be
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/6701d6be
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/6701d6be
Branch: refs/heads/javelin
Commit: 6701d6bec2db7efe42e5435439019c97bd06455d
Parents: e07f844
Author: Edison Su <di...@gmail.com>
Authored: Mon Aug 27 00:00:45 2012 -0700
Committer: Edison Su <di...@gmail.com>
Committed: Mon Aug 27 00:00:45 2012 -0700
----------------------------------------------------------------------
.../api/storage/DataMigrationSubSystem.java | 23 ---
.../platform/subsystem/api/storage/DataObject.java | 42 -----
.../platform/subsystem/api/storage/DataStore.java | 47 -----
.../subsystem/api/storage/DataStoreDriver.java | 28 ---
.../api/storage/DistributedFileSystem.java | 23 ---
.../platform/subsystem/api/storage/FileSystem.java | 31 ---
.../platform/subsystem/api/storage/Snapshot.java | 23 ---
.../subsystem/api/storage/StorageSubSystem.java | 13 --
.../platform/subsystem/api/storage/Template.java | 23 ---
.../platform/subsystem/api/storage/Volume.java | 22 ---
.../subsystem/api/storage/BackupStrategy.java | 5 +
.../platform/subsystem/api/storage/DataObject.java | 42 +++++
.../platform/subsystem/api/storage/DataStore.java | 52 ++++++
.../api/storage/DataStoreConfigurator.java | 16 ++
.../subsystem/api/storage/DataStoreDriver.java | 28 +++
.../subsystem/api/storage/DataStoreEndPoint.java | 5 +
.../api/storage/DataStoreEndPointSelector.java | 7 +
.../api/storage/DataStoreExtendedAttribute.java | 5 +
.../subsystem/api/storage/DataStoreLifeCycle.java | 13 ++
.../platform/subsystem/api/storage/FileSystem.java | 32 ++++
.../platform/subsystem/api/storage/Snapshot.java | 23 +++
.../subsystem/api/storage/SnapshotStrategy.java | 5 +
.../subsystem/api/storage/StorageProvider.java | 19 ++
.../platform/subsystem/api/storage/Template.java | 23 +++
.../subsystem/api/storage/TemplateStrategy.java | 5 +
.../platform/subsystem/api/storage/Volume.java | 22 +++
.../subsystem/api/storage/VolumeStrategy.java | 10 +
.../storage/DefaultPrimaryStorageProvider.java | 142 +++++++++++++++
.../cloudstack/storage/StorageProviderManager.java | 7 +
.../storage/StorageProviderManagerImpl.java | 39 ++++
.../storage/datastore/DefaultDataStore.java | 130 +++++++++++++
.../storage/datastore/XenDataStoreDriver.java | 39 ++++
.../NfsDataStoreConfigurator.java | 71 +++++++
.../XenNfsDataStoreConfigurator.java | 33 ++++
.../epselector/DefaultPrimaryEndpointSelector.java | 17 ++
.../storage/filesystem/DefaultFileSystem.java | 59 ++++++
.../lifecycle/DefaultDataStoreLifeCycle.java | 38 ++++
.../storage/strategy/XenBackupStrategy.java | 7 +
.../storage/strategy/XenSnapshotStrategy.java | 7 +
.../storage/strategy/XenVolumeStrategy.java | 40 ++++
40 files changed, 941 insertions(+), 275 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataMigrationSubSystem.java
----------------------------------------------------------------------
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
deleted file mode 100755
index 30185b7..0000000
--- a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataMigrationSubSystem.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataObject.java
----------------------------------------------------------------------
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
deleted file mode 100644
index c861bc4..0000000
--- a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataObject.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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<DataObject> getChidren();
- boolean lock();
- boolean unlock();
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataStore.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 3415a71..0000000
--- a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataStore.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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();
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreDriver.java
----------------------------------------------------------------------
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
deleted file mode 100644
index f8987f7..0000000
--- a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreDriver.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DistributedFileSystem.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 84eb8ad..0000000
--- a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/DistributedFileSystem.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/FileSystem.java
----------------------------------------------------------------------
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
deleted file mode 100644
index b0fba44..0000000
--- a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/FileSystem.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Snapshot.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 5702e4c..0000000
--- a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Snapshot.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java
----------------------------------------------------------------------
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
deleted file mode 100755
index e12ff79..0000000
--- a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.cloudstack.platform.subsystem.api.storage;
-
-import java.net.URI;
-
-import com.cloud.org.Grouping;
-
-public interface StorageSubSystem {
- String getType();
- Class<? extends Grouping> getScope();
-
- URI grantAccess(String vol, String reservationId);
- URI RemoveAccess(String vol, String reservationId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Template.java
----------------------------------------------------------------------
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
deleted file mode 100644
index efa7538..0000000
--- a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Template.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Volume.java
----------------------------------------------------------------------
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
deleted file mode 100644
index dc72d8f..0000000
--- a/platform/api/src/main/java/org/apache/cloudstack/platform/subsystem/api/storage/Volume.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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 {
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/BackupStrategy.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/BackupStrategy.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/BackupStrategy.java
new file mode 100644
index 0000000..b5aecd7
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/BackupStrategy.java
@@ -0,0 +1,5 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+public interface BackupStrategy {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataObject.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataObject.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataObject.java
new file mode 100644
index 0000000..c861bc4
--- /dev/null
+++ b/platform/api/src/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<DataObject> getChidren();
+ boolean lock();
+ boolean unlock();
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStore.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStore.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStore.java
new file mode 100644
index 0000000..c21c613
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStore.java
@@ -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.
+ */
+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();
+ DataStoreDriver getDataStoreDriver();
+ void setEndPointSelector(DataStoreEndPointSelector selector);
+ FileSystem getFileSystem();
+ VolumeStrategy getVolumeStrategy();
+ SnapshotStrategy getSnapshotStrategy();
+ BackupStrategy getBackupStrategy();
+ DataStoreLifeCycle getLifeCycle();
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreConfigurator.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreConfigurator.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreConfigurator.java
new file mode 100644
index 0000000..8d80d8d
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreConfigurator.java
@@ -0,0 +1,16 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import com.cloud.storage.StoragePool;
+
+public interface DataStoreConfigurator {
+ String getProtocol();
+ StoragePool getStoragePool(Map<String, String> configs);
+ List<String> getConfigNames();
+ Map<String, String> getConfigs(URI uri, Map<String, String> extras);
+ boolean validate(Map<String, String> configs);
+ DataStore getDataStore(StoragePool pool);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreDriver.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreDriver.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreDriver.java
new file mode 100644
index 0000000..f8987f7
--- /dev/null
+++ b/platform/api/src/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);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPoint.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPoint.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPoint.java
new file mode 100644
index 0000000..06bde0d
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPoint.java
@@ -0,0 +1,5 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+public interface DataStoreEndPoint {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPointSelector.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPointSelector.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPointSelector.java
new file mode 100644
index 0000000..6493baa
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPointSelector.java
@@ -0,0 +1,7 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+import java.util.List;
+
+public interface DataStoreEndPointSelector {
+ List<DataStoreEndPoint> getEndPoints(DataStore ds);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreExtendedAttribute.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreExtendedAttribute.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreExtendedAttribute.java
new file mode 100644
index 0000000..55af9d9
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreExtendedAttribute.java
@@ -0,0 +1,5 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+public interface DataStoreExtendedAttribute {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreLifeCycle.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreLifeCycle.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreLifeCycle.java
new file mode 100644
index 0000000..6d2294e
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreLifeCycle.java
@@ -0,0 +1,13 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+public interface DataStoreLifeCycle {
+ public enum DataStoreEvent {
+ HOSTUP,
+ HOSTDOWN,
+ }
+ void create();
+ void delete();
+ void enable();
+ void disable();
+ void processEvent(DataStoreEvent event, Object... objs);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/FileSystem.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/FileSystem.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/FileSystem.java
new file mode 100644
index 0000000..213829d
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/FileSystem.java
@@ -0,0 +1,32 @@
+/*
+ * 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);
+ DataObject ioctl(DataObject obj, Object... objects);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Snapshot.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Snapshot.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Snapshot.java
new file mode 100644
index 0000000..5702e4c
--- /dev/null
+++ b/platform/api/src/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 {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/SnapshotStrategy.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/SnapshotStrategy.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/SnapshotStrategy.java
new file mode 100644
index 0000000..f627f5a
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/SnapshotStrategy.java
@@ -0,0 +1,5 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+public interface SnapshotStrategy {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageProvider.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageProvider.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageProvider.java
new file mode 100644
index 0000000..0372f30
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageProvider.java
@@ -0,0 +1,19 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore.StoreType;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.storage.StoragePool;
+
+public interface StorageProvider {
+ List<HypervisorType> supportedHypervisors();
+ String getProviderName();
+ StoreType supportedStoreType();
+ void configure(Map<String, String> storeProviderInfo);
+ DataStore createDataStore(HypervisorType hypervisor, DataStoreConfigurator dsc);
+ DataStore getDataStore(StoragePool pool);
+ Map<HypervisorType, Map<String,DataStoreConfigurator>> getDataStoreConfigs();
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Template.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Template.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Template.java
new file mode 100644
index 0000000..efa7538
--- /dev/null
+++ b/platform/api/src/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 {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/TemplateStrategy.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/TemplateStrategy.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/TemplateStrategy.java
new file mode 100644
index 0000000..01e90c5
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/TemplateStrategy.java
@@ -0,0 +1,5 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+public interface TemplateStrategy {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Volume.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Volume.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Volume.java
new file mode 100644
index 0000000..dc72d8f
--- /dev/null
+++ b/platform/api/src/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 {
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/VolumeStrategy.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/VolumeStrategy.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/VolumeStrategy.java
new file mode 100644
index 0000000..0a914a8
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/VolumeStrategy.java
@@ -0,0 +1,10 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+public interface VolumeStrategy {
+ Volume createVolume(Volume vol);
+ Volume copyVolume(Volume srcVol, Volume destVol);
+ Volume createVolumeFromSnapshot(Volume vol, Snapshot snapshot);
+ Volume createVolumeFromTemplate(Volume vol, Template template);
+ Volume migrateVolume(Volume srcVol, Volume destVol);
+ boolean deleteVolume(Volume vol);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/storage/src/org/apache/cloudstack/storage/DefaultPrimaryStorageProvider.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/DefaultPrimaryStorageProvider.java b/platform/storage/src/org/apache/cloudstack/storage/DefaultPrimaryStorageProvider.java
new file mode 100644
index 0000000..f7ae5dd
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/DefaultPrimaryStorageProvider.java
@@ -0,0 +1,142 @@
+package org.apache.cloudstack.storage;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreConfigurator;
+import org.apache.cloudstack.platform.subsystem.api.storage.StorageProvider;
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore.StoreType;
+import org.apache.cloudstack.storage.datastoreconfigurator.NfsDataStoreConfigurator;
+import org.apache.cloudstack.storage.datastoreconfigurator.XenNfsDataStoreConfigurator;
+
+import com.cloud.dc.ClusterVO;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.dc.HostPodVO;
+import com.cloud.dc.dao.ClusterDao;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.hypervisor.Hypervisor;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.storage.StoragePool;
+import com.cloud.storage.StoragePoolStatus;
+import com.cloud.storage.StoragePoolVO;
+import com.cloud.storage.dao.StoragePoolDao;
+import com.cloud.utils.component.Inject;
+
+public class DefaultPrimaryStorageProvider implements StorageProvider {
+ private String _name = DefaultPrimaryStorageProvider.class.toString();
+ static Map<HypervisorType, Map<String, DataStoreConfigurator>> _supportedProtocols;
+
+ @Inject
+ protected DataCenterDao _dcDao;
+ @Inject
+ protected ClusterDao _clusterDao;
+ @Inject
+ protected StoragePoolDao _storagePoolDao;
+
+ public List<HypervisorType> supportedHypervisors() {
+ List<HypervisorType> hypervisors = new ArrayList<HypervisorType>();
+ hypervisors.add(Hypervisor.HypervisorType.XenServer);
+ return hypervisors;
+ }
+
+ public DefaultPrimaryStorageProvider() {
+ Map<String, DataStoreConfigurator> dscs = new HashMap<String, DataStoreConfigurator>();
+ DataStoreConfigurator nfsdc = new XenNfsDataStoreConfigurator();
+ dscs.put(nfsdc.getProtocol(), nfsdc);
+
+ _supportedProtocols.put(HypervisorType.XenServer, dscs);
+ }
+
+ public StoreType supportedStoreType() {
+ return StoreType.Primary;
+ }
+
+ public void configure(Map<String, String> storeProviderInfo) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public DataStore createDataStore(HypervisorType hypervisor,
+ long dcId,
+ long podId,
+ long clusterId,
+ String name,
+ String url,
+ Map<String, String> extra) {
+ URI uri;
+ try {
+ uri = new URI(url);
+ } catch (URISyntaxException e) {
+ throw new InvalidParameterValueException("invalide url" + url);
+ }
+
+ String protocol = uri.getScheme();
+ if (protocol == null) {
+ throw new InvalidParameterValueException("the protocol can't be null");
+ }
+
+ Map<String, DataStoreConfigurator> dscs = _supportedProtocols.get(hypervisor);
+ if (dscs.isEmpty()) {
+ throw new InvalidParameterValueException("Doesn't support this hypervisor");
+ }
+
+ DataStoreConfigurator dsc = dscs.get(protocol);
+ if (dsc == null) {
+ throw new InvalidParameterValueException("Doesn't support this protocol");
+ }
+
+ Map<String, String> configs = dsc.getConfigs(uri, extra);
+ dsc.validate(configs);
+ StoragePoolVO spool = (StoragePoolVO)dsc.getStoragePool(configs);
+ DataCenterVO zone = _dcDao.findById(dcId);
+ if (zone == null) {
+ throw new InvalidParameterValueException("unable to find zone by id " + dcId);
+ }
+ StoragePoolVO existingPool = _storagePoolDao.findPoolByUUID(spool.getUuid());
+ if (existingPool != null) {
+ throw new InvalidParameterValueException("The same storage pool was added already");
+ }
+
+ long poolId = _storagePoolDao.getNextInSequence(Long.class, "id");
+ spool.setId(poolId);
+ spool.setDataCenterId(dcId);
+ spool.setPodId(podId);
+ spool.setName(name);
+ spool.setClusterId(clusterId);
+ spool.setStatus(StoragePoolStatus.Up);
+ spool = _storagePoolDao.persist(spool, extra);
+
+ DataStore ds = dsc.getDataStore(spool);
+
+ return ds;
+ }
+
+ public Map<HypervisorType, Map<String,DataStoreConfigurator>> getDataStoreConfigs() {
+ return _supportedProtocols;
+ }
+
+ public String getProviderName() {
+ return _name;
+ }
+
+ public DataStore createDataStore(HypervisorType hypervisor,
+ DataStoreConfigurator dsc) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public DataStore getDataStore(StoragePool pool) {
+ ClusterVO clu = _clusterDao.findById(pool.getClusterId());
+ HypervisorType hy = clu.getHypervisorType();
+ Map<String, DataStoreConfigurator> dscs = _supportedProtocols.get(hy);
+ DataStoreConfigurator dsc = dscs.get(pool.getPoolType().toString());
+ return dsc.getDataStore(pool);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/storage/src/org/apache/cloudstack/storage/StorageProviderManager.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/StorageProviderManager.java b/platform/storage/src/org/apache/cloudstack/storage/StorageProviderManager.java
new file mode 100644
index 0000000..25b9bdd
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/StorageProviderManager.java
@@ -0,0 +1,7 @@
+package org.apache.cloudstack.storage;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.StorageProvider;
+
+public interface StorageProviderManager {
+ StorageProvider getProvider(String uuid);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/storage/src/org/apache/cloudstack/storage/StorageProviderManagerImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/StorageProviderManagerImpl.java b/platform/storage/src/org/apache/cloudstack/storage/StorageProviderManagerImpl.java
new file mode 100644
index 0000000..a400d7d
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/StorageProviderManagerImpl.java
@@ -0,0 +1,39 @@
+package org.apache.cloudstack.storage;
+
+import java.util.Map;
+
+import javax.naming.ConfigurationException;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.StorageProvider;
+
+import com.cloud.utils.component.Manager;
+
+public class StorageProviderManagerImpl implements StorageProviderManager, Manager {
+
+ public StorageProvider getProvider(String uuid) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean configure(String name, Map<String, Object> params)
+ throws ConfigurationException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean start() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean stop() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/storage/src/org/apache/cloudstack/storage/datastore/DefaultDataStore.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/DefaultDataStore.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/DefaultDataStore.java
new file mode 100644
index 0000000..a3e52cf
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/DefaultDataStore.java
@@ -0,0 +1,130 @@
+package org.apache.cloudstack.storage.datastore;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.BackupStrategy;
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreDriver;
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreEndPointSelector;
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreLifeCycle;
+import org.apache.cloudstack.platform.subsystem.api.storage.FileSystem;
+import org.apache.cloudstack.platform.subsystem.api.storage.SnapshotStrategy;
+import org.apache.cloudstack.platform.subsystem.api.storage.VolumeStrategy;
+
+public class DefaultDataStore implements DataStore {
+ protected VolumeStrategy _volumeStrategy;
+ protected SnapshotStrategy _snapshotStrategy;
+ protected BackupStrategy _backupStrategy;
+ protected String _uri;
+ protected String _uuid;
+ protected StoreType _type;
+ protected StoreScope _scope;
+ protected long _poolId;
+ protected DataStoreDriver _driverRef;
+ protected DataStoreEndPointSelector _selector;
+ protected FileSystem _fs;
+ protected VolumeStrategy _volumeSt;
+ protected SnapshotStrategy _snapshotSt;
+ protected BackupStrategy _backupSt;
+ protected long _id;
+ protected DataStoreLifeCycle _dslf;
+
+ public DefaultDataStore(
+ ) {
+ }
+
+ public String getURI() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setURI(String uri) {
+ this._uri = uri;
+ }
+
+ public String getUUID() {
+ return this._uuid;
+ }
+
+ public void setUUID(String uuid) {
+ this._uuid = uuid;
+ }
+
+ public StoreType getType() {
+ return this._type;
+ }
+
+ public void setType(StoreType type) {
+ this._type = type;
+ }
+
+ public StoreScope getScope() {
+ return this._scope;
+ }
+
+ public void setScope(StoreScope scope) {
+ this._scope = scope;
+ }
+
+ public Long getId() {
+ return this._id;
+ }
+
+ public void setId(long id) {
+ this._id = id;
+ }
+
+ public DataStoreDriver getDataStoreDriver() {
+ return this._driverRef;
+ }
+
+ public void setDataStoreDriver(DataStoreDriver drv) {
+ this._driverRef = drv;
+ }
+
+ public void setEndPointSelector(DataStoreEndPointSelector selector) {
+ this._selector = selector;
+ }
+
+ public DataStoreEndPointSelector getSelector() {
+ return this._selector;
+ }
+
+ public FileSystem getFileSystem() {
+ return this._fs;
+ }
+
+ public void setFileSystem(FileSystem fs) {
+ this._fs = fs;
+ }
+
+ public VolumeStrategy getVolumeStrategy() {
+ return this._volumeSt;
+ }
+
+ public void setVolumeStrategy(VolumeStrategy vs) {
+ this._volumeSt = vs;
+ }
+
+ public SnapshotStrategy getSnapshotStrategy() {
+ return this._snapshotSt;
+ }
+
+ public void setSnapshotStrategy(SnapshotStrategy ss) {
+ this._snapshotSt = ss;
+ }
+
+ public BackupStrategy getBackupStrategy() {
+ return this._backupSt;
+ }
+
+ public void setBackupStrategy(BackupStrategy bs) {
+ this._backupSt = bs;
+ }
+
+ public DataStoreLifeCycle getLifeCycle() {
+ return this._dslf;
+ }
+
+ public void setLifeCycle(DataStoreLifeCycle lf) {
+ this._dslf = lf;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/storage/src/org/apache/cloudstack/storage/datastore/XenDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/XenDataStoreDriver.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/XenDataStoreDriver.java
new file mode 100644
index 0000000..479b950
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/XenDataStoreDriver.java
@@ -0,0 +1,39 @@
+package org.apache.cloudstack.storage.datastore;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.DataObject;
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreDriver;
+
+public class XenDataStoreDriver implements DataStoreDriver {
+
+ public String getDriverType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public DataObject create(DataObject obj) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public DataObject copy(DataObject src, DataStore dest) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public DataObject copy(DataObject src, DataObject dest) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public DataObject move(DataObject src, DataObject dest) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean delete(DataObject obj) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/NfsDataStoreConfigurator.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/NfsDataStoreConfigurator.java b/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/NfsDataStoreConfigurator.java
new file mode 100644
index 0000000..c154bd0
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/NfsDataStoreConfigurator.java
@@ -0,0 +1,71 @@
+package org.apache.cloudstack.storage.datastoreconfigurator;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreConfigurator;
+
+import com.cloud.storage.StoragePool;
+import com.cloud.storage.StoragePoolVO;
+import com.cloud.storage.Storage.StoragePoolType;
+
+public abstract class NfsDataStoreConfigurator implements DataStoreConfigurator {
+ private enum NfsConfigName {
+ SERVER,
+ PORT,
+ PATH;
+ }
+
+ public NfsDataStoreConfigurator() {
+
+ }
+
+ public String getProtocol() {
+ return "NFS";
+ }
+
+ public Map<String, String> getConfigs(URI uri, Map<String, String> extras) {
+ Map<String, String> configs = new HashMap<String, String>();
+ String storageHost = uri.getHost();
+ String hostPath = uri.getPath();
+ configs.put(NfsConfigName.SERVER.toString(), storageHost);
+ configs.put(NfsConfigName.PATH.toString(), hostPath);
+ configs.putAll(extras);
+
+ return configs;
+ }
+
+ public List<String> getConfigNames() {
+ List<String> names = new ArrayList<String>();
+ names.add(NfsConfigName.SERVER.toString());
+ names.add(NfsConfigName.PATH.toString());
+ return names;
+ }
+
+ public boolean validate(Map<String, String> configs) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public StoragePoolVO getStoragePool(Map<String, String> configs) {
+ String nfsServer = configs.get(NfsConfigName.SERVER.toString());
+ String nfsPath = configs.get(NfsConfigName.PATH.toString());
+ String uuid = UUID.nameUUIDFromBytes(new String(nfsServer + nfsPath).getBytes()).toString();
+ StoragePoolVO pool = new StoragePoolVO(StoragePoolType.NetworkFilesystem,
+ nfsServer, -1,
+ nfsPath);
+ pool.setUuid(uuid);
+ return pool;
+ }
+
+ public DataStore getDataStore(StoragePool pool) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/XenNfsDataStoreConfigurator.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/XenNfsDataStoreConfigurator.java b/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/XenNfsDataStoreConfigurator.java
new file mode 100644
index 0000000..dd240d8
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastoreconfigurator/XenNfsDataStoreConfigurator.java
@@ -0,0 +1,33 @@
+package org.apache.cloudstack.storage.datastoreconfigurator;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore.StoreType;
+import org.apache.cloudstack.storage.datastore.DefaultDataStore;
+import org.apache.cloudstack.storage.datastore.XenDataStoreDriver;
+import org.apache.cloudstack.storage.epselector.DefaultPrimaryEndpointSelector;
+import org.apache.cloudstack.storage.filesystem.DefaultFileSystem;
+import org.apache.cloudstack.storage.lifecycle.DefaultDataStoreLifeCycle;
+import org.apache.cloudstack.storage.strategy.XenBackupStrategy;
+import org.apache.cloudstack.storage.strategy.XenSnapshotStrategy;
+import org.apache.cloudstack.storage.strategy.XenVolumeStrategy;
+
+import com.cloud.storage.StoragePool;
+
+public class XenNfsDataStoreConfigurator extends NfsDataStoreConfigurator {
+ @Override
+ public DataStore getDataStore(StoragePool pool) {
+ DefaultDataStore ds = new DefaultDataStore();
+ ds.setBackupStrategy(new XenBackupStrategy());
+ ds.setVolumeStrategy(new XenVolumeStrategy());
+ ds.setSnapshotStrategy(new XenSnapshotStrategy());
+ ds.setEndPointSelector(new DefaultPrimaryEndpointSelector());
+ ds.setFileSystem(new DefaultFileSystem());
+ ds.setId(pool.getId());
+ ds.setType(StoreType.Primary);
+ ds.setURI(pool.getHostAddress() + "/" + pool.getPath());
+ ds.setUUID(pool.getUuid());
+ ds.setDataStoreDriver(new XenDataStoreDriver());
+ ds.setLifeCycle(new DefaultDataStoreLifeCycle(ds));
+ return ds;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/storage/src/org/apache/cloudstack/storage/epselector/DefaultPrimaryEndpointSelector.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/epselector/DefaultPrimaryEndpointSelector.java b/platform/storage/src/org/apache/cloudstack/storage/epselector/DefaultPrimaryEndpointSelector.java
new file mode 100644
index 0000000..9b18f2c
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/epselector/DefaultPrimaryEndpointSelector.java
@@ -0,0 +1,17 @@
+package org.apache.cloudstack.storage.epselector;
+
+import java.util.List;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreEndPoint;
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreEndPointSelector;
+
+public class DefaultPrimaryEndpointSelector implements
+ DataStoreEndPointSelector {
+
+ public List<DataStoreEndPoint> getEndPoints(DataStore ds) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/storage/src/org/apache/cloudstack/storage/filesystem/DefaultFileSystem.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/filesystem/DefaultFileSystem.java b/platform/storage/src/org/apache/cloudstack/storage/filesystem/DefaultFileSystem.java
new file mode 100644
index 0000000..7176cea
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/filesystem/DefaultFileSystem.java
@@ -0,0 +1,59 @@
+package org.apache.cloudstack.storage.filesystem;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.DataObject;
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.platform.subsystem.api.storage.FileSystem;
+
+public class DefaultFileSystem implements FileSystem {
+
+ public DataObject create(DataObject obj) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public DataObject copy(DataObject Obj, DataStore destStore) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public DataObject copy(DataObject obj, DataObject destObj) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public DataObject move(DataObject srcObj, DataObject destObj) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean delete(DataObject obj) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public long getStats(DataObject obj) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public String getFileType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isWritable(DataObject obj) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean contains(DataObject obj) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public DataObject ioctl(DataObject obj, Object... objects) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultDataStoreLifeCycle.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultDataStoreLifeCycle.java b/platform/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultDataStoreLifeCycle.java
new file mode 100644
index 0000000..723c550
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultDataStoreLifeCycle.java
@@ -0,0 +1,38 @@
+package org.apache.cloudstack.storage.lifecycle;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreLifeCycle;
+
+public class DefaultDataStoreLifeCycle implements DataStoreLifeCycle {
+ private DataStore _ds;
+ public DefaultDataStoreLifeCycle(DataStore ds) {
+ this._ds = ds;
+ }
+
+
+ public void create() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void delete() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void enable() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void disable() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void processEvent(DataStoreEvent event, Object... objs) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/storage/src/org/apache/cloudstack/storage/strategy/XenBackupStrategy.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/strategy/XenBackupStrategy.java b/platform/storage/src/org/apache/cloudstack/storage/strategy/XenBackupStrategy.java
new file mode 100644
index 0000000..acf125d
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/strategy/XenBackupStrategy.java
@@ -0,0 +1,7 @@
+package org.apache.cloudstack.storage.strategy;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.BackupStrategy;
+
+public class XenBackupStrategy implements BackupStrategy {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/storage/src/org/apache/cloudstack/storage/strategy/XenSnapshotStrategy.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/strategy/XenSnapshotStrategy.java b/platform/storage/src/org/apache/cloudstack/storage/strategy/XenSnapshotStrategy.java
new file mode 100644
index 0000000..c78b99e
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/strategy/XenSnapshotStrategy.java
@@ -0,0 +1,7 @@
+package org.apache.cloudstack.storage.strategy;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.SnapshotStrategy;
+
+public class XenSnapshotStrategy implements SnapshotStrategy {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6701d6be/platform/storage/src/org/apache/cloudstack/storage/strategy/XenVolumeStrategy.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/strategy/XenVolumeStrategy.java b/platform/storage/src/org/apache/cloudstack/storage/strategy/XenVolumeStrategy.java
new file mode 100644
index 0000000..48e7b1a
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/strategy/XenVolumeStrategy.java
@@ -0,0 +1,40 @@
+package org.apache.cloudstack.storage.strategy;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.Snapshot;
+import org.apache.cloudstack.platform.subsystem.api.storage.Template;
+import org.apache.cloudstack.platform.subsystem.api.storage.Volume;
+import org.apache.cloudstack.platform.subsystem.api.storage.VolumeStrategy;
+
+public class XenVolumeStrategy implements VolumeStrategy {
+
+ public Volume createVolume(Volume vol) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Volume copyVolume(Volume srcVol, Volume destVol) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Volume createVolumeFromSnapshot(Volume vol, Snapshot snapshot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Volume createVolumeFromTemplate(Volume vol, Template template) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Volume migrateVolume(Volume srcVol, Volume destVol) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean deleteVolume(Volume vol) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}