incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [5/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/strategy/DefaultTemplateStratey.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/strategy/DefaultTemplateStratey.java b/engine/storage/src/org/apache/cloudstack/storage/strategy/DefaultTemplateStratey.java
index 17ef4b9..8c2339f 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/strategy/DefaultTemplateStratey.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/strategy/DefaultTemplateStratey.java
@@ -47,11 +47,11 @@ import com.cloud.utils.component.Inject;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 public class DefaultTemplateStratey implements TemplateStrategy {
-	private static final Logger s_logger = Logger.getLogger(DefaultTemplateStratey.class);
-	protected DataStore _ds;
-	protected DataStoreDriver _driver;
-	protected int _primaryStorageDownloadWait;
-	protected int _installTries = 3;
+    private static final Logger s_logger = Logger.getLogger(DefaultTemplateStratey.class);
+    protected DataStore _ds;
+    protected DataStoreDriver _driver;
+    protected int _primaryStorageDownloadWait;
+    protected int _installTries = 3;
     protected int _storagePoolMaxWaitSeconds = 3600;
     @Inject
     VMTemplatePoolDao _templatePoolDao;
@@ -59,133 +59,133 @@ public class DefaultTemplateStratey implements TemplateStrategy {
     VMTemplateHostDao _templateImageStoreDao;
     @Inject
     ImageManager _templateMgr;
-    
+
     public DefaultTemplateStratey(DataStore ds) {
-    	_ds = ds;
+        _ds = ds;
     }
-    
+
     public TemplateProfile get(long templateId) {
-    	return _templateMgr.getProfile(templateId);
+        return _templateMgr.getProfile(templateId);
+    }
+
+    public TemplateProfile install(TemplateProfile tp) {
+        DataStoreEndPointSelector dseps = _ds.getEndPointSelector();
+        List<DataStoreEndPoint> eps = dseps.getEndPoints(StorageEvent.DownloadTemplateToPrimary);
+        int tries = Math.min(eps.size(), _installTries);
+
+        VMTemplateStoragePoolVO templateStoragePoolRef = _templatePoolDao.acquireInLockTable(tp.getTemplatePoolRefId(), _storagePoolMaxWaitSeconds);
+        if (templateStoragePoolRef == null) {
+            throw new CloudRuntimeException("Unable to acquire lock on VMTemplateStoragePool: " + tp.getTemplatePoolRefId());
+        }
+
+        try {
+            for (int retry = 0; retry < tries; retry++) {
+                Collections.shuffle(eps);
+                DataStoreEndPoint ep = eps.get(0);
+                try {
+                    tp = _driver.install(tp, ep);
+                    templateStoragePoolRef.setDownloadPercent(100);
+                    templateStoragePoolRef.setDownloadState(Status.DOWNLOADED);
+                    templateStoragePoolRef.setLocalDownloadPath(tp.getLocalPath());
+                    templateStoragePoolRef.setInstallPath(tp.getLocalPath());
+                    templateStoragePoolRef.setTemplateSize(tp.getSize());
+                    _templatePoolDao.update(templateStoragePoolRef.getId(), templateStoragePoolRef);
+                    if (s_logger.isDebugEnabled()) {
+                        s_logger.debug("Template " + tp.getTemplateId() + " is installed via " + ep.getHostId());
+                    }
+                    return get(tp.getTemplateId());
+                } catch (CloudRuntimeException e) {
+                    if (s_logger.isDebugEnabled()) {
+                        s_logger.debug("Template " + tp.getTemplateId() + " download to pool " + _ds.getId() + " failed due to " + e.toString());
+                    }
+                }
+            }
+        } finally {
+            _templatePoolDao.releaseFromLockTable(tp.getTemplatePoolRefId());
+        }
+
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Template " + tp.getTemplateId() + " is not found on and can not be downloaded to pool " + _ds.getId());
+        }
+        return null;
+    }
+
+    public TemplateProfile register(TemplateProfile tp) {
+
+        VMTemplateHostVO vmTemplateHost = _templateImageStoreDao.findByHostTemplate(_ds.getId(), tp.getTemplateId());
+        if (vmTemplateHost == null) {
+            vmTemplateHost = new VMTemplateHostVO(_ds.getId(), tp.getTemplateId(), new Date(), 0, VMTemplateStorageResourceAssoc.Status.NOT_DOWNLOADED, null, null, "jobid0000", null, tp.getUrl());
+            _templateImageStoreDao.persist(vmTemplateHost);
+        }
+
+        DataStoreEndPointSelector dseps = _ds.getEndPointSelector();
+        List<DataStoreEndPoint> eps = dseps.getEndPoints(StorageEvent.RegisterTemplate);
+
+        Collections.shuffle(eps);
+        DataStoreEndPoint ep = eps.get(0);
+        _driver.register(tp, ep);
+
+        return null;
+    }
+
+    protected boolean checkHypervisor(HypervisorType hypervisor) {
+        StorageProvider sp = _ds.getProvider();
+        List<HypervisorType> spHys = sp.supportedHypervisors();
+        boolean checkHypervisor = false;
+        for (HypervisorType hy : spHys) {
+            if (hy == hypervisor) {
+                checkHypervisor = true;
+            }
+        }
+        return checkHypervisor;
+    }
+
+    protected boolean checkFormat(String url, String format) {
+        if ((!url.toLowerCase().endsWith("vhd")) && (!url.toLowerCase().endsWith("vhd.zip")) && (!url.toLowerCase().endsWith("vhd.bz2")) && (!url.toLowerCase().endsWith("vhd.gz"))
+                && (!url.toLowerCase().endsWith("qcow2")) && (!url.toLowerCase().endsWith("qcow2.zip")) && (!url.toLowerCase().endsWith("qcow2.bz2")) && (!url.toLowerCase().endsWith("qcow2.gz"))
+                && (!url.toLowerCase().endsWith("ova")) && (!url.toLowerCase().endsWith("ova.zip")) && (!url.toLowerCase().endsWith("ova.bz2")) && (!url.toLowerCase().endsWith("ova.gz"))
+                && (!url.toLowerCase().endsWith("img")) && (!url.toLowerCase().endsWith("raw"))) {
+            throw new InvalidParameterValueException("Please specify a valid " + format.toLowerCase());
+        }
+
+        if ((format.equalsIgnoreCase("vhd") && (!url.toLowerCase().endsWith("vhd") && !url.toLowerCase().endsWith("vhd.zip") && !url.toLowerCase().endsWith("vhd.bz2") && !url.toLowerCase().endsWith(
+                "vhd.gz")))
+                || (format.equalsIgnoreCase("qcow2") && (!url.toLowerCase().endsWith("qcow2") && !url.toLowerCase().endsWith("qcow2.zip") && !url.toLowerCase().endsWith("qcow2.bz2") && !url
+                        .toLowerCase().endsWith("qcow2.gz")))
+                || (format.equalsIgnoreCase("ova") && (!url.toLowerCase().endsWith("ova") && !url.toLowerCase().endsWith("ova.zip") && !url.toLowerCase().endsWith("ova.bz2") && !url.toLowerCase()
+                        .endsWith("ova.gz"))) || (format.equalsIgnoreCase("raw") && (!url.toLowerCase().endsWith("img") && !url.toLowerCase().endsWith("raw")))) {
+            throw new InvalidParameterValueException("Please specify a valid URL. URL:" + url + " is an invalid for the format " + format.toLowerCase());
+        }
+        return true;
+    }
+
+    public boolean canRegister(long templateId) {
+        TemplateProfile tp = get(templateId);
+
+        if (!checkHypervisor(tp.getHypervisorType())) {
+            return false;
+        }
+
+        if (!checkFormat(tp.getUrl(), tp.getFormat().toString())) {
+            return false;
+        }
+
+        return true;
+    }
+
+    public int getDownloadWait() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public long getMaxTemplateSizeInBytes() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public Proxy getHttpProxy() {
+        // TODO Auto-generated method stub
+        return null;
     }
-    
-	public TemplateProfile install(TemplateProfile tp) {
-		DataStoreEndPointSelector dseps = _ds.getEndPointSelector();
-		List<DataStoreEndPoint> eps = dseps.getEndPoints(StorageEvent.DownloadTemplateToPrimary);
-		int tries = Math.min(eps.size(), _installTries);
-
-		VMTemplateStoragePoolVO templateStoragePoolRef = _templatePoolDao.acquireInLockTable(tp.getTemplatePoolRefId(), _storagePoolMaxWaitSeconds);
-		if (templateStoragePoolRef == null) {
-			throw new CloudRuntimeException("Unable to acquire lock on VMTemplateStoragePool: " + tp.getTemplatePoolRefId());
-		}
-
-		try {
-			for (int retry = 0; retry < tries; retry++) {
-				Collections.shuffle(eps);
-				DataStoreEndPoint ep = eps.get(0);
-				try {
-					tp = _driver.install(tp, ep);
-					templateStoragePoolRef.setDownloadPercent(100);
-					templateStoragePoolRef.setDownloadState(Status.DOWNLOADED);
-					templateStoragePoolRef.setLocalDownloadPath(tp.getLocalPath());
-					templateStoragePoolRef.setInstallPath(tp.getLocalPath());
-					templateStoragePoolRef.setTemplateSize(tp.getSize());
-					_templatePoolDao.update(templateStoragePoolRef.getId(), templateStoragePoolRef);
-					if (s_logger.isDebugEnabled()) {
-						s_logger.debug("Template " + tp.getTemplateId() + " is installed via " + ep.getHostId());
-					}
-					return get(tp.getTemplateId());
-				} catch (CloudRuntimeException e) {
-					if (s_logger.isDebugEnabled()) {
-						s_logger.debug("Template " + tp.getTemplateId() + " download to pool " + _ds.getId() + " failed due to " + e.toString());          
-					}
-				}
-			}
-		} finally {
-			_templatePoolDao.releaseFromLockTable(tp.getTemplatePoolRefId());
-		}
-
-		if (s_logger.isDebugEnabled()) {
-			s_logger.debug("Template " + tp.getTemplateId() + " is not found on and can not be downloaded to pool " + _ds.getId());
-		}
-		return null;
-	}
-
-	public TemplateProfile register(TemplateProfile tp) {
-		
-		VMTemplateHostVO vmTemplateHost = _templateImageStoreDao.findByHostTemplate(_ds.getId(), tp.getTemplateId());
-		if (vmTemplateHost == null) {
-			vmTemplateHost = new VMTemplateHostVO(_ds.getId(), tp.getTemplateId(), new Date(), 0, VMTemplateStorageResourceAssoc.Status.NOT_DOWNLOADED, null, null, "jobid0000", null, tp.getUrl());
-			_templateImageStoreDao.persist(vmTemplateHost);
-		}
-		
-		DataStoreEndPointSelector dseps = _ds.getEndPointSelector();
-		List<DataStoreEndPoint> eps = dseps.getEndPoints(StorageEvent.RegisterTemplate);
-		
-		Collections.shuffle(eps);
-		DataStoreEndPoint ep = eps.get(0);
-		_driver.register(tp, ep);
-
-		return null;
-	}
-	
-	protected boolean checkHypervisor(HypervisorType hypervisor) {
-		StorageProvider sp = _ds.getProvider();
-		List<HypervisorType> spHys = sp.supportedHypervisors();
-		boolean checkHypervisor = false;
-		for (HypervisorType hy : spHys) {
-			if (hy == hypervisor) {
-				checkHypervisor = true;
-			}
-		}
-		return checkHypervisor;
-	}
-	
-	protected boolean checkFormat(String url, String format) {
-		if ((!url.toLowerCase().endsWith("vhd")) && (!url.toLowerCase().endsWith("vhd.zip")) && (!url.toLowerCase().endsWith("vhd.bz2")) && (!url.toLowerCase().endsWith("vhd.gz"))
-				&& (!url.toLowerCase().endsWith("qcow2")) && (!url.toLowerCase().endsWith("qcow2.zip")) && (!url.toLowerCase().endsWith("qcow2.bz2")) && (!url.toLowerCase().endsWith("qcow2.gz"))
-				&& (!url.toLowerCase().endsWith("ova")) && (!url.toLowerCase().endsWith("ova.zip")) && (!url.toLowerCase().endsWith("ova.bz2")) && (!url.toLowerCase().endsWith("ova.gz"))
-				&& (!url.toLowerCase().endsWith("img")) && (!url.toLowerCase().endsWith("raw"))) {
-			throw new InvalidParameterValueException("Please specify a valid " + format.toLowerCase());
-		}
-
-		if ((format.equalsIgnoreCase("vhd") && (!url.toLowerCase().endsWith("vhd") && !url.toLowerCase().endsWith("vhd.zip") && !url.toLowerCase().endsWith("vhd.bz2") && !url.toLowerCase().endsWith(
-				"vhd.gz")))
-				|| (format.equalsIgnoreCase("qcow2") && (!url.toLowerCase().endsWith("qcow2") && !url.toLowerCase().endsWith("qcow2.zip") && !url.toLowerCase().endsWith("qcow2.bz2") && !url
-						.toLowerCase().endsWith("qcow2.gz")))
-				|| (format.equalsIgnoreCase("ova") && (!url.toLowerCase().endsWith("ova") && !url.toLowerCase().endsWith("ova.zip") && !url.toLowerCase().endsWith("ova.bz2") && !url.toLowerCase()
-						.endsWith("ova.gz"))) || (format.equalsIgnoreCase("raw") && (!url.toLowerCase().endsWith("img") && !url.toLowerCase().endsWith("raw")))) {
-			throw new InvalidParameterValueException("Please specify a valid URL. URL:" + url + " is an invalid for the format " + format.toLowerCase());
-		}
-		return true;
-	}
-
-	public boolean canRegister(long templateId) {
-		TemplateProfile tp = get(templateId);
-		
-		if (!checkHypervisor(tp.getHypervisorType())) {
-			return false;
-		}
-		
-		if (!checkFormat(tp.getUrl(), tp.getFormat().toString())) {
-			return false;
-		}
-		
-		return true;
-	}
-
-	public int getDownloadWait() {
-		// TODO Auto-generated method stub
-		return 0;
-	}
-
-	public long getMaxTemplateSizeInBytes() {
-		// TODO Auto-generated method stub
-		return 0;
-	}
-
-	public Proxy getHttpProxy() {
-		// 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/strategy/DefaultVolumeStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/strategy/DefaultVolumeStrategy.java b/engine/storage/src/org/apache/cloudstack/storage/strategy/DefaultVolumeStrategy.java
index d926d9a..8d1ab79 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/strategy/DefaultVolumeStrategy.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/strategy/DefaultVolumeStrategy.java
@@ -16,75 +16,77 @@ import org.apache.cloudstack.storage.volume.VolumeManager;
 
 import org.apache.log4j.Logger;
 
-
 import com.cloud.storage.Volume;
 import com.cloud.storage.VolumeVO;
 import com.cloud.utils.component.Inject;
 
-
 public class DefaultVolumeStrategy implements VolumeStrategy {
-	private static final Logger s_logger = Logger.getLogger(DefaultVolumeStrategy.class);
-	protected DataStore _ds;
-	protected DataStoreDriver _driver;
-	@Inject
-	VolumeManager _volumeMgr;
-	
-	public VolumeProfile get(long volumeId) {
-		return _volumeMgr.getProfile(volumeId);
-	}
-
-	public DefaultVolumeStrategy(DataStore ds) {
-		_ds = ds;
-	}
-	public Volume createVolume(Volume vol) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-	public Volume createDataVolume(Volume vol) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-	public Volume copyVolumeFromBackup(VolumeProfile srcVol, Volume destVol) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-	public Volume createVolumeFromSnapshot(SnapshotProfile snapshot, Volume vol) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-	public Volume createVolumeFromTemplate(TemplateProfile template, Volume vol) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-	public Volume migrateVolume(Volume srcVol, Volume destVol, DataStore destStore) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-	
-	public Volume createVolumeFromBaseTemplate(Volume volume, TemplateProfile tp) {
-		DataStoreEndPointSelector dsep = _ds.getEndPointSelector();
-		List<DataStoreEndPoint> dseps = dsep.getEndPoints(StorageEvent.CreateVolumeFromTemplate);
-		DataStoreEndPoint dp = dseps.get(0);
-		
-		VolumeProfile vp = _driver.createVolumeFromTemplate(get(volume.getId()), tp, dp);
-		
-		VolumeVO vlvo = _volumeMgr.getVolume(volume.getId());
-		
-		vlvo.setFolder(_ds.getPath());
-		vlvo.setPath(vp.getPath());
-		vlvo.setSize(vp.getSize());
-		vlvo.setPoolType(_ds.getPoolType());
-		vlvo.setPoolId(_ds.getId());
-		vlvo.setPodId(_ds.getPodId());
-		
-		return _volumeMgr.updateVolume(vlvo);
-	}
-	public boolean deleteVolume(Volume vol) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-	
-	
+    private static final Logger s_logger = Logger.getLogger(DefaultVolumeStrategy.class);
+    protected DataStore _ds;
+    protected DataStoreDriver _driver;
+    @Inject
+    VolumeManager _volumeMgr;
+
+    public VolumeProfile get(long volumeId) {
+        return _volumeMgr.getProfile(volumeId);
+    }
+
+    public DefaultVolumeStrategy(DataStore ds) {
+        _ds = ds;
+    }
+
+    public Volume createVolume(Volume vol) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Volume createDataVolume(Volume vol) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Volume copyVolumeFromBackup(VolumeProfile srcVol, Volume destVol) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Volume createVolumeFromSnapshot(SnapshotProfile snapshot, Volume vol) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Volume createVolumeFromTemplate(TemplateProfile template, Volume vol) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Volume migrateVolume(Volume srcVol, Volume destVol, DataStore destStore) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Volume createVolumeFromBaseTemplate(Volume volume, TemplateProfile tp) {
+        DataStoreEndPointSelector dsep = _ds.getEndPointSelector();
+        List<DataStoreEndPoint> dseps = dsep.getEndPoints(StorageEvent.CreateVolumeFromTemplate);
+        DataStoreEndPoint dp = dseps.get(0);
+
+        VolumeProfile vp = _driver.createVolumeFromTemplate(get(volume.getId()), tp, dp);
+
+        VolumeVO vlvo = _volumeMgr.getVolume(volume.getId());
+
+        vlvo.setFolder(_ds.getPath());
+        vlvo.setPath(vp.getPath());
+        vlvo.setSize(vp.getSize());
+        vlvo.setPoolType(_ds.getPoolType());
+        vlvo.setPoolId(_ds.getId());
+        vlvo.setPodId(_ds.getPodId());
+
+        return _volumeMgr.updateVolume(vlvo);
+    }
 
+    public boolean deleteVolume(Volume vol) {
+        // 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/strategy/XenBackupStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/strategy/XenBackupStrategy.java b/engine/storage/src/org/apache/cloudstack/storage/strategy/XenBackupStrategy.java
index 09abc9f..86953f4 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/strategy/XenBackupStrategy.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/strategy/XenBackupStrategy.java
@@ -4,8 +4,9 @@ import org.apache.cloudstack.engine.subsystem.api.storage.BackupStrategy;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
 
 public class XenBackupStrategy implements BackupStrategy {
-	protected DataStore _ds;
-	public XenBackupStrategy(DataStore ds) {
-		_ds = ds;
-	}
+    protected DataStore _ds;
+
+    public XenBackupStrategy(DataStore ds) {
+        _ds = ds;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/strategy/XenSnapshotStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/strategy/XenSnapshotStrategy.java b/engine/storage/src/org/apache/cloudstack/storage/strategy/XenSnapshotStrategy.java
index 70b3b68..32581dd 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/strategy/XenSnapshotStrategy.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/strategy/XenSnapshotStrategy.java
@@ -4,8 +4,9 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy;
 
 public class XenSnapshotStrategy implements SnapshotStrategy {
-	protected DataStore _ds;
-	public XenSnapshotStrategy(DataStore ds) {
-		_ds = ds;
-	}
+    protected DataStore _ds;
+
+    public XenSnapshotStrategy(DataStore ds) {
+        _ds = ds;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/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 1b4c083..ca1e9b7 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/to/ImageDataStoreTO.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/to/ImageDataStoreTO.java
@@ -3,7 +3,7 @@ package org.apache.cloudstack.storage.to;
 import org.apache.cloudstack.storage.image.store.ImageDataStoreInfo;
 
 public class ImageDataStoreTO {
-	public ImageDataStoreTO(ImageDataStoreInfo dataStore) {
-		
-	}
+    public ImageDataStoreTO(ImageDataStoreInfo dataStore) {
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/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 203ab05..cc31bc7 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/to/ImageOnPrimayDataStoreTO.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/to/ImageOnPrimayDataStoreTO.java
@@ -21,7 +21,7 @@ package org.apache.cloudstack.storage.to;
 import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
 
 public class ImageOnPrimayDataStoreTO {
-	public ImageOnPrimayDataStoreTO(TemplateOnPrimaryDataStoreInfo template) {
-		
-	}
+    public ImageOnPrimayDataStoreTO(TemplateOnPrimaryDataStoreInfo template) {
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/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 bb264df..bd97dda 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/to/PrimaryDataStoreTO.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/to/PrimaryDataStoreTO.java
@@ -3,7 +3,7 @@ package org.apache.cloudstack.storage.to;
 import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
 
 public class PrimaryDataStoreTO {
-	public PrimaryDataStoreTO(PrimaryDataStoreInfo dataStore) {
-		
-	}
+    public PrimaryDataStoreTO(PrimaryDataStoreInfo dataStore) {
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/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 0c9d53f..d5f9d09 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java
@@ -3,7 +3,7 @@ package org.apache.cloudstack.storage.to;
 import org.apache.cloudstack.storage.image.TemplateInfo;
 
 public class TemplateTO {
-	public TemplateTO(TemplateInfo template) {
-		
-	}
+    public TemplateTO(TemplateInfo template) {
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/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 28150f1..eff22f0 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java
@@ -3,7 +3,7 @@ package org.apache.cloudstack.storage.to;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 
 public class VolumeTO {
-	public VolumeTO(VolumeInfo volume) {
-		
-	}
+    public VolumeTO(VolumeInfo volume) {
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreInfo.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreInfo.java b/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreInfo.java
index 33a350e..b1bf403 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreInfo.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreInfo.java
@@ -22,8 +22,11 @@ import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
 import org.apache.cloudstack.storage.image.TemplateInfo;
 
 public interface TemplateOnPrimaryDataStoreInfo {
-	public String getPath();
-	public void setPath(String path);
-	public PrimaryDataStoreInfo getPrimaryDataStore();
-	public TemplateInfo getTemplate();
+    public String getPath();
+
+    public void setPath(String path);
+
+    public PrimaryDataStoreInfo getPrimaryDataStore();
+
+    public TemplateInfo getTemplate();
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreObject.java b/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreObject.java
index d68b497..25ae38d 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreObject.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreObject.java
@@ -28,41 +28,41 @@ import org.apache.cloudstack.storage.volume.db.TemplatePrimaryDataStoreVO;
 import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
 
 public class TemplateOnPrimaryDataStoreObject implements TemplateOnPrimaryDataStoreInfo {
-	protected PrimaryDataStoreInfo dataStore;
-	protected TemplateInfo template;
-	protected TemplatePrimaryDataStoreVO vo;
-	@Inject
-	TemplatePrimaryDataStoreDao templateStoreDao;
-	
-	public TemplateOnPrimaryDataStoreObject(PrimaryDataStoreInfo primaryDataStore, TemplateInfo template, TemplatePrimaryDataStoreVO vo) {
-		this.dataStore = primaryDataStore;
-		this.template = template;
-		this.vo = vo;
-	}
-	
-	@Override
-	public String getPath() {
-		return vo.getInstallPath();
-	}
+    protected PrimaryDataStoreInfo dataStore;
+    protected TemplateInfo template;
+    protected TemplatePrimaryDataStoreVO vo;
+    @Inject
+    TemplatePrimaryDataStoreDao templateStoreDao;
 
-	@Override
-	public void setPath(String path) {
-		this.vo.setInstallPath(path);
-	}
+    public TemplateOnPrimaryDataStoreObject(PrimaryDataStoreInfo primaryDataStore, TemplateInfo template, TemplatePrimaryDataStoreVO vo) {
+        this.dataStore = primaryDataStore;
+        this.template = template;
+        this.vo = vo;
+    }
 
-	@Override
-	public PrimaryDataStoreInfo getPrimaryDataStore() {
-		return this.dataStore;
-	}
+    @Override
+    public String getPath() {
+        return vo.getInstallPath();
+    }
 
-	@Override
-	public TemplateInfo getTemplate() {
-		return this.template;
-	}
-	
-	public void updateStatus(Status status) {
-		vo.setDownloadState(status);
-		templateStoreDao.update(vo.getId(), vo);
-	}
+    @Override
+    public void setPath(String path) {
+        this.vo.setInstallPath(path);
+    }
+
+    @Override
+    public PrimaryDataStoreInfo getPrimaryDataStore() {
+        return this.dataStore;
+    }
+
+    @Override
+    public TemplateInfo getTemplate() {
+        return this.template;
+    }
+
+    public void updateStatus(Status status) {
+        vo.setDownloadState(status);
+        templateStoreDao.update(vo.getId(), vo);
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/volume/TemplatePrimaryDataStoreManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/TemplatePrimaryDataStoreManager.java b/engine/storage/src/org/apache/cloudstack/storage/volume/TemplatePrimaryDataStoreManager.java
index 2038edf..eb0b670 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/TemplatePrimaryDataStoreManager.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/TemplatePrimaryDataStoreManager.java
@@ -22,6 +22,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
 import org.apache.cloudstack.storage.image.TemplateInfo;
 
 public interface TemplatePrimaryDataStoreManager {
-	public TemplateOnPrimaryDataStoreInfo createTemplateOnPrimaryDataStore(TemplateInfo template, PrimaryDataStoreInfo dataStore);
-	public TemplateOnPrimaryDataStoreInfo findTemplateOnPrimaryDataStore(TemplateInfo template, PrimaryDataStoreInfo dataStore);
+    public TemplateOnPrimaryDataStoreInfo createTemplateOnPrimaryDataStore(TemplateInfo template, PrimaryDataStoreInfo dataStore);
+
+    public TemplateOnPrimaryDataStoreInfo findTemplateOnPrimaryDataStore(TemplateInfo template, PrimaryDataStoreInfo dataStore);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/volume/TemplatePrimaryDataStoreManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/TemplatePrimaryDataStoreManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/volume/TemplatePrimaryDataStoreManagerImpl.java
index aec3c4d..95ea49f 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/TemplatePrimaryDataStoreManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/TemplatePrimaryDataStoreManagerImpl.java
@@ -24,31 +24,35 @@ import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
 import org.apache.cloudstack.storage.image.TemplateInfo;
 import org.apache.cloudstack.storage.volume.db.TemplatePrimaryDataStoreDao;
 import org.apache.cloudstack.storage.volume.db.TemplatePrimaryDataStoreVO;
+import org.springframework.stereotype.Component;
 
 import com.cloud.storage.VMTemplateStorageResourceAssoc;
 import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.SearchCriteriaService;
 import com.cloud.utils.db.SearchCriteria.Op;
 
+@Component
 public class TemplatePrimaryDataStoreManagerImpl implements TemplatePrimaryDataStoreManager {
-	@Inject
-	TemplatePrimaryDataStoreDao templateStoreDao;
-	@Override
-	public TemplateOnPrimaryDataStoreObject createTemplateOnPrimaryDataStore(TemplateInfo template, PrimaryDataStoreInfo dataStore) {
-		
-		TemplatePrimaryDataStoreVO templateStoreVO = new TemplatePrimaryDataStoreVO(dataStore.getId(), template.getId());
-		templateStoreVO = templateStoreDao.persist(templateStoreVO);
-		TemplateOnPrimaryDataStoreObject templateStoreObject = new TemplateOnPrimaryDataStoreObject(dataStore, template, templateStoreVO);
-		return templateStoreObject;
-	}
-	@Override
-	public TemplateOnPrimaryDataStoreObject findTemplateOnPrimaryDataStore(TemplateInfo template, PrimaryDataStoreInfo dataStore) {
-		SearchCriteriaService<TemplatePrimaryDataStoreVO, TemplatePrimaryDataStoreVO> sc = SearchCriteria2.create(TemplatePrimaryDataStoreVO.class);
-		sc.addAnd(sc.getEntity().getTemplateId(), Op.EQ, template.getId());
-		sc.addAnd(sc.getEntity().getPoolId(), Op.EQ, dataStore.getId());
-		sc.addAnd(sc.getEntity().getDownloadState(), Op.EQ, VMTemplateStorageResourceAssoc.Status.DOWNLOADED);
-		TemplatePrimaryDataStoreVO templateStoreVO = sc.find();
-		TemplateOnPrimaryDataStoreObject templateStoreObject = new TemplateOnPrimaryDataStoreObject(dataStore, template, templateStoreVO);
-		return templateStoreObject;
-	}
+    @Inject
+    TemplatePrimaryDataStoreDao templateStoreDao;
+
+    @Override
+    public TemplateOnPrimaryDataStoreObject createTemplateOnPrimaryDataStore(TemplateInfo template, PrimaryDataStoreInfo dataStore) {
+
+        TemplatePrimaryDataStoreVO templateStoreVO = new TemplatePrimaryDataStoreVO(dataStore.getId(), template.getId());
+        templateStoreVO = templateStoreDao.persist(templateStoreVO);
+        TemplateOnPrimaryDataStoreObject templateStoreObject = new TemplateOnPrimaryDataStoreObject(dataStore, template, templateStoreVO);
+        return templateStoreObject;
+    }
+
+    @Override
+    public TemplateOnPrimaryDataStoreObject findTemplateOnPrimaryDataStore(TemplateInfo template, PrimaryDataStoreInfo dataStore) {
+        SearchCriteriaService<TemplatePrimaryDataStoreVO, TemplatePrimaryDataStoreVO> sc = SearchCriteria2.create(TemplatePrimaryDataStoreVO.class);
+        sc.addAnd(sc.getEntity().getTemplateId(), Op.EQ, template.getId());
+        sc.addAnd(sc.getEntity().getPoolId(), Op.EQ, dataStore.getId());
+        sc.addAnd(sc.getEntity().getDownloadState(), Op.EQ, VMTemplateStorageResourceAssoc.Status.DOWNLOADED);
+        TemplatePrimaryDataStoreVO templateStoreVO = sc.find();
+        TemplateOnPrimaryDataStoreObject templateStoreObject = new TemplateOnPrimaryDataStoreObject(dataStore, template, templateStoreVO);
+        return templateStoreObject;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/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
index 424c7f7..cc48f10 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java
@@ -56,6 +56,12 @@ public class VolumeEntityImpl implements VolumeEntity {
     }
 
     @Override
+    public String getExternalId() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
     public String getCurrentState() {
         return volumeInfo.getCurrentState().toString();
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEvent.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEvent.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEvent.java
index 33d1261..663584b 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEvent.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEvent.java
@@ -19,16 +19,5 @@
 package org.apache.cloudstack.storage.volume;
 
 public enum VolumeEvent {
-	CreateRequested,
-	CopyRequested,
-	CopySucceeded,
-	CopyFailed,
-	OperationFailed,
-	OperationSucceeded,
-	OperationRetry,
-	UploadRequested,
-	MigrationRequested,
-	SnapshotRequested,
-	DestroyRequested,
-	ExpungingRequested;
+    CreateRequested, CopyRequested, CopySucceeded, CopyFailed, OperationFailed, OperationSucceeded, OperationRetry, UploadRequested, MigrationRequested, SnapshotRequested, DestroyRequested, ExpungingRequested;
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeManager.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeManager.java
index daaadc1..22e9baf 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeManager.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeManager.java
@@ -25,9 +25,13 @@ import com.cloud.storage.VolumeVO;
 import com.cloud.utils.fsm.NoTransitionException;
 
 public interface VolumeManager {
-	VolumeVO allocateDuplicateVolume(VolumeVO oldVol);
-	VolumeVO processEvent(Volume vol, Volume.Event event) throws NoTransitionException;
-	VolumeProfile getProfile(long volumeId);
-	VolumeVO getVolume(long volumeId);
-	VolumeVO updateVolume(VolumeVO volume);
+    VolumeVO allocateDuplicateVolume(VolumeVO oldVol);
+
+    VolumeVO processEvent(Volume vol, Volume.Event event) throws NoTransitionException;
+
+    VolumeProfile getProfile(long volumeId);
+
+    VolumeVO getVolume(long volumeId);
+
+    VolumeVO updateVolume(VolumeVO volume);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeManagerImpl.java
index 2a5ac86..241bc3b 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeManagerImpl.java
@@ -28,43 +28,38 @@ import com.cloud.utils.fsm.NoTransitionException;
 import com.cloud.utils.fsm.StateMachine2;
 
 public class VolumeManagerImpl implements VolumeManager {
-	private StateMachine2<Volume.State, Volume.Event, Volume> _volStateMachine;
-	@Inject
-	protected VolumeDao _volumeDao;
-	
+    private StateMachine2<Volume.State, Volume.Event, Volume> _volStateMachine;
+    @Inject
+    protected VolumeDao _volumeDao;
 
-	public VolumeVO allocateDuplicateVolume(VolumeVO oldVol) {
-		VolumeVO newVol = new VolumeVO(oldVol.getVolumeType(), oldVol.getName(), oldVol.getDataCenterId(), oldVol.getDomainId(), oldVol.getAccountId(), oldVol.getDiskOfferingId(), oldVol.getSize());
-		newVol.setTemplateId(oldVol.getTemplateId());
-		newVol.setDeviceId(oldVol.getDeviceId());
-		newVol.setInstanceId(oldVol.getInstanceId());
-		newVol.setRecreatable(oldVol.isRecreatable());
-		newVol.setReservationId(oldVol.getReservationId());
-		return null;
-		//return _volumeDao.persist(newVol);
-	}
-	
+    public VolumeVO allocateDuplicateVolume(VolumeVO oldVol) {
+        VolumeVO newVol = new VolumeVO(oldVol.getVolumeType(), oldVol.getName(), oldVol.getDataCenterId(), oldVol.getDomainId(), oldVol.getAccountId(), oldVol.getDiskOfferingId(), oldVol.getSize());
+        newVol.setTemplateId(oldVol.getTemplateId());
+        newVol.setDeviceId(oldVol.getDeviceId());
+        newVol.setInstanceId(oldVol.getInstanceId());
+        newVol.setRecreatable(oldVol.isRecreatable());
+        newVol.setReservationId(oldVol.getReservationId());
+        return null;
+        // return _volumeDao.persist(newVol);
+    }
 
-	public VolumeVO processEvent(Volume vol, Volume.Event event) throws NoTransitionException {
-		//_volStateMachine.transitTo(vol, event, null, _volumeDao);
-		return _volumeDao.findById(vol.getId());
-	}
+    public VolumeVO processEvent(Volume vol, Volume.Event event) throws NoTransitionException {
+        // _volStateMachine.transitTo(vol, event, null, _volumeDao);
+        return _volumeDao.findById(vol.getId());
+    }
 
+    public VolumeProfile getProfile(long volumeId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-	public VolumeProfile getProfile(long volumeId) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public VolumeVO getVolume(long volumeId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-
-	public VolumeVO getVolume(long volumeId) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-
-	public VolumeVO updateVolume(VolumeVO volume) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public VolumeVO updateVolume(VolumeVO volume) {
+        // 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/volume/VolumeMotionService.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeMotionService.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeMotionService.java
index 9814ecb..9349e6b 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeMotionService.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeMotionService.java
@@ -19,5 +19,5 @@
 package org.apache.cloudstack.storage.volume;
 
 public interface VolumeMotionService {
-	boolean copyVolume(String volumeUri, String destVolumeUri);
+    boolean copyVolume(String volumeUri, String destVolumeUri);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeObject.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeObject.java
index d495c35..f57fb75 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeObject.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeObject.java
@@ -1,6 +1,5 @@
 package org.apache.cloudstack.storage.volume;
 
-
 import java.util.Date;
 
 import javax.inject.Inject;
@@ -24,112 +23,112 @@ import com.cloud.utils.fsm.NoTransitionException;
 import com.cloud.utils.fsm.StateMachine2;
 
 public class VolumeObject implements VolumeInfo {
-	private static final Logger s_logger = Logger.getLogger(VolumeObject.class);
-	protected VolumeVO volumeVO;
-	private StateMachine2<Volume.State, VolumeEvent, VolumeVO> _volStateMachine;
-	protected PrimaryDataStore dataStore;
-	@Inject
-	VolumeDiskTypeHelper diskTypeHelper;
-	@Inject
-	VolumeTypeHelper volumeTypeHelper;
-	@Inject
-	VolumeDao volumeDao;
-	
-	public VolumeObject(PrimaryDataStore dataStore, VolumeVO volumeVO) {
-		this.volumeVO = volumeVO;
-		this.dataStore = dataStore;
-	}
-	
-	public String getUuid() {
-		return volumeVO.getUuid();
-	}
-	
-	public void setPath(String uuid) {
-		volumeVO.setUuid(uuid);
-	}
-	
-	public String getPath() {
-		return volumeVO.getPath();
-	}
-	
-	public String getTemplateUuid() {
-		return null;
-	}
-	
-	public String getTemplatePath() {
-		return null;
-	}
-	
-	public PrimaryDataStoreInfo getDataStoreInfo() {
-		return dataStore.getDataStoreInfo();
-	}
-	
-	public Volume.State getState() {
-		return volumeVO.getState();
-	}
-
-	public PrimaryDataStore getDataStore() {
-		return dataStore;
-	}
-	
-	public long getSize() {
-		return volumeVO.getSize();
-	}
-	
-	public VolumeDiskType getDiskType() {
-		return diskTypeHelper.getDiskType(volumeVO.getDiskType());
-	}
-	
-	public VolumeType getType() {
-		return volumeTypeHelper.getType(volumeVO.getVolumeType());
-	}
-	
-	public long getVolumeId() {
-		return volumeVO.getId();
-	}
-	
-	public void setVolumeDiskType(VolumeDiskType type) {
-		volumeVO.setDiskType(type.toString());
-	}
-	
-	public boolean stateTransit(VolumeEvent event) {
-		boolean result = false;
-		try {
-			result = _volStateMachine.transitTo(volumeVO, event, null, volumeDao);
-		} catch (NoTransitionException e) {
-			String errorMessage = "Failed to transit volume: " + this.getVolumeId() + ", due to: " + e.toString();
-			s_logger.debug(errorMessage);
-			throw new CloudRuntimeException(errorMessage);
-		}
-		return result;
-	}
-	
-	public void update() {
-		volumeDao.update(volumeVO.getId(), volumeVO);
-		volumeVO = volumeDao.findById(volumeVO.getId());
-	}
-
-	@Override
-	public long getId() {
-		// TODO Auto-generated method stub
-		return 0;
-	}
-
-	@Override
-	public State getCurrentState() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public State getDesiredState() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public Date getCreatedData() {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    private static final Logger s_logger = Logger.getLogger(VolumeObject.class);
+    protected VolumeVO volumeVO;
+    private StateMachine2<Volume.State, VolumeEvent, VolumeVO> _volStateMachine;
+    protected PrimaryDataStore dataStore;
+    @Inject
+    VolumeDiskTypeHelper diskTypeHelper;
+    @Inject
+    VolumeTypeHelper volumeTypeHelper;
+    @Inject
+    VolumeDao volumeDao;
+
+    public VolumeObject(PrimaryDataStore dataStore, VolumeVO volumeVO) {
+        this.volumeVO = volumeVO;
+        this.dataStore = dataStore;
+    }
+
+    public String getUuid() {
+        return volumeVO.getUuid();
+    }
+
+    public void setPath(String uuid) {
+        volumeVO.setUuid(uuid);
+    }
+
+    public String getPath() {
+        return volumeVO.getPath();
+    }
+
+    public String getTemplateUuid() {
+        return null;
+    }
+
+    public String getTemplatePath() {
+        return null;
+    }
+
+    public PrimaryDataStoreInfo getDataStoreInfo() {
+        return dataStore.getDataStoreInfo();
+    }
+
+    public Volume.State getState() {
+        return volumeVO.getState();
+    }
+
+    public PrimaryDataStore getDataStore() {
+        return dataStore;
+    }
+
+    public long getSize() {
+        return volumeVO.getSize();
+    }
+
+    public VolumeDiskType getDiskType() {
+        return diskTypeHelper.getDiskType(volumeVO.getDiskType());
+    }
+
+    public VolumeType getType() {
+        return volumeTypeHelper.getType(volumeVO.getVolumeType());
+    }
+
+    public long getVolumeId() {
+        return volumeVO.getId();
+    }
+
+    public void setVolumeDiskType(VolumeDiskType type) {
+        volumeVO.setDiskType(type.toString());
+    }
+
+    public boolean stateTransit(VolumeEvent event) {
+        boolean result = false;
+        try {
+            result = _volStateMachine.transitTo(volumeVO, event, null, volumeDao);
+        } catch (NoTransitionException e) {
+            String errorMessage = "Failed to transit volume: " + this.getVolumeId() + ", due to: " + e.toString();
+            s_logger.debug(errorMessage);
+            throw new CloudRuntimeException(errorMessage);
+        }
+        return result;
+    }
+
+    public void update() {
+        volumeDao.update(volumeVO.getId(), volumeVO);
+        volumeVO = volumeDao.findById(volumeVO.getId());
+    }
+
+    @Override
+    public long getId() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public State getCurrentState() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public State getDesiredState() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Date getCreatedData() {
+        // 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/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 773d2f1..36a2256 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeService.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeService.java
@@ -26,52 +26,53 @@ import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskTyp
 import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType;
 import org.apache.cloudstack.storage.image.TemplateInfo;
 
-
 public interface VolumeService {
-	/**
+    /**
 	 * 
 	 */
-	VolumeEntity allocateVolumeInDb(long size, VolumeType type,String volName, Long templateId);
-	
+    VolumeEntity allocateVolumeInDb(long size, VolumeType type, String volName, Long templateId);
+
     /**
      * Creates the volume based on the given criteria
      * 
      * @param cmd
-     *            
+     * 
      * @return the volume object
      */
-	VolumeInfo createVolume(VolumeInfo volume, long dataStoreId, VolumeDiskType diskType);
+    VolumeInfo createVolume(VolumeInfo volume, long dataStoreId, VolumeDiskType diskType);
 
     /**
      * Delete volume
+     * 
      * @param volumeId
      * @return
      * @throws ConcurrentOperationException
      */
     boolean deleteVolume(long volumeId);
-    
+
     /**
      * 
      */
     boolean cloneVolume(long volumeId, long baseVolId);
-    
+
     /**
      * 
      */
     boolean createVolumeFromSnapshot(long volumeId, long snapshotId);
-    
+
     /**
      * 
      */
     String grantAccess(VolumeInfo volume, EndPoint endpointId);
-    
+
     TemplateOnPrimaryDataStoreInfo grantAccess(TemplateOnPrimaryDataStoreInfo template, EndPoint endPoint);
-    
+
     /**
      * 
      */
     boolean rokeAccess(long volumeId, long endpointId);
 
     VolumeEntity getVolumeEntity(long volumeId);
+
     VolumeInfo createVolumeFromTemplate(VolumeInfo volume, long dataStoreId, VolumeDiskType diskType, TemplateInfo template);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index 68d0160..f994847 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -47,141 +47,141 @@ import com.cloud.utils.exception.CloudRuntimeException;
 
 @Service
 public class VolumeServiceImpl implements VolumeService {
-	@Inject
-	VolumeDao volDao;
-	@Inject
-	PrimaryDataStoreManager dataStoreMgr;
-	@Inject
-	TemplatePrimaryDataStoreManager templatePrimaryStoreMgr;
-	@Inject
-	ImageMotionService imageMotion;
-	@Override
-	public VolumeInfo createVolume(VolumeInfo volume, long dataStoreId, VolumeDiskType diskType) {
-		PrimaryDataStore dataStore = dataStoreMgr.getPrimaryDataStore(dataStoreId);
-		if (dataStore == null) {
-			throw new CloudRuntimeException("Can't find dataStoreId: " + dataStoreId);
-		}
-		
-		if (dataStore.exists(volume)) {
-			return volume;
-		}
-		
-		VolumeObject vo = (VolumeObject)volume;
-		vo.stateTransit(VolumeEvent.CreateRequested);
-		
-		try {
-			VolumeInfo vi = dataStore.createVolume(vo, diskType);
-			vo.stateTransit(VolumeEvent.OperationSucceeded);
-			return vi;
-		} catch (Exception e) {
-			vo.stateTransit(VolumeEvent.OperationFailed);
-			throw new CloudRuntimeException(e.toString());
-		}
-	}
-
-	@DB
-	@Override
-	public boolean deleteVolume(long volumeId) {
-		return true;
-	}
-
-	@Override
-	public boolean cloneVolume(long volumeId, long baseVolId) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	@Override
-	public boolean createVolumeFromSnapshot(long volumeId, long snapshotId) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	@Override
-	public boolean rokeAccess(long volumeId, long endpointId) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	@Override
-	public VolumeEntity allocateVolumeInDb(long size, VolumeType type, String volName, Long templateId) {
-		VolumeVO vo = volDao.allocVolume(size, type, volName, templateId);
-		return new VolumeEntityImpl(new VolumeObject(null, vo));
-	}
-
-	@Override
-	public VolumeEntity getVolumeEntity(long volumeId) {
-		VolumeVO vo = volDao.findById(volumeId);
-		if (vo == null) {
-			return null;
-		}
-		
-		if (vo.getPoolId() == null) {
-			return new VolumeEntityImpl(new VolumeObject(null, vo));
-		} else {
-			PrimaryDataStore dataStore = dataStoreMgr.getPrimaryDataStore(vo.getPoolId());
-			return new VolumeEntityImpl(dataStore.getVolume(volumeId));
-		}
-	}
-
-
-	@Override
-	public String grantAccess(VolumeInfo volume, EndPoint endpointId) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	protected TemplateOnPrimaryDataStoreObject createBaseImage(PrimaryDataStore dataStore, TemplateInfo template) {
-		TemplateOnPrimaryDataStoreObject templateOnPrimaryStoreObj = (TemplateOnPrimaryDataStoreObject)templatePrimaryStoreMgr.createTemplateOnPrimaryDataStore(template, dataStore);
-		templateOnPrimaryStoreObj.updateStatus(Status.CREATING);
-		try {
-			dataStore.installTemplate(templateOnPrimaryStoreObj);
-			templateOnPrimaryStoreObj.updateStatus(Status.CREATED);
-		} catch (Exception e) {
-			templateOnPrimaryStoreObj.updateStatus(Status.ABANDONED);
-			throw new CloudRuntimeException(e.toString());
-		}
-		
-		templateOnPrimaryStoreObj.updateStatus(Status.DOWNLOAD_IN_PROGRESS);
-		try {
-			imageMotion.copyTemplate(templateOnPrimaryStoreObj);
-			templateOnPrimaryStoreObj.updateStatus(Status.DOWNLOADED);
-		} catch (Exception e) {
-			templateOnPrimaryStoreObj.updateStatus(Status.ABANDONED);
-			throw new CloudRuntimeException(e.toString());
-		}
-		
-		return templateOnPrimaryStoreObj;
-	}
-	
-	@Override
-	public VolumeInfo createVolumeFromTemplate(VolumeInfo volume, long dataStoreId, VolumeDiskType diskType, TemplateInfo template) {
-		PrimaryDataStore pd = dataStoreMgr.getPrimaryDataStore(dataStoreId);
-		TemplateOnPrimaryDataStoreInfo templateOnPrimaryStore = pd.getTemplate(template);
-		if (templateOnPrimaryStore == null) {
-			templateOnPrimaryStore = createBaseImage(pd, template);
-		}
-		
-		VolumeObject vo = (VolumeObject)volume;
-		try {
-			vo.stateTransit(VolumeEvent.CreateRequested);
-		} catch (Exception e) {
-			throw new CloudRuntimeException(e.toString());
-		}
-		
-		try {
-			volume = pd.createVoluemFromBaseImage(volume, templateOnPrimaryStore);
-			vo.stateTransit(VolumeEvent.OperationSucceeded);
-		} catch (Exception e) {
-			vo.stateTransit(VolumeEvent.OperationFailed);
-			throw new CloudRuntimeException(e.toString());
-		}
-		return volume;
-	}
-
-	@Override
-	public TemplateOnPrimaryDataStoreInfo grantAccess(TemplateOnPrimaryDataStoreInfo template, EndPoint endPoint) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    @Inject
+    VolumeDao volDao;
+    @Inject
+    PrimaryDataStoreManager dataStoreMgr;
+    @Inject
+    TemplatePrimaryDataStoreManager templatePrimaryStoreMgr;
+    @Inject
+    ImageMotionService imageMotion;
+
+    @Override
+    public VolumeInfo createVolume(VolumeInfo volume, long dataStoreId, VolumeDiskType diskType) {
+        PrimaryDataStore dataStore = dataStoreMgr.getPrimaryDataStore(dataStoreId);
+        if (dataStore == null) {
+            throw new CloudRuntimeException("Can't find dataStoreId: " + dataStoreId);
+        }
+
+        if (dataStore.exists(volume)) {
+            return volume;
+        }
+
+        VolumeObject vo = (VolumeObject) volume;
+        vo.stateTransit(VolumeEvent.CreateRequested);
+
+        try {
+            VolumeInfo vi = dataStore.createVolume(vo, diskType);
+            vo.stateTransit(VolumeEvent.OperationSucceeded);
+            return vi;
+        } catch (Exception e) {
+            vo.stateTransit(VolumeEvent.OperationFailed);
+            throw new CloudRuntimeException(e.toString());
+        }
+    }
+
+    @DB
+    @Override
+    public boolean deleteVolume(long volumeId) {
+        return true;
+    }
+
+    @Override
+    public boolean cloneVolume(long volumeId, long baseVolId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean createVolumeFromSnapshot(long volumeId, long snapshotId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean rokeAccess(long volumeId, long endpointId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public VolumeEntity allocateVolumeInDb(long size, VolumeType type, String volName, Long templateId) {
+        VolumeVO vo = volDao.allocVolume(size, type, volName, templateId);
+        return new VolumeEntityImpl(new VolumeObject(null, vo));
+    }
+
+    @Override
+    public VolumeEntity getVolumeEntity(long volumeId) {
+        VolumeVO vo = volDao.findById(volumeId);
+        if (vo == null) {
+            return null;
+        }
+
+        if (vo.getPoolId() == null) {
+            return new VolumeEntityImpl(new VolumeObject(null, vo));
+        } else {
+            PrimaryDataStore dataStore = dataStoreMgr.getPrimaryDataStore(vo.getPoolId());
+            return new VolumeEntityImpl(dataStore.getVolume(volumeId));
+        }
+    }
+
+    @Override
+    public String grantAccess(VolumeInfo volume, EndPoint endpointId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    protected TemplateOnPrimaryDataStoreObject createBaseImage(PrimaryDataStore dataStore, TemplateInfo template) {
+        TemplateOnPrimaryDataStoreObject templateOnPrimaryStoreObj = (TemplateOnPrimaryDataStoreObject) templatePrimaryStoreMgr.createTemplateOnPrimaryDataStore(template, dataStore);
+        templateOnPrimaryStoreObj.updateStatus(Status.CREATING);
+        try {
+            dataStore.installTemplate(templateOnPrimaryStoreObj);
+            templateOnPrimaryStoreObj.updateStatus(Status.CREATED);
+        } catch (Exception e) {
+            templateOnPrimaryStoreObj.updateStatus(Status.ABANDONED);
+            throw new CloudRuntimeException(e.toString());
+        }
+
+        templateOnPrimaryStoreObj.updateStatus(Status.DOWNLOAD_IN_PROGRESS);
+        try {
+            imageMotion.copyTemplate(templateOnPrimaryStoreObj);
+            templateOnPrimaryStoreObj.updateStatus(Status.DOWNLOADED);
+        } catch (Exception e) {
+            templateOnPrimaryStoreObj.updateStatus(Status.ABANDONED);
+            throw new CloudRuntimeException(e.toString());
+        }
+
+        return templateOnPrimaryStoreObj;
+    }
+
+    @Override
+    public VolumeInfo createVolumeFromTemplate(VolumeInfo volume, long dataStoreId, VolumeDiskType diskType, TemplateInfo template) {
+        PrimaryDataStore pd = dataStoreMgr.getPrimaryDataStore(dataStoreId);
+        TemplateOnPrimaryDataStoreInfo templateOnPrimaryStore = pd.getTemplate(template);
+        if (templateOnPrimaryStore == null) {
+            templateOnPrimaryStore = createBaseImage(pd, template);
+        }
+
+        VolumeObject vo = (VolumeObject) volume;
+        try {
+            vo.stateTransit(VolumeEvent.CreateRequested);
+        } catch (Exception e) {
+            throw new CloudRuntimeException(e.toString());
+        }
+
+        try {
+            volume = pd.createVoluemFromBaseImage(volume, templateOnPrimaryStore);
+            vo.stateTransit(VolumeEvent.OperationSucceeded);
+        } catch (Exception e) {
+            vo.stateTransit(VolumeEvent.OperationFailed);
+            throw new CloudRuntimeException(e.toString());
+        }
+        return volume;
+    }
+
+    @Override
+    public TemplateOnPrimaryDataStoreInfo grantAccess(TemplateOnPrimaryDataStoreInfo template, EndPoint endPoint) {
+        // 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/volume/db/TemplatePrimaryDataStoreVO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreVO.java b/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreVO.java
index 0abef22..70e705f 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreVO.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreVO.java
@@ -36,183 +36,192 @@ import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
 import com.cloud.utils.db.GenericDaoBase;
 
 @Entity
-@Table(name="template_spool_ref")
+@Table(name = "template_spool_ref")
 public class TemplatePrimaryDataStoreVO {
-	@Id
-	@GeneratedValue(strategy=GenerationType.IDENTITY)
-	long id;
-	
-	@Column(name="pool_id")
-	private long poolId;
-	
-	@Column(name="template_id") long templateId;
-	
-	@Column(name=GenericDaoBase.CREATED_COLUMN) Date created = null;
-	
-	@Column(name="last_updated")
-	@Temporal(value=TemporalType.TIMESTAMP) Date lastUpdated = null;
-	
-	@Column (name="download_pct") int downloadPercent;
-	
-	@Column (name="download_state")
-	@Enumerated(EnumType.STRING) Status downloadState;
-	
-	@Column (name="local_path") String localDownloadPath;
-	
-	@Column (name="error_str") String errorString;
-	
-	@Column (name="job_id") String jobId;
-	
-	@Column (name="install_path") String installPath;
-	
-	@Column (name="template_size") long templateSize;
-	
-	@Column (name="marked_for_gc") boolean markedForGC;
-    
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    long id;
+
+    @Column(name = "pool_id")
+    private long poolId;
+
+    @Column(name = "template_id")
+    long templateId;
+
+    @Column(name = GenericDaoBase.CREATED_COLUMN)
+    Date created = null;
+
+    @Column(name = "last_updated")
+    @Temporal(value = TemporalType.TIMESTAMP)
+    Date lastUpdated = null;
+
+    @Column(name = "download_pct")
+    int downloadPercent;
+
+    @Column(name = "download_state")
+    @Enumerated(EnumType.STRING)
+    Status downloadState;
+
+    @Column(name = "local_path")
+    String localDownloadPath;
+
+    @Column(name = "error_str")
+    String errorString;
+
+    @Column(name = "job_id")
+    String jobId;
+
+    @Column(name = "install_path")
+    String installPath;
+
+    @Column(name = "template_size")
+    long templateSize;
+
+    @Column(name = "marked_for_gc")
+    boolean markedForGC;
+
     public String getInstallPath() {
-		return installPath;
-	}
-	
+        return installPath;
+    }
+
     public long getTemplateSize() {
-		return templateSize;
-	}
+        return templateSize;
+    }
 
-	public long getPoolId() {
-		return poolId;
-	}
+    public long getPoolId() {
+        return poolId;
+    }
 
-	public void setpoolId(long poolId) {
-		this.poolId = poolId;
-	}
+    public void setpoolId(long poolId) {
+        this.poolId = poolId;
+    }
 
     public long getTemplateId() {
-		return templateId;
-	}
+        return templateId;
+    }
 
     public void setTemplateId(long templateId) {
-		this.templateId = templateId;
-	}
+        this.templateId = templateId;
+    }
 
     public int getDownloadPercent() {
-		return downloadPercent;
-	}
+        return downloadPercent;
+    }
 
     public void setDownloadPercent(int downloadPercent) {
-		this.downloadPercent = downloadPercent;
-	}
+        this.downloadPercent = downloadPercent;
+    }
 
     public void setDownloadState(Status downloadState) {
-		this.downloadState = downloadState;
-	}
+        this.downloadState = downloadState;
+    }
 
     public long getId() {
-		return id;
-	}
+        return id;
+    }
 
     public Date getCreated() {
-		return created;
-	}
+        return created;
+    }
 
     public Date getLastUpdated() {
-		return lastUpdated;
-	}
-	
+        return lastUpdated;
+    }
+
     public void setLastUpdated(Date date) {
-	    lastUpdated = date;
-	}
-	
+        lastUpdated = date;
+    }
+
     public void setInstallPath(String installPath) {
-	    this.installPath = installPath;
-	}
+        this.installPath = installPath;
+    }
 
     public Status getDownloadState() {
-		return downloadState;
-	}
-
-	public TemplatePrimaryDataStoreVO(long poolId, long templateId) {
-		super();
-		this.poolId = poolId;
-		this.templateId = templateId;
-		this.downloadState = Status.NOT_DOWNLOADED;
-		this.markedForGC = false;
-	}
-
-	public TemplatePrimaryDataStoreVO(long poolId, long templateId, Date lastUpdated,
-			int downloadPercent, Status downloadState,
-			String localDownloadPath, String errorString, String jobId,
-			String installPath, long templateSize) {
-		super();
-		this.poolId = poolId;
-		this.templateId = templateId;
-		this.lastUpdated = lastUpdated;
-		this.downloadPercent = downloadPercent;
-		this.downloadState = downloadState;
-		this.localDownloadPath = localDownloadPath;
-		this.errorString = errorString;
-		this.jobId = jobId;
-		this.installPath = installPath;
-		this.templateSize = templateSize;
-	}
-
-	protected TemplatePrimaryDataStoreVO() {
-		
-	}
+        return downloadState;
+    }
+
+    public TemplatePrimaryDataStoreVO(long poolId, long templateId) {
+        super();
+        this.poolId = poolId;
+        this.templateId = templateId;
+        this.downloadState = Status.NOT_DOWNLOADED;
+        this.markedForGC = false;
+    }
+
+    public TemplatePrimaryDataStoreVO(long poolId, long templateId, Date lastUpdated, int downloadPercent, Status downloadState, String localDownloadPath, String errorString, String jobId,
+            String installPath, long templateSize) {
+        super();
+        this.poolId = poolId;
+        this.templateId = templateId;
+        this.lastUpdated = lastUpdated;
+        this.downloadPercent = downloadPercent;
+        this.downloadState = downloadState;
+        this.localDownloadPath = localDownloadPath;
+        this.errorString = errorString;
+        this.jobId = jobId;
+        this.installPath = installPath;
+        this.templateSize = templateSize;
+    }
+
+    protected TemplatePrimaryDataStoreVO() {
+
+    }
 
     public void setLocalDownloadPath(String localPath) {
-		this.localDownloadPath = localPath;
-	}
+        this.localDownloadPath = localPath;
+    }
 
     public String getLocalDownloadPath() {
-		return localDownloadPath;
-	}
+        return localDownloadPath;
+    }
 
     public void setErrorString(String errorString) {
-		this.errorString = errorString;
-	}
+        this.errorString = errorString;
+    }
 
     public String getErrorString() {
-		return errorString;
-	}
+        return errorString;
+    }
 
     public void setJobId(String jobId) {
-		this.jobId = jobId;
-	}
+        this.jobId = jobId;
+    }
 
     public String getJobId() {
-		return jobId;
-	}
-	
-	public void setTemplateSize(long templateSize) {
-		this.templateSize = templateSize;
-	}
-	
-	public boolean getMarkedForGC() {
-		return markedForGC;
-	}
-	
-	public void setMarkedForGC(boolean markedForGC) {
-		this.markedForGC = markedForGC;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (obj instanceof TemplatePrimaryDataStoreVO) {
-		   TemplatePrimaryDataStoreVO other = (TemplatePrimaryDataStoreVO)obj;
-		   return (this.templateId==other.getTemplateId() && this.poolId==other.getPoolId());
-		}
-		return false;
-	}
-
-	@Override
-	public int hashCode() {
-		Long tid = new Long(templateId);
-		Long hid = new Long(poolId);
-		return tid.hashCode()+hid.hashCode();
-	}
-	
-	@Override
+        return jobId;
+    }
+
+    public void setTemplateSize(long templateSize) {
+        this.templateSize = templateSize;
+    }
+
+    public boolean getMarkedForGC() {
+        return markedForGC;
+    }
+
+    public void setMarkedForGC(boolean markedForGC) {
+        this.markedForGC = markedForGC;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof TemplatePrimaryDataStoreVO) {
+            TemplatePrimaryDataStoreVO other = (TemplatePrimaryDataStoreVO) obj;
+            return (this.templateId == other.getTemplateId() && this.poolId == other.getPoolId());
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        Long tid = new Long(templateId);
+        Long hid = new Long(poolId);
+        return tid.hashCode() + hid.hashCode();
+    }
+
+    @Override
     public String toString() {
-	    return new StringBuilder("TmplPool[").append(id).append("-").append(templateId).append("-").append("poolId").append("-").append(installPath).append("]").toString();
-	}
+        return new StringBuilder("TmplPool[").append(id).append("-").append(templateId).append("-").append("poolId").append("-").append(installPath).append("]").toString();
+    }
 
 }
\ 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/volume/db/VolumeDao.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeDao.java b/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeDao.java
index a5cd0e8..85124ec 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeDao.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeDao.java
@@ -21,8 +21,6 @@ import java.util.List;
 import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType;
 import org.apache.cloudstack.storage.volume.VolumeEvent;
 
-
-
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.Volume;
@@ -31,51 +29,51 @@ import com.cloud.utils.db.GenericDao;
 import com.cloud.utils.fsm.StateDao;
 
 public interface VolumeDao extends GenericDao<VolumeVO, Long>, StateDao<Volume.State, VolumeEvent, VolumeVO> {
-    
-	List<VolumeVO> findDetachedByAccount(long accountId);
-	
+
+    List<VolumeVO> findDetachedByAccount(long accountId);
+
     List<VolumeVO> findByAccount(long accountId);
-    
+
     Pair<Long, Long> getCountAndTotalByPool(long poolId);
-    
+
     Pair<Long, Long> getNonDestroyedCountAndTotalByPool(long poolId);
-    
+
     List<VolumeVO> findByInstance(long id);
-    
+
     List<VolumeVO> findByInstanceAndType(long id, VolumeType vType);
-    
+
     List<VolumeVO> findByInstanceIdDestroyed(long vmId);
-    
+
     List<VolumeVO> findByAccountAndPod(long accountId, long podId);
-    
+
     List<VolumeVO> findByTemplateAndZone(long templateId, long zoneId);
-    
+
     void deleteVolumesByInstance(long instanceId);
-    
+
     void attachVolume(long volumeId, long vmId, long deviceId);
-    
+
     void detachVolume(long volumeId);
-    
+
     boolean isAnyVolumeActivelyUsingTemplateOnPool(long templateId, long poolId);
-    
+
     List<VolumeVO> findCreatedByInstance(long id);
-    
+
     List<VolumeVO> findByPoolId(long poolId);
-    
-	List<VolumeVO> findByInstanceAndDeviceId(long instanceId, long deviceId);
-	
+
+    List<VolumeVO> findByInstanceAndDeviceId(long instanceId, long deviceId);
+
     List<VolumeVO> findUsableVolumesForInstance(long instanceId);
-    
-    Long countAllocatedVolumesForAccount(long accountId); 
-   
+
+    Long countAllocatedVolumesForAccount(long accountId);
+
     HypervisorType getHypervisorType(long volumeId);
-    
+
     List<VolumeVO> listVolumesToBeDestroyed();
-    
+
     ImageFormat getImageFormat(Long volumeId);
-    
+
     List<VolumeVO> findReadyRootVolumesByInstance(long instanceId);
-    
+
     List<Long> listPoolIdsByVolumeCount(long dcId, Long podId, Long clusterId, long accountId);
 
     VolumeVO allocVolume(long size, VolumeType type, String volName, Long templateId);


Mime
View raw message