cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [2/8] starting unit test
Date Wed, 21 Nov 2012 03:01:19 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
index 4429499..9986525 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
@@ -34,6 +34,7 @@ import org.springframework.stereotype.Component;
 import com.cloud.storage.StoragePoolDetailVO;
 import com.cloud.storage.dao.StoragePoolDetailsDao;
 import com.cloud.storage.dao.StoragePoolDetailsDaoImpl;
+import com.cloud.utils.component.ComponentInject;
 import com.cloud.utils.component.ComponentLocator;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.GenericDaoBase;
@@ -46,136 +47,126 @@ import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 @Component
-public class PrimaryDataStoreDaoImpl extends GenericDaoBase<DataStoreVO, Long>  implements PrimaryDataStoreDao {
+public class PrimaryDataStoreDaoImpl extends GenericDaoBase<DataStoreVO, Long> implements PrimaryDataStoreDao {
     protected final SearchBuilder<DataStoreVO> AllFieldSearch;
-	protected final SearchBuilder<DataStoreVO> DcPodSearch;
+    protected final SearchBuilder<DataStoreVO> DcPodSearch;
     protected final SearchBuilder<DataStoreVO> DcPodAnyClusterSearch;
     protected final SearchBuilder<DataStoreVO> DeleteLvmSearch;
     protected final GenericSearchBuilder<DataStoreVO, Long> StatusCountSearch;
 
-    
-    
-    protected final StoragePoolDetailsDao _detailsDao;
-	
+    protected final PrimaryDataStoreDetailsDao _detailsDao = null;
+
     private final String DetailsSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_details ON storage_pool.id = storage_pool_details.pool_id WHERE storage_pool.removed is null and storage_pool.data_center_id = ? and (storage_pool.pod_id = ? or storage_pool.pod_id is null) and (";
-	private final String DetailsSqlSuffix = ") GROUP BY storage_pool_details.pool_id HAVING COUNT(storage_pool_details.name) >= ?";
-	private final String FindPoolTagDetails = "SELECT storage_pool_details.name FROM storage_pool_details WHERE pool_id = ? and value = ?";
-	
+    private final String DetailsSqlSuffix = ") GROUP BY storage_pool_details.pool_id HAVING COUNT(storage_pool_details.name) >= ?";
+    private final String FindPoolTagDetails = "SELECT storage_pool_details.name FROM storage_pool_details WHERE pool_id = ? and value = ?";
+
     protected PrimaryDataStoreDaoImpl() {
         AllFieldSearch = createSearchBuilder();
         AllFieldSearch.and("name", AllFieldSearch.entity().getName(), SearchCriteria.Op.EQ);
         AllFieldSearch.and("uuid", AllFieldSearch.entity().getUuid(), SearchCriteria.Op.EQ);
         AllFieldSearch.and("datacenterId", AllFieldSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
         AllFieldSearch.and("hostAddress", AllFieldSearch.entity().getHostAddress(), SearchCriteria.Op.EQ);
-        AllFieldSearch.and("status",AllFieldSearch.entity().getStatus(),SearchCriteria.Op.EQ);
+        AllFieldSearch.and("status", AllFieldSearch.entity().getStatus(), SearchCriteria.Op.EQ);
         AllFieldSearch.and("path", AllFieldSearch.entity().getPath(), SearchCriteria.Op.EQ);
         AllFieldSearch.and("podId", AllFieldSearch.entity().getPodId(), Op.EQ);
         AllFieldSearch.and("clusterId", AllFieldSearch.entity().getClusterId(), Op.EQ);
-        AllFieldSearch.done();  
-        
-    	DcPodSearch = createSearchBuilder();
-    	DcPodSearch.and("datacenterId", DcPodSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-    	DcPodSearch.and().op("nullpod", DcPodSearch.entity().getPodId(), SearchCriteria.Op.NULL);
-    	DcPodSearch.or("podId", DcPodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
-    	DcPodSearch.cp();
-    	DcPodSearch.and().op("nullcluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.NULL);
-    	DcPodSearch.or("cluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
-    	DcPodSearch.cp();
-    	DcPodSearch.done();
-    	
-    	DcPodAnyClusterSearch = createSearchBuilder();
+        AllFieldSearch.done();
+
+        DcPodSearch = createSearchBuilder();
+        DcPodSearch.and("datacenterId", DcPodSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        DcPodSearch.and().op("nullpod", DcPodSearch.entity().getPodId(), SearchCriteria.Op.NULL);
+        DcPodSearch.or("podId", DcPodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
+        DcPodSearch.cp();
+        DcPodSearch.and().op("nullcluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.NULL);
+        DcPodSearch.or("cluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
+        DcPodSearch.cp();
+        DcPodSearch.done();
+
+        DcPodAnyClusterSearch = createSearchBuilder();
         DcPodAnyClusterSearch.and("datacenterId", DcPodAnyClusterSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
         DcPodAnyClusterSearch.and().op("nullpod", DcPodAnyClusterSearch.entity().getPodId(), SearchCriteria.Op.NULL);
         DcPodAnyClusterSearch.or("podId", DcPodAnyClusterSearch.entity().getPodId(), SearchCriteria.Op.EQ);
         DcPodAnyClusterSearch.cp();
         DcPodAnyClusterSearch.done();
-        
+
         DeleteLvmSearch = createSearchBuilder();
         DeleteLvmSearch.and("ids", DeleteLvmSearch.entity().getId(), SearchCriteria.Op.IN);
         DeleteLvmSearch.and().op("LVM", DeleteLvmSearch.entity().getPoolType(), SearchCriteria.Op.EQ);
         DeleteLvmSearch.or("Filesystem", DeleteLvmSearch.entity().getPoolType(), SearchCriteria.Op.EQ);
         DeleteLvmSearch.cp();
-        DeleteLvmSearch.done();        
+        DeleteLvmSearch.done();
 
-        
-        
         StatusCountSearch = createSearchBuilder(Long.class);
         StatusCountSearch.and("status", StatusCountSearch.entity().getStatus(), SearchCriteria.Op.IN);
         StatusCountSearch.select(null, Func.COUNT, null);
         StatusCountSearch.done();
 
-        _detailsDao = ComponentLocator.inject(StoragePoolDetailsDaoImpl.class);
+       // _detailsDao = ComponentInject.inject(PrimaryDataStoreDetailsDaoImpl.class);
     }
-    
-	@Override
-	public List<DataStoreVO> findPoolByName(String name) {
-		SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
+
+    @Override
+    public List<DataStoreVO> findPoolByName(String name) {
+        SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
         sc.setParameters("name", name);
         return listIncludingRemovedBy(sc);
-	}
-
+    }
 
-	@Override
-	public DataStoreVO findPoolByUUID(String uuid) {
-		SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
+    @Override
+    public DataStoreVO findPoolByUUID(String uuid) {
+        SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
         sc.setParameters("uuid", uuid);
         return findOneIncludingRemovedBy(sc);
-	}
-	
-	
+    }
 
-	@Override
-	public List<DataStoreVO> findIfDuplicatePoolsExistByUUID(String uuid) {
-		SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
+    @Override
+    public List<DataStoreVO> findIfDuplicatePoolsExistByUUID(String uuid) {
+        SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
         sc.setParameters("uuid", uuid);
         return listBy(sc);
-	}
-
+    }
 
-	@Override
-	public List<DataStoreVO> listByDataCenterId(long datacenterId) {
-		SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
+    @Override
+    public List<DataStoreVO> listByDataCenterId(long datacenterId) {
+        SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
         sc.setParameters("datacenterId", datacenterId);
         return listBy(sc);
-	}
-
+    }
 
-	@Override
-	public void updateAvailable(long id, long available) {
-		DataStoreVO pool = createForUpdate(id);
-		pool.setAvailableBytes(available);
-		update(id, pool);
-	}
+    @Override
+    public void updateAvailable(long id, long available) {
+        DataStoreVO pool = createForUpdate(id);
+        pool.setAvailableBytes(available);
+        update(id, pool);
+    }
 
+    @Override
+    public void updateCapacity(long id, long capacity) {
+        DataStoreVO pool = createForUpdate(id);
+        pool.setCapacityBytes(capacity);
+        update(id, pool);
 
-	@Override
-	public void updateCapacity(long id, long capacity) {
-		DataStoreVO pool = createForUpdate(id);
-		pool.setCapacityBytes(capacity);
-		update(id, pool);
+    }
 
-	}
-	
     @Override
     public List<DataStoreVO> listByStorageHost(String hostFqdnOrIp) {
         SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
         sc.setParameters("hostAddress", hostFqdnOrIp);
         return listIncludingRemovedBy(sc);
     }
-    
+
     @Override
-    public List<DataStoreVO> listByStatus(DataStoreStatus status){
+    public List<DataStoreVO> listByStatus(DataStoreStatus status) {
         SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
-    	sc.setParameters("status", status);
-    	return listBy(sc);
+        sc.setParameters("status", status);
+        return listBy(sc);
     }
-    
+
     @Override
-    public List<DataStoreVO> listByStatusInZone(long dcId, DataStoreStatus status){
+    public List<DataStoreVO> listByStatusInZone(long dcId, DataStoreStatus status) {
         SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
-    	sc.setParameters("status", status);
-    	sc.setParameters("datacenterId", dcId);
-    	return listBy(sc);
+        sc.setParameters("status", status);
+        sc.setParameters("datacenterId", dcId);
+        return listBy(sc);
     }
 
     @Override
@@ -186,192 +177,190 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<DataStoreVO, Long>
         sc.setParameters("datacenterId", datacenterId);
         sc.setParameters("podId", podId);
         sc.setParameters("uuid", uuid);
-        
+
         return findOneBy(sc);
     }
 
-	@Override
-	public List<DataStoreVO> listBy(long datacenterId, long podId, Long clusterId) {
-	    if (clusterId != null) {
-    		SearchCriteria<DataStoreVO> sc = DcPodSearch.create();
+    @Override
+    public List<DataStoreVO> listBy(long datacenterId, long podId, Long clusterId) {
+        if (clusterId != null) {
+            SearchCriteria<DataStoreVO> sc = DcPodSearch.create();
             sc.setParameters("datacenterId", datacenterId);
             sc.setParameters("podId", podId);
-           
+
             sc.setParameters("cluster", clusterId);
             return listBy(sc);
-	    } else {
-	        SearchCriteria<DataStoreVO> sc = DcPodAnyClusterSearch.create();
-	        sc.setParameters("datacenterId", datacenterId);
-	        sc.setParameters("podId", podId);
-	        return listBy(sc);
-	    }
-	}
-
-	@Override
-	public List<DataStoreVO> listPoolByHostPath(String host, String path) {
+        } else {
+            SearchCriteria<DataStoreVO> sc = DcPodAnyClusterSearch.create();
+            sc.setParameters("datacenterId", datacenterId);
+            sc.setParameters("podId", podId);
+            return listBy(sc);
+        }
+    }
+
+    @Override
+    public List<DataStoreVO> listPoolByHostPath(String host, String path) {
         SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
         sc.setParameters("hostAddress", host);
         sc.setParameters("path", path);
-        
+
         return listBy(sc);
-	}
-	
-	public DataStoreVO listById(Integer id)
-	{
+    }
+
+    public DataStoreVO listById(Integer id) {
         SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
         sc.setParameters("id", id);
-        
+
         return findOneIncludingRemovedBy(sc);
-	}
-	
-	@Override @DB
-	public DataStoreVO persist(DataStoreVO pool, Map<String, String> details) {
-	    Transaction txn = Transaction.currentTxn();
-	    txn.start();
-	    pool = super.persist(pool);
-	    if (details != null) {
-    	    for (Map.Entry<String, String> detail : details.entrySet()) {
-    	        StoragePoolDetailVO vo = new StoragePoolDetailVO(pool.getId(), detail.getKey(), detail.getValue());
-    	        _detailsDao.persist(vo);
-    	    }
+    }
+
+    @Override
+    @DB
+    public DataStoreVO persist(DataStoreVO pool, Map<String, String> details) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        pool = super.persist(pool);
+        if (details != null) {
+            for (Map.Entry<String, String> detail : details.entrySet()) {
+                PrimaryDataStoreDetailVO vo = new PrimaryDataStoreDetailVO(pool.getId(), detail.getKey(), detail.getValue());
+                _detailsDao.persist(vo);
+            }
+        }
+        txn.commit();
+        return pool;
+    }
+
+    @DB
+    @Override
+    public List<DataStoreVO> findPoolsByDetails(long dcId, long podId, Long clusterId, Map<String, String> details) {
+        StringBuilder sql = new StringBuilder(DetailsSqlPrefix);
+        if (clusterId != null) {
+            sql.append("storage_pool.cluster_id = ? OR storage_pool.cluster_id IS NULL) AND (");
+        }
+        for (Map.Entry<String, String> detail : details.entrySet()) {
+            sql.append("((storage_pool_details.name='").append(detail.getKey()).append("') AND (storage_pool_details.value='").append(detail.getValue()).append("')) OR ");
+        }
+        sql.delete(sql.length() - 4, sql.length());
+        sql.append(DetailsSqlSuffix);
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql.toString());
+            int i = 1;
+            pstmt.setLong(i++, dcId);
+            pstmt.setLong(i++, podId);
+            if (clusterId != null) {
+                pstmt.setLong(i++, clusterId);
+            }
+            pstmt.setInt(i++, details.size());
+            ResultSet rs = pstmt.executeQuery();
+            List<DataStoreVO> pools = new ArrayList<DataStoreVO>();
+            while (rs.next()) {
+                pools.add(toEntityBean(rs, false));
+            }
+            return pools;
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Unable to execute " + pstmt, e);
+        }
+    }
+
+    protected Map<String, String> tagsToDetails(String[] tags) {
+        Map<String, String> details = new HashMap<String, String>(tags.length);
+        for (String tag : tags) {
+            details.put(tag, "true");
         }
-	    txn.commit();
-	    return pool;
-	}
-	
-	@DB
-	@Override
-	public List<DataStoreVO> findPoolsByDetails(long dcId, long podId, Long clusterId, Map<String, String> details) {
-	    StringBuilder sql = new StringBuilder(DetailsSqlPrefix);
-	    if (clusterId != null) {
-	        sql.append("storage_pool.cluster_id = ? OR storage_pool.cluster_id IS NULL) AND (");
-	    }
-	    for (Map.Entry<String, String> detail : details.entrySet()) {
-	        sql.append("((storage_pool_details.name='").append(detail.getKey()).append("') AND (storage_pool_details.value='").append(detail.getValue()).append("')) OR ");
-	    }
-	    sql.delete(sql.length() - 4, sql.length());
-	    sql.append(DetailsSqlSuffix);
-	    Transaction txn = Transaction.currentTxn();
-	    PreparedStatement pstmt = null;
-	    try {
-	        pstmt = txn.prepareAutoCloseStatement(sql.toString());
-	        int i = 1;
-	        pstmt.setLong(i++, dcId);
-	        pstmt.setLong(i++, podId);
-	        if (clusterId != null) {
-	            pstmt.setLong(i++, clusterId);
-	        }
-	        pstmt.setInt(i++, details.size());
-	        ResultSet rs = pstmt.executeQuery();
-	        List<DataStoreVO> pools = new ArrayList<DataStoreVO>();
-	        while (rs.next()) {
-	            pools.add(toEntityBean(rs, false));
-	        }
-	        return pools;
-	    } catch (SQLException e) {
-	        throw new CloudRuntimeException("Unable to execute " + pstmt, e);
-	    }
-	}
-	
-	protected Map<String, String> tagsToDetails(String[] tags) {
-	    Map<String, String> details = new HashMap<String, String>(tags.length);
-	    for (String tag: tags) {
-	        details.put(tag, "true");
-	    }
-	    return details;
-	}
-	
-	@Override
-	public List<DataStoreVO> findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared) {
-		List<DataStoreVO> storagePools = null;
-	    if (tags == null || tags.length == 0) {
-	        storagePools = listBy(dcId, podId, clusterId);
-	    } else {
-	        Map<String, String> details = tagsToDetails(tags);
-	        storagePools =  findPoolsByDetails(dcId, podId, clusterId, details);
-	    }
-	    
-	    if (shared == null) {
-	    	return storagePools;
-	    } else {
-	    	List<DataStoreVO> filteredStoragePools = new ArrayList<DataStoreVO>(storagePools);
-	    	for (DataStoreVO pool : storagePools) {
-	    		/*
-	    		if (shared != pool.isShared()) {
-	    			filteredStoragePools.remove(pool);
-	    		}*/
-	    	}
-	    	
-	    	return filteredStoragePools;
-	    }
-	}
-	
-	@Override
-	@DB
-	public List<String> searchForStoragePoolDetails(long poolId, String value){
-		
-	    StringBuilder sql = new StringBuilder(FindPoolTagDetails);
-
-	    Transaction txn = Transaction.currentTxn();
-		PreparedStatement pstmt = null;
-	    try {
-	        pstmt = txn.prepareAutoCloseStatement(sql.toString());
-	        pstmt.setLong(1, poolId);
-	        pstmt.setString(2, value);
-
-	        ResultSet rs = pstmt.executeQuery();
-	        List<String> tags = new ArrayList<String>();
-
-	        while (rs.next()) {
-	            tags.add(rs.getString("name"));
-	        }
-	        return tags;
-	    } catch (SQLException e) {
-	        throw new CloudRuntimeException("Unable to execute " + pstmt.toString(), e);
-	    }
-
-	}
-	
-	@Override
-	public void updateDetails(long poolId, Map<String, String> details) {
-	    if (details != null) {
-	        _detailsDao.update(poolId, details);
-	    }
+        return details;
     }
-	
-	@Override
-	public Map<String, String> getDetails(long poolId) {
-		return _detailsDao.getDetails(poolId);
-	}
-    
-	@Override
+
+    @Override
+    public List<DataStoreVO> findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared) {
+        List<DataStoreVO> storagePools = null;
+        if (tags == null || tags.length == 0) {
+            storagePools = listBy(dcId, podId, clusterId);
+        } else {
+            Map<String, String> details = tagsToDetails(tags);
+            storagePools = findPoolsByDetails(dcId, podId, clusterId, details);
+        }
+
+        if (shared == null) {
+            return storagePools;
+        } else {
+            List<DataStoreVO> filteredStoragePools = new ArrayList<DataStoreVO>(storagePools);
+            for (DataStoreVO pool : storagePools) {
+                /*
+                 * if (shared != pool.isShared()) {
+                 * filteredStoragePools.remove(pool); }
+                 */
+            }
+
+            return filteredStoragePools;
+        }
+    }
+
+    @Override
+    @DB
+    public List<String> searchForStoragePoolDetails(long poolId, String value) {
+
+        StringBuilder sql = new StringBuilder(FindPoolTagDetails);
+
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql.toString());
+            pstmt.setLong(1, poolId);
+            pstmt.setString(2, value);
+
+            ResultSet rs = pstmt.executeQuery();
+            List<String> tags = new ArrayList<String>();
+
+            while (rs.next()) {
+                tags.add(rs.getString("name"));
+            }
+            return tags;
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Unable to execute " + pstmt.toString(), e);
+        }
+
+    }
+
+    @Override
+    public void updateDetails(long poolId, Map<String, String> details) {
+        if (details != null) {
+            _detailsDao.update(poolId, details);
+        }
+    }
+
+    @Override
+    public Map<String, String> getDetails(long poolId) {
+        return _detailsDao.getDetails(poolId);
+    }
+
+    @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-	    super.configure(name, params);
-	    _detailsDao.configure("DetailsDao", params);
-	    return true;
-	}
-	
-    
-    
+        super.configure(name, params);
+        _detailsDao.configure("DetailsDao", params);
+        return true;
+    }
+
     @Override
-    public long countPoolsByStatus( DataStoreStatus... statuses) {
+    public long countPoolsByStatus(DataStoreStatus... statuses) {
         SearchCriteria<Long> sc = StatusCountSearch.create();
-        
-        sc.setParameters("status", (Object[])statuses);
-        
+
+        sc.setParameters("status", (Object[]) statuses);
+
         List<Long> rs = customSearchIncludingRemoved(sc, null);
         if (rs.size() == 0) {
             return 0;
         }
-        
+
         return rs.get(0);
     }
-    
+
     @Override
     public List<DataStoreVO> listPoolsByCluster(long clusterId) {
         SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
         sc.setParameters("clusterId", clusterId);
-        
+
         return listBy(sc);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java
new file mode 100644
index 0000000..d1f802d
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java
@@ -0,0 +1,79 @@
+// 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.db;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="storage_pool_details")
+public class PrimaryDataStoreDetailVO {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+    
+    @Column(name="pool_id")
+    long poolId;
+    
+    @Column(name="name")
+    String name;
+    
+    @Column(name="value")
+    String value;
+    
+    public PrimaryDataStoreDetailVO(long poolId, String name, String value) {
+        this.poolId = poolId;
+        this.name = name;
+        this.value = value;
+    }
+   
+    public long getId() {
+        return id;
+    }
+
+    public long getPoolId() {
+        return poolId;
+    }
+
+    public void setPoolId(long poolId) {
+        this.poolId = poolId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    protected PrimaryDataStoreDetailVO() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java
new file mode 100644
index 0000000..906742b
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.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.storage.datastore.db;
+
+import java.util.Map;
+
+import com.cloud.storage.StoragePoolDetailVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface PrimaryDataStoreDetailsDao extends GenericDao<PrimaryDataStoreDetailVO, Long> {
+    
+    void update(long poolId, Map<String, String> details);
+    Map<String, String> getDetails(long poolId);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java
new file mode 100644
index 0000000..59c488c
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java
@@ -0,0 +1,71 @@
+// 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.db;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+public class PrimaryDataStoreDetailsDaoImpl extends GenericDaoBase<PrimaryDataStoreDetailVO, Long> implements PrimaryDataStoreDetailsDao {
+    
+    protected final SearchBuilder<PrimaryDataStoreDetailVO> PoolSearch = null;
+    
+    protected PrimaryDataStoreDetailsDaoImpl() {
+        /*
+        super();
+        PoolSearch = createSearchBuilder();
+        PoolSearch.and("pool", PoolSearch.entity().getPoolId(), SearchCriteria.Op.EQ);
+        PoolSearch.done();
+        */
+    }
+    
+    @Override
+    public void update(long poolId, Map<String, String> details) {
+        Transaction txn = Transaction.currentTxn();
+        SearchCriteria<PrimaryDataStoreDetailVO> sc = PoolSearch.create();
+        sc.setParameters("pool", poolId);
+        
+        txn.start();
+        expunge(sc);
+        for (Map.Entry<String, String> entry : details.entrySet()) {
+            PrimaryDataStoreDetailVO detail = new PrimaryDataStoreDetailVO(poolId, entry.getKey(), entry.getValue());
+            persist(detail);
+        }
+        txn.commit();
+    }
+    
+    @Override
+    public Map<String, String> getDetails(long poolId) {
+    	SearchCriteria<PrimaryDataStoreDetailVO> sc = PoolSearch.create();
+    	sc.setParameters("pool", poolId);
+    	
+    	List<PrimaryDataStoreDetailVO> details = listBy(sc);
+    	Map<String, String> detailsMap = new HashMap<String, String>();
+    	for (PrimaryDataStoreDetailVO detail : details) {
+    		detailsMap.put(detail.getName(), detail.getValue());
+    	}
+    	
+    	return detailsMap;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java
index cebcacf..2fb556e 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java
@@ -21,5 +21,5 @@ package org.apache.cloudstack.storage.datastore.db;
 import com.cloud.utils.db.GenericDao;
 
 public interface PrimaryDataStoreProviderDao extends GenericDao<PrimaryDataStoreProviderVO, Long> {
-	
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java
index bd0571d..c65ca4c 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java
@@ -24,5 +24,5 @@ import com.cloud.utils.db.GenericDaoBase;
 
 @Component
 class PrimaryDataStoreProviderDaoImpl extends GenericDaoBase<PrimaryDataStoreProviderVO, Long> implements PrimaryDataStoreProviderDao {
-	
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java
index 0d15580..4047819 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java
@@ -25,14 +25,14 @@ import javax.persistence.Table;
 import javax.persistence.TableGenerator;
 
 @Entity
-@Table(name="data_store_provider")
+@Table(name = "data_store_provider")
 public class PrimaryDataStoreProviderVO {
     @Id
-    @TableGenerator(name="data_store_provider_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="data_store_provider_seq", allocationSize=1)
-    @Column(name="id", updatable=false, nullable = false)
-	private long id;
-    
+    @TableGenerator(name = "data_store_provider_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "data_store_provider_seq", allocationSize = 1)
+    @Column(name = "id", updatable = false, nullable = false)
+    private long id;
+
     public long getId() {
-    	return id;
+        return id;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java
index 630b3a7..7a1e335 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java
@@ -20,92 +20,93 @@ import com.cloud.agent.api.Command;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 @Component
-public class DefaultPrimaryDataStoreDriverImpl implements
-		PrimaryDataStoreDriver {
-	private static final Logger s_logger = Logger.getLogger(DefaultPrimaryDataStoreDriverImpl.class);
-	@Override
-	public boolean createVolume(VolumeObject vol) {
-		//The default driver will send createvolume command to one of hosts which can access its datastore
-		List<EndPoint> endPoints = vol.getDataStore().getEndPoints();
-		int retries = 3;
-		VolumeInfo volInfo = vol;
-		CreateVolumeCommand createCmd = new CreateVolumeCommand(new VolumeTO(volInfo));
-		Answer answer = null;
-		int i = 0;
-		boolean result = false;
-		
-		for (EndPoint ep : endPoints) {
-			answer = ep.sendMessage(createCmd);
-			if (answer == null) {
-				if (i < retries) {
-					s_logger.debug("create volume failed, retrying: " + i);
-				}
-				i++;
-			} else {
-				CreateVolumeAnswer volAnswer = (CreateVolumeAnswer)answer;
-				vol.setPath(volAnswer.getVolumeUuid());
-				result = true;
-			}
-		}
-		
-		return result;
-	}
+public class DefaultPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver {
+    private static final Logger s_logger = Logger.getLogger(DefaultPrimaryDataStoreDriverImpl.class);
 
-	@Override
-	public boolean deleteVolume(VolumeObject vo) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    @Override
+    public boolean createVolume(VolumeObject vol) {
+        // The default driver will send createvolume command to one of hosts
+        // which can access its datastore
+        List<EndPoint> endPoints = vol.getDataStore().getEndPoints();
+        int retries = 3;
+        VolumeInfo volInfo = vol;
+        CreateVolumeCommand createCmd = new CreateVolumeCommand(new VolumeTO(volInfo));
+        Answer answer = null;
+        int i = 0;
+        boolean result = false;
 
-	@Override
-	public String grantAccess(VolumeObject vol, EndPoint ep) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+        for (EndPoint ep : endPoints) {
+            answer = ep.sendMessage(createCmd);
+            if (answer == null) {
+                if (i < retries) {
+                    s_logger.debug("create volume failed, retrying: " + i);
+                }
+                i++;
+            } else {
+                CreateVolumeAnswer volAnswer = (CreateVolumeAnswer) answer;
+                vol.setPath(volAnswer.getVolumeUuid());
+                result = true;
+            }
+        }
 
-	@Override
-	public boolean revokeAccess(VolumeObject vol, EndPoint ep) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-	
-	protected Answer sendOutCommand(Command cmd, List<EndPoint> endPoints) {
-		Answer answer = null;
-		int retries = 3;
-		int i = 0;
-		for (EndPoint ep : endPoints) {
-			answer = ep.sendMessage(cmd);
-			if (answer == null || answer.getDetails() != null) {
-				if (i < retries) {
-					s_logger.debug("create volume failed, retrying: " + i);
-				}
-				i++;
-			} else {
-				break;
-			}
-		}
-		return answer;
-	}
+        return result;
+    }
 
-	@Override
-	public boolean createVolumeFromBaseImage(VolumeObject volume, TemplateOnPrimaryDataStoreInfo template) {
-		VolumeTO vol = new VolumeTO(volume);
-		ImageOnPrimayDataStoreTO image = new ImageOnPrimayDataStoreTO(template);
-		CreateVolumeFromBaseImageCommand cmd = new CreateVolumeFromBaseImageCommand(vol, image);
-		List<EndPoint> endPoints = volume.getDataStore().getEndPoints();
-		
-		Answer answer = sendOutCommand(cmd, endPoints);
-		
-		if (answer == null || answer.getDetails() != null) {
-			if (answer == null) {
-				throw new CloudRuntimeException("Failed to created volume");
-			} else {
-				throw new CloudRuntimeException(answer.getDetails());
-			}
-		} else {
-			CreateVolumeAnswer volAnswer = (CreateVolumeAnswer)answer;
-			volume.setPath(volAnswer.getVolumeUuid());
-			return true;
-		}
-	}
+    @Override
+    public boolean deleteVolume(VolumeObject vo) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public String grantAccess(VolumeObject vol, EndPoint ep) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean revokeAccess(VolumeObject vol, EndPoint ep) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    protected Answer sendOutCommand(Command cmd, List<EndPoint> endPoints) {
+        Answer answer = null;
+        int retries = 3;
+        int i = 0;
+        for (EndPoint ep : endPoints) {
+            answer = ep.sendMessage(cmd);
+            if (answer == null || answer.getDetails() != null) {
+                if (i < retries) {
+                    s_logger.debug("create volume failed, retrying: " + i);
+                }
+                i++;
+            } else {
+                break;
+            }
+        }
+        return answer;
+    }
+
+    @Override
+    public boolean createVolumeFromBaseImage(VolumeObject volume, TemplateOnPrimaryDataStoreInfo template) {
+        VolumeTO vol = new VolumeTO(volume);
+        ImageOnPrimayDataStoreTO image = new ImageOnPrimayDataStoreTO(template);
+        CreateVolumeFromBaseImageCommand cmd = new CreateVolumeFromBaseImageCommand(vol, image);
+        List<EndPoint> endPoints = volume.getDataStore().getEndPoints();
+
+        Answer answer = sendOutCommand(cmd, endPoints);
+
+        if (answer == null || answer.getDetails() != null) {
+            if (answer == null) {
+                throw new CloudRuntimeException("Failed to created volume");
+            } else {
+                throw new CloudRuntimeException(answer.getDetails());
+            }
+        } else {
+            CreateVolumeAnswer volAnswer = (CreateVolumeAnswer) answer;
+            volume.setPath(volAnswer.getVolumeUuid());
+            return true;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java
index 30f6c54..e3ff0b7 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java
@@ -4,11 +4,14 @@ import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
 import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
 import org.apache.cloudstack.storage.volume.VolumeObject;
 
-
 public interface PrimaryDataStoreDriver {
-	boolean createVolume(VolumeObject vol);
-	boolean createVolumeFromBaseImage(VolumeObject volume, TemplateOnPrimaryDataStoreInfo template);
-	boolean deleteVolume(VolumeObject vo);
-	String grantAccess(VolumeObject vol,  EndPoint ep);
-	boolean revokeAccess(VolumeObject vol, EndPoint ep);
+    boolean createVolume(VolumeObject vol);
+
+    boolean createVolumeFromBaseImage(VolumeObject volume, TemplateOnPrimaryDataStoreInfo template);
+
+    boolean deleteVolume(VolumeObject vo);
+
+    String grantAccess(VolumeObject vol, EndPoint ep);
+
+    boolean revokeAccess(VolumeObject vol, EndPoint ep);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/DefaultPrimaryDataStoreLifeCycleImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/DefaultPrimaryDataStoreLifeCycleImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/DefaultPrimaryDataStoreLifeCycleImpl.java
index fe4562c..a50ebdc 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/DefaultPrimaryDataStoreLifeCycleImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/DefaultPrimaryDataStoreLifeCycleImpl.java
@@ -25,46 +25,46 @@ import org.springframework.stereotype.Component;
 @Component
 public class DefaultPrimaryDataStoreLifeCycleImpl implements PrimaryDataStoreLifeCycle {
 
-	@Override
-	public boolean registerDataStore(Map<String, String> dsInfos) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    @Override
+    public boolean registerDataStore(Map<String, String> dsInfos) {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
-	@Override
-	public boolean attach(long scope) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    @Override
+    public boolean attach(long scope) {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
-	@Override
-	public boolean dettach(long dataStoreId) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    @Override
+    public boolean dettach(long dataStoreId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
-	@Override
-	public boolean unmanaged(long dataStoreId) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    @Override
+    public boolean unmanaged(long dataStoreId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
-	@Override
-	public boolean maintain(long dataStoreId) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    @Override
+    public boolean maintain(long dataStoreId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
-	@Override
-	public boolean cancelMaintain(long dataStoreId) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    @Override
+    public boolean cancelMaintain(long dataStoreId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
-	@Override
-	public boolean deleteDataStore(long dataStoreId) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    @Override
+    public boolean deleteDataStore(long dataStoreId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/PrimaryDataStoreLifeCycle.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/PrimaryDataStoreLifeCycle.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/PrimaryDataStoreLifeCycle.java
index 2e41a62..99bb995 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/PrimaryDataStoreLifeCycle.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/PrimaryDataStoreLifeCycle.java
@@ -21,11 +21,17 @@ package org.apache.cloudstack.storage.datastore.lifecycle;
 import java.util.Map;
 
 public interface PrimaryDataStoreLifeCycle {
-	public boolean registerDataStore(Map<String, String> dsInfos);
-	public boolean attach(long scope);
-	public boolean dettach(long dataStoreId);
-	public boolean unmanaged(long dataStoreId);
-	public boolean maintain(long dataStoreId);
-	public boolean cancelMaintain(long dataStoreId);
-	public boolean deleteDataStore(long dataStoreId);
+    public boolean registerDataStore(Map<String, String> dsInfos);
+
+    public boolean attach(long scope);
+
+    public boolean dettach(long dataStoreId);
+
+    public boolean unmanaged(long dataStoreId);
+
+    public boolean maintain(long dataStoreId);
+
+    public boolean cancelMaintain(long dataStoreId);
+
+    public boolean deleteDataStore(long dataStoreId);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/manager/DefaultPrimaryDataStoreManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/manager/DefaultPrimaryDataStoreManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/manager/DefaultPrimaryDataStoreManagerImpl.java
index 4949b2f..e55b126 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/manager/DefaultPrimaryDataStoreManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/manager/DefaultPrimaryDataStoreManagerImpl.java
@@ -31,25 +31,26 @@ import org.springframework.stereotype.Component;
 
 @Component
 public class DefaultPrimaryDataStoreManagerImpl implements PrimaryDataStoreManager {
-	@Inject
-	PrimaryDataStoreProviderDao dataStoreProviderDao;
-	@Inject
-	PrimaryDataStoreProviderManager providerManager;
-	@Inject
-	PrimaryDataStoreDao dataStoreDao;
-	@Override
-	public PrimaryDataStore getPrimaryDataStore(long dataStoreId) {
-		DataStoreVO dataStoreVO = dataStoreDao.findById(dataStoreId);
-		Long providerId = dataStoreVO.getStorageProviderId();
-		PrimaryDataStoreProvider provider = providerManager.getDataStoreProvider(providerId);
-		PrimaryDataStore dataStore = provider.getDataStore(dataStoreId);
-		return dataStore;
-	}
+    @Inject
+    PrimaryDataStoreProviderDao dataStoreProviderDao;
+    @Inject
+    PrimaryDataStoreProviderManager providerManager;
+    @Inject
+    PrimaryDataStoreDao dataStoreDao;
 
-	@Override
-	public PrimaryDataStoreLifeCycle getPrimaryDataStoreLifeCycle(long dataStoreId) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    @Override
+    public PrimaryDataStore getPrimaryDataStore(long dataStoreId) {
+        DataStoreVO dataStoreVO = dataStoreDao.findById(dataStoreId);
+        Long providerId = dataStoreVO.getStorageProviderId();
+        PrimaryDataStoreProvider provider = providerManager.getDataStoreProvider(providerId);
+        PrimaryDataStore dataStore = provider.getDataStore(dataStoreId);
+        return dataStore;
+    }
+
+    @Override
+    public PrimaryDataStoreLifeCycle getPrimaryDataStoreLifeCycle(long dataStoreId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreManager.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreManager.java
index b6ac34d..7dd0276 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreManager.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreManager.java
@@ -22,6 +22,7 @@ import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
 import org.apache.cloudstack.storage.datastore.lifecycle.PrimaryDataStoreLifeCycle;
 
 public interface PrimaryDataStoreManager {
-	public PrimaryDataStore getPrimaryDataStore(long dataStoreId);
-	public PrimaryDataStoreLifeCycle getPrimaryDataStoreLifeCycle(long dataStoreId);
+    public PrimaryDataStore getPrimaryDataStore(long dataStoreId);
+
+    public PrimaryDataStoreLifeCycle getPrimaryDataStoreLifeCycle(long dataStoreId);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
index 0d46c13..6126a8a 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
@@ -14,31 +14,31 @@ import org.springframework.stereotype.Component;
 import com.cloud.utils.component.ComponentInject;
 
 @Component
-public class DefaultPrimaryDatastoreProviderImpl implements
-		PrimaryDataStoreProvider {
-	protected PrimaryDataStoreDriver driver;
-	@Inject
-	public PrimaryDataStoreDao dataStoreDao;
-
-	public DefaultPrimaryDatastoreProviderImpl() {
-		this.driver = new DefaultPrimaryDataStoreDriverImpl();
-	}
-	@Override
-	public PrimaryDataStore getDataStore(long dataStoreId) {
-		DataStoreVO dsv = dataStoreDao.findById(dataStoreId);
-		if (dsv == null) {
-			return null;
-		}
-		
-		PrimaryDataStore pds = new DefaultPrimaryDataStoreImpl(driver, dsv, null);
-		pds = ComponentInject.inject(pds);
-		return pds;
-	}
-	
-	@Override
-	public PrimaryDataStoreInfo getDataStoreInfo(long dataStoreId) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-	
+public class DefaultPrimaryDatastoreProviderImpl implements PrimaryDataStoreProvider {
+    protected PrimaryDataStoreDriver driver;
+    @Inject
+    public PrimaryDataStoreDao dataStoreDao;
+
+    public DefaultPrimaryDatastoreProviderImpl() {
+        this.driver = new DefaultPrimaryDataStoreDriverImpl();
+    }
+
+    @Override
+    public PrimaryDataStore getDataStore(long dataStoreId) {
+        DataStoreVO dsv = dataStoreDao.findById(dataStoreId);
+        if (dsv == null) {
+            return null;
+        }
+
+        PrimaryDataStore pds = new DefaultPrimaryDataStoreImpl(driver, dsv, null);
+        pds = ComponentInject.inject(pds);
+        return pds;
+    }
+
+    @Override
+    public PrimaryDataStoreInfo getDataStoreInfo(long dataStoreId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProvider.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProvider.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProvider.java
index 7b07637..dcc8093 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProvider.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProvider.java
@@ -3,9 +3,8 @@ package org.apache.cloudstack.storage.datastore.provider;
 import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
 import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
 
-
-
 public interface PrimaryDataStoreProvider {
-	public PrimaryDataStore getDataStore(long dataStoreId);
-	public PrimaryDataStoreInfo getDataStoreInfo(long dataStoreId);
+    public PrimaryDataStore getDataStore(long dataStoreId);
+
+    public PrimaryDataStoreInfo getDataStoreInfo(long dataStoreId);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManager.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManager.java
index 28f9250..85a132f 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManager.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManager.java
@@ -1,6 +1,5 @@
 package org.apache.cloudstack.storage.datastore.provider;
 
-
 public interface PrimaryDataStoreProviderManager {
-	public PrimaryDataStoreProvider getDataStoreProvider(Long providerId);
+    public PrimaryDataStoreProvider getDataStoreProvider(Long providerId);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManagerImpl.java
index 0875553..809a7e5 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManagerImpl.java
@@ -23,10 +23,10 @@ import org.springframework.stereotype.Component;
 @Component
 public class PrimaryDataStoreProviderManagerImpl implements PrimaryDataStoreProviderManager {
 
-	@Override
-	public PrimaryDataStoreProvider getDataStoreProvider(Long providerId) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    @Override
+    public PrimaryDataStoreProvider getDataStoreProvider(Long providerId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/type/ISCSI.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/type/ISCSI.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/type/ISCSI.java
index 26d36de..9b80bcc 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/type/ISCSI.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/type/ISCSI.java
@@ -23,9 +23,10 @@ import org.springframework.stereotype.Component;
 
 @Component
 public class ISCSI extends BaseType implements DataStoreType {
-	private final String type = "iscsi";
-	@Override
-	public String toString() {
-		return type;
-	}
+    private final String type = "iscsi";
+
+    @Override
+    public String toString() {
+        return type;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/type/NetworkFileSystem.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/type/NetworkFileSystem.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/type/NetworkFileSystem.java
index 9340975..f880154 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/type/NetworkFileSystem.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/type/NetworkFileSystem.java
@@ -23,9 +23,10 @@ import org.springframework.stereotype.Component;
 
 @Component
 public class NetworkFileSystem extends BaseType implements DataStoreType {
-	private final String type = "nfs";
-	@Override
-	public String toString() {
-		return type;
-	}
+    private final String type = "nfs";
+
+    @Override
+    public String toString() {
+        return type;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/datastore/type/SharedMount.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/type/SharedMount.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/type/SharedMount.java
index c97a893..addf901 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/type/SharedMount.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/type/SharedMount.java
@@ -21,9 +21,10 @@ package org.apache.cloudstack.storage.datastore.type;
 import org.apache.cloudstack.storage.BaseType;
 
 public class SharedMount extends BaseType implements DataStoreType {
-	private final String type = "SharedMountPoint";
-	@Override
-	public String toString() {
-		return type;
-	}
+    private final String type = "SharedMountPoint";
+
+    @Override
+    public String toString() {
+        return type;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/driver/AbstractStorageDriver.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/driver/AbstractStorageDriver.java b/engine/storage/src/org/apache/cloudstack/storage/driver/AbstractStorageDriver.java
index 933a322..8b78378 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/driver/AbstractStorageDriver.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/driver/AbstractStorageDriver.java
@@ -31,46 +31,43 @@ import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
 import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
 
 public abstract class AbstractStorageDriver implements DataStoreDriver {
-	protected DataStore _ds;
-	protected TemplateStrategy _ts;
-	
-	public AbstractStorageDriver(DataStore ds) {
-		_ds = ds;
-		_ts = ds.getTemplateStrategy();
-	}
-	
-	public TemplateProfile install(TemplateProfile tp, DataStoreEndPoint ep) {
-		PrimaryStorageDownloadCommand dcmd = new PrimaryStorageDownloadCommand(tp.getName(), tp.getUrl(), tp.getFormat(), 
-				0, _ds.getId(), _ds.getUUID(), _ts.getDownloadWait());
-		dcmd.setSecondaryStorageUrl(tp.getImageStorageUri());
-		dcmd.setPrimaryStorageUrl(_ds.getURI());
-		PrimaryStorageDownloadAnswer asw = (PrimaryStorageDownloadAnswer)ep.sendCommand(dcmd);
+    protected DataStore _ds;
+    protected TemplateStrategy _ts;
 
-		tp.setLocalPath(asw.getInstallPath());
-		return tp;
-	}
-	
-	public TemplateProfile register(TemplateProfile tp, DataStoreEndPoint ep, boolean freshDownload) {
-		
-		DownloadCommand dcmd =
-				new DownloadCommand(_ds.getURI(), tp.getTemplate(), _ts.getMaxTemplateSizeInBytes());
-		dcmd.setProxy(_ts.getHttpProxy());
-		if (!freshDownload) {
-			dcmd = new DownloadProgressCommand(dcmd, tp.getJobId(), RequestType.GET_OR_RESTART);
-		}
-		
-		ep.sendCommand(dcmd);
-		return tp;
-	}
-	/*
-	public VolumeProfile createVolumeFromTemplate(VolumeProfile volProfile, TemplateProfile tp, DataStoreEndPoint ep) {
-		CreateCommand cmd = new CreateCommand(volProfile, tp.getLocalPath(), _ds.getTO());
-		CreateAnswer ans = (CreateAnswer)ep.sendCommand(cmd);
-		VolumeTO created = ans.getVolume();
-		DiskProfile diskProfile = new VolumeProfile(volProfile);
-		diskProfile.setPath(created.getPath());
-		diskProfile.setSize(created.getSize());
-		return diskProfile;
-		return null;
-	}*/
+    public AbstractStorageDriver(DataStore ds) {
+        _ds = ds;
+        _ts = ds.getTemplateStrategy();
+    }
+
+    public TemplateProfile install(TemplateProfile tp, DataStoreEndPoint ep) {
+        PrimaryStorageDownloadCommand dcmd = new PrimaryStorageDownloadCommand(tp.getName(), tp.getUrl(), tp.getFormat(), 0, _ds.getId(), _ds.getUUID(), _ts.getDownloadWait());
+        dcmd.setSecondaryStorageUrl(tp.getImageStorageUri());
+        dcmd.setPrimaryStorageUrl(_ds.getURI());
+        PrimaryStorageDownloadAnswer asw = (PrimaryStorageDownloadAnswer) ep.sendCommand(dcmd);
+
+        tp.setLocalPath(asw.getInstallPath());
+        return tp;
+    }
+
+    public TemplateProfile register(TemplateProfile tp, DataStoreEndPoint ep, boolean freshDownload) {
+
+        DownloadCommand dcmd = new DownloadCommand(_ds.getURI(), tp.getTemplate(), _ts.getMaxTemplateSizeInBytes());
+        dcmd.setProxy(_ts.getHttpProxy());
+        if (!freshDownload) {
+            dcmd = new DownloadProgressCommand(dcmd, tp.getJobId(), RequestType.GET_OR_RESTART);
+        }
+
+        ep.sendCommand(dcmd);
+        return tp;
+    }
+    /*
+     * public VolumeProfile createVolumeFromTemplate(VolumeProfile volProfile,
+     * TemplateProfile tp, DataStoreEndPoint ep) { CreateCommand cmd = new
+     * CreateCommand(volProfile, tp.getLocalPath(), _ds.getTO()); CreateAnswer
+     * ans = (CreateAnswer)ep.sendCommand(cmd); VolumeTO created =
+     * ans.getVolume(); DiskProfile diskProfile = new VolumeProfile(volProfile);
+     * diskProfile.setPath(created.getPath());
+     * diskProfile.setSize(created.getSize()); return diskProfile; return null;
+     * }
+     */
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/driver/DefaultNfsSecondaryDriver.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/driver/DefaultNfsSecondaryDriver.java b/engine/storage/src/org/apache/cloudstack/storage/driver/DefaultNfsSecondaryDriver.java
index ec84514..df1e0b3 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/driver/DefaultNfsSecondaryDriver.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/driver/DefaultNfsSecondaryDriver.java
@@ -29,62 +29,62 @@ import com.cloud.storage.TemplateProfile;
 
 public class DefaultNfsSecondaryDriver extends AbstractStorageDriver {
 
-	/**
-	 * @param ds
-	 */
-	public DefaultNfsSecondaryDriver(DataStore ds) {
-		super(ds);
-		// TODO Auto-generated constructor stub
-	}
+    /**
+     * @param ds
+     */
+    public DefaultNfsSecondaryDriver(DataStore ds) {
+        super(ds);
+        // TODO Auto-generated constructor stub
+    }
 
-	public String getDriverType() {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public String getDriverType() {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-	public TemplateProfile register(TemplateProfile tp, DataStoreEndPoint ep) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public TemplateProfile register(TemplateProfile tp, DataStoreEndPoint ep) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-	public DataObject create(DataObject obj) {
-		// 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, 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 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 DataObject move(DataObject src, DataObject dest) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-	public Answer sendMessage(DataStoreEndPoint dsep, Command cmd) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public Answer sendMessage(DataStoreEndPoint dsep, Command cmd) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-	public boolean delete(DataObject obj) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    public boolean delete(DataObject obj) {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
-	public org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile register(org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint ep) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile register(org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint ep) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-	public VolumeProfile createVolumeFromTemplate(VolumeProfile vol, org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint dp) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public VolumeProfile createVolumeFromTemplate(VolumeProfile vol, org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint dp) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/driver/XenServerStorageDriver.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/driver/XenServerStorageDriver.java b/engine/storage/src/org/apache/cloudstack/storage/driver/XenServerStorageDriver.java
index b3de721..4b3bbe5 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/driver/XenServerStorageDriver.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/driver/XenServerStorageDriver.java
@@ -26,56 +26,56 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeProfile;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
 
-
 public class XenServerStorageDriver extends AbstractStorageDriver {
-	protected DataStore _ds;
-	public XenServerStorageDriver(DataStore ds) {
-		super(ds);
-		_ds = ds;
-	}
-	
-	public String getDriverType() {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    protected DataStore _ds;
+
+    public XenServerStorageDriver(DataStore ds) {
+        super(ds);
+        _ds = ds;
+    }
+
+    public String getDriverType() {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-	public DataObject create(DataObject obj) {
-		// 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, 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 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 DataObject move(DataObject src, DataObject dest) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-	public Answer sendMessage(DataStoreEndPoint dsep, Command cmd) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public Answer sendMessage(DataStoreEndPoint dsep, Command cmd) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-	public boolean delete(DataObject obj) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    public boolean delete(DataObject obj) {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
-	public org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile register(org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint ep) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile register(org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint ep) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-	public VolumeProfile createVolumeFromTemplate(VolumeProfile vol, org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint dp) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public VolumeProfile createVolumeFromTemplate(VolumeProfile vol, org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint dp) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/ImageManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/ImageManager.java b/engine/storage/src/org/apache/cloudstack/storage/image/ImageManager.java
index e029fe2..a5b4497 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/ImageManager.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/ImageManager.java
@@ -21,12 +21,12 @@ package org.apache.cloudstack.storage.image;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile;
 
-
 import com.cloud.api.commands.RegisterTemplateCmd;
 
-
 public interface ImageManager {
-	TemplateProfile AssociateTemplateStoragePool(TemplateProfile tp, DataStore ds);
-	TemplateProfile getProfile(long templateId);
-	TemplateProfile allocateTemplateInDB(RegisterTemplateCmd cmd);
+    TemplateProfile AssociateTemplateStoragePool(TemplateProfile tp, DataStore ds);
+
+    TemplateProfile getProfile(long templateId);
+
+    TemplateProfile allocateTemplateInDB(RegisterTemplateCmd cmd);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/ImageManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/ImageManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/ImageManagerImpl.java
index d183296..bcf42ce 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/ImageManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/ImageManagerImpl.java
@@ -41,127 +41,125 @@ import com.cloud.utils.component.Inject;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 public class ImageManagerImpl implements ImageManager {
-	private static final Logger s_logger = Logger.getLogger(ImageManagerImpl.class);
-	@Inject
-	VMTemplateDao _templateDao;
-	@Inject
-	VMTemplatePoolDao _templatePoolDao;
-	@Inject
-	DataCenterDao _dcDao;
-	
-	public boolean contains(VirtualMachineTemplate template, DataStore ds) {
-		long templateId = template.getId();
-		long poolId = ds.getId();
-		VMTemplateStoragePoolVO templateStoragePoolRef = null;
-		templateStoragePoolRef = _templatePoolDao.findByPoolTemplate(poolId, templateId);
-		return templateStoragePoolRef == null ? false : true;
-	}
-	
-	public TemplateProfile AssociateTemplateStoragePool(TemplateProfile tp, DataStore ds) {
-		long templateId = tp.getTemplateId();
-		long poolId = ds.getId();
-		VMTemplateStoragePoolVO templateStoragePoolRef = null;
-		long templateStoragePoolRefId;
-		
-		templateStoragePoolRef = _templatePoolDao.findByPoolTemplate(poolId, templateId);
-		if (templateStoragePoolRef != null) {
-			templateStoragePoolRef.setMarkedForGC(false);
-			_templatePoolDao.update(templateStoragePoolRef.getId(), templateStoragePoolRef);
-
-			if (templateStoragePoolRef.getDownloadState() == Status.DOWNLOADED) {
-				if (s_logger.isDebugEnabled()) {
-					s_logger.debug("Template " + templateId + " has already been downloaded to pool " + poolId);
-				}
-
-				tp.setLocalPath(templateStoragePoolRef.getInstallPath());
-				tp.setTemplatePoolRefId(templateStoragePoolRef.getId());
-				return tp;
-			}
-		}
-		
-		if (templateStoragePoolRef == null) {
-			templateStoragePoolRef = new VMTemplateStoragePoolVO(poolId, templateId);
-			try {
-				templateStoragePoolRef = _templatePoolDao.persist(templateStoragePoolRef);
-				templateStoragePoolRefId =  templateStoragePoolRef.getId();
-			} catch (Exception e) {
-				s_logger.debug("Assuming we're in a race condition: " + e.getMessage());
-				templateStoragePoolRef = _templatePoolDao.findByPoolTemplate(poolId, templateId);
-				if (templateStoragePoolRef == null) {
-					throw new CloudRuntimeException("Unable to persist a reference for pool " + poolId + " and template " + templateId);
-				}
-				templateStoragePoolRefId = templateStoragePoolRef.getId();
-			}
-		} else {
-			templateStoragePoolRefId = templateStoragePoolRef.getId();
-		}
-		tp.setTemplatePoolRefId(templateStoragePoolRefId);
-		return tp;
-	}
-
-	public TemplateProfile getProfile(long templateId) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-	
-	protected TemplateProfile persistTemplate(TemplateProfile profile) {
-		Long zoneId = profile.getZoneId();
-		VMTemplateVO template = new VMTemplateVO(profile.getTemplateId(), profile.getName(), profile.getFormat(), profile.getIsPublic(),
-				profile.getFeatured(), profile.getIsExtractable(), TemplateType.USER, profile.getUrl(), profile.getRequiresHVM(),
-				profile.getBits(), profile.getAccountId(), profile.getCheckSum(), profile.getDisplayText(),
-				profile.getPasswordEnabled(), profile.getGuestOsId(), profile.getBootable(), profile.getHypervisorType(), profile.getTemplateTag(), 
-				profile.getDetails(), profile.getSshKeyEnabled());
-        
-		if (zoneId == null || zoneId.longValue() == -1) {
+    private static final Logger s_logger = Logger.getLogger(ImageManagerImpl.class);
+    @Inject
+    VMTemplateDao _templateDao;
+    @Inject
+    VMTemplatePoolDao _templatePoolDao;
+    @Inject
+    DataCenterDao _dcDao;
+
+    public boolean contains(VirtualMachineTemplate template, DataStore ds) {
+        long templateId = template.getId();
+        long poolId = ds.getId();
+        VMTemplateStoragePoolVO templateStoragePoolRef = null;
+        templateStoragePoolRef = _templatePoolDao.findByPoolTemplate(poolId, templateId);
+        return templateStoragePoolRef == null ? false : true;
+    }
+
+    public TemplateProfile AssociateTemplateStoragePool(TemplateProfile tp, DataStore ds) {
+        long templateId = tp.getTemplateId();
+        long poolId = ds.getId();
+        VMTemplateStoragePoolVO templateStoragePoolRef = null;
+        long templateStoragePoolRefId;
+
+        templateStoragePoolRef = _templatePoolDao.findByPoolTemplate(poolId, templateId);
+        if (templateStoragePoolRef != null) {
+            templateStoragePoolRef.setMarkedForGC(false);
+            _templatePoolDao.update(templateStoragePoolRef.getId(), templateStoragePoolRef);
+
+            if (templateStoragePoolRef.getDownloadState() == Status.DOWNLOADED) {
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("Template " + templateId + " has already been downloaded to pool " + poolId);
+                }
+
+                tp.setLocalPath(templateStoragePoolRef.getInstallPath());
+                tp.setTemplatePoolRefId(templateStoragePoolRef.getId());
+                return tp;
+            }
+        }
+
+        if (templateStoragePoolRef == null) {
+            templateStoragePoolRef = new VMTemplateStoragePoolVO(poolId, templateId);
+            try {
+                templateStoragePoolRef = _templatePoolDao.persist(templateStoragePoolRef);
+                templateStoragePoolRefId = templateStoragePoolRef.getId();
+            } catch (Exception e) {
+                s_logger.debug("Assuming we're in a race condition: " + e.getMessage());
+                templateStoragePoolRef = _templatePoolDao.findByPoolTemplate(poolId, templateId);
+                if (templateStoragePoolRef == null) {
+                    throw new CloudRuntimeException("Unable to persist a reference for pool " + poolId + " and template " + templateId);
+                }
+                templateStoragePoolRefId = templateStoragePoolRef.getId();
+            }
+        } else {
+            templateStoragePoolRefId = templateStoragePoolRef.getId();
+        }
+        tp.setTemplatePoolRefId(templateStoragePoolRefId);
+        return tp;
+    }
+
+    public TemplateProfile getProfile(long templateId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    protected TemplateProfile persistTemplate(TemplateProfile profile) {
+        Long zoneId = profile.getZoneId();
+        VMTemplateVO template = new VMTemplateVO(profile.getTemplateId(), profile.getName(), profile.getFormat(), profile.getIsPublic(), profile.getFeatured(), profile.getIsExtractable(),
+                TemplateType.USER, profile.getUrl(), profile.getRequiresHVM(), profile.getBits(), profile.getAccountId(), profile.getCheckSum(), profile.getDisplayText(),
+                profile.getPasswordEnabled(), profile.getGuestOsId(), profile.getBootable(), profile.getHypervisorType(), profile.getTemplateTag(), profile.getDetails(), profile.getSshKeyEnabled());
+
+        if (zoneId == null || zoneId.longValue() == -1) {
             List<DataCenterVO> dcs = _dcDao.listAll();
-            
+
             if (dcs.isEmpty()) {
-            	throw new CloudRuntimeException("No zones are present in the system, can't add template");
+                throw new CloudRuntimeException("No zones are present in the system, can't add template");
             }
 
             template.setCrossZones(true);
-        	for (DataCenterVO dc: dcs) {
-    			_templateDao.addTemplateToZone(template, dc.getId());
-    		}
+            for (DataCenterVO dc : dcs) {
+                _templateDao.addTemplateToZone(template, dc.getId());
+            }
         } else {
-			_templateDao.addTemplateToZone(template, zoneId);
+            _templateDao.addTemplateToZone(template, zoneId);
+        }
+
+        return getProfile(template.getId());
+    }
+
+    protected boolean parameterCheck(RegisterTemplateCmd cmd) {
+        Long zoneId = cmd.getZoneId();
+        if (zoneId == -1) {
+            zoneId = null;
+        }
+
+        ImageFormat imgfmt = ImageFormat.valueOf(cmd.getFormat().toUpperCase());
+        if (imgfmt == null) {
+            throw new IllegalArgumentException("Image format is incorrect " + cmd.getFormat() + ". Supported formats are " + EnumUtils.listValues(ImageFormat.values()));
         }
 
-		return getProfile(template.getId());
-	}
-	
-	protected boolean parameterCheck(RegisterTemplateCmd cmd) {
-		Long zoneId = cmd.getZoneId();
-		if (zoneId == -1) {
-			zoneId = null;
-		}
-
-		ImageFormat imgfmt = ImageFormat.valueOf(cmd.getFormat().toUpperCase());
-		if (imgfmt == null) {
-			throw new IllegalArgumentException("Image format is incorrect " + cmd.getFormat() + ". Supported formats are " + EnumUtils.listValues(ImageFormat.values()));
-		}
-         
         // If a zoneId is specified, make sure it is valid
         if (zoneId != null) {
-        	DataCenterVO zone = _dcDao.findById(zoneId);
-        	if (zone == null) {
-        		throw new IllegalArgumentException("Please specify a valid zone.");
-        	}
+            DataCenterVO zone = _dcDao.findById(zoneId);
+            if (zone == null) {
+                throw new IllegalArgumentException("Please specify a valid zone.");
+            }
         }
-       
+
         List<VMTemplateVO> systemvmTmplts = _templateDao.listAllSystemVMTemplates();
         for (VMTemplateVO template : systemvmTmplts) {
             if (template.getName().equalsIgnoreCase(cmd.getTemplateName()) || template.getDisplayText().equalsIgnoreCase(cmd.getDisplayText())) {
                 throw new IllegalArgumentException("Cannot use reserved names for templates");
             }
         }
-        
+
         return true;
-	}
+    }
 
-	public TemplateProfile allocateTemplateInDB(RegisterTemplateCmd cmd) {
-		parameterCheck(cmd);
-		//TemplateProfile tp = new TemplateProfile(cmd);
-		return persistTemplate(null);
-	}
+    public TemplateProfile allocateTemplateInDB(RegisterTemplateCmd cmd) {
+        parameterCheck(cmd);
+        // TemplateProfile tp = new TemplateProfile(cmd);
+        return persistTemplate(null);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/ImageOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/ImageOrchestrator.java b/engine/storage/src/org/apache/cloudstack/storage/image/ImageOrchestrator.java
index f759d6b..e4141f3 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/ImageOrchestrator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/ImageOrchestrator.java
@@ -19,8 +19,11 @@
 package org.apache.cloudstack.storage.image;
 
 public interface ImageOrchestrator {
-	void registerTemplate(long templateId);
-	void registerSnapshot(long snapshotId);
-	void registerVolume(long volumeId);
-	void registerIso(long isoId);
+    void registerTemplate(long templateId);
+
+    void registerSnapshot(long snapshotId);
+
+    void registerVolume(long volumeId);
+
+    void registerIso(long isoId);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/ImageOrchestratorImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/ImageOrchestratorImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/ImageOrchestratorImpl.java
index 39564f3..8da27b5 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/ImageOrchestratorImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/ImageOrchestratorImpl.java
@@ -32,47 +32,47 @@ import com.cloud.storage.dao.VMTemplateZoneDao;
 import com.cloud.utils.component.Inject;
 
 public class ImageOrchestratorImpl implements ImageOrchestrator {
-	@Inject
-	SecondaryStorageManager _secStorageMgr;
-	@Inject
-	VMTemplateZoneDao _templateZoneDao;
-	public void registerTemplate(long templateId) {
-		List<VMTemplateZoneVO> tpZones = _templateZoneDao.listByTemplateId(templateId);
-		
-		for (VMTemplateZoneVO tpZone : tpZones) {
-			DataStore imageStore = null;
-			List<DataStore> imageStores = _secStorageMgr.getImageStores(tpZone.getZoneId());
-			for (DataStore imgStore : imageStores) {
-				TemplateStrategy ts = imgStore.getTemplateStrategy();
-				if (ts.canRegister(templateId)) {
-					imageStore = imgStore;
-					break;
-				}
-			}
-			
-			if (imageStore == null) {
-				continue;
-			}
-			
-			TemplateStrategy ts = imageStore.getTemplateStrategy();
-			ts.register(ts.get(templateId));
-		}
-	}
+    @Inject
+    SecondaryStorageManager _secStorageMgr;
+    @Inject
+    VMTemplateZoneDao _templateZoneDao;
 
-	public void registerSnapshot(long snapshotId) {
-		// TODO Auto-generated method stub
-		
-	}
+    public void registerTemplate(long templateId) {
+        List<VMTemplateZoneVO> tpZones = _templateZoneDao.listByTemplateId(templateId);
 
-	public void registerVolume(long volumeId) {
-		// TODO Auto-generated method stub
-		
-	}
+        for (VMTemplateZoneVO tpZone : tpZones) {
+            DataStore imageStore = null;
+            List<DataStore> imageStores = _secStorageMgr.getImageStores(tpZone.getZoneId());
+            for (DataStore imgStore : imageStores) {
+                TemplateStrategy ts = imgStore.getTemplateStrategy();
+                if (ts.canRegister(templateId)) {
+                    imageStore = imgStore;
+                    break;
+                }
+            }
 
-	public void registerIso(long isoId) {
-		// TODO Auto-generated method stub
-		
-	}
+            if (imageStore == null) {
+                continue;
+            }
 
+            TemplateStrategy ts = imageStore.getTemplateStrategy();
+            ts.register(ts.get(templateId));
+        }
+    }
+
+    public void registerSnapshot(long snapshotId) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void registerVolume(long volumeId) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void registerIso(long isoId) {
+        // TODO Auto-generated method stub
+
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/ImageService.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/ImageService.java b/engine/storage/src/org/apache/cloudstack/storage/image/ImageService.java
index 8863a6a..d657715 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/ImageService.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/ImageService.java
@@ -21,15 +21,22 @@ package org.apache.cloudstack.storage.image;
 import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity;
 import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
 
-
 public interface ImageService {
-	boolean registerTemplate(long templateId, long imageStoreId);
-	boolean deleteTemplate(long templateId);
-	long registerIso(String isoUrl, long accountId);
-	boolean deleteIso(long isoId);
-	TemplateInfo grantTemplateAccess(TemplateInfo template, EndPoint endpointId);
-	boolean revokeTemplateAccess(long templateId, long endpointId);
-	String grantIsoAccess(long isoId, long endpointId);
-	boolean revokeIsoAccess(long isoId, long endpointId);
-	TemplateEntity getTemplateEntity(long templateId);
+    TemplateEntity registerTemplate(long templateId, long imageStoreId);
+
+    boolean deleteTemplate(long templateId);
+
+    long registerIso(String isoUrl, long accountId);
+
+    boolean deleteIso(long isoId);
+
+    boolean grantTemplateAccess(TemplateInfo template, EndPoint endpointId);
+
+    boolean revokeTemplateAccess(long templateId, long endpointId);
+
+    String grantIsoAccess(long isoId, long endpointId);
+
+    boolean revokeIsoAccess(long isoId, long endpointId);
+
+    TemplateEntity getTemplateEntity(long templateId);
 }


Mime
View raw message