cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [26/44] Revert "Merge remote-tracking branch 'origin/javelin' into javelin"
Date Tue, 15 Jan 2013 02:04:54 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionDriver.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionDriver.java b/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionDriver.java
deleted file mode 100644
index 3a59b21..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionDriver.java
+++ /dev/null
@@ -1,25 +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.storage.motion;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-
-public interface DataMotionDriver {
-    public void copy(DataObject srcObj, DataObject destObj);
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionService.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionService.java b/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionService.java
deleted file mode 100644
index db36f64..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionService.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.storage.motion;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
-
-public interface DataMotionService {
-    public void copyAsync(DataObject srcData, DataObject destData,
-            AsyncCompletionCallback<CopyCommandResult> callback);
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java b/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java
deleted file mode 100644
index 343140f..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java
+++ /dev/null
@@ -1,61 +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.storage.motion;
-
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
-import org.springframework.stereotype.Component;
-
-import com.cloud.utils.exception.CloudRuntimeException;
-
-@Component
-public class DataMotionServiceImpl implements DataMotionService {
-    @Inject
-    List<DataMotionStrategy> strategies;
-
-    @Override
-    public void copyAsync(DataObject srcData, DataObject destData,
-            AsyncCompletionCallback<CopyCommandResult> callback) {
-
-        if (srcData.getDataStore().getDriver().canCopy(srcData, destData)) {
-            srcData.getDataStore().getDriver()
-                    .copyAsync(srcData, destData, callback);
-            return;
-        } else if (destData.getDataStore().getDriver()
-                .canCopy(srcData, destData)) {
-            destData.getDataStore().getDriver()
-                    .copyAsync(srcData, destData, callback);
-            return;
-        }
-
-        for (DataMotionStrategy strategy : strategies) {
-            if (strategy.canHandle(srcData, destData)) {
-                strategy.copyAsync(srcData, destData, callback);
-                return;
-            }
-        }
-        throw new CloudRuntimeException("can't find strategy to move data");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionStrategy.java b/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionStrategy.java
deleted file mode 100644
index ba40c6d..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionStrategy.java
+++ /dev/null
@@ -1,30 +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.storage.motion;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
-
-public interface DataMotionStrategy {
-    public boolean canHandle(DataObject srcData, DataObject destData);
-
-    public Void copyAsync(DataObject srcData, DataObject destData,
-            AsyncCompletionCallback<CopyCommandResult> callback);
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotDataFactory.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotDataFactory.java b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotDataFactory.java
deleted file mode 100644
index 22d328f..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotDataFactory.java
+++ /dev/null
@@ -1,25 +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.storage.snapshot;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-
-public interface SnapshotDataFactory {
-    public SnapshotInfo getSnapshot(long snapshotId, DataStore store);
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java
index d57d078..1363251 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java
@@ -1,3 +1,19 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 package org.apache.cloudstack.storage.snapshot;
 
 import java.lang.reflect.Method;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotInfo.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotInfo.java b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotInfo.java
index 983ec4d..1c572cf 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotInfo.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotInfo.java
@@ -1,9 +1,24 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 package org.apache.cloudstack.storage.snapshot;
 
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 
-public interface SnapshotInfo extends DataObject {
+public interface SnapshotInfo {
 	public String getName();
 	public SnapshotInfo getParent();
 	public SnapshotInfo getChild();

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java
index bc56e62..d50c9a0 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java
@@ -1,3 +1,19 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 package org.apache.cloudstack.storage.snapshot;
 
 import org.apache.cloudstack.engine.cloud.entity.api.SnapshotEntity;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotStrategy.java b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotStrategy.java
index 980b2dd..4e31186 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotStrategy.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotStrategy.java
@@ -1,3 +1,19 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 package org.apache.cloudstack.storage.snapshot;
 
 public interface SnapshotStrategy {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/to/ImageDataStoreTO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/ImageDataStoreTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/ImageDataStoreTO.java
index 9f59a4f..43998a3 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/to/ImageDataStoreTO.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/to/ImageDataStoreTO.java
@@ -1,6 +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.storage.to;
 
-import org.apache.cloudstack.storage.image.datastore.ImageDataStoreInfo;
+import org.apache.cloudstack.storage.image.store.ImageDataStoreInfo;
 
 public class ImageDataStoreTO {
     private final String type;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/to/ImageOnPrimayDataStoreTO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/ImageOnPrimayDataStoreTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/ImageOnPrimayDataStoreTO.java
index 18743d7..f7c2322 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/to/ImageOnPrimayDataStoreTO.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/to/ImageOnPrimayDataStoreTO.java
@@ -22,11 +22,11 @@ import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
 
 public class ImageOnPrimayDataStoreTO {
     private final String pathOnPrimaryDataStore;
-    private  PrimaryDataStoreTO dataStore;
+    private final PrimaryDataStoreTO dataStore;
     private final TemplateTO template;
     public ImageOnPrimayDataStoreTO(TemplateOnPrimaryDataStoreInfo template) {
         this.pathOnPrimaryDataStore = template.getPath();
-        //this.dataStore = template.getPrimaryDataStore().getDataStoreTO();
+        this.dataStore = template.getPrimaryDataStore().getDataStoreTO();
         this.template = new TemplateTO(template.getTemplate());
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/to/NfsPrimaryDataStoreTO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/NfsPrimaryDataStoreTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/NfsPrimaryDataStoreTO.java
index 06ff16b..96fb6bb 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/to/NfsPrimaryDataStoreTO.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/to/NfsPrimaryDataStoreTO.java
@@ -1,3 +1,19 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 package org.apache.cloudstack.storage.to;
 
 import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/to/PrimaryDataStoreTO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/PrimaryDataStoreTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/PrimaryDataStoreTO.java
index 13d51ac..cd67b97 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/to/PrimaryDataStoreTO.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/to/PrimaryDataStoreTO.java
@@ -1,3 +1,19 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 package org.apache.cloudstack.storage.to;
 
 import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java
index 26a523a..b9db8cc 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java
@@ -1,19 +1,35 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 package org.apache.cloudstack.storage.to;
 
-import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
+import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType;
 import org.apache.cloudstack.storage.image.TemplateInfo;
-import org.apache.cloudstack.storage.image.datastore.ImageDataStoreInfo;
+import org.apache.cloudstack.storage.image.store.ImageDataStoreInfo;
 
 public class TemplateTO {
     private final String path;
     private final String uuid;
-    private  DiskFormat diskType;
+    private final VolumeDiskType diskType;
     private final ImageDataStoreTO imageDataStore;
 
     public TemplateTO(TemplateInfo template) {
         this.path = template.getPath();
         this.uuid = template.getUuid();
-        //this.diskType = template.getDiskType();
+        this.diskType = template.getDiskType();
         this.imageDataStore = new ImageDataStoreTO((ImageDataStoreInfo)template.getDataStore());
     }
     
@@ -25,7 +41,7 @@ public class TemplateTO {
         return this.uuid;
     }
     
-    public DiskFormat getDiskType() {
+    public VolumeDiskType getDiskType() {
         return this.diskType;
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java
index 4373bad..af71344 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java
@@ -1,29 +1,44 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 package org.apache.cloudstack.storage.to;
 
-import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
+import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType;
 import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType;
 
 public class VolumeTO {
     private final String uuid;
     private final String path;
-    private  VolumeType volumeType;
-    private  DiskFormat diskType;
+    private final VolumeType volumeType;
+    private final VolumeDiskType diskType;
     private PrimaryDataStoreTO dataStore;
-    private  String name;
+    private final String name;
     private final long size;
     public VolumeTO(VolumeInfo volume) {
         this.uuid = volume.getUuid();
-        this.path = volume.getUri();
-        //this.volumeType = volume.getType();
-        //this.diskType = volume.getDiskType();
+        this.path = volume.getPath();
+        this.volumeType = volume.getType();
+        this.diskType = volume.getDiskType();
         if (volume.getDataStore() != null) {
-            this.dataStore = new PrimaryDataStoreTO((PrimaryDataStoreInfo)volume.getDataStore());
+            this.dataStore = new PrimaryDataStoreTO(volume.getDataStore());
         } else {
             this.dataStore = null;
         }
-        //this.name = volume.getName();
+        this.name = volume.getName();
         this.size = volume.getSize();
     }
     
@@ -39,7 +54,7 @@ public class VolumeTO {
         return this.volumeType;
     }
     
-    public DiskFormat getDiskType() {
+    public VolumeDiskType getDiskType() {
         return this.diskType;
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/volume/ObjectInDataStoreStateMachine.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/ObjectInDataStoreStateMachine.java b/engine/storage/src/org/apache/cloudstack/storage/volume/ObjectInDataStoreStateMachine.java
index d0530d1..11cf2ef 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/ObjectInDataStoreStateMachine.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/ObjectInDataStoreStateMachine.java
@@ -23,11 +23,8 @@ import com.cloud.utils.fsm.StateObject;
 public interface ObjectInDataStoreStateMachine extends StateObject<ObjectInDataStoreStateMachine.State> {
     enum State {
         Allocated("The initial state"),
-        Creating2("This is only used with createOnlyRequested event"),
-        Creating("The object is being creating on data store"),
-        Created("The object is created"),
+        Creating("The template is being downloading to data store"),
         Ready("Template downloading is complished"),
-        Copying("The object is being coping"),
         Destroying("Template is destroying"),
         Destroyed("Template is destroyed"),
         Failed("Failed to download template");
@@ -44,11 +41,8 @@ public interface ObjectInDataStoreStateMachine extends StateObject<ObjectInDataS
     
     enum Event {
         CreateRequested,
-        CreateOnlyRequested,
         DestroyRequested,
         OperationSuccessed,
         OperationFailed,
-        CopyingRequested,
-        
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/volume/PrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/PrimaryDataStoreDriver.java b/engine/storage/src/org/apache/cloudstack/storage/volume/PrimaryDataStoreDriver.java
deleted file mode 100644
index 60db60b..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/PrimaryDataStoreDriver.java
+++ /dev/null
@@ -1,29 +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.storage.volume;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
-import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
-import org.apache.cloudstack.storage.snapshot.SnapshotInfo;
-
-public interface PrimaryDataStoreDriver extends DataStoreDriver {
-    public void takeSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback<CommandResult> callback);
-    public void revertSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback<CommandResult> callback);
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java
new file mode 100644
index 0000000..b90a6d6
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java
@@ -0,0 +1,246 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.volume;
+
+import java.lang.reflect.Method;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+
+import org.apache.cloudstack.engine.cloud.entity.api.SnapshotEntity;
+import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity;
+import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity;
+import org.apache.cloudstack.engine.datacenter.entity.api.StorageEntity;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType;
+import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType;
+import org.apache.cloudstack.framework.async.AsyncCallFuture;
+import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
+import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
+import org.apache.cloudstack.storage.datastore.PrimaryDataStoreEntityImpl;
+import org.apache.cloudstack.storage.image.TemplateEntityImpl;
+import org.apache.cloudstack.storage.image.TemplateInfo;
+import org.apache.cloudstack.storage.volume.VolumeService.VolumeApiResult;
+
+import com.cloud.utils.exception.CloudRuntimeException;
+
+public class VolumeEntityImpl implements VolumeEntity {
+    private VolumeInfo volumeInfo;
+    private final VolumeService vs;
+    private VolumeApiResult result;
+    
+    protected VolumeEntityImpl() {
+        this.vs = null;
+    }
+    
+    public VolumeEntityImpl(VolumeInfo volumeObject, VolumeService vs) {
+        this.volumeInfo = volumeObject;
+        this.vs = vs;
+    }
+
+    public VolumeInfo getVolumeInfo() {
+        return volumeInfo;
+    }
+
+    @Override 
+    public String getUuid() {
+        return volumeInfo.getUuid();
+    }
+
+    @Override
+    public long getId() {
+        return volumeInfo.getId();
+    }
+
+    public String getExternalId() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getCurrentState() {
+        return volumeInfo.getCurrentState().toString();
+    }
+
+    @Override
+    public String getDesiredState() {
+        return volumeInfo.getDesiredState().toString();
+    }
+
+    @Override
+    public Date getCreatedTime() {
+        return volumeInfo.getCreatedDate();
+    }
+
+    @Override
+    public Date getLastUpdatedTime() {
+        return volumeInfo.getUpdatedDate();
+    }
+
+    @Override
+    public String getOwner() {
+        return volumeInfo.getOwner();
+    }
+
+  
+    @Override
+    public List<Method> getApplicableActions() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public SnapshotEntity takeSnapshotOf(boolean full) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String reserveForMigration(long expirationTime) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void migrate(String reservationToken) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public VolumeEntity setupForCopy() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void copy(VolumeEntity dest) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void attachTo(String vm, long deviceId) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void detachFrom() {
+        // TODO Auto-generated method stub
+
+    }
+
+
+    @Override
+    public long getSize() {
+        return volumeInfo.getSize();
+    }
+
+    @Override
+    public VolumeDiskType getDiskType() {
+        return volumeInfo.getDiskType();
+    }
+
+    @Override
+    public VolumeType getType() {
+        return volumeInfo.getType();
+    }
+
+    @Override
+    public StorageEntity getDataStore() {
+        return new PrimaryDataStoreEntityImpl(volumeInfo.getDataStore());
+    }
+
+    @Override
+    public boolean createVolumeFromTemplate(long dataStoreId, VolumeDiskType diskType, TemplateEntity template) {
+        TemplateInfo ti = ((TemplateEntityImpl)template).getTemplateInfo();
+          
+        AsyncCallFuture<VolumeApiResult> future = vs.createVolumeFromTemplateAsync(volumeInfo, dataStoreId, diskType, ti);
+        try {
+            result = future.get();
+            if (!result.isSuccess()) {
+                throw new CloudRuntimeException("create volume from template failed: " + result.getResult()); 
+            }
+            return true;
+        } catch (InterruptedException e) {
+           throw new CloudRuntimeException("wait result failed", e);
+        } catch (ExecutionException e) {
+            throw new CloudRuntimeException("wait result failed", e);
+        }
+    }
+
+    @Override
+    public boolean createVolume(long dataStoreId, VolumeDiskType diskType) {
+        AsyncCallFuture<VolumeApiResult> future = vs.createVolumeAsync(volumeInfo, dataStoreId, diskType);
+        try {
+            result = future.get();
+            if (result.isSuccess()) {
+                return true;
+            } else {
+                throw new CloudRuntimeException("Failed to create volume:" + result.getResult());
+            }
+        } catch (InterruptedException e) {
+            throw new CloudRuntimeException("wait volume info failed", e);
+        } catch (ExecutionException e) {
+            throw new CloudRuntimeException("wait volume failed", e);
+        }
+    }
+    
+    @Override
+    public void destroy() {
+        AsyncCallFuture<VolumeApiResult> future = vs.deleteVolumeAsync(volumeInfo);
+        try {
+            result = future.get();
+            if (!result.isSuccess()) {
+                throw new CloudRuntimeException("Failed to create volume:" + result.getResult());
+            }
+        } catch (InterruptedException e) {
+           throw new CloudRuntimeException("wait to delete volume info failed", e);
+        } catch (ExecutionException e) {
+            throw new CloudRuntimeException("wait to delete volume failed", e);
+        }
+    }
+
+	@Override
+	public Map<String, String> getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void addDetail(String name, String value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void delDetail(String name, String value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void updateDetail(String name, String value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeService.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeService.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeService.java
index 19a4c3a..2bd2127 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeService.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeService.java
@@ -19,13 +19,13 @@
 package org.apache.cloudstack.storage.volume;
 
 import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity;
-import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
+import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType;
 import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType;
 import org.apache.cloudstack.framework.async.AsyncCallFuture;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
+import org.apache.cloudstack.storage.EndPoint;
+import org.apache.cloudstack.storage.command.CommandResult;
 import org.apache.cloudstack.storage.image.TemplateInfo;
 
 public interface VolumeService {
@@ -52,7 +52,7 @@ public interface VolumeService {
      * 
      * @return the volume object
      */
-    AsyncCallFuture<VolumeApiResult> createVolumeAsync(VolumeInfo volume, long dataStoreId);
+    AsyncCallFuture<VolumeApiResult> createVolumeAsync(VolumeInfo volume, long dataStoreId, VolumeDiskType diskType);
 
     /**
      * Delete volume
@@ -87,5 +87,5 @@ public interface VolumeService {
 
     VolumeEntity getVolumeEntity(long volumeId);
 
-    AsyncCallFuture<VolumeApiResult> createVolumeFromTemplateAsync(VolumeInfo volume, long dataStoreId, TemplateInfo template);
+    AsyncCallFuture<VolumeApiResult> createVolumeFromTemplateAsync(VolumeInfo volume, long dataStoreId, VolumeDiskType diskType, TemplateInfo template);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java b/engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java
deleted file mode 100644
index a7397e1..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java
+++ /dev/null
@@ -1,77 +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.storage.volume.datastore;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
-import org.apache.cloudstack.storage.command.AttachPrimaryDataStoreCmd;
-import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreVO;
-import org.apache.cloudstack.storage.volume.PrimaryDataStoreDriver;
-import org.springframework.stereotype.Component;
-
-import com.cloud.utils.exception.CloudRuntimeException;
-
-@Component
-public class PrimaryDataStoreHelper {
-    @Inject
-    private PrimaryDataStoreDao dataStoreDao;
-    public PrimaryDataStoreVO createPrimaryDataStore(Map<String, String> params) {
-        PrimaryDataStoreVO dataStoreVO = dataStoreDao.findPoolByUUID(params.get("uuid"));
-        if (dataStoreVO != null) {
-            throw new CloudRuntimeException("duplicate uuid: " + params.get("uuid"));
-        }
-        
-        dataStoreVO = new PrimaryDataStoreVO();
-        dataStoreVO.setStorageProviderId(Long.parseLong(params.get("providerId")));
-        dataStoreVO.setHostAddress(params.get("server"));
-        dataStoreVO.setPath(params.get("path"));
-        dataStoreVO.setPoolType(params.get("protocol"));
-        dataStoreVO.setPort(Integer.parseInt(params.get("port")));
-        //dataStoreVO.setKey(params.get("key"));
-        dataStoreVO.setName(params.get("name"));
-        dataStoreVO.setUuid(params.get("uuid"));
-        dataStoreVO = dataStoreDao.persist(dataStoreVO);
-        return dataStoreVO;
-    }
-    
-    public boolean deletePrimaryDataStore(long id) {
-        PrimaryDataStoreVO dataStoreVO = dataStoreDao.findById(id);
-        if (dataStoreVO == null) {
-            throw new CloudRuntimeException("can't find store: " + id);
-        }
-        dataStoreDao.remove(id);
-        return true;
-    }
-    
-    public void attachCluster(DataStore dataStore) {
-        //send down AttachPrimaryDataStoreCmd command to all the hosts in the cluster
-        AttachPrimaryDataStoreCmd cmd = new AttachPrimaryDataStoreCmd(dataStore.getUri());
-        /*for (EndPoint ep : dataStore.getEndPoints()) {
-            ep.sendMessage(cmd);
-        } */
-    }
-    
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeDao2Impl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeDao2Impl.java b/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeDao2Impl.java
index 0eb0ac3..1e12498 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeDao2Impl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeDao2Impl.java
@@ -38,7 +38,7 @@ import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.Volume;
 import com.cloud.tags.dao.ResourceTagsDaoImpl;
 import com.cloud.utils.Pair;
-import com.cloud.utils.component.ComponentLocator;
+
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.GenericSearchBuilder;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeVO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeVO.java b/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeVO.java
index da8234e..ee1600d 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeVO.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeVO.java
@@ -33,7 +33,7 @@ import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
 import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
+import org.apache.cloudstack.engine.subsystem.api.storage.disktype.Unknown;
 
 import com.cloud.storage.Storage.StoragePoolType;
 import com.cloud.storage.Volume;
@@ -113,7 +113,7 @@ public class VolumeVO implements Identity, StateObject<Volume.State> {
     StoragePoolType poolType;
 
     @Column(name = "disk_type")
-    DiskFormat diskType;
+    String diskType = new Unknown().toString();
 
     @Column(name = GenericDao.REMOVED_COLUMN)
     Date removed;
@@ -406,11 +406,11 @@ public class VolumeVO implements Identity, StateObject<Volume.State> {
         this.uuid = uuid;
     }
 
-    public DiskFormat getDiskType() {
+    public String getDiskType() {
         return diskType;
     }
 
-    public void setDiskType(DiskFormat type) {
+    public void setDiskType(String type) {
         diskType = type;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/storage.ucls
----------------------------------------------------------------------
diff --git a/engine/storage/storage.ucls b/engine/storage/storage.ucls
index 9b3a47c..23a7b21 100644
--- a/engine/storage/storage.ucls
+++ b/engine/storage/storage.ucls
@@ -1,3 +1,21 @@
+<!--
+  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.
+-->
 <class-diagram version="1.0.11" icons="true" automaticImage="JPEG" always-add-relationships="false" 
   generalizations="true" realizations="true" associations="true" dependencies="false" nesting-relationships="true">    
   <class id="1" corner="BOTTOM_RIGHT" language="java" 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java
new file mode 100644
index 0000000..23551e4
--- /dev/null
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.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.storage.datastore;
+
+public enum DataStoreStatus {
+    Initial, Initialized, Creating, Attaching, Up, PrepareForMaintenance, ErrorInMaintenance, CancelMaintenance, Maintenance, Removed;
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
index a67a47c..ff95aa0 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
@@ -1,46 +1,65 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 package org.apache.cloudstack.storage.datastore;
 
-import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 
 import javax.inject.Inject;
 
 import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity;
-import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
 import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle;
-import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
-import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreProvider;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
-import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
+import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType;
+import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
+import org.apache.cloudstack.storage.EndPoint;
+import org.apache.cloudstack.storage.HypervisorHostEndPoint;
+import org.apache.cloudstack.storage.command.CommandResult;
+import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreVO;
-import org.apache.cloudstack.storage.datastore.provider.DataStoreProvider;
-import org.apache.cloudstack.storage.image.ImageDataFactory;
+import org.apache.cloudstack.storage.datastore.driver.PrimaryDataStoreDriver;
 import org.apache.cloudstack.storage.image.TemplateInfo;
-import org.apache.cloudstack.storage.snapshot.SnapshotDataFactory;
 import org.apache.cloudstack.storage.snapshot.SnapshotInfo;
-import org.apache.cloudstack.storage.volume.PrimaryDataStoreDriver;
+import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
+import org.apache.cloudstack.storage.to.VolumeTO;
+import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
+import org.apache.cloudstack.storage.volume.TemplatePrimaryDataStoreManager;
 import org.apache.cloudstack.storage.volume.VolumeObject;
 import org.apache.cloudstack.storage.volume.db.VolumeDao2;
 import org.apache.cloudstack.storage.volume.db.VolumeVO;
 import org.apache.log4j.Logger;
 
+import com.cloud.host.HostVO;
 import com.cloud.host.dao.HostDao;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.utils.component.ComponentContext;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+import edu.emory.mathcs.backport.java.util.Collections;
 
 public class DefaultPrimaryDataStore implements PrimaryDataStore {
-    private static final Logger s_logger = Logger
-            .getLogger(DefaultPrimaryDataStore.class);
+    private static final Logger s_logger = Logger.getLogger(DefaultPrimaryDataStore.class);
     protected PrimaryDataStoreDriver driver;
     protected PrimaryDataStoreVO pdsv;
     protected PrimaryDataStoreLifeCycle lifeCycle;
-    protected DataStoreProvider provider;
-    //protected StorageProtocolTransformer protocalTransformer;
+    protected PrimaryDataStoreProvider provider;
+    protected StorageProtocolTransformer protocalTransformer;
     private HypervisorType supportedHypervisor;
     private boolean isLocalStorageSupported = false;
     @Inject
@@ -50,30 +69,42 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
     @Inject
     private PrimaryDataStoreDao dataStoreDao;
     @Inject
-    private ObjectInDataStoreManager objectInStoreMgr;
-    @Inject
-    ImageDataFactory imageDataFactory;
-    @Inject
-    SnapshotDataFactory snapshotFactory;
+    private TemplatePrimaryDataStoreManager templatePrimaryStoreMgr;
 
-    private DefaultPrimaryDataStore(PrimaryDataStoreVO pdsv,
-            PrimaryDataStoreDriver driver,
-            DataStoreProvider provider) {
+    private DefaultPrimaryDataStore(PrimaryDataStoreVO pdsv) {
         this.pdsv = pdsv;
+    }
+
+    public void setDriver(PrimaryDataStoreDriver driver) {
+        driver.setDataStore(this);
         this.driver = driver;
+    }
+
+    public void setLifeCycle(PrimaryDataStoreLifeCycle lifeCycle) {
+        lifeCycle.setDataStore(this);
+        this.lifeCycle = lifeCycle;
+    }
+
+    public void setProvider(PrimaryDataStoreProvider provider) {
         this.provider = provider;
     }
 
+    public void setProtocolTransFormer(StorageProtocolTransformer transformer) {
+        this.protocalTransformer = transformer;
+    }
+
+    @Override
+    public PrimaryDataStoreTO getDataStoreTO() {
+        return this.protocalTransformer.getDataStoreTO(this);
+    }
+
     @Override
-    public PrimaryDataStoreDriver getDriver() {
-        return this.driver;
+    public VolumeTO getVolumeTO(VolumeInfo volume) {
+        return this.protocalTransformer.getVolumeTO(volume);
     }
 
-    public static DefaultPrimaryDataStore createDataStore(
-            PrimaryDataStoreVO pdsv,
-            PrimaryDataStoreDriver driver,
-            DataStoreProvider provider) {
-        DefaultPrimaryDataStore dataStore = new DefaultPrimaryDataStore(pdsv, driver, provider);
+    public static DefaultPrimaryDataStore createDataStore(PrimaryDataStoreVO pdsv) {
+        DefaultPrimaryDataStore dataStore = new DefaultPrimaryDataStore(pdsv);
         return ComponentContext.inject(dataStore);
     }
 
@@ -94,13 +125,16 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
         return volumeInfos;
     }
 
-/*    @Override
-    public void deleteAsync(DataObject volume,
-            AsyncCompletionCallback<CommandResult> callback) {
-        this.driver.deleteAsync((VolumeObject) volume, callback);
+    @Override
+    public void deleteVolumeAsync(VolumeInfo volume, AsyncCompletionCallback<CommandResult> callback) {
+        CommandResult result = new CommandResult();
+        if (volume.isAttachedVM()) {
+            result.setResult("Can't delete volume: " + volume.getId() + ", if it's attached to a VM");
+            callback.complete(result);
+        }
+        this.driver.deleteVolumeAsync((VolumeObject)volume, callback);
     }
-*/
-    /*
+
     @Override
     public List<EndPoint> getEndPoints() {
         Long clusterId = pdsv.getClusterId();
@@ -115,14 +149,13 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
         List<EndPoint> endpoints = new ArrayList<EndPoint>();
         List<HostVO> hosts = hostDao.findHypervisorHostInCluster(clusterId);
         for (HostVO host : hosts) {
-            HypervisorHostEndPoint ep = new HypervisorHostEndPoint(
-                    host.getId(), host.getPrivateIpAddress());
-            ComponentInject.inject(ep);
+            HypervisorHostEndPoint ep = new HypervisorHostEndPoint(host.getId(), host.getPrivateIpAddress());
+            ComponentContext.inject(ep);
             endpoints.add(ep);
         }
         Collections.shuffle(endpoints);
         return endpoints;
-    }*/
+    }
 
     public void setSupportedHypervisor(HypervisorType type) {
         this.supportedHypervisor = type;
@@ -143,53 +176,43 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
     }
 
     @Override
-    public boolean isVolumeDiskTypeSupported(DiskFormat diskType) {
+    public boolean isVolumeDiskTypeSupported(VolumeDiskType diskType) {
         return true;
     }
 
     @Override
     public long getCapacity() {
-        return 0;
+        return this.driver.getCapacity();
     }
 
     @Override
     public long getAvailableCapacity() {
-        //return this.driver.getAvailableCapacity();
-        return 0;
+        return this.driver.getAvailableCapacity();
     }
 
-/*    @Override
-    public void createAsync(DataObject data,
-            AsyncCompletionCallback<CommandResult> callback) {
-        this.provider.getVolumeDriver().createAsync(data, callback);
-    }
-*/
-/*    @Override
-    public void takeSnapshot(SnapshotInfo snapshot,
-            AsyncCompletionCallback<CommandResult> callback) {
-        this.provider.getSnapshotDriver().takeSnapshot(snapshot, callback);
-    }
-*/
-/*    @Override
-    public void revertSnapshot(SnapshotInfo snapshot,
-            AsyncCompletionCallback<CommandResult> callback) {
-        this.provider.getSnapshotDriver().revertSnapshot(snapshot, callback);
+    @Override
+    public void createVolumeAsync(VolumeInfo vi, VolumeDiskType diskType, AsyncCompletionCallback<CommandResult> callback) {
+        if (!isVolumeDiskTypeSupported(diskType)) {
+            throw new CloudRuntimeException("disk type " + diskType + " is not supported");
+        }
+        VolumeObject vo = (VolumeObject) vi;
+        vo.setVolumeDiskType(diskType);
+        this.driver.createVolumeAsync(vo, callback);
     }
 
     @Override
-    public void deleteSnapshot(SnapshotInfo snapshot,
-            AsyncCompletionCallback<CommandResult> callback) {
-        this.provider.getSnapshotDriver().deleteSnapshot(snapshot, callback);
+    public boolean exists(VolumeInfo vi) {
+        VolumeVO vol = volumeDao.findByVolumeIdAndPoolId(vi.getId(), this.getId());
+        return (vol != null) ? true : false;
     }
-*/
+
     @Override
-    public boolean exists(DataObject data) {
-        return (objectInStoreMgr.findObject(data.getId(), data.getType(), this.getId(), this.getRole()) != null) ? true
-                : false;
+    public boolean templateExists(TemplateInfo template) {
+        return (templatePrimaryStoreMgr.findTemplateOnPrimaryDataStore(template, this) != null) ? true : false;
     }
 
     @Override
-    public DiskFormat getDefaultDiskType() {
+    public VolumeDiskType getDefaultDiskType() {
         // TODO Auto-generated method stub
         return null;
     }
@@ -200,19 +223,31 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
     }
 
     @Override
-    public TemplateInfo getTemplate(long templateId) {
-       return imageDataFactory.getTemplate(templateId, this);
+    public TemplateOnPrimaryDataStoreInfo getTemplate(TemplateInfo template) {
+        return templatePrimaryStoreMgr.findTemplateOnPrimaryDataStore(template, this);
+    }
+
+    @Override
+    public VolumeInfo createVoluemFromBaseImage(VolumeInfo volume, TemplateOnPrimaryDataStoreInfo template) {
+        VolumeObject vo = (VolumeObject) volume;
+        vo.setVolumeDiskType(template.getTemplate().getDiskType());
+        //this.driver.createVolumeFromBaseImage(vo, template);
+        return volume;
     }
 
-/*    @Override
-    public void createVoluemFromBaseImageAsync(VolumeInfo volume,
-            TemplateInfo template,
-            AsyncCompletionCallback<CommandResult> callback) {
+    @Override
+    public void createVoluemFromBaseImageAsync(VolumeInfo volume, TemplateInfo templateStore, AsyncCompletionCallback<CommandResult> callback) {
         VolumeObject vo = (VolumeObject) volume;
-        vo.setVolumeDiskType(template.getDiskType());
-        this.driver.createVolumeFromBaseImageAsync(vo, template, callback);
+        vo.setVolumeDiskType(templateStore.getDiskType());
+        String templateUri = templateStore.getDataStore().grantAccess(templateStore, this.getEndPoints().get(0));
+        this.driver.createVolumeFromBaseImageAsync(vo, templateUri, callback);
+    }
+
+    @Override
+    public boolean installTemplate(TemplateOnPrimaryDataStoreInfo template) {
+        // TODO Auto-generated method stub
+        return true;
     }
-*/
 
     @Override
     public String getUuid() {
@@ -234,40 +269,55 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
         return this.pdsv.getPoolType();
     }
 
-    public DataStoreProvider getProvider() {
+    @Override
+    public PrimaryDataStoreLifeCycle getLifeCycle() {
+        return lifeCycle;
+    }
+
+    @Override
+    public PrimaryDataStoreProvider getProvider() {
         return this.provider;
     }
 
     @Override
-    public DataStoreRole getRole() {
-        return DataStoreRole.Primary;
+    public String grantAccess(VolumeInfo volume, EndPoint ep) {
+        return this.driver.grantAccess((VolumeObject)volume, ep);
     }
 
     @Override
-    public String getUri() {
-        return this.pdsv.getPoolType() + File.separator
-                + this.pdsv.getHostAddress() + File.separator
-                + this.pdsv.getPath();
+    public boolean revokeAccess(VolumeInfo volume, EndPoint ep) {
+        // TODO Auto-generated method stub
+        return false;
     }
 
     @Override
-    public PrimaryDataStoreLifeCycle getLifeCycle() {
-        return this.lifeCycle;
+    public String grantAccess(TemplateInfo template, EndPoint ep) {
+        // TODO Auto-generated method stub
+        return null;
     }
 
     @Override
-    public SnapshotInfo getSnapshot(long snapshotId) {
-        return snapshotFactory.getSnapshot(snapshotId, this);
+    public boolean revokeAccess(TemplateInfo template, EndPoint ep) {
+        // TODO Auto-generated method stub
+        return false;
     }
 
     @Override
-    public Scope getScope() {
-        if (pdsv.getScope() == ScopeType.CLUSTER) {
-            return new ClusterScope(pdsv.getClusterId(), pdsv.getPodId(), pdsv.getDataCenterId());
-        } else if (pdsv.getScope() == ScopeType.ZONE) {
-            return new ZoneScope(pdsv.getDataCenterId());
-        }
-        
+    public String grantAccess(SnapshotInfo snapshot, EndPoint ep) {
+        // TODO Auto-generated method stub
         return null;
     }
+
+    @Override
+    public boolean revokeAccess(SnapshotInfo snapshot, EndPoint ep) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public String getRole() {
+        // TODO Auto-generated method stub
+        return "volumeStore";
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/AbstractPrimaryDataStoreConfigurator.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/AbstractPrimaryDataStoreConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/AbstractPrimaryDataStoreConfigurator.java
new file mode 100644
index 0000000..2ecbfbf
--- /dev/null
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/AbstractPrimaryDataStoreConfigurator.java
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.storage.datastore.configurator;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle;
+import org.apache.cloudstack.storage.datastore.DefaultPrimaryDataStore;
+import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreVO;
+import org.apache.cloudstack.storage.datastore.driver.PrimaryDataStoreDriver;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+public abstract class AbstractPrimaryDataStoreConfigurator implements PrimaryDataStoreConfigurator {
+    @Inject
+    protected PrimaryDataStoreDao dataStoreDao;
+    
+    protected abstract PrimaryDataStoreLifeCycle getLifeCycle();
+    
+    protected abstract PrimaryDataStoreDriver getDriver();
+    
+    protected abstract boolean isLocalStorageSupported();
+
+    @Override
+    public PrimaryDataStore getDataStore(long dataStoreId) {
+        PrimaryDataStoreVO dataStoreVO = dataStoreDao.findById(dataStoreId);
+        if (dataStoreVO == null) {
+            throw new CloudRuntimeException("Can't find primary data store: " + dataStoreId);
+        }
+        
+        DefaultPrimaryDataStore dataStore = DefaultPrimaryDataStore.createDataStore(dataStoreVO);
+        dataStore.setDriver(getDriver());
+        dataStore.setLifeCycle(getLifeCycle());
+        dataStore.setSupportedHypervisor(getSupportedHypervisor());
+        dataStore.setLocalStorageFlag(isLocalStorageSupported());
+        dataStore.setProtocolTransFormer(getProtocolTransformer());
+        return dataStore;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/PrimaryDataStoreConfigurator.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/PrimaryDataStoreConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/PrimaryDataStoreConfigurator.java
new file mode 100644
index 0000000..e868b4e
--- /dev/null
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/PrimaryDataStoreConfigurator.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.storage.datastore.configurator;
+
+import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
+import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.storage.Storage.StoragePoolType;
+
+public interface PrimaryDataStoreConfigurator {
+    public HypervisorType getSupportedHypervisor();
+    public String getSupportedDataStoreType();
+    public PrimaryDataStore getDataStore(long dataStoreId);
+    public StorageProtocolTransformer getProtocolTransformer();
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/AbstractKvmConfigurator.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/AbstractKvmConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/AbstractKvmConfigurator.java
new file mode 100644
index 0000000..008af85
--- /dev/null
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/AbstractKvmConfigurator.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.datastore.configurator.kvm;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle;
+import org.apache.cloudstack.storage.datastore.configurator.AbstractPrimaryDataStoreConfigurator;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.driver.DefaultPrimaryDataStoreDriverImpl;
+import org.apache.cloudstack.storage.datastore.driver.PrimaryDataStoreDriver;
+import org.apache.cloudstack.storage.datastore.lifecycle.DefaultKvmPrimaryDataStoreLifeCycle;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+
+public abstract class AbstractKvmConfigurator extends AbstractPrimaryDataStoreConfigurator {
+    @Inject
+    PrimaryDataStoreDao dataStoreDao;
+    
+    @Override
+    public HypervisorType getSupportedHypervisor() {
+        return HypervisorType.KVM;
+    }
+    
+    protected PrimaryDataStoreLifeCycle getLifeCycle() {
+        return new DefaultKvmPrimaryDataStoreLifeCycle(dataStoreDao);
+    }
+    
+    protected PrimaryDataStoreDriver getDriver() {
+        return new DefaultPrimaryDataStoreDriverImpl();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmCLVMConfigurator.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmCLVMConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmCLVMConfigurator.java
new file mode 100644
index 0000000..f0b581f
--- /dev/null
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmCLVMConfigurator.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.storage.datastore.configurator.kvm;
+
+import org.apache.cloudstack.storage.datastore.configurator.validator.CLVMProtocolTransformer;
+import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+@Component
+@Qualifier("defaultProvider")
+public class KvmCLVMConfigurator extends AbstractKvmConfigurator {
+
+    @Override
+    public String getSupportedDataStoreType() {
+        return "clvm";
+    }
+
+    @Override
+    public StorageProtocolTransformer getProtocolTransformer() {
+        return new CLVMProtocolTransformer();
+    }
+
+    @Override
+    protected boolean isLocalStorageSupported() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmNfsConfigurator.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmNfsConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmNfsConfigurator.java
new file mode 100644
index 0000000..1c36f15
--- /dev/null
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmNfsConfigurator.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.datastore.configurator.kvm;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.storage.datastore.configurator.validator.NfsProtocolTransformer;
+import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+
+@Component
+@Qualifier("defaultProvider")
+public class KvmNfsConfigurator extends AbstractKvmConfigurator {
+    @Inject
+    PrimaryDataStoreDao dataStoreDao;
+
+    @Override
+    public String getSupportedDataStoreType() {
+        return "nfs";
+    }
+
+    @Override
+    public StorageProtocolTransformer getProtocolTransformer() {
+        return new NfsProtocolTransformer(dataStoreDao);
+    }
+
+    @Override
+    protected boolean isLocalStorageSupported() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmRBDConfigurator.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmRBDConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmRBDConfigurator.java
new file mode 100644
index 0000000..a644239
--- /dev/null
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmRBDConfigurator.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.datastore.configurator.kvm;
+
+import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer;
+import org.apache.cloudstack.storage.datastore.configurator.validator.RBDValidator;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+import com.cloud.storage.Storage.StoragePoolType;
+
+@Component
+@Qualifier("defaultProvider")
+public class KvmRBDConfigurator extends AbstractKvmConfigurator {
+
+    public String getSupportedDataStoreType() {
+        return "rbd";
+    }
+
+    @Override
+    public StorageProtocolTransformer getProtocolTransformer() {
+        return new RBDValidator();
+    }
+
+    @Override
+    protected boolean isLocalStorageSupported() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/CLVMProtocolTransformer.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/CLVMProtocolTransformer.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/CLVMProtocolTransformer.java
new file mode 100644
index 0000000..4dd19d2
--- /dev/null
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/CLVMProtocolTransformer.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.datastore.configurator.validator;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
+import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
+import org.apache.cloudstack.storage.to.VolumeTO;
+
+public class CLVMProtocolTransformer implements StorageProtocolTransformer {
+
+    @Override
+    public boolean normalizeUserInput(Map<String, String> params) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public List<String> getInputParamNames() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public PrimaryDataStoreTO getDataStoreTO(PrimaryDataStoreInfo dataStore) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public VolumeTO getVolumeTO(VolumeInfo volume) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/FileSystemValidator.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/FileSystemValidator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/FileSystemValidator.java
new file mode 100644
index 0000000..8e1180e
--- /dev/null
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/FileSystemValidator.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.datastore.configurator.validator;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
+import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
+import org.apache.cloudstack.storage.to.VolumeTO;
+
+public class FileSystemValidator implements StorageProtocolTransformer {
+
+    @Override
+    public boolean normalizeUserInput(Map<String, String> params) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public List<String> getInputParamNames() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public PrimaryDataStoreTO getDataStoreTO(PrimaryDataStoreInfo dataStore) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public VolumeTO getVolumeTO(VolumeInfo volume) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+}


Mime
View raw message