cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [06/17] clean up storage related coded
Date Thu, 30 May 2013 01:06:26 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManager.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManager.java
index c605770..f07db7e 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManager.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManager.java
@@ -22,5 +22,5 @@ import com.cloud.storage.SnapshotVO;
 import com.cloud.utils.fsm.NoTransitionException;
 
 public interface SnapshotStateMachineManager {
-	public void processEvent(SnapshotVO snapshot, Event event) throws NoTransitionException;
+    public void processEvent(SnapshotVO snapshot, Event event) throws NoTransitionException;
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java
index 489ba28..c756ddb 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java
@@ -31,30 +31,31 @@ import com.cloud.utils.fsm.NoTransitionException;
 import com.cloud.utils.fsm.StateMachine2;
 
 @Component
-public class SnapshotStateMachineManagerImpl implements
-SnapshotStateMachineManager {
-	private StateMachine2<State, Event, SnapshotVO> stateMachine = new StateMachine2<State, Event, SnapshotVO>();
+public class SnapshotStateMachineManagerImpl implements SnapshotStateMachineManager {
+    private StateMachine2<State, Event, SnapshotVO> stateMachine = new StateMachine2<State, Event, SnapshotVO>();
     @Inject
-    protected SnapshotDao snapshotDao; 
-	public SnapshotStateMachineManagerImpl() {
-		stateMachine.addTransition(Snapshot.State.Allocated, Event.CreateRequested, Snapshot.State.Creating);
-		stateMachine.addTransition(Snapshot.State.Creating, Event.OperationSucceeded, Snapshot.State.CreatedOnPrimary);
-		stateMachine.addTransition(Snapshot.State.Creating, Event.OperationNotPerformed, Snapshot.State.BackedUp);
-		stateMachine.addTransition(Snapshot.State.Creating, Event.OperationFailed, Snapshot.State.Error);
-		stateMachine.addTransition(Snapshot.State.CreatedOnPrimary, Event.BackupToSecondary, Snapshot.State.BackingUp);
-		stateMachine.addTransition(Snapshot.State.BackingUp, Event.OperationSucceeded, Snapshot.State.BackedUp);
-		stateMachine.addTransition(Snapshot.State.BackingUp, Event.OperationFailed, Snapshot.State.CreatedOnPrimary);
-		stateMachine.addTransition(Snapshot.State.BackedUp, Event.DestroyRequested, Snapshot.State.Destroying);
-		stateMachine.addTransition(Snapshot.State.BackedUp, Event.CopyingRequested, Snapshot.State.Copying);
-		stateMachine.addTransition(Snapshot.State.Copying, Event.OperationSucceeded, Snapshot.State.BackedUp);
-		stateMachine.addTransition(Snapshot.State.Copying, Event.OperationFailed, Snapshot.State.BackedUp);
-		stateMachine.addTransition(Snapshot.State.Destroying, Event.OperationSucceeded, Snapshot.State.Destroyed);
-		stateMachine.addTransition(Snapshot.State.Destroying, Event.OperationFailed, Snapshot.State.Error);
-		
-		stateMachine.registerListener(new SnapshotStateListener());
-	}
-	
-	public void processEvent(SnapshotVO snapshot, Event event) throws NoTransitionException {
-		stateMachine.transitTo(snapshot, event, null, snapshotDao);
-	}
-} 
+    protected SnapshotDao snapshotDao;
+
+    public SnapshotStateMachineManagerImpl() {
+        stateMachine.addTransition(Snapshot.State.Allocated, Event.CreateRequested, Snapshot.State.Creating);
+        stateMachine.addTransition(Snapshot.State.Creating, Event.OperationSucceeded, Snapshot.State.CreatedOnPrimary);
+        stateMachine.addTransition(Snapshot.State.Creating, Event.OperationNotPerformed, Snapshot.State.BackedUp);
+        stateMachine.addTransition(Snapshot.State.Creating, Event.OperationFailed, Snapshot.State.Error);
+        stateMachine.addTransition(Snapshot.State.CreatedOnPrimary, Event.BackupToSecondary, Snapshot.State.BackingUp);
+        stateMachine.addTransition(Snapshot.State.BackingUp, Event.OperationSucceeded, Snapshot.State.BackedUp);
+        stateMachine.addTransition(Snapshot.State.BackingUp, Event.OperationFailed, Snapshot.State.CreatedOnPrimary);
+        stateMachine.addTransition(Snapshot.State.BackedUp, Event.DestroyRequested, Snapshot.State.Destroying);
+        stateMachine.addTransition(Snapshot.State.BackedUp, Event.CopyingRequested, Snapshot.State.Copying);
+        stateMachine.addTransition(Snapshot.State.Copying, Event.OperationSucceeded, Snapshot.State.BackedUp);
+        stateMachine.addTransition(Snapshot.State.Copying, Event.OperationFailed, Snapshot.State.BackedUp);
+        stateMachine.addTransition(Snapshot.State.Destroying, Event.OperationSucceeded, Snapshot.State.Destroyed);
+        stateMachine.addTransition(Snapshot.State.Destroying, Event.OperationFailed, Snapshot.State.Error);
+
+        stateMachine.registerListener(new SnapshotStateListener());
+    }
+
+    @Override
+    public void processEvent(SnapshotVO snapshot, Event event) throws NoTransitionException {
+        stateMachine.transitTo(snapshot, event, null, snapshotDao);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStrategyBase.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStrategyBase.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStrategyBase.java
index 5e78b01..1b57922 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStrategyBase.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStrategyBase.java
@@ -23,16 +23,16 @@ import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotService;
 import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy;
 
 public abstract class SnapshotStrategyBase implements SnapshotStrategy {
-	@Inject
-	SnapshotService snapshotSvr;
+    @Inject
+    SnapshotService snapshotSvr;
 
-	@Override
-	public SnapshotInfo takeSnapshot(SnapshotInfo snapshot) {
-		return snapshotSvr.takeSnapshot(snapshot).getSnashot();
-	}
+    @Override
+    public SnapshotInfo takeSnapshot(SnapshotInfo snapshot) {
+        return snapshotSvr.takeSnapshot(snapshot).getSnashot();
+    }
 
-	@Override
-	public SnapshotInfo backupSnapshot(SnapshotInfo snapshot) {
-		return snapshotSvr.backupSnapshot(snapshot);
-	}
+    @Override
+    public SnapshotInfo backupSnapshot(SnapshotInfo snapshot) {
+        return snapshotSvr.backupSnapshot(snapshot);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
index 32504ee..0c3f31c 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
@@ -16,18 +16,14 @@
 // under the License.
 package org.apache.cloudstack.storage.snapshot;
 
-import java.util.List;
-
 import javax.inject.Inject;
 
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
-import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
+import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event;
 import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.State;
 import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
 import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event;
 import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotService;
 import org.apache.cloudstack.storage.command.CreateObjectAnswer;
 import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
@@ -38,11 +34,9 @@ import org.springframework.stereotype.Component;
 
 import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.storage.DataStoreRole;
 import com.cloud.storage.Snapshot;
 import com.cloud.storage.SnapshotVO;
-import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.SnapshotDao;
 import com.cloud.storage.snapshot.SnapshotManager;
 import com.cloud.utils.NumbersUtil;
@@ -51,165 +45,161 @@ import com.cloud.utils.fsm.NoTransitionException;
 
 @Component
 public class XenserverSnapshotStrategy extends SnapshotStrategyBase {
-	private static final Logger s_logger = Logger
-			.getLogger(XenserverSnapshotStrategy.class);
-
-	@Inject
-	SnapshotManager snapshotMgr;
-	@Inject
-	SnapshotService snapshotSvr;
-	@Inject
-	DataStoreManager dataStoreMgr;
-	@Inject
-	SnapshotDataStoreDao snapshotStoreDao;
-	@Inject
-	ConfigurationDao configDao;
-	@Inject
-	SnapshotDao snapshotDao;
-	@Inject
-	SnapshotDataFactory snapshotDataFactory;
-
-	@Override
-	public SnapshotInfo backupSnapshot(SnapshotInfo snapshot) {
-		SnapshotInfo parentSnapshot = snapshot.getParent();
-		if (parentSnapshot != null && parentSnapshot.getPath().equalsIgnoreCase(snapshot.getPath())) {
-			s_logger.debug("backup an empty snapshot");
-			//don't need to backup this snapshot
-			SnapshotDataStoreVO parentSnapshotOnBackupStore = this.snapshotStoreDao.findBySnapshot(parentSnapshot.getId(), DataStoreRole.Image);
-			if (parentSnapshotOnBackupStore != null && 
-					parentSnapshotOnBackupStore.getState() == State.Ready) {
-				DataStore store = dataStoreMgr.getDataStore(parentSnapshotOnBackupStore.getDataStoreId(), 
-						parentSnapshotOnBackupStore.getRole());
-
-				SnapshotInfo snapshotOnImageStore =  (SnapshotInfo)store.create(snapshot);
-				snapshotOnImageStore.processEvent(Event.CreateOnlyRequested);
-
-				SnapshotObjectTO snapTO = new SnapshotObjectTO();
-				snapTO.setPath(parentSnapshotOnBackupStore.getInstallPath());
-				CreateObjectAnswer createSnapshotAnswer = new CreateObjectAnswer(snapTO);
-
-				snapshotOnImageStore.processEvent(Event.OperationSuccessed, createSnapshotAnswer);
-				SnapshotObject snapObj = (SnapshotObject)snapshot;
-				try {
-					snapObj.processEvent(Snapshot.Event.OperationNotPerformed);
-				} catch (NoTransitionException e) {
-					s_logger.debug("Failed to change state: " + snapshot.getId() + ": " +e.toString());
-					throw new CloudRuntimeException(e.toString());
-				}
-				return this.snapshotDataFactory.getSnapshot(snapObj.getId(), store);
-			} else {
-				s_logger.debug("parent snapshot hasn't been backed up yet");
-			}
-		}
-
-		//determine full snapshot backup or not
-
-		boolean fullBackup = false;
-		long preSnapshotId = 0;
-		if (parentSnapshot != null) {
-
-			preSnapshotId = parentSnapshot.getId();
-			int _deltaSnapshotMax = NumbersUtil.parseInt(configDao.getValue("snapshot.delta.max"), SnapshotManager.DELTAMAX);
-			int deltaSnap = _deltaSnapshotMax;
-
-			int i;
-			SnapshotDataStoreVO parentSnapshotOnBackupStore = null;
-			for (i = 1; i < deltaSnap; i++) {
-				parentSnapshotOnBackupStore = this.snapshotStoreDao.findBySnapshot(parentSnapshot.getId(), DataStoreRole.Image);
-
-				Long prevBackupId = parentSnapshotOnBackupStore.getParentSnapshotId();
-
-				if (prevBackupId == 0) {
-					break;
-				}
-
-				parentSnapshotOnBackupStore = this.snapshotStoreDao.findBySnapshot(prevBackupId, DataStoreRole.Image);
-			}
-			if (i >= deltaSnap) {
-				fullBackup = true;
-			}
-		}
-		
-		snapshot.addPayload(fullBackup);
-		return this.snapshotSvr.backupSnapshot(snapshot);
-	}
-	
-	protected void deleteSnapshotChain(SnapshotInfo snapshot) {
-	    while(snapshot != null) {
-	        SnapshotInfo child = snapshot.getChild();
-	        SnapshotInfo parent = snapshot.getParent();
-	        if (child == null) {
-	            if (parent == null || !parent.getPath().equalsIgnoreCase(snapshot.getPath())) {
-	                this.snapshotSvr.deleteSnapshot(snapshot);
-	                snapshot = parent;
-	                continue;
-	            }
-	            break;
-	        } else {
-	            break;
-	        }
-	    }
-	}
-
-	@Override
-	public boolean deleteSnapshot(Long snapshotId) {
-	    SnapshotVO snapshotVO = snapshotDao.findById(snapshotId);
-	    if (snapshotVO.getState() == Snapshot.State.Destroyed) {
-	        return true;
-	    }
-	    
-		if (!Snapshot.State.BackedUp.equals(snapshotVO.getState())) {
-			throw new InvalidParameterValueException("Can't delete snapshotshot " + snapshotId + " due to it is not in BackedUp Status");
-		}
-
-		if (s_logger.isDebugEnabled()) {
-			s_logger.debug("Calling deleteSnapshot for snapshotId: " + snapshotId);
-		}
-		
-		
-		//firt mark the snapshot as destroyed, so that ui can't see it, but we may not destroy the snapshot on the storage, as other snaphosts may depend on it.
-		SnapshotInfo snapshotOnPrimary = this.snapshotDataFactory.getSnapshot(snapshotId, DataStoreRole.Primary);
-		SnapshotObject obj = (SnapshotObject)snapshotOnPrimary;
-		try {
+    private static final Logger s_logger = Logger.getLogger(XenserverSnapshotStrategy.class);
+
+    @Inject
+    SnapshotManager snapshotMgr;
+    @Inject
+    SnapshotService snapshotSvr;
+    @Inject
+    DataStoreManager dataStoreMgr;
+    @Inject
+    SnapshotDataStoreDao snapshotStoreDao;
+    @Inject
+    ConfigurationDao configDao;
+    @Inject
+    SnapshotDao snapshotDao;
+    @Inject
+    SnapshotDataFactory snapshotDataFactory;
+
+    @Override
+    public SnapshotInfo backupSnapshot(SnapshotInfo snapshot) {
+        SnapshotInfo parentSnapshot = snapshot.getParent();
+        if (parentSnapshot != null && parentSnapshot.getPath().equalsIgnoreCase(snapshot.getPath())) {
+            s_logger.debug("backup an empty snapshot");
+            // don't need to backup this snapshot
+            SnapshotDataStoreVO parentSnapshotOnBackupStore = this.snapshotStoreDao.findBySnapshot(
+                    parentSnapshot.getId(), DataStoreRole.Image);
+            if (parentSnapshotOnBackupStore != null && parentSnapshotOnBackupStore.getState() == State.Ready) {
+                DataStore store = dataStoreMgr.getDataStore(parentSnapshotOnBackupStore.getDataStoreId(),
+                        parentSnapshotOnBackupStore.getRole());
+
+                SnapshotInfo snapshotOnImageStore = (SnapshotInfo) store.create(snapshot);
+                snapshotOnImageStore.processEvent(Event.CreateOnlyRequested);
+
+                SnapshotObjectTO snapTO = new SnapshotObjectTO();
+                snapTO.setPath(parentSnapshotOnBackupStore.getInstallPath());
+                CreateObjectAnswer createSnapshotAnswer = new CreateObjectAnswer(snapTO);
+
+                snapshotOnImageStore.processEvent(Event.OperationSuccessed, createSnapshotAnswer);
+                SnapshotObject snapObj = (SnapshotObject) snapshot;
+                try {
+                    snapObj.processEvent(Snapshot.Event.OperationNotPerformed);
+                } catch (NoTransitionException e) {
+                    s_logger.debug("Failed to change state: " + snapshot.getId() + ": " + e.toString());
+                    throw new CloudRuntimeException(e.toString());
+                }
+                return this.snapshotDataFactory.getSnapshot(snapObj.getId(), store);
+            } else {
+                s_logger.debug("parent snapshot hasn't been backed up yet");
+            }
+        }
+
+        // determine full snapshot backup or not
+
+        boolean fullBackup = false;
+
+        if (parentSnapshot != null) {
+            int _deltaSnapshotMax = NumbersUtil.parseInt(configDao.getValue("snapshot.delta.max"),
+                    SnapshotManager.DELTAMAX);
+            int deltaSnap = _deltaSnapshotMax;
+
+            int i;
+            SnapshotDataStoreVO parentSnapshotOnBackupStore = null;
+            for (i = 1; i < deltaSnap; i++) {
+                parentSnapshotOnBackupStore = this.snapshotStoreDao.findBySnapshot(parentSnapshot.getId(),
+                        DataStoreRole.Image);
+
+                Long prevBackupId = parentSnapshotOnBackupStore.getParentSnapshotId();
+
+                if (prevBackupId == 0) {
+                    break;
+                }
+
+                parentSnapshotOnBackupStore = this.snapshotStoreDao.findBySnapshot(prevBackupId, DataStoreRole.Image);
+            }
+            if (i >= deltaSnap) {
+                fullBackup = true;
+            }
+        }
+
+        snapshot.addPayload(fullBackup);
+        return this.snapshotSvr.backupSnapshot(snapshot);
+    }
+
+    protected void deleteSnapshotChain(SnapshotInfo snapshot) {
+        while (snapshot != null) {
+            SnapshotInfo child = snapshot.getChild();
+            SnapshotInfo parent = snapshot.getParent();
+            if (child == null) {
+                if (parent == null || !parent.getPath().equalsIgnoreCase(snapshot.getPath())) {
+                    this.snapshotSvr.deleteSnapshot(snapshot);
+                    snapshot = parent;
+                    continue;
+                }
+                break;
+            } else {
+                break;
+            }
+        }
+    }
+
+    @Override
+    public boolean deleteSnapshot(Long snapshotId) {
+        SnapshotVO snapshotVO = snapshotDao.findById(snapshotId);
+        if (snapshotVO.getState() == Snapshot.State.Destroyed) {
+            return true;
+        }
+
+        if (!Snapshot.State.BackedUp.equals(snapshotVO.getState())) {
+            throw new InvalidParameterValueException("Can't delete snapshotshot " + snapshotId
+                    + " due to it is not in BackedUp Status");
+        }
+
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Calling deleteSnapshot for snapshotId: " + snapshotId);
+        }
+
+        // firt mark the snapshot as destroyed, so that ui can't see it, but we
+        // may not destroy the snapshot on the storage, as other snaphosts may
+        // depend on it.
+        SnapshotInfo snapshotOnPrimary = this.snapshotDataFactory.getSnapshot(snapshotId, DataStoreRole.Primary);
+        SnapshotObject obj = (SnapshotObject) snapshotOnPrimary;
+        try {
             obj.processEvent(Snapshot.Event.DestroyRequested);
         } catch (NoTransitionException e) {
             s_logger.debug("Failed to destroy snapshot: " + e.toString());
             return false;
         }
-		
-		try {
-			/*
-		    if (snapshotOnPrimary != null) {
-		        deleteSnapshotChain(snapshotOnPrimary);
-		    }*/
-
-		    SnapshotInfo snapshotOnImage = this.snapshotDataFactory.getSnapshot(snapshotId, DataStoreRole.Image);
-		    if (snapshotOnImage != null) {
-		        deleteSnapshotChain(snapshotOnImage);
-		    }
-		    
-		    obj.processEvent(Snapshot.Event.OperationSucceeded);
-		} catch (Exception e) {
-		    s_logger.debug("Failed to delete snapshot: " + e.toString());
-		    try {
+
+        try {
+            SnapshotInfo snapshotOnImage = this.snapshotDataFactory.getSnapshot(snapshotId, DataStoreRole.Image);
+            if (snapshotOnImage != null) {
+                deleteSnapshotChain(snapshotOnImage);
+            }
+
+            obj.processEvent(Snapshot.Event.OperationSucceeded);
+        } catch (Exception e) {
+            s_logger.debug("Failed to delete snapshot: " + e.toString());
+            try {
                 obj.processEvent(Snapshot.Event.OperationFailed);
             } catch (NoTransitionException e1) {
                 s_logger.debug("Failed to change snapshot state: " + e.toString());
             }
-		}
-		
-		return true;
-	}
-	
-	@Override
-	public SnapshotInfo takeSnapshot(SnapshotInfo snapshot) {
-		snapshot = snapshotSvr.takeSnapshot(snapshot).getSnashot();
-		//TODO: add async
-		return this.backupSnapshot(snapshot);
-	}
+        }
+
+        return true;
+    }
+
+    @Override
+    public SnapshotInfo takeSnapshot(SnapshotInfo snapshot) {
+        snapshot = snapshotSvr.takeSnapshot(snapshot).getSnashot();
+        // TODO: add async
+        return this.backupSnapshot(snapshot);
+    }
 
     @Override
     public boolean canHandle(Snapshot snapshot) {
-       return true;
+        return true;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotVO.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotVO.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotVO.java
index b05b803..43ec609 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotVO.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotVO.java
@@ -35,87 +35,88 @@ import com.cloud.utils.db.GenericDao;
 import com.google.gson.annotations.Expose;
 
 @Entity
-@Table(name="snapshots")
+@Table(name = "snapshots")
 public class SnapshotVO {
     @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
     private final long id = -1;
 
-    @Column(name="data_center_id")
+    @Column(name = "data_center_id")
     long dataCenterId;
 
-    @Column(name="account_id")
+    @Column(name = "account_id")
     long accountId;
 
-    @Column(name="domain_id")
+    @Column(name = "domain_id")
     long domainId;
 
-    @Column(name="volume_id")
+    @Column(name = "volume_id")
     Long volumeId;
 
-    @Column(name="disk_offering_id")
+    @Column(name = "disk_offering_id")
     Long diskOfferingId;
 
     @Expose
-    @Column(name="path")
+    @Column(name = "path")
     String path;
 
     @Expose
-    @Column(name="name")
+    @Column(name = "name")
     String name;
 
     @Expose
-    @Column(name="status", updatable = true, nullable=false)
-    @Enumerated(value=EnumType.STRING)
+    @Column(name = "status", updatable = true, nullable = false)
+    @Enumerated(value = EnumType.STRING)
     private State status;
 
-    @Column(name="snapshot_type")
+    @Column(name = "snapshot_type")
     short snapshotType;
 
-    @Column(name="type_description")
+    @Column(name = "type_description")
     String typeDescription;
 
-    @Column(name="size")
+    @Column(name = "size")
     long size;
 
-    @Column(name=GenericDao.CREATED_COLUMN)
+    @Column(name = GenericDao.CREATED_COLUMN)
     Date created;
 
-    @Column(name=GenericDao.REMOVED_COLUMN)
+    @Column(name = GenericDao.REMOVED_COLUMN)
     Date removed;
 
-    @Column(name="backup_snap_id")
+    @Column(name = "backup_snap_id")
     String backupSnapshotId;
 
-    @Column(name="swift_id")
+    @Column(name = "swift_id")
     Long swiftId;
 
-    @Column(name="s3_id")
+    @Column(name = "s3_id")
     Long s3Id;
 
-    @Column(name="sechost_id")
+    @Column(name = "sechost_id")
     Long secHostId;
 
-    @Column(name="prev_snap_id")
+    @Column(name = "prev_snap_id")
     long prevSnapshotId;
 
-    @Column(name="hypervisor_type")
-    @Enumerated(value=EnumType.STRING)
-    HypervisorType  hypervisorType;
+    @Column(name = "hypervisor_type")
+    @Enumerated(value = EnumType.STRING)
+    HypervisorType hypervisorType;
 
     @Expose
-    @Column(name="version")
+    @Column(name = "version")
     String version;
 
-    @Column(name="uuid")
+    @Column(name = "uuid")
     String uuid;
 
     public SnapshotVO() {
         this.uuid = UUID.randomUUID().toString();
     }
 
-    public SnapshotVO(long dcId, long accountId, long domainId, Long volumeId, Long diskOfferingId, String path, String name, short snapshotType, String typeDescription, long size, HypervisorType hypervisorType ) {
+    public SnapshotVO(long dcId, long accountId, long domainId, Long volumeId, Long diskOfferingId, String path,
+            String name, short snapshotType, String typeDescription, long size, HypervisorType hypervisorType) {
         this.dataCenterId = dcId;
         this.accountId = accountId;
         this.domainId = domainId;
@@ -141,16 +142,14 @@ public class SnapshotVO {
         return dataCenterId;
     }
 
-    
     public long getAccountId() {
         return accountId;
     }
 
-    
     public long getDomainId() {
         return domainId;
     }
-    
+
     public long getVolumeId() {
         return volumeId;
     }
@@ -210,8 +209,8 @@ public class SnapshotVO {
         this.snapshotType = snapshotType;
     }
 
-    public boolean isRecursive(){
-        if ( snapshotType >= Type.HOURLY.ordinal() && snapshotType <= Type.MONTHLY.ordinal() ) {
+    public boolean isRecursive() {
+        if (snapshotType >= Type.HOURLY.ordinal() && snapshotType <= Type.MONTHLY.ordinal()) {
             return true;
         }
         return false;
@@ -224,6 +223,7 @@ public class SnapshotVO {
     public String getTypeDescription() {
         return typeDescription;
     }
+
     public void setTypeDescription(String typeDescription) {
         this.typeDescription = typeDescription;
     }
@@ -252,25 +252,25 @@ public class SnapshotVO {
         this.status = status;
     }
 
-    public String getBackupSnapshotId(){
+    public String getBackupSnapshotId() {
         return backupSnapshotId;
     }
 
-    public long getPrevSnapshotId(){
+    public long getPrevSnapshotId() {
         return prevSnapshotId;
     }
 
-    public void setBackupSnapshotId(String backUpSnapshotId){
+    public void setBackupSnapshotId(String backUpSnapshotId) {
         this.backupSnapshotId = backUpSnapshotId;
     }
 
-    public void setPrevSnapshotId(long prevSnapshotId){
+    public void setPrevSnapshotId(long prevSnapshotId) {
         this.prevSnapshotId = prevSnapshotId;
     }
 
     public static Type getSnapshotType(String snapshotType) {
-        for ( Type type : Type.values()) {
-            if ( type.equals(snapshotType)) {
+        for (Type type : Type.values()) {
+            if (type.equals(snapshotType)) {
                 return type;
             }
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/snapshot/test/src/SnapshotDataFactoryTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/test/src/SnapshotDataFactoryTest.java b/engine/storage/snapshot/test/src/SnapshotDataFactoryTest.java
index e722ab5..317521d 100644
--- a/engine/storage/snapshot/test/src/SnapshotDataFactoryTest.java
+++ b/engine/storage/snapshot/test/src/SnapshotDataFactoryTest.java
@@ -18,33 +18,24 @@
  */
 package src;
 
-import javax.inject.Inject;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
 import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import com.cloud.utils.component.ComponentContext;
-
 import junit.framework.TestCase;
 
 //@RunWith(SpringJUnit4ClassRunner.class)
 //@ContextConfiguration(locations = "classpath:/SnapshotManagerTestContext.xml")
 public class SnapshotDataFactoryTest extends TestCase {
-    //@Inject SnapshotDataFactory snapshotFactory;
-    
+    // @Inject SnapshotDataFactory snapshotFactory;
+
     @Before
     public void setup() throws Exception {
-        //ComponentContext.initComponentsLifeCycle();
-        
+        // ComponentContext.initComponentsLifeCycle();
+
     }
-    
+
     @Test
     public void testGestSnapshot() {
-        //snapshotFactory.getSnapshot(snapshotId);
+        // snapshotFactory.getSnapshot(snapshotId);
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/src/org/apache/cloudstack/storage/BaseType.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/BaseType.java b/engine/storage/src/org/apache/cloudstack/storage/BaseType.java
index a5b45e1..5397926 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/BaseType.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/BaseType.java
@@ -19,6 +19,7 @@
 package org.apache.cloudstack.storage;
 
 public abstract class BaseType {
+    @Override
     public boolean equals(Object that) {
         if (this == that) {
             return true;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/src/org/apache/cloudstack/storage/HostEndpointRpcServer.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/HostEndpointRpcServer.java b/engine/storage/src/org/apache/cloudstack/storage/HostEndpointRpcServer.java
deleted file mode 100644
index 01611be..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/HostEndpointRpcServer.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage;
-
-import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-
-public interface HostEndpointRpcServer {
-    void sendCommandAsync(RemoteHostEndPoint ep, final Command command, final AsyncCompletionCallback<Answer> callback);
-    Answer sendCommand(RemoteHostEndPoint ep, final Command command);
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPointRpcServer.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPointRpcServer.java b/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPointRpcServer.java
deleted file mode 100644
index 5675b73..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPointRpcServer.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-
-import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
-import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
-import org.apache.cloudstack.framework.async.AsyncRpcConext;
-import org.apache.cloudstack.framework.rpc.RpcCallbackListener;
-import org.apache.cloudstack.framework.rpc.RpcException;
-import org.apache.cloudstack.framework.rpc.RpcProvider;
-import org.apache.cloudstack.framework.rpc.RpcServiceDispatcher;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-@Component
-public class HypervisorHostEndPointRpcServer implements HostEndpointRpcServer {
-    private static final Logger s_logger = Logger.getLogger(HypervisorHostEndPointRpcServer.class);
-    
-    @Inject
-    private RpcProvider rpcProvider;
-    
-    public HypervisorHostEndPointRpcServer() {
-    }
-    
-    public HypervisorHostEndPointRpcServer(RpcProvider rpcProvider) {
-        rpcProvider = rpcProvider;
-        rpcProvider.registerRpcServiceEndpoint(RpcServiceDispatcher.getDispatcher(this));
-    }
-    
-    @PostConstruct
-    public void Initialize() {
-        rpcProvider.registerRpcServiceEndpoint(RpcServiceDispatcher.getDispatcher(this));
-    }
-    
-    @Override
-    public void sendCommandAsync(RemoteHostEndPoint host, final Command command, final AsyncCompletionCallback<Answer> callback) {
-        rpcProvider.newCall(host.getHostAddr()).addCallbackListener(new RpcCallbackListener<Answer>() {
-            @Override
-            public void onSuccess(Answer result) {
-                callback.complete(result);
-            }
-
-            @Override
-            public void onFailure(RpcException e) {
-                Answer answer = new Answer(command, false, e.toString());
-                callback.complete(answer);
-            }
-        }).apply();
-    }
-    
-    private class SendCommandContext<T> extends AsyncRpcConext<T> {
-        private T answer;
-       
-        public SendCommandContext(AsyncCompletionCallback<T> callback) {
-            super(callback);
-        }
-        
-        public void setAnswer(T answer) {
-            this.answer = answer;
-        }
-        
-        public T getAnswer() {
-            return this.answer;
-        }
-        
-    }
-
-    @Override
-    public Answer sendCommand(RemoteHostEndPoint host, Command command) {
-        SendCommandContext<Answer> context = new SendCommandContext<Answer>(null);
-        AsyncCallbackDispatcher<HypervisorHostEndPointRpcServer, Answer> caller = AsyncCallbackDispatcher.create(this);
-        caller.setCallback(caller.getTarget().sendCommandCallback(null, null))
-        .setContext(context);
-        
-        this.sendCommandAsync(host, command, caller);
-        
-        synchronized (context) {
-            try {
-                context.wait();
-            } catch (InterruptedException e) {
-                s_logger.debug(e.toString());
-                throw new CloudRuntimeException("wait on context is interrupted", e);
-            }
-        }
-        
-        return context.getAnswer();
-    }
-    
-    protected Object sendCommandCallback(AsyncCallbackDispatcher<HypervisorHostEndPointRpcServer, Answer> callback, SendCommandContext<Answer> context) {
-        context.setAnswer((Answer)callback.getResult());
-        synchronized(context) {
-            context.notify();
-        }
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java b/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java
index c095791..18fcd71 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java
@@ -26,38 +26,34 @@ import org.apache.cloudstack.storage.command.CopyCommand;
 import org.apache.cloudstack.storage.command.DownloadCommand;
 import org.apache.cloudstack.storage.resource.LocalNfsSecondaryStorageResource;
 
-import com.cloud.agent.Listener;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
-import com.cloud.agent.api.storage.DownloadAnswer;
 import com.cloud.resource.ServerResource;
-import com.cloud.storage.VMTemplateStorageResourceAssoc;
-import com.cloud.storage.download.DownloadListener;
 import com.cloud.utils.net.NetUtils;
 
 public class LocalHostEndpoint implements EndPoint {
-	private ScheduledExecutorService executor;
-	protected ServerResource resource;
-	public LocalHostEndpoint() {
+    private ScheduledExecutorService executor;
+    protected ServerResource resource;
+
+    public LocalHostEndpoint() {
         resource = new LocalNfsSecondaryStorageResource();
-		executor = Executors.newScheduledThreadPool(10);
-	}
-	@Override
-	public long getId() {
-		// TODO Auto-generated method stub
-		return 0;
-	}
+        executor = Executors.newScheduledThreadPool(10);
+    }
 
+    @Override
+    public long getId() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
 
-	@Override
+    @Override
     public String getHostAddr() {
         return "127.0.0.0";
     }
 
-
     @Override
     public String getPublicAddr() {
-        String hostIp= NetUtils.getDefaultHostIp();
+        String hostIp = NetUtils.getDefaultHostIp();
         if (hostIp != null)
             return hostIp;
         else
@@ -65,70 +61,41 @@ public class LocalHostEndpoint implements EndPoint {
     }
 
     @Override
-	public Answer sendMessage(Command cmd) {
-		if ((cmd instanceof CopyCommand) || (cmd instanceof DownloadCommand)) {
-			return resource.executeRequest(cmd);
-		}
-		// TODO Auto-generated method stub
-		return new Answer(cmd, false, "unsupported command:" + cmd.toString());
-	}
-
-	private class CmdRunner implements Runnable {
-		final Command cmd;
-		final AsyncCompletionCallback<Answer> callback;
-		public CmdRunner(Command cmd, AsyncCompletionCallback<Answer> callback) {
-			this.cmd = cmd;
-			this.callback = callback;
-		}
-		@Override
-		public void run() {
-			Answer answer = sendMessage(cmd);
-			callback.complete(answer);
-		}
-	}
-
-	private class CmdRunner2 implements Runnable {
-		final Command cmd;
-		final Listener listener;
-		public CmdRunner2(Command cmd, Listener listener) {
-			this.cmd = cmd;
-			this.listener = listener;
-		}
-		@Override
-		public void run() {
-            try {
-                DownloadAnswer answer = (DownloadAnswer) sendMessage(cmd);
-                Answer[] answers = new Answer[1];
-                answers[0] = answer;
-                listener.processAnswers(getId(), 0, answers);
-                if (listener instanceof DownloadListener) {
-                    DownloadListener dwldListener = (DownloadListener)listener;
-                    dwldListener.getCallback().complete(answer);
-                }
-            } catch (Exception ex) {
-                DownloadAnswer fail = new DownloadAnswer("Error in handling DownloadCommand : " + ex.getMessage(), VMTemplateStorageResourceAssoc.Status.DOWNLOAD_ERROR);
-                Answer[] answers = new Answer[1];
-                answers[0] = fail;
-                listener.processAnswers(getId(), 0, answers);
-                if (listener instanceof DownloadListener) {
-                    DownloadListener dwldListener = (DownloadListener)listener;
-                    dwldListener.getCallback().complete(fail);
-                }
-            }
-		}
-	}
-	@Override
+    public Answer sendMessage(Command cmd) {
+        if ((cmd instanceof CopyCommand) || (cmd instanceof DownloadCommand)) {
+            return resource.executeRequest(cmd);
+        }
+        // TODO Auto-generated method stub
+        return new Answer(cmd, false, "unsupported command:" + cmd.toString());
+    }
+
+    private class CmdRunner implements Runnable {
+        final Command cmd;
+        final AsyncCompletionCallback<Answer> callback;
+
+        public CmdRunner(Command cmd, AsyncCompletionCallback<Answer> callback) {
+            this.cmd = cmd;
+            this.callback = callback;
+        }
+
+        @Override
+        public void run() {
+            Answer answer = sendMessage(cmd);
+            callback.complete(answer);
+        }
+    }
+
+    @Override
     public void sendMessageAsync(Command cmd, AsyncCompletionCallback<Answer> callback) {
-		 executor.schedule(new CmdRunner(cmd, callback), 10, TimeUnit.SECONDS);
-	}
+        executor.schedule(new CmdRunner(cmd, callback), 10, TimeUnit.SECONDS);
+    }
 
     public ServerResource getResource() {
         return resource;
     }
+
     public void setResource(ServerResource resource) {
         this.resource = resource;
     }
 
-
-
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/src/org/apache/cloudstack/storage/RemoteHostEndPoint.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/RemoteHostEndPoint.java b/engine/storage/src/org/apache/cloudstack/storage/RemoteHostEndPoint.java
index 5b0debb..cd64ab2 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/RemoteHostEndPoint.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/RemoteHostEndPoint.java
@@ -47,19 +47,17 @@ import com.cloud.utils.exception.CloudRuntimeException;
 
 public class RemoteHostEndPoint implements EndPoint {
     private static final Logger s_logger = Logger.getLogger(RemoteHostEndPoint.class);
-    private  long hostId;
-    private  String hostAddress;
-    private  String publicAddress;
+    private long hostId;
+    private String hostAddress;
+    private String publicAddress;
     @Inject
     AgentManager agentMgr;
     @Inject
-    HostEndpointRpcServer rpcServer;
-    @Inject
     protected HypervisorGuruManager _hvGuruMgr;
     private ScheduledExecutorService executor;
 
     public RemoteHostEndPoint() {
-    	executor = Executors.newScheduledThreadPool(10);
+        executor = Executors.newScheduledThreadPool(10);
     }
 
     private void configure(long hostId, String hostAddress, String publicAddress) {
@@ -79,7 +77,7 @@ public class RemoteHostEndPoint implements EndPoint {
         return this.hostAddress;
     }
 
-
+    @Override
     public String getPublicAddr() {
         return this.publicAddress;
     }
@@ -91,27 +89,27 @@ public class RemoteHostEndPoint implements EndPoint {
 
     @Override
     public Answer sendMessage(Command cmd) {
-    	String errMsg = null;
-    	try {
-    	    long newHostId = _hvGuruMgr.getGuruProcessedCommandTargetHost(hostId, cmd);
-			return agentMgr.send(newHostId, cmd);
-		} catch (AgentUnavailableException e) {
-			errMsg = e.toString();
-			s_logger.debug("Failed to send command, due to Agent:" + getId() + ", " + e.toString());
-		} catch (OperationTimedoutException e) {
-			errMsg = e.toString();
-			s_logger.debug("Failed to send command, due to Agent:" + getId() + ", " + e.toString());
-		}
-    	throw new CloudRuntimeException("Failed to send command, due to Agent:" + getId() + ", " + errMsg);
+        String errMsg = null;
+        try {
+            long newHostId = _hvGuruMgr.getGuruProcessedCommandTargetHost(hostId, cmd);
+            return agentMgr.send(newHostId, cmd);
+        } catch (AgentUnavailableException e) {
+            errMsg = e.toString();
+            s_logger.debug("Failed to send command, due to Agent:" + getId() + ", " + e.toString());
+        } catch (OperationTimedoutException e) {
+            errMsg = e.toString();
+            s_logger.debug("Failed to send command, due to Agent:" + getId() + ", " + e.toString());
+        }
+        throw new CloudRuntimeException("Failed to send command, due to Agent:" + getId() + ", " + errMsg);
     }
 
     private class CmdRunner implements Listener, Runnable {
-		final AsyncCompletionCallback<Answer> callback;
+        final AsyncCompletionCallback<Answer> callback;
         Answer answer;
 
         public CmdRunner(AsyncCompletionCallback<Answer> callback) {
-			this.callback = callback;
-		}
+            this.callback = callback;
+        }
 
         @Override
         public boolean processAnswers(long agentId, long seq, Answer[] answers) {
@@ -166,12 +164,12 @@ public class RemoteHostEndPoint implements EndPoint {
         public void run() {
             callback.complete(answer);
         }
-	}
+    }
 
     @Override
     public void sendMessageAsync(Command cmd, AsyncCompletionCallback<Answer> callback) {
         try {
-    	    long newHostId = _hvGuruMgr.getGuruProcessedCommandTargetHost(this.hostId, cmd);
+            long newHostId = _hvGuruMgr.getGuruProcessedCommandTargetHost(this.hostId, cmd);
             agentMgr.send(newHostId, new Commands(cmd), new CmdRunner(callback));
         } catch (AgentUnavailableException e) {
             throw new CloudRuntimeException("Unable to send message", e);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
index 3a66b85..010e468 100755
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
@@ -53,140 +53,153 @@ import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 public abstract class AbstractStoragePoolAllocator extends AdapterBase implements StoragePoolAllocator {
-	private static final Logger s_logger = Logger.getLogger(AbstractStoragePoolAllocator.class);
-    @Inject StorageManager storageMgr;
-    protected @Inject PrimaryDataStoreDao _storagePoolDao;
-    @Inject VolumeDao _volumeDao;
-    @Inject ConfigurationDao _configDao;
-    @Inject ClusterDao _clusterDao;
-    protected @Inject DataStoreManager dataStoreMgr;
-    protected BigDecimal _storageOverprovisioningFactor = new BigDecimal(1);    
+    private static final Logger s_logger = Logger.getLogger(AbstractStoragePoolAllocator.class);
+    @Inject
+    StorageManager storageMgr;
+    protected @Inject
+    PrimaryDataStoreDao _storagePoolDao;
+    @Inject
+    VolumeDao _volumeDao;
+    @Inject
+    ConfigurationDao _configDao;
+    @Inject
+    ClusterDao _clusterDao;
+    protected @Inject
+    DataStoreManager dataStoreMgr;
+    protected BigDecimal _storageOverprovisioningFactor = new BigDecimal(1);
     long _extraBytesPerVolume = 0;
     Random _rand;
     boolean _dontMatter;
     protected String _allocationAlgorithm = "random";
     @Inject
     DiskOfferingDao _diskOfferingDao;
-    
+
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
         super.configure(name, params);
-        
+
         Map<String, String> configs = _configDao.getConfiguration(null, params);
-        
+
         String globalStorageOverprovisioningFactor = configs.get("storage.overprovisioning.factor");
-        _storageOverprovisioningFactor = new BigDecimal(NumbersUtil.parseFloat(globalStorageOverprovisioningFactor, 2.0f));
-        
+        _storageOverprovisioningFactor = new BigDecimal(NumbersUtil.parseFloat(globalStorageOverprovisioningFactor,
+                2.0f));
+
         _extraBytesPerVolume = 0;
-        
+
         _rand = new Random(System.currentTimeMillis());
 
         _dontMatter = Boolean.parseBoolean(configs.get("storage.overwrite.provisioning"));
 
         String allocationAlgorithm = configs.get("vm.allocation.algorithm");
         if (allocationAlgorithm != null) {
-        	_allocationAlgorithm = allocationAlgorithm;
+            _allocationAlgorithm = allocationAlgorithm;
         }
 
         return true;
     }
-	
-	protected abstract List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo);
-    
+
+    protected abstract List<StoragePool> select(DiskProfile dskCh,
+            VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid,
+            int returnUpTo);
+
     @Override
-	public
-    List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
-    	List<StoragePool> pools = select(dskCh, vmProfile, plan, avoid, returnUpTo);
-    	return reOrder(pools, vmProfile, plan);
+    public List<StoragePool> allocateToPool(DiskProfile dskCh,
+            VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid,
+            int returnUpTo) {
+        List<StoragePool> pools = select(dskCh, vmProfile, plan, avoid, returnUpTo);
+        return reOrder(pools, vmProfile, plan);
     }
-    
-    protected List<StoragePool> reorderPoolsByNumberOfVolumes(DeploymentPlan plan, List<StoragePool> pools, Account account) {
-        if(account == null){
+
+    protected List<StoragePool> reorderPoolsByNumberOfVolumes(DeploymentPlan plan, List<StoragePool> pools,
+            Account account) {
+        if (account == null) {
             return pools;
         }
         long dcId = plan.getDataCenterId();
         Long podId = plan.getPodId();
         Long clusterId = plan.getClusterId();
-            
-        List<Long> poolIdsByVolCount = _volumeDao.listPoolIdsByVolumeCount(dcId, podId, clusterId, account.getAccountId());
+
+        List<Long> poolIdsByVolCount = _volumeDao.listPoolIdsByVolumeCount(dcId, podId, clusterId,
+                account.getAccountId());
         if (s_logger.isDebugEnabled()) {
-            s_logger.debug("List of pools in ascending order of number of volumes for account id: "+ account.getAccountId() + " is: "+ poolIdsByVolCount);
+            s_logger.debug("List of pools in ascending order of number of volumes for account id: "
+                    + account.getAccountId() + " is: " + poolIdsByVolCount);
         }
-            
-        //now filter the given list of Pools by this ordered list
-        Map<Long, StoragePool> poolMap = new HashMap<Long, StoragePool>();        
+
+        // now filter the given list of Pools by this ordered list
+        Map<Long, StoragePool> poolMap = new HashMap<Long, StoragePool>();
         for (StoragePool pool : pools) {
             poolMap.put(pool.getId(), pool);
         }
         List<Long> matchingPoolIds = new ArrayList<Long>(poolMap.keySet());
-        
+
         poolIdsByVolCount.retainAll(matchingPoolIds);
-        
+
         List<StoragePool> reorderedPools = new ArrayList<StoragePool>();
-        for(Long id: poolIdsByVolCount){
+        for (Long id : poolIdsByVolCount) {
             reorderedPools.add(poolMap.get(id));
         }
-        
+
         return reorderedPools;
     }
-    
-    protected List<StoragePool> reOrder(List<StoragePool> pools, 
-    		VirtualMachineProfile<? extends VirtualMachine> vmProfile,
-    		DeploymentPlan plan) {
-    	Account account = null;
-    	if(vmProfile.getVirtualMachine() != null){
-    		account = vmProfile.getOwner();
-    	}
-    	
-    	if(_allocationAlgorithm.equals("random") || _allocationAlgorithm.equals("userconcentratedpod_random") || (account == null)) {
-    		// Shuffle this so that we don't check the pools in the same order.
-    		Collections.shuffle(pools);
-    	}else if(_allocationAlgorithm.equals("userdispersing")){
-    		pools = reorderPoolsByNumberOfVolumes(plan, pools, account);
-    	}
-    	return pools;
+
+    protected List<StoragePool> reOrder(List<StoragePool> pools,
+            VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan) {
+        Account account = null;
+        if (vmProfile.getVirtualMachine() != null) {
+            account = vmProfile.getOwner();
+        }
+
+        if (_allocationAlgorithm.equals("random") || _allocationAlgorithm.equals("userconcentratedpod_random")
+                || (account == null)) {
+            // Shuffle this so that we don't check the pools in the same order.
+            Collections.shuffle(pools);
+        } else if (_allocationAlgorithm.equals("userdispersing")) {
+            pools = reorderPoolsByNumberOfVolumes(plan, pools, account);
+        }
+        return pools;
     }
-	
-	protected boolean filter(ExcludeList avoid, StoragePool pool, DiskProfile dskCh, 
-		 DeploymentPlan plan) {
-		
-		if (s_logger.isDebugEnabled()) {
-            s_logger.debug("Checking if storage pool is suitable, name: " + pool.getName()+ " ,poolId: "+ pool.getId());
+
+    protected boolean filter(ExcludeList avoid, StoragePool pool, DiskProfile dskCh, DeploymentPlan plan) {
+
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Checking if storage pool is suitable, name: " + pool.getName() + " ,poolId: "
+                    + pool.getId());
         }
-		if (avoid.shouldAvoid(pool)) {
-			if (s_logger.isDebugEnabled()) {
+        if (avoid.shouldAvoid(pool)) {
+            if (s_logger.isDebugEnabled()) {
                 s_logger.debug("StoragePool is in avoid set, skipping this pool");
-            }			
-			return false;
-		}
-		
-        if(dskCh.getType().equals(Type.ROOT) && pool.getPoolType().equals(StoragePoolType.Iscsi)){
-    		if (s_logger.isDebugEnabled()) {
+            }
+            return false;
+        }
+
+        if (dskCh.getType().equals(Type.ROOT) && pool.getPoolType().equals(StoragePoolType.Iscsi)) {
+            if (s_logger.isDebugEnabled()) {
                 s_logger.debug("Disk needed for ROOT volume, but StoragePoolType is Iscsi, skipping this and trying other available pools");
-            }	
+            }
             return false;
         }
-        
+
         DiskOfferingVO diskOffering = _diskOfferingDao.findById(dskCh.getDiskOfferingId());
         if (diskOffering.getSystemUse() && pool.getPoolType() == StoragePoolType.RBD) {
-            s_logger.debug("Skipping RBD pool " + pool.getName() + " as a suitable pool. RBD is not supported for System VM's");
+            s_logger.debug("Skipping RBD pool " + pool.getName()
+                    + " as a suitable pool. RBD is not supported for System VM's");
             return false;
         }
 
-        
-		Long clusterId = pool.getClusterId();
-		ClusterVO cluster = _clusterDao.findById(clusterId);
-		if (!(cluster.getHypervisorType() == dskCh.getHypervisorType())) {
-    		if (s_logger.isDebugEnabled()) {
+        Long clusterId = pool.getClusterId();
+        ClusterVO cluster = _clusterDao.findById(clusterId);
+        if (!(cluster.getHypervisorType() == dskCh.getHypervisorType())) {
+            if (s_logger.isDebugEnabled()) {
                 s_logger.debug("StoragePool's Cluster does not have required hypervisorType, skipping this pool");
             }
-			return false;
-		}
+            return false;
+        }
 
-        // check capacity  
-        Volume volume =  _volumeDao.findById(dskCh.getVolumeId());
+        // check capacity
+        Volume volume = _volumeDao.findById(dskCh.getVolumeId());
         List<Volume> requestVolumes = new ArrayList<Volume>();
         requestVolumes.add(volume);
         return storageMgr.storagePoolHasEnoughSpace(requestVolumes, pool);
-	}
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
index 5b1f8cd..0933adc 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
@@ -40,7 +40,7 @@ import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 @Component
-@Local(value=StoragePoolAllocator.class)
+@Local(value = StoragePoolAllocator.class)
 public class ClusterScopeStoragePoolAllocator extends AbstractStoragePoolAllocator {
     private static final Logger s_logger = Logger.getLogger(ClusterScopeStoragePoolAllocator.class);
     protected String _allocationAlgorithm = "random";
@@ -49,19 +49,21 @@ public class ClusterScopeStoragePoolAllocator extends AbstractStoragePoolAllocat
     DiskOfferingDao _diskOfferingDao;
 
     @Override
-	protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
+    protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+            DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
 
         s_logger.debug("ClusterScopeStoragePoolAllocator looking for storage pool");
-    	List<StoragePool> suitablePools = new ArrayList<StoragePool>();
+        List<StoragePool> suitablePools = new ArrayList<StoragePool>();
 
-		long dcId = plan.getDataCenterId();
-		Long podId = plan.getPodId();
-		Long clusterId = plan.getClusterId();
+        long dcId = plan.getDataCenterId();
+        Long podId = plan.getPodId();
+        Long clusterId = plan.getClusterId();
 
-        if(dskCh.getTags() != null && dskCh.getTags().length != 0){
-        	s_logger.debug("Looking for pools in dc: " + dcId + "  pod:" + podId + "  cluster:" + clusterId + " having tags:" + Arrays.toString(dskCh.getTags()));
-        }else{
-        	s_logger.debug("Looking for pools in dc: " + dcId + "  pod:" + podId + "  cluster:" + clusterId);
+        if (dskCh.getTags() != null && dskCh.getTags().length != 0) {
+            s_logger.debug("Looking for pools in dc: " + dcId + "  pod:" + podId + "  cluster:" + clusterId
+                    + " having tags:" + Arrays.toString(dskCh.getTags()));
+        } else {
+            s_logger.debug("Looking for pools in dc: " + dcId + "  pod:" + podId + "  cluster:" + clusterId);
         }
 
         List<StoragePoolVO> pools = _storagePoolDao.findPoolsByTags(dcId, podId, clusterId, dskCh.getTags());
@@ -75,30 +77,31 @@ public class ClusterScopeStoragePoolAllocator extends AbstractStoragePoolAllocat
 
         if (pools.size() == 0) {
             if (s_logger.isDebugEnabled()) {
-                String storageType = dskCh.useLocalStorage() ? ServiceOffering.StorageType.local.toString() : ServiceOffering.StorageType.shared.toString();
+                String storageType = dskCh.useLocalStorage() ? ServiceOffering.StorageType.local.toString()
+                        : ServiceOffering.StorageType.shared.toString();
                 s_logger.debug("No storage pools available for " + storageType + " volume allocation, returning");
             }
             return suitablePools;
         }
 
-        for (StoragePoolVO pool: pools) {
-        	if(suitablePools.size() == returnUpTo){
-        		break;
-        	}
-        	StoragePool pol = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(pool.getId());
-        	if (filter(avoid, pol, dskCh, plan)) {
-        		suitablePools.add(pol);
+        for (StoragePoolVO pool : pools) {
+            if (suitablePools.size() == returnUpTo) {
+                break;
+            }
+            StoragePool pol = (StoragePool) this.dataStoreMgr.getPrimaryDataStore(pool.getId());
+            if (filter(avoid, pol, dskCh, plan)) {
+                suitablePools.add(pol);
             } else {
                 avoid.addPool(pool.getId());
-        	}
+            }
         }
 
         if (s_logger.isDebugEnabled()) {
-            s_logger.debug("FirstFitStoragePoolAllocator returning "+suitablePools.size() +" suitable storage pools");
+            s_logger.debug("FirstFitStoragePoolAllocator returning " + suitablePools.size() + " suitable storage pools");
         }
 
         return suitablePools;
-	}
+    }
 
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/src/org/apache/cloudstack/storage/allocator/GarbageCollectingStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/GarbageCollectingStoragePoolAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/GarbageCollectingStoragePoolAllocator.java
index 02032ee..979ea73 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/GarbageCollectingStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/GarbageCollectingStoragePoolAllocator.java
@@ -36,18 +36,21 @@ import com.cloud.vm.DiskProfile;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
-@Local(value=StoragePoolAllocator.class)
+@Local(value = StoragePoolAllocator.class)
 public class GarbageCollectingStoragePoolAllocator extends AbstractStoragePoolAllocator {
     private static final Logger s_logger = Logger.getLogger(GarbageCollectingStoragePoolAllocator.class);
 
     StoragePoolAllocator _firstFitStoragePoolAllocator;
     StoragePoolAllocator _localStoragePoolAllocator;
-    @Inject StorageManager storageMgr;
-    @Inject ConfigurationDao _configDao;
+    @Inject
+    StorageManager storageMgr;
+    @Inject
+    ConfigurationDao _configDao;
     boolean _storagePoolCleanupEnabled;
 
     @Override
-    public List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
+    public List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+            DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
         s_logger.debug("GarbageCollectingStoragePoolAllocator looking for storage pool");
         if (!_storagePoolCleanupEnabled) {
             s_logger.debug("Storage pool cleanup is not enabled, so GarbageCollectingStoragePoolAllocator is being skipped.");
@@ -65,7 +68,8 @@ public class GarbageCollectingStoragePoolAllocator extends AbstractStoragePoolAl
         }
 
         // Try to find a storage pool after cleanup
-        ExcludeList myAvoids = new ExcludeList(avoid.getDataCentersToAvoid(), avoid.getPodsToAvoid(), avoid.getClustersToAvoid(), avoid.getHostsToAvoid(), avoid.getPoolsToAvoid());
+        ExcludeList myAvoids = new ExcludeList(avoid.getDataCentersToAvoid(), avoid.getPodsToAvoid(),
+                avoid.getClustersToAvoid(), avoid.getHostsToAvoid(), avoid.getPoolsToAvoid());
 
         return allocator.allocateToPool(dskCh, vmProfile, plan, myAvoids, returnUpTo);
     }
@@ -80,7 +84,8 @@ public class GarbageCollectingStoragePoolAllocator extends AbstractStoragePoolAl
         _localStoragePoolAllocator.configure("GCLocalStoragePoolAllocator", params);
 
         String storagePoolCleanupEnabled = _configDao.getValue("storage.pool.cleanup.enabled");
-        _storagePoolCleanupEnabled = (storagePoolCleanupEnabled == null) ? true : Boolean.parseBoolean(storagePoolCleanupEnabled);
+        _storagePoolCleanupEnabled = (storagePoolCleanupEnabled == null) ? true : Boolean
+                .parseBoolean(storagePoolCleanupEnabled);
 
         return true;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java
index 632ba43..ef9e84e 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java
@@ -65,7 +65,8 @@ public class LocalStoragePoolAllocator extends AbstractStoragePoolAllocator {
     ConfigurationDao _configDao;
 
     @Override
-    protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
+    protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+            DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
 
         List<StoragePool> suitablePools = new ArrayList<StoragePool>();
 
@@ -78,13 +79,13 @@ public class LocalStoragePoolAllocator extends AbstractStoragePoolAllocator {
         // data disk and host identified from deploying vm (attach volume case)
         if (dskCh.getType() == Volume.Type.DATADISK && plan.getHostId() != null) {
             List<StoragePoolHostVO> hostPools = _poolHostDao.listByHostId(plan.getHostId());
-            for (StoragePoolHostVO hostPool: hostPools) {
+            for (StoragePoolHostVO hostPool : hostPools) {
                 StoragePoolVO pool = _storagePoolDao.findById(hostPool.getPoolId());
                 if (pool != null && pool.isLocal()) {
-                	StoragePool pol = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(pool.getId());
-                	if (filter(avoid, pol, dskCh, plan)) {
-                		s_logger.debug("Found suitable local storage pool " + pool.getId() + ", adding to list");
-                		suitablePools.add(pol);
+                    StoragePool pol = (StoragePool) this.dataStoreMgr.getPrimaryDataStore(pool.getId());
+                    if (filter(avoid, pol, dskCh, plan)) {
+                        s_logger.debug("Found suitable local storage pool " + pool.getId() + ", adding to list");
+                        suitablePools.add(pol);
                     } else {
                         avoid.addPool(pool.getId());
                     }
@@ -95,18 +96,19 @@ public class LocalStoragePoolAllocator extends AbstractStoragePoolAllocator {
                 }
             }
         } else {
-        	List<StoragePoolVO> availablePools = _storagePoolDao.findLocalStoragePoolsByTags(plan.getDataCenterId(), plan.getPodId(), plan.getClusterId(), dskCh.getTags());
-        	for (StoragePoolVO pool : availablePools) {
-        		if (suitablePools.size() == returnUpTo) {
-            		break;
-            	}
-        		StoragePool pol = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(pool.getId());
-        		if (filter(avoid, pol, dskCh, plan)) {
-        			suitablePools.add(pol);
+            List<StoragePoolVO> availablePools = _storagePoolDao.findLocalStoragePoolsByTags(plan.getDataCenterId(),
+                    plan.getPodId(), plan.getClusterId(), dskCh.getTags());
+            for (StoragePoolVO pool : availablePools) {
+                if (suitablePools.size() == returnUpTo) {
+                    break;
+                }
+                StoragePool pol = (StoragePool) this.dataStoreMgr.getPrimaryDataStore(pool.getId());
+                if (filter(avoid, pol, dskCh, plan)) {
+                    suitablePools.add(pol);
                 } else {
                     avoid.addPool(pool.getId());
                 }
-        	}
+            }
 
             // add remaining pools in cluster, that did not match tags, to avoid
             // set

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/src/org/apache/cloudstack/storage/allocator/UseLocalForRootAllocator.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/UseLocalForRootAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/UseLocalForRootAllocator.java
index 4663b12..d057138 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/UseLocalForRootAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/UseLocalForRootAllocator.java
@@ -34,22 +34,24 @@ import com.cloud.vm.DiskProfile;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
-@Local(value=StoragePoolAllocator.class)
+@Local(value = StoragePoolAllocator.class)
 public class UseLocalForRootAllocator extends LocalStoragePoolAllocator implements StoragePoolAllocator {
 
     @Inject
     DataCenterDao _dcDao;
 
     @Override
-    public List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
+    public List<StoragePool> allocateToPool(DiskProfile dskCh,
+            VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid,
+            int returnUpTo) {
         DataCenterVO dc = _dcDao.findById(plan.getDataCenterId());
         if (!dc.isLocalStorageEnabled()) {
             return null;
         }
-        
+
         return super.allocateToPool(dskCh, vmProfile, plan, avoid, returnUpTo);
     }
-    
+
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
         super.configure(name, params);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
index e976980..8155edf 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
@@ -38,34 +38,35 @@ import com.cloud.vm.VirtualMachineProfile;
 
 @Component
 public class ZoneWideStoragePoolAllocator extends AbstractStoragePoolAllocator {
-	private static final Logger s_logger = Logger.getLogger(ZoneWideStoragePoolAllocator.class);
-	@Inject PrimaryDataStoreDao _storagePoolDao;
-	@Inject DataStoreManager dataStoreMgr;
+    private static final Logger s_logger = Logger.getLogger(ZoneWideStoragePoolAllocator.class);
+    @Inject
+    PrimaryDataStoreDao _storagePoolDao;
+    @Inject
+    DataStoreManager dataStoreMgr;
 
-	@Override
-	protected boolean filter(ExcludeList avoid, StoragePool pool, DiskProfile dskCh,
-			 DeploymentPlan plan) {
-        Volume volume =  _volumeDao.findById(dskCh.getVolumeId());
+    @Override
+    protected boolean filter(ExcludeList avoid, StoragePool pool, DiskProfile dskCh, DeploymentPlan plan) {
+        Volume volume = _volumeDao.findById(dskCh.getVolumeId());
         List<Volume> requestVolumes = new ArrayList<Volume>();
         requestVolumes.add(volume);
         return storageMgr.storagePoolHasEnoughSpace(requestVolumes, pool);
-	}
+    }
 
-	@Override
-	protected List<StoragePool> select(DiskProfile dskCh,
-			VirtualMachineProfile<? extends VirtualMachine> vmProfile,
-			DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
-	    s_logger.debug("ZoneWideStoragePoolAllocator to find storage pool");
-		List<StoragePool> suitablePools = new ArrayList<StoragePool>();
-		HypervisorType hypervisor = dskCh.getHypervisorType();
-		if (hypervisor != null) {
-			if (hypervisor != HypervisorType.KVM) {
-				s_logger.debug("Only kvm supports zone wide storage");
-				return suitablePools;
-			}
-		}
+    @Override
+    protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+            DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
+        s_logger.debug("ZoneWideStoragePoolAllocator to find storage pool");
+        List<StoragePool> suitablePools = new ArrayList<StoragePool>();
+        HypervisorType hypervisor = dskCh.getHypervisorType();
+        if (hypervisor != null) {
+            if (hypervisor != HypervisorType.KVM) {
+                s_logger.debug("Only kvm supports zone wide storage");
+                return suitablePools;
+            }
+        }
 
-		List<StoragePoolVO> storagePools = _storagePoolDao.findZoneWideStoragePoolsByTags(plan.getDataCenterId(), dskCh.getTags());
+        List<StoragePoolVO> storagePools = _storagePoolDao.findZoneWideStoragePoolsByTags(plan.getDataCenterId(),
+                dskCh.getTags());
 
         // add remaining pools in zone, that did not match tags, to avoid set
         List<StoragePoolVO> allPools = _storagePoolDao.findZoneWideStoragePoolsByTags(plan.getDataCenterId(), null);
@@ -74,17 +75,17 @@ public class ZoneWideStoragePoolAllocator extends AbstractStoragePoolAllocator {
             avoid.addPool(pool.getId());
         }
 
-		for (StoragePoolVO storage : storagePools) {
-			if (suitablePools.size() == returnUpTo) {
-        		break;
-        	}
-			StoragePool pol = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(storage.getId());
-			if (filter(avoid, pol, dskCh, plan)) {
-				suitablePools.add(pol);
+        for (StoragePoolVO storage : storagePools) {
+            if (suitablePools.size() == returnUpTo) {
+                break;
+            }
+            StoragePool pol = (StoragePool) this.dataStoreMgr.getPrimaryDataStore(storage.getId());
+            if (filter(avoid, pol, dskCh, plan)) {
+                suitablePools.add(pol);
             } else {
                 avoid.addPool(pol.getId());
             }
-		}
-		return suitablePools;
-	}
+        }
+        return suitablePools;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/src/org/apache/cloudstack/storage/backup/SnapshotOnBackupStoreInfo.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/backup/SnapshotOnBackupStoreInfo.java b/engine/storage/src/org/apache/cloudstack/storage/backup/SnapshotOnBackupStoreInfo.java
index 5f5ce2f..36da966 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/backup/SnapshotOnBackupStoreInfo.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/backup/SnapshotOnBackupStoreInfo.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.storage.backup;
 import org.apache.cloudstack.storage.backup.datastore.BackupStoreInfo;
 
 public interface SnapshotOnBackupStoreInfo {
-	public String getName();
-	public BackupStoreInfo getBackupStore();
+    public String getName();
+
+    public BackupStoreInfo getBackupStore();
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/src/org/apache/cloudstack/storage/backup/datastore/BackupStoreInfo.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/backup/datastore/BackupStoreInfo.java b/engine/storage/src/org/apache/cloudstack/storage/backup/datastore/BackupStoreInfo.java
index ca1454a..fc41d47 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/backup/datastore/BackupStoreInfo.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/backup/datastore/BackupStoreInfo.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.storage.backup.datastore;
 import org.apache.cloudstack.storage.backup.SnapshotOnBackupStoreInfo;
 
 public interface BackupStoreInfo {
-	public SnapshotOnBackupStoreInfo getSnapshot(long snapshotId);
-	public boolean deleteSnapshot(SnapshotOnBackupStoreInfo snapshot);
+    public SnapshotOnBackupStoreInfo getSnapshot(long snapshotId);
+
+    public boolean deleteSnapshot(SnapshotOnBackupStoreInfo snapshot);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a522892/engine/storage/src/org/apache/cloudstack/storage/datastore/DataObjectManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataObjectManager.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataObjectManager.java
index 177dc3e..ef21528 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataObjectManager.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataObjectManager.java
@@ -25,13 +25,18 @@ import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.storage.command.CommandResult;
 
 public interface DataObjectManager {
-    public void createAsync(DataObject data, DataStore store, AsyncCompletionCallback<CreateCmdResult> callback, boolean noCopy);
+    public void createAsync(DataObject data, DataStore store, AsyncCompletionCallback<CreateCmdResult> callback,
+            boolean noCopy);
+
     /*
-     * Only create internal state, without actually send down create command. 
+     * Only create internal state, without actually send down create command.
      * It's up to device driver decides whether to create object before copying
      */
     public DataObject createInternalStateOnly(DataObject data, DataStore store);
+
     public void update(DataObject data, String path, Long size);
+
     public void copyAsync(DataObject srcData, DataObject destData, AsyncCompletionCallback<CreateCmdResult> callback);
+
     public void deleteAsync(DataObject data, AsyncCompletionCallback<CommandResult> callback);
 }


Mime
View raw message