You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/07/22 20:48:34 UTC

[1/7] git commit: updated refs/heads/master to 0223657

Updated Branches:
  refs/heads/master 4aa9e0a69 -> 02236576c


Changed start to use uuid instead of generic vm start


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7928963d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7928963d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7928963d

Branch: refs/heads/master
Commit: 7928963d16430d2b4aed5a502a1d9b3e57412e77
Parents: 4aa9e0a
Author: Alex Huang <al...@citrix.com>
Authored: Sat Jul 20 10:10:30 2013 -0700
Committer: Alex Huang <al...@citrix.com>
Committed: Mon Jul 22 11:46:33 2013 -0700

----------------------------------------------------------------------
 .../cloud/entity/api/VMEntityManagerImpl.java   |  17 ++-
 .../lb/ElasticLoadBalancerManagerImpl.java      |   7 +-
 .../lb/InternalLoadBalancerVMManagerImpl.java   |  17 +--
 .../InternalLBVMServiceTest.java                |  13 --
 .../consoleproxy/ConsoleProxyManagerImpl.java   |  13 +-
 .../cloud/ha/HighAvailabilityManagerImpl.java   | 124 ++++++++--------
 .../VirtualNetworkApplianceManagerImpl.java     |  27 ++--
 .../storage/StoragePoolAutomationImpl.java      | 143 ++++++-------------
 .../secondary/SecondaryStorageManagerImpl.java  |   3 +-
 .../src/com/cloud/vm/SystemVmLoadScanner.java   |   7 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java  |   5 +-
 .../src/com/cloud/vm/VirtualMachineManager.java |  10 +-
 .../com/cloud/vm/VirtualMachineManagerImpl.java |  57 ++++----
 .../vm/snapshot/VMSnapshotManagerImpl.java      |  33 ++---
 server/test/com/cloud/vm/UserVmManagerTest.java |   3 -
 15 files changed, 215 insertions(+), 264 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7928963d/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
index 6dd5844..ee5ae2d 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
@@ -22,6 +22,9 @@ import java.util.UUID;
 
 import javax.inject.Inject;
 
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
 import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
 import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO;
 import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO;
@@ -29,16 +32,14 @@ import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMEntityDao;
 import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMReservationDao;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
 
 import com.cloud.dc.DataCenter;
 import com.cloud.deploy.DataCenterDeployment;
 import com.cloud.deploy.DeployDestination;
 import com.cloud.deploy.DeploymentPlan;
 import com.cloud.deploy.DeploymentPlanner;
-import com.cloud.deploy.DeploymentPlanningManager;
 import com.cloud.deploy.DeploymentPlanner.ExcludeList;
+import com.cloud.deploy.DeploymentPlanningManager;
 import com.cloud.exception.AffinityConflictException;
 import com.cloud.exception.AgentUnavailableException;
 import com.cloud.exception.ConcurrentOperationException;
@@ -156,7 +157,7 @@ public class VMEntityManagerImpl implements VMEntityManager {
         List<VolumeVO> vols = _volsDao.findReadyRootVolumesByInstance(vm.getId());
         if(!vols.isEmpty()){
             VolumeVO vol = vols.get(0);
-            StoragePool pool = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(vol.getPoolId());
+            StoragePool pool = (StoragePool)dataStoreMgr.getPrimaryDataStore(vol.getPoolId());
 
             if (!pool.isInMaintenance()) {
                 long rootVolDcId = pool.getDataCenterId();
@@ -224,8 +225,7 @@ public class VMEntityManagerImpl implements VMEntityManager {
             DataCenterDeployment reservedPlan = new DataCenterDeployment(vm.getDataCenterId(),
                     vmReservation.getPodId(), vmReservation.getClusterId(), vmReservation.getHostId(), null, null);
             try {
-                VMInstanceVO vmDeployed = _itMgr.start(vm, params, _userDao.findById(new Long(caller)),
-                        _accountDao.findById(vm.getAccountId()), reservedPlan);
+                _itMgr.start(vm.getUuid(), params, reservedPlan);
             } catch (Exception ex) {
                 // Retry the deployment without using the reservation plan
                 DataCenterDeployment plan = new DataCenterDeployment(0, null, null, null, null, null);
@@ -234,12 +234,11 @@ public class VMEntityManagerImpl implements VMEntityManager {
                     plan.setAvoids(reservedPlan.getAvoids());
                 }
 
-                _itMgr.start(vm, params, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()),
-                        plan);
+                _itMgr.start(vm.getUuid(), params, plan);
             }
         } else {
             // no reservation found. Let VirtualMachineManager retry
-            _itMgr.start(vm, params, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()), null);
+            _itMgr.start(vm.getUuid(), params, null);
         }
 
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7928963d/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
index 601b034..24ec87a 100644
--- a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
+++ b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
@@ -538,11 +538,8 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
     private DomainRouterVO start(DomainRouterVO elbVm, User user, Account caller, Map<Param, Object> params) throws StorageUnavailableException, InsufficientCapacityException,
     ConcurrentOperationException, ResourceUnavailableException {
         s_logger.debug("Starting ELB VM " + elbVm);
-        if (_itMgr.start(elbVm, params, user, caller) != null) {
-            return _routerDao.findById(elbVm.getId());
-        } else {
-            return null;
-        }
+        _itMgr.start(elbVm.getUuid(), params);
+        return _routerDao.findById(elbVm.getId());
     }
     
     private DomainRouterVO stop(DomainRouterVO elbVm, boolean forced, User user, Account caller) throws ConcurrentOperationException, ResourceUnavailableException {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7928963d/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
index 06d3f70..90ff9bc 100644
--- a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
+++ b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
@@ -467,7 +467,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
             maxconn = offering.getConcurrentConnections().toString();
         }
         LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lbs, guestNic.getIp4Address(),
-                guestNic.getIp4Address(), internalLbVm.getPrivateIpAddress(), 
+                guestNic.getIp4Address(), internalLbVm.getPrivateIpAddress(),
                 _itMgr.toNicTO(guestNicProfile, internalLbVm.getHypervisorType()), internalLbVm.getVpcId(), maxconn);
 
         cmd.lbStatsVisibility = _configDao.getValue(Config.NetworkLBHaproxyStatsVisbility.key());
@@ -815,16 +815,13 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
             throws StorageUnavailableException, InsufficientCapacityException,
             ConcurrentOperationException, ResourceUnavailableException {
         s_logger.debug("Starting Internal LB VM " + internalLbVm);
-        if (_itMgr.start(internalLbVm, params, _accountMgr.getUserIncludingRemoved(callerUserId), caller, null) != null) {
-            if (internalLbVm.isStopPending()) {
-                s_logger.info("Clear the stop pending flag of Internal LB VM " + internalLbVm.getHostName() + " after start router successfully!");
-                internalLbVm.setStopPending(false);
-                internalLbVm = _internalLbVmDao.persist(internalLbVm);
-            }
-            return _internalLbVmDao.findById(internalLbVm.getId());
-        } else {
-            return null;
+        _itMgr.start(internalLbVm.getUuid(), params, null);
+        if (internalLbVm.isStopPending()) {
+            s_logger.info("Clear the stop pending flag of Internal LB VM " + internalLbVm.getHostName() + " after start router successfully!");
+            internalLbVm.setStopPending(false);
+            internalLbVm = _internalLbVmDao.persist(internalLbVm);
         }
+        return _internalLbVmDao.findById(internalLbVm.getId());
     }
     
     

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7928963d/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMServiceTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMServiceTest.java b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMServiceTest.java
index 70dafa3..a74f6b0 100644
--- a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMServiceTest.java
+++ b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMServiceTest.java
@@ -17,7 +17,6 @@
 package org.apache.cloudstack.internallbvmmgr;
 
 import java.lang.reflect.Field;
-import java.util.Map;
 
 import javax.inject.Inject;
 
@@ -34,7 +33,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.network.lb.InternalLoadBalancerVMService;
 
-import com.cloud.deploy.DeploymentPlan;
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientCapacityException;
 import com.cloud.exception.InvalidParameterValueException;
@@ -114,17 +112,6 @@ public class InternalLBVMServiceTest extends TestCase {
         Mockito.when(_domainRouterDao.findById(nonInternalLbVmId)).thenReturn(nonInternalLbVm);
         
         try {
-            Mockito.when(_itMgr.start(Mockito.any(DomainRouterVO.class),
-                    Mockito.any(Map.class), Mockito.any(User.class), Mockito.any(Account.class), Mockito.any(DeploymentPlan.class))).thenReturn(validVm);
-        } catch (InsufficientCapacityException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (ResourceUnavailableException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        
-        try {
             Mockito.when(_itMgr.advanceStop(Mockito.any(DomainRouterVO.class), Mockito.any(Boolean.class), Mockito.any(User.class), Mockito.any(Account.class))).thenReturn(true);
         } catch (ResourceUnavailableException e) {
             // TODO Auto-generated catch block

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7928963d/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
index 30fbb48..5d6719d 100755
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@ -65,6 +65,7 @@ import com.cloud.deploy.DataCenterDeployment;
 import com.cloud.deploy.DeployDestination;
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.OperationTimedoutException;
 import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.exception.StorageUnavailableException;
 import com.cloud.host.Host;
@@ -110,7 +111,6 @@ import com.cloud.storage.dao.VMTemplateDao;
 import com.cloud.template.TemplateManager;
 import com.cloud.user.Account;
 import com.cloud.user.AccountManager;
-import com.cloud.user.User;
 import com.cloud.utils.DateUtil;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
@@ -540,8 +540,6 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
     public ConsoleProxyVO startProxy(long proxyVmId) {
         try {
             ConsoleProxyVO proxy = _consoleProxyDao.findById(proxyVmId);
-            Account systemAcct = _accountMgr.getSystemAccount();
-            User systemUser = _accountMgr.getSystemUser();
             if (proxy.getState() == VirtualMachine.State.Running) {
                 return proxy;
             }
@@ -552,7 +550,8 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
             }
 
             if (proxy.getState() == VirtualMachine.State.Stopped) {
-                return _itMgr.start(proxy, null, systemUser, systemAcct);
+                _itMgr.advanceStart(proxy.getUuid(), null);
+                proxy = _consoleProxyDao.findById(proxy.getId());
             }
 
             // For VMs that are in Stopping, Starting, Migrating state, let client to wait by returning null
@@ -574,6 +573,12 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
         } catch (CloudRuntimeException e) {
             s_logger.warn("Runtime Exception while trying to start console proxy", e);
             return null;
+        } catch (ConcurrentOperationException e) {
+            s_logger.warn("Runtime Exception while trying to start console proxy", e);
+            return null;
+        } catch (OperationTimedoutException e) {
+            s_logger.warn("Runtime Exception while trying to start console proxy", e);
+            return null;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7928963d/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
index 25c5a04..fcc4792 100755
--- a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
+++ b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
@@ -32,6 +32,8 @@ import javax.naming.ConfigurationException;
 import org.apache.log4j.Logger;
 import org.apache.log4j.NDC;
 
+import org.apache.cloudstack.context.ServerContexts;
+
 import com.cloud.agent.AgentManager;
 import com.cloud.alert.AlertManager;
 import com.cloud.cluster.ClusterManagerListener;
@@ -294,7 +296,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai
             } catch (ConcurrentOperationException e) {
                 assert false : "How do we hit this when force is true?";
             throw new CloudRuntimeException("Caught exception even though it should be handled.", e);
-            }            
+            }
             return;
         }
 
@@ -338,7 +340,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai
             } catch (ConcurrentOperationException e) {
                 assert false : "How do we hit this when force is true?";
             throw new CloudRuntimeException("Caught exception even though it should be handled.", e);
-            }        
+            }
         }
 
         List<HaWorkVO> items = _haDao.findPreviousHA(vm.getId());
@@ -513,7 +515,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai
             return null; // VM doesn't require HA
         }
 
-        if (!this.volumeMgr.canVmRestartOnAnotherServer(vm.getId())) {
+        if (!volumeMgr.canVmRestartOnAnotherServer(vm.getId())) {
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("VM can not restart on another server.");
             }
@@ -530,9 +532,10 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai
             if (_haTag != null) {
                 params.put(VirtualMachineProfile.Param.HaTag, _haTag);
             }
-            VMInstanceVO started = _itMgr.advanceStart(vm, params, _accountMgr.getSystemUser(), _accountMgr.getSystemAccount());
-
-            if (started != null) {
+            _itMgr.advanceStart(vm.getUuid(), params);
+            
+            VMInstanceVO started = _instanceDao.findById(vm.getId());
+            if (started != null && started.getState() == VirtualMachine.State.Running) {
                 s_logger.info("VM is now restarted: " + vmId + " on " + started.getHostId());
                 return null;
             }
@@ -801,66 +804,71 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai
 
         @Override
         public void run() {
-            s_logger.info("Starting work");
-            while (!_stopped) {
-                HaWorkVO work = null;
-                try {
-                    s_logger.trace("Checking the database");
-                    work = _haDao.take(_serverId);
-                    if (work == null) {
+            ServerContexts.registerSystemContext();
+            try {
+                s_logger.info("Starting work");
+                while (!_stopped) {
+                    HaWorkVO work = null;
                         try {
-                            synchronized (this) {
-                                wait(_timeToSleep);
+                        s_logger.trace("Checking the database");
+                        work = _haDao.take(_serverId);
+                        if (work == null) {
+                            try {
+                                synchronized (this) {
+                                    wait(_timeToSleep);
+                                }
+                                continue;
+                            } catch (final InterruptedException e) {
+                                s_logger.info("Interrupted");
+                                continue;
                             }
-                            continue;
-                        } catch (final InterruptedException e) {
-                            s_logger.info("Interrupted");
-                            continue;
                         }
-                    }
 
-                    NDC.push("work-" + work.getId());
-                    s_logger.info("Processing " + work);
-
-                    try {
-                        final WorkType wt = work.getWorkType();
-                        Long nextTime = null;
-                        if (wt == WorkType.Migration) {
-                            nextTime = migrate(work);
-                        } else if (wt == WorkType.HA) {
-                            nextTime = restart(work);
-                        } else if (wt == WorkType.Stop || wt == WorkType.CheckStop || wt == WorkType.ForceStop) {
-                            nextTime = stopVM(work);
-                        } else if (wt == WorkType.Destroy) {
-                            nextTime = destroyVM(work);
-                        } else {
-                            assert false : "How did we get here with " + wt.toString();
-                        continue;
-                        }
+                        NDC.push("work-" + work.getId());
+                        s_logger.info("Processing " + work);
 
-                        if (nextTime == null) {
-                            s_logger.info("Completed " + work);
-                            work.setStep(Step.Done);
-                        } else {
-                            s_logger.info("Rescheduling " + work + " to try again at " + new Date(nextTime << 10));
-                            work.setTimeToTry(nextTime);
-                            work.setServerId(null);
-                            work.setDateTaken(null);
+                        try {
+                            final WorkType wt = work.getWorkType();
+                            Long nextTime = null;
+                            if (wt == WorkType.Migration) {
+                                nextTime = migrate(work);
+                            } else if (wt == WorkType.HA) {
+                                nextTime = restart(work);
+                            } else if (wt == WorkType.Stop || wt == WorkType.CheckStop || wt == WorkType.ForceStop) {
+                                nextTime = stopVM(work);
+                            } else if (wt == WorkType.Destroy) {
+                                nextTime = destroyVM(work);
+                            } else {
+                                assert false : "How did we get here with " + wt.toString();
+                                continue;
+                            }
+
+                            if (nextTime == null) {
+                                s_logger.info("Completed " + work);
+                                work.setStep(Step.Done);
+                            } else {
+                                s_logger.info("Rescheduling " + work + " to try again at " + new Date(nextTime << 10));
+                                work.setTimeToTry(nextTime);
+                                work.setServerId(null);
+                                work.setDateTaken(null);
+                            }
+                        } catch (Exception e) {
+                            s_logger.error("Terminating " + work, e);
+                            work.setStep(Step.Error);
+                        }
+                        _haDao.update(work.getId(), work);
+                    } catch (final Throwable th) {
+                        s_logger.error("Caught this throwable, ", th);
+                    } finally {
+                        if (work != null) {
+                            NDC.pop();
+                            }
                         }
-                    } catch (Exception e) {
-                        s_logger.error("Terminating " + work, e);
-                        work.setStep(Step.Error);
-                    }
-                    _haDao.update(work.getId(), work);
-                } catch (final Throwable th) {
-                    s_logger.error("Caught this throwable, ", th);
-                } finally {
-                    if (work != null) {
-                        NDC.pop();
                     }
-                }
+                s_logger.info("Time to go home!");
+            } finally {
+                ServerContexts.unregisterSystemContext();
             }
-            s_logger.info("Time to go home!");
         }
 
         public synchronized void wakup() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7928963d/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index 6c0f7a1..d05d8e8 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -2735,22 +2735,19 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
             throws StorageUnavailableException, InsufficientCapacityException,
     ConcurrentOperationException, ResourceUnavailableException {
         s_logger.debug("Starting router " + router);
-        if (_itMgr.start(router, params, user, caller, planToDeploy) != null) {
-            if (router.isStopPending()) {
-                s_logger.info("Clear the stop pending flag of router " + router.getHostName() + " after start router successfully!");
-                router.setStopPending(false);
-                router = _routerDao.persist(router);
-            }
-            // We don't want the failure of VPN Connection affect the status of router, so we try to make connection
-            // only after router start successfully
-            Long vpcId = router.getVpcId();
-            if (vpcId != null) {
-                _s2sVpnMgr.reconnectDisconnectedVpnByVpc(vpcId);
-            }
-            return _routerDao.findById(router.getId());
-        } else {
-            return null;
+        _itMgr.start(router.getUuid(), params, planToDeploy);
+        if (router.isStopPending()) {
+            s_logger.info("Clear the stop pending flag of router " + router.getHostName() + " after start router successfully!");
+            router.setStopPending(false);
+            router = _routerDao.persist(router);
+        }
+        // We don't want the failure of VPN Connection affect the status of router, so we try to make connection
+        // only after router start successfully
+        Long vpcId = router.getVpcId();
+        if (vpcId != null) {
+            _s2sVpnMgr.reconnectDisconnectedVpnByVpc(vpcId);
         }
+        return _routerDao.findById(router.getId());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7928963d/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StoragePoolAutomationImpl.java b/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
index 5c97183..7b93103 100644
--- a/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
+++ b/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
@@ -23,22 +23,22 @@ import java.util.List;
 
 import javax.inject.Inject;
 
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
 import org.apache.cloudstack.context.CallContext;
-import org.apache.cloudstack.engine.subsystem.api.storage.*;
+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.DataStoreProviderManager;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.ModifyStoragePoolCommand;
 import com.cloud.alert.AlertManager;
-import com.cloud.host.Host;
 import com.cloud.host.HostVO;
 import com.cloud.host.Status;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.resource.ResourceManager;
 import com.cloud.server.ManagementServer;
 import com.cloud.storage.dao.StoragePoolHostDao;
@@ -48,7 +48,6 @@ import com.cloud.user.Account;
 import com.cloud.user.User;
 import com.cloud.user.dao.UserDao;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.exception.ExecutionException;
 import com.cloud.vm.ConsoleProxyVO;
 import com.cloud.vm.DomainRouterVO;
 import com.cloud.vm.SecondaryStorageVmVO;
@@ -100,18 +99,19 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
     VMInstanceDao vmDao;
     @Inject
     ManagementServer server;
-    @Inject DataStoreProviderManager providerMgr;
+    @Inject
+    DataStoreProviderManager providerMgr;
 
     @Override
     public boolean maintain(DataStore store) {
         Long userId = CallContext.current().getCallingUserId();
         User user = _userDao.findById(userId);
         Account account = CallContext.current().getCallingAccount();
-        StoragePoolVO pool = this.primaryDataStoreDao.findById(store.getId());
+        StoragePoolVO pool = primaryDataStoreDao.findById(store.getId());
         try {
             List<StoragePoolVO> spes = null;
             // Handling Zone and Cluster wide storage scopes.
-            // if the storage is ZONE wide then we pass podid and cluster id as null as they will be empty for ZWPS 
+            // if the storage is ZONE wide then we pass podid and cluster id as null as they will be empty for ZWPS
             if (pool.getScope() == ScopeType.ZONE) {
                 spes = primaryDataStoreDao.listBy(
                         pool.getDataCenterId(), null,
@@ -128,14 +128,14 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
                             + " is already in  PrepareForMaintenance mode ");
                 }
             }
-            StoragePool storagePool = (StoragePool) store;
+            StoragePool storagePool = (StoragePool)store;
 
             //Handeling the Zone wide and cluster wide primay storage
             List<HostVO> hosts = new ArrayList<HostVO>();
             // if the storage scope is ZONE wide, then get all the hosts for which hypervisor ZWSP created to send Modifystoragepoolcommand
             //TODO: if it's zone wide, this code will list a lot of hosts in the zone, which may cause performance/OOM issue.
             if (pool.getScope().equals(ScopeType.ZONE)) {
-                hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(pool.getHypervisor() , pool.getDataCenterId());
+                hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(pool.getHypervisor(), pool.getDataCenterId());
             } else {
                 hosts = _resourceMgr.listHostsInClusterByStatus(
                         pool.getClusterId(), Status.Up);
@@ -159,7 +159,7 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
                     if (s_logger.isDebugEnabled()) {
                         s_logger.debug("ModifyStoragePool false failed due to "
                                 + ((answer == null) ? "answer null" : answer
-                                .getDetails()));
+                                        .getDetails()));
                     }
                 } else {
                     if (s_logger.isDebugEnabled()) {
@@ -179,7 +179,7 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
             }
 
             // 2. Get a list of all the ROOT volumes within this storage pool
-            List<VolumeVO> allVolumes = this.volumeDao.findByPoolId(pool
+            List<VolumeVO> allVolumes = volumeDao.findByPoolId(pool
                     .getId());
 
             // 3. Enqueue to the work queue
@@ -250,22 +250,15 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
 
                     if (restart) {
 
-                        if (this.vmMgr.advanceStart(consoleProxy, null, user,
-                                account) == null) {
-                            String errorMsg = "There was an error starting the console proxy id: "
-                                    + vmInstance.getId()
-                                    + " on another storage pool, cannot enable primary storage maintenance";
-                            s_logger.warn(errorMsg);
-                        } else {
-                            // update work status
-                            work.setStartedAfterMaintenance(true);
-                            _storagePoolWorkDao.update(work.getId(), work);
-                        }
+                        vmMgr.advanceStart(consoleProxy.getUuid(), null);
+                        // update work status
+                        work.setStartedAfterMaintenance(true);
+                        _storagePoolWorkDao.update(work.getId(), work);
                     }
                 }
 
                 // if the instance is of type uservm, call the user vm manager
-                if (vmInstance.getType().equals(VirtualMachine.Type.User)) {
+                if (vmInstance.getType() == VirtualMachine.Type.User) {
                     UserVmVO userVm = userVmDao.findById(vmInstance.getId());
                     if (!vmMgr.advanceStop(userVm, true, user, account)) {
                         String errorMsg = "There was an error stopping the user vm id: "
@@ -299,16 +292,10 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
                     }
 
                     if (restart) {
-                        if (vmMgr.advanceStart(secStrgVm, null, user, account) == null) {
-                            String errorMsg = "There was an error starting the ssvm id: "
-                                    + vmInstance.getId()
-                                    + " on another storage pool, cannot enable primary storage maintenance";
-                            s_logger.warn(errorMsg);
-                        } else {
-                            // update work status
-                            work.setStartedAfterMaintenance(true);
-                            _storagePoolWorkDao.update(work.getId(), work);
-                        }
+                        vmMgr.advanceStart(secStrgVm.getUuid(), null);
+                        // update work status
+                        work.setStartedAfterMaintenance(true);
+                        _storagePoolWorkDao.update(work.getId(), work);
                     }
                 }
 
@@ -330,24 +317,18 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
                     }
 
                     if (restart) {
-                        if (vmMgr.advanceStart(domR, null, user, account) == null) {
-                            String errorMsg = "There was an error starting the domain router id: "
-                                    + vmInstance.getId()
-                                    + " on another storage pool, cannot enable primary storage maintenance";
-                            s_logger.warn(errorMsg);
-                        } else {
-                            // update work status
-                            work.setStartedAfterMaintenance(true);
-                            _storagePoolWorkDao.update(work.getId(), work);
-                        }
+                        vmMgr.advanceStart(domR.getUuid(), null);
+                        // update work status
+                        work.setStartedAfterMaintenance(true);
+                        _storagePoolWorkDao.update(work.getId(), work);
                     }
                 }
             }
-        } catch(Exception e) {
+        } catch (Exception e) {
             s_logger.error(
                     "Exception in enabling primary storage maintenance:", e);
             pool.setStatus(StoragePoolStatus.ErrorInMaintenance);
-            this.primaryDataStoreDao.update(pool.getId(), pool);
+            primaryDataStoreDao.update(pool.getId(), pool);
             throw new CloudRuntimeException(e.getMessage());
         }
         return true;
@@ -359,7 +340,7 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
         Long userId = CallContext.current().getCallingUserId();
         User user = _userDao.findById(userId);
         Account account = CallContext.current().getCallingAccount();
-        StoragePoolVO poolVO = this.primaryDataStoreDao
+        StoragePoolVO poolVO = primaryDataStoreDao
                 .findById(store.getId());
         StoragePool pool = (StoragePool)store;
 
@@ -370,7 +351,7 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
             hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(poolVO.getHypervisor(), pool.getDataCenterId());
         } else {
             hosts = _resourceMgr.listHostsInClusterByStatus(
-                pool.getClusterId(), Status.Up);
+                    pool.getClusterId(), Status.Up);
         }
 
         if (hosts == null || hosts.size() == 0) {
@@ -385,7 +366,7 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug("ModifyStoragePool add failed due to "
                             + ((answer == null) ? "answer null" : answer
-                            .getDetails()));
+                                    .getDetails()));
                 }
             } else {
                 if (s_logger.isDebugEnabled()) {
@@ -414,17 +395,10 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
 
                     ConsoleProxyVO consoleProxy = _consoleProxyDao
                             .findById(vmInstance.getId());
-                    if (vmMgr.advanceStart(consoleProxy, null, user, account) == null) {
-                        String msg = "There was an error starting the console proxy id: "
-                                + vmInstance.getId()
-                                + " on storage pool, cannot complete primary storage maintenance";
-                        s_logger.warn(msg);
-                        throw new ExecutionException(msg);
-                    } else {
-                        // update work queue
-                        work.setStartedAfterMaintenance(true);
-                        _storagePoolWorkDao.update(work.getId(), work);
-                    }
+                    vmMgr.advanceStart(consoleProxy.getUuid(), null);
+                    // update work queue
+                    work.setStartedAfterMaintenance(true);
+                    _storagePoolWorkDao.update(work.getId(), work);
                 }
 
                 // if the instance is of type ssvm, call the ssvm manager
@@ -432,52 +406,29 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
                         VirtualMachine.Type.SecondaryStorageVm)) {
                     SecondaryStorageVmVO ssVm = _secStrgDao.findById(vmInstance
                             .getId());
-                    if (vmMgr.advanceStart(ssVm, null, user, account) == null) {
-                        String msg = "There was an error starting the ssvm id: "
-                                + vmInstance.getId()
-                                + " on storage pool, cannot complete primary storage maintenance";
-                        s_logger.warn(msg);
-                        throw new ExecutionException(msg);
-                    } else {
-                        // update work queue
-                        work.setStartedAfterMaintenance(true);
-                        _storagePoolWorkDao.update(work.getId(), work);
-                    }
+                    vmMgr.advanceStart(ssVm.getUuid(), null);
+                    // update work queue
+                    work.setStartedAfterMaintenance(true);
+                    _storagePoolWorkDao.update(work.getId(), work);
                 }
 
                 // if the instance is of type ssvm, call the ssvm manager
                 if (vmInstance.getType().equals(
                         VirtualMachine.Type.DomainRouter)) {
                     DomainRouterVO domR = _domrDao.findById(vmInstance.getId());
-                    if (vmMgr.advanceStart(domR, null, user, account) == null) {
-                        String msg = "There was an error starting the domR id: "
-                                + vmInstance.getId()
-                                + " on storage pool, cannot complete primary storage maintenance";
-                        s_logger.warn(msg);
-                        throw new ExecutionException(msg);
-                    } else {
-                        // update work queue
-                        work.setStartedAfterMaintenance(true);
-                        _storagePoolWorkDao.update(work.getId(), work);
-                    }
+                    vmMgr.advanceStart(domR.getUuid(), null);
+                    // update work queue
+                    work.setStartedAfterMaintenance(true);
+                    _storagePoolWorkDao.update(work.getId(), work);
                 }
 
                 // if the instance is of type user vm, call the user vm manager
                 if (vmInstance.getType().equals(VirtualMachine.Type.User)) {
                     UserVmVO userVm = userVmDao.findById(vmInstance.getId());
 
-                    if (vmMgr.advanceStart(userVm, null, user, account) == null) {
-
-                        String msg = "There was an error starting the user vm id: "
-                                + vmInstance.getId()
-                                + " on storage pool, cannot complete primary storage maintenance";
-                        s_logger.warn(msg);
-                        throw new ExecutionException(msg);
-                    } else {
-                        // update work queue
-                        work.setStartedAfterMaintenance(true);
-                        _storagePoolWorkDao.update(work.getId(), work);
-                    }
+                    vmMgr.advanceStart(userVm.getUuid(), null);                        // update work queue
+                    work.setStartedAfterMaintenance(true);
+                    _storagePoolWorkDao.update(work.getId(), work);
                 }
                 return true;
             } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7928963d/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
index b80892a..f7a7219 100755
--- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
+++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
@@ -259,7 +259,8 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
             SecondaryStorageVmVO secStorageVm = _secStorageVmDao.findById(secStorageVmId);
             Account systemAcct = _accountMgr.getSystemAccount();
             User systemUser = _accountMgr.getSystemUser();
-            return _itMgr.start(secStorageVm, null, systemUser, systemAcct);
+            _itMgr.advanceStart(secStorageVm.getUuid(), null);
+            return _secStorageVmDao.findById(secStorageVm.getId());
         } catch (StorageUnavailableException e) {
             s_logger.warn("Exception while trying to start secondary storage vm", e);
             return null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7928963d/server/src/com/cloud/vm/SystemVmLoadScanner.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/SystemVmLoadScanner.java b/server/src/com/cloud/vm/SystemVmLoadScanner.java
index 4251b40..3932c3b 100644
--- a/server/src/com/cloud/vm/SystemVmLoadScanner.java
+++ b/server/src/com/cloud/vm/SystemVmLoadScanner.java
@@ -22,10 +22,11 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.log4j.Logger;
 
+import org.apache.cloudstack.context.ServerContexts;
+
 import com.cloud.utils.Pair;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.GlobalLock;
-import com.cloud.utils.db.Transaction;
 
 //
 // TODO: simple load scanner, to minimize code changes required in console proxy manager and SSVM, we still leave most of work at handler
@@ -67,13 +68,13 @@ public class SystemVmLoadScanner<T> {
 
             @Override
             public void run() {
-                Transaction txn = Transaction.open(Transaction.CLOUD_DB);
+                ServerContexts.registerSystemContext();
                 try {
                     reallyRun();
                 } catch (Throwable e) {
                     s_logger.warn("Unexpected exception " + e.getMessage(), e);
                 } finally {
-                    txn.close();
+                    ServerContexts.unregisterSystemContext();
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7928963d/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index adcf475..f353bb7 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -4588,7 +4588,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
 
         if (needRestart) {
             try {
-                _itMgr.start(vm, null, user, caller);
+                _itMgr.start(vm.getUuid(), null);
             } catch (Exception e) {
                 s_logger.debug("Unable to start VM " + vm.getUuid(), e);
                 CloudRuntimeException ex = new CloudRuntimeException(
@@ -4598,8 +4598,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
             }
         }
 
-        s_logger.debug("Restore VM " + vmId + " with template "
-                + template.getUuid() + " done successfully");
+        s_logger.debug("Restore VM " + vmId + " with template " + template.getUuid() + " done successfully");
         return vm;
 
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7928963d/server/src/com/cloud/vm/VirtualMachineManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineManager.java b/server/src/com/cloud/vm/VirtualMachineManager.java
index bf6af44..49953b9 100644
--- a/server/src/com/cloud/vm/VirtualMachineManager.java
+++ b/server/src/com/cloud/vm/VirtualMachineManager.java
@@ -72,9 +72,9 @@ public interface VirtualMachineManager extends Manager {
             DeploymentPlan plan,
             HypervisorType hyperType) throws InsufficientCapacityException;
 
-    <T extends VMInstanceVO> T start(T vm, Map<VirtualMachineProfile.Param, Object> params, User caller, Account account) throws InsufficientCapacityException, ResourceUnavailableException;
+    void start(String vmUuid, Map<VirtualMachineProfile.Param, Object> params);
 
-    <T extends VMInstanceVO> T start(T vm, Map<VirtualMachineProfile.Param, Object> params, User caller, Account account, DeploymentPlan planToDeploy) throws InsufficientCapacityException, ResourceUnavailableException;
+    void start(String vmUuid, Map<VirtualMachineProfile.Param, Object> params, DeploymentPlan planToDeploy);
 
     <T extends VMInstanceVO> boolean stop(T vm, User caller, Account account) throws ResourceUnavailableException;
 
@@ -84,9 +84,11 @@ public interface VirtualMachineManager extends Manager {
 
     boolean stateTransitTo(VMInstanceVO vm, VirtualMachine.Event e, Long hostId) throws NoTransitionException;
 
-    <T extends VMInstanceVO> T advanceStart(T vm, Map<VirtualMachineProfile.Param, Object> params, User caller, Account account) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException;
+    void advanceStart(String vmUuid, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException,
+            ConcurrentOperationException, OperationTimedoutException;
 
-    <T extends VMInstanceVO> T advanceStart(T vm, Map<VirtualMachineProfile.Param, Object> params, User caller, Account account, DeploymentPlan planToDeploy) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException;
+    void advanceStart(String vmUuid, Map<VirtualMachineProfile.Param, Object> params, DeploymentPlan planToDeploy) throws InsufficientCapacityException,
+            ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException;
 
     <T extends VMInstanceVO> boolean advanceStop(T vm, boolean forced, User caller, Account account) throws ResourceUnavailableException, OperationTimedoutException, ConcurrentOperationException;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7928963d/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 7a4bf50..363bb45 100755
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -39,6 +39,7 @@ import javax.naming.ConfigurationException;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
+import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
@@ -603,17 +604,20 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
     }
 
     @Override
-    public <T extends VMInstanceVO> T start(T vm, Map<VirtualMachineProfile.Param, Object> params, User caller, Account account) throws InsufficientCapacityException, ResourceUnavailableException {
-        return start(vm, params, caller, account, null);
+    public void start(String vmUuid, Map<VirtualMachineProfile.Param, Object> params) {
+        start(vmUuid, params, null);
     }
 
     @Override
-    public <T extends VMInstanceVO> T start(T vm, Map<VirtualMachineProfile.Param, Object> params, User caller, Account account, DeploymentPlan planToDeploy) throws InsufficientCapacityException,
-    ResourceUnavailableException {
+    public void start(String vmUuid, Map<VirtualMachineProfile.Param, Object> params, DeploymentPlan planToDeploy) {
         try {
-            return advanceStart(vm, params, caller, account, planToDeploy);
+            advanceStart(vmUuid, params, planToDeploy);
         } catch (ConcurrentOperationException e) {
-            throw new CloudRuntimeException("Unable to start a VM due to concurrent operation", e);
+            throw new CloudRuntimeException("Unable to start a VM due to concurrent operation", e).add(VirtualMachine.class, vmUuid);
+        } catch (InsufficientCapacityException e) {
+            throw new CloudRuntimeException("Unable to start a VM due to insufficient capacity", e).add(VirtualMachine.class, vmUuid);
+        } catch (ResourceUnavailableException e) {
+            throw new CloudRuntimeException("Unable to start a VM due to concurrent operation", e).add(VirtualMachine.class, vmUuid);
         }
     }
 
@@ -651,7 +655,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
     }
 
     @DB
-    protected <T extends VMInstanceVO> Ternary<T, ReservationContext, ItWorkVO> changeToStartState(VirtualMachineGuru<T> vmGuru, T vm, User caller, Account account)
+    protected Ternary<VMInstanceVO, ReservationContext, ItWorkVO> changeToStartState(VirtualMachineGuru vmGuru, VMInstanceVO vm, User caller, Account account)
             throws ConcurrentOperationException {
         long vmId = vm.getId();
 
@@ -659,7 +663,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         int retry = _lockStateRetry;
         while (retry-- != 0) {
             Transaction txn = Transaction.currentTxn();
-            Ternary<T, ReservationContext, ItWorkVO> result = null;
+            Ternary<VMInstanceVO, ReservationContext, ItWorkVO> result = null;
             txn.start();
             try {
                 Journal journal = new Journal.LogJournal("Creating " + vm, s_logger);
@@ -670,7 +674,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
                     if (s_logger.isDebugEnabled()) {
                         s_logger.debug("Successfully transitioned to start state for " + vm + " reservation id = " + work.getId());
                     }
-                    result = new Ternary<T, ReservationContext, ItWorkVO>(vmGuru.findById(vmId), context, work);
+                    result = new Ternary<VMInstanceVO, ReservationContext, ItWorkVO>(vm, context, work);
                     txn.commit();
                     return result;
                 }
@@ -744,28 +748,33 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
     }
 
     @Override
-    public <T extends VMInstanceVO> T advanceStart(T vm, Map<VirtualMachineProfile.Param, Object> params, User caller, Account account) throws InsufficientCapacityException,
-    ConcurrentOperationException, ResourceUnavailableException {
-        return advanceStart(vm, params, caller, account, null);
+    public void advanceStart(String vmUuid, Map<VirtualMachineProfile.Param, Object> params)
+            throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
+        advanceStart(vmUuid, params, null);
     }
 
     @Override
-    public <T extends VMInstanceVO> T advanceStart(T vm, Map<VirtualMachineProfile.Param, Object> params, User caller, Account account, DeploymentPlan planToDeploy)
+    public void advanceStart(String vmUuid, Map<VirtualMachineProfile.Param, Object> params, DeploymentPlan planToDeploy)
             throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
+        CallContext cctxt = CallContext.current();
+        Account account = cctxt.getCallingAccount();
+        User caller = cctxt.getCallingUser();
+        
+        VMInstanceVO vm = _vmDao.findByUuid(vmUuid);
+
         long vmId = vm.getId();
-        VirtualMachineGuru<T> vmGuru = getVmGuru(vm);
+        VirtualMachineGuru<?> vmGuru = getVmGuru(vm);
 
-        vm = vmGuru.findById(vm.getId());
-        Ternary<T, ReservationContext, ItWorkVO> start = changeToStartState(vmGuru, vm, caller, account);
+        Ternary<VMInstanceVO, ReservationContext, ItWorkVO> start = changeToStartState(vmGuru, vm, caller, account);
         if (start == null) {
-            return vmGuru.findById(vmId);
+            return;
         }
 
         vm = start.first();
         ReservationContext ctx = start.second();
         ItWorkVO work = start.third();
 
-        T startedVm = null;
+        VMInstanceVO startedVm = null;
         ServiceOfferingVO offering = _offeringDao.findById(vm.getServiceOfferingId());
         VMTemplateVO template = _templateDao.findById(vm.getTemplateId());
 
@@ -845,7 +854,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
                                     }
                                 }
                                 plan = new DataCenterDeployment(planToDeploy.getDataCenterId(), planToDeploy.getPodId(), planToDeploy.getClusterId(), planToDeploy.getHostId(), vol.getPoolId(), null, ctx);
-                            }else{
+                            } else {
                                 plan = new DataCenterDeployment(rootVolDcId, rootVolPodId, rootVolClusterId, null, vol.getPoolId(), null, ctx);
                                 if (s_logger.isDebugEnabled()) {
                                     s_logger.debug(vol + " is READY, changing deployment plan to use this pool's dcId: " + rootVolDcId + " , podId: " + rootVolPodId + " , and clusterId: " + rootVolClusterId);
@@ -856,7 +865,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
                     }
                 }
 
-                VirtualMachineProfileImpl<T> vmProfile = new VirtualMachineProfileImpl<T>(vm, template, offering, account, params);
+                VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vm, template, offering, account, params);
                 DeployDestination dest = null;
                 try {
                     dest = _dpMgr.planDeployment(vmProfile, plan, avoids);
@@ -955,7 +964,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
                             if (s_logger.isDebugEnabled()) {
                                 s_logger.debug("Start completed for VM " + vm);
                             }
-                            return startedVm;
+                            return;
                         } else {
                             if (s_logger.isDebugEnabled()) {
                                 s_logger.info("The guru did not like the answers so stopping " + vm);
@@ -1037,7 +1046,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
                     + "' (" + vm.getUuid() + "), see management server log for details");
         }
 
-        return startedVm;
+        return;
     }
 
     @Override
@@ -1075,8 +1084,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         return true;
     }
 
-    protected <T extends VMInstanceVO> boolean cleanup(VirtualMachineGuru<T> guru, VirtualMachineProfile<T> profile, ItWorkVO work, Event event, boolean force, User user, Account account) {
-        T vm = profile.getVirtualMachine();
+    protected boolean cleanup(VirtualMachineGuru guru, VirtualMachineProfile profile, ItWorkVO work, Event event, boolean force, User user, Account account) {
+        VirtualMachine vm = profile.getVirtualMachine();
         State state = vm.getState();
         s_logger.debug("Cleaning up resources for the vm " + vm + " in " + state + " state");
         if (state == State.Starting) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7928963d/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
index 686c688..b072318 100644
--- a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
+++ b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
@@ -27,15 +27,15 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
 import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
@@ -61,8 +61,8 @@ import com.cloud.host.Host;
 import com.cloud.host.HostVO;
 import com.cloud.host.dao.HostDao;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao;
 import com.cloud.hypervisor.HypervisorGuruManager;
+import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao;
 import com.cloud.projects.Project.ListProjectResourcesCriteria;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.Snapshot;
@@ -205,7 +205,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
         }
 
         if (state == null) {
-            VMSnapshot.State[] status = { VMSnapshot.State.Ready, VMSnapshot.State.Creating, VMSnapshot.State.Allocated, 
+            VMSnapshot.State[] status = { VMSnapshot.State.Ready, VMSnapshot.State.Creating, VMSnapshot.State.Allocated,
                     VMSnapshot.State.Error, VMSnapshot.State.Expunging, VMSnapshot.State.Reverting };
             sc.setParameters("status", (Object[]) status);
         } else {
@@ -237,7 +237,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
     }
     
     @Override
-    public VMSnapshot allocVMSnapshot(Long vmId, String vsDisplayName, String vsDescription, Boolean snapshotMemory) 
+    public VMSnapshot allocVMSnapshot(Long vmId, String vsDisplayName, String vsDescription, Boolean snapshotMemory)
             throws ResourceAllocationException {
 
         Account caller = getCaller();
@@ -265,7 +265,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
             vsDisplayName = vmSnapshotName;
         }
         if(_vmSnapshotDao.findByName(vmId,vsDisplayName) != null){
-            throw new InvalidParameterValueException("Creating VM snapshot failed due to VM snapshot with name" + vsDisplayName + "  already exists"); 
+            throw new InvalidParameterValueException("Creating VM snapshot failed due to VM snapshot with name" + vsDisplayName + "  already exists");
         }
         
         // check VM state
@@ -322,7 +322,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
         } catch (Exception e) {
             String msg = e.getMessage();
             s_logger.error("Create vm snapshot record failed for vm: " + vmId + " due to: " + msg);
-        }  
+        }
         return null;
     }
 
@@ -352,7 +352,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
     }
 
     protected VMSnapshot createVmSnapshotInternal(UserVmVO userVm, VMSnapshotVO vmSnapshot, Long hostId) {
-        try { 
+        try {
             CreateVMSnapshotAnswer answer = null;
             GuestOSVO guestOS = _guestOSDao.findById(userVm.getGuestOSId());
             
@@ -412,7 +412,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
         List<VolumeVO> volumeVos = _volumeDao.findByInstance(vmId);
         
         for (VolumeVO volume : volumeVos) {
-            StoragePool pool = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(volume.getPoolId());
+            StoragePool pool = (StoragePool)dataStoreMgr.getPrimaryDataStore(volume.getPoolId());
             VolumeTO volumeTO = new VolumeTO(volume, pool);
             volumeTOs.add(volumeTO);
         }
@@ -488,7 +488,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
             _vmSnapshotDao.persist(child);
         }
         
-        // update current snapshot 
+        // update current snapshot
         VMSnapshotVO current = _vmSnapshotDao.findCurrentSnapshotByVmId(vmSnapshot.getVmId());
         if(current != null && current.getId() == vmSnapshot.getId() && vmSnapshot.getParent() != null){
             VMSnapshotVO parent = _vmSnapshotDao.findById(vmSnapshot.getParent());
@@ -550,7 +550,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
     
     @Override
     public boolean hasActiveVMSnapshotTasks(Long vmId){
-        List<VMSnapshotVO> activeVMSnapshots = _vmSnapshotDao.listByInstanceId(vmId, 
+        List<VMSnapshotVO> activeVMSnapshots = _vmSnapshotDao.listByInstanceId(vmId,
                 VMSnapshot.State.Creating, VMSnapshot.State.Expunging,VMSnapshot.State.Reverting,VMSnapshot.State.Allocated);
         return activeVMSnapshots.size() > 0;
     }
@@ -602,7 +602,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
             // prepare DeleteVMSnapshotCommand
             String vmInstanceName = userVm.getInstanceName();
             VMSnapshotTO parent = getSnapshotWithParents(vmSnapshot).getParent();
-            VMSnapshotTO vmSnapshotTO = new VMSnapshotTO(vmSnapshot.getId(), vmSnapshot.getName(), vmSnapshot.getType(), 
+            VMSnapshotTO vmSnapshotTO = new VMSnapshotTO(vmSnapshot.getId(), vmSnapshot.getName(), vmSnapshot.getType(),
                     vmSnapshot.getCreated().getTime(), vmSnapshot.getDescription(), vmSnapshot.getCurrent(), parent);
             GuestOSVO guestOS = _guestOSDao.findById(userVm.getGuestOSId());
             DeleteVMSnapshotCommand deleteSnapshotCommand = new DeleteVMSnapshotCommand(vmInstanceName, vmSnapshotTO, volumeTOs,guestOS.getDisplayName());
@@ -673,7 +673,8 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
         // start or stop VM first, if revert from stopped state to running state, or from running to stopped
         if(userVm.getState() == VirtualMachine.State.Stopped && vmSnapshotVo.getType() == VMSnapshot.Type.DiskAndMemory){
             try {
-        	    vm = _itMgr.advanceStart(userVm, new HashMap<VirtualMachineProfile.Param, Object>(), callerUser, owner);
+                _itMgr.advanceStart(userVm.getUuid(), new HashMap<VirtualMachineProfile.Param, Object>());
+                vm = _userVMDao.findById(userVm.getId());
         	    hostId = vm.getHostId();
         	} catch (Exception e) {
         	    s_logger.error("Start VM " + userVm.getInstanceName() + " before reverting failed due to " + e.getMessage());
@@ -715,7 +716,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
             List<VolumeTO> volumeTOs = getVolumeTOList(userVm.getId());
             String vmInstanceName = userVm.getInstanceName();
             VMSnapshotTO parent = getSnapshotWithParents(snapshot).getParent();
-            VMSnapshotTO vmSnapshotTO = new VMSnapshotTO(snapshot.getId(), snapshot.getName(), snapshot.getType(), 
+            VMSnapshotTO vmSnapshotTO = new VMSnapshotTO(snapshot.getId(), snapshot.getName(), snapshot.getType(),
             		snapshot.getCreated().getTime(), snapshot.getDescription(), snapshot.getCurrent(), parent);
             
             GuestOSVO guestOS = _guestOSDao.findById(userVm.getGuestOSId());
@@ -746,7 +747,7 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
             String errMsg = "revert vm: " + userVm.getInstanceName() + " to snapshot " + vmSnapshotVo.getName() + " failed due to " + e.getMessage();
             s_logger.error(errMsg);
             throw new CloudRuntimeException(e.getMessage());
-        } 
+        }
         return userVm;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7928963d/server/test/com/cloud/vm/UserVmManagerTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/UserVmManagerTest.java b/server/test/com/cloud/vm/UserVmManagerTest.java
index 0eb9a08..6b0f688 100755
--- a/server/test/com/cloud/vm/UserVmManagerTest.java
+++ b/server/test/com/cloud/vm/UserVmManagerTest.java
@@ -198,7 +198,6 @@ public class UserVmManagerTest {
         doReturn(3L).when(_volumeMock).getTemplateId();
         when(_templateDao.findById(anyLong())).thenReturn(_templateMock);
         when(_itMgr.stop(_vmMock, _userMock, _account)).thenReturn(true);
-        when(_itMgr.start(_vmMock, null, _userMock, _account)).thenReturn(_vmMock);
         when(_storageMgr.allocateDuplicateVolume(_volumeMock, null)).thenReturn(_volumeMock);
         doNothing().when(_volsDao).attachVolume(anyLong(), anyLong(), anyLong());
         when(_volumeMock.getId()).thenReturn(3L);
@@ -237,7 +236,6 @@ public class UserVmManagerTest {
         doNothing().when(_vmMock).setGuestOSId(anyLong());
         doNothing().when(_vmMock).setTemplateId(3L);
         when(_vmDao.update(314L, _vmMock)).thenReturn(true);
-        when(_itMgr.start(_vmMock, null, _userMock, _account)).thenReturn(_vmMock);
         when(_storageMgr.allocateDuplicateVolume(_volumeMock, null)).thenReturn(_volumeMock);
         doNothing().when(_volsDao).attachVolume(anyLong(), anyLong(), anyLong());
         when(_volumeMock.getId()).thenReturn(3L);
@@ -278,7 +276,6 @@ public class UserVmManagerTest {
         doNothing().when(_vmMock).setGuestOSId(anyLong());
         doNothing().when(_vmMock).setTemplateId(3L);
         when(_vmDao.update(314L, _vmMock)).thenReturn(true);
-        when(_itMgr.start(_vmMock, null, _userMock, _account)).thenReturn(_vmMock);
         when(_storageMgr.allocateDuplicateVolume(_volumeMock, null)).thenReturn(_volumeMock);
         doNothing().when(_volsDao).attachVolume(anyLong(), anyLong(), anyLong());
         when(_volumeMock.getId()).thenReturn(3L);


[6/7] git commit: updated refs/heads/master to 0223657

Posted by ah...@apache.org.
Changed VirtualMachineProfile to be non-generic.  From here on VirtualMachineManager will only manage vm instance.  It doesn't understand the difference between different types of VMs.  This makes the vmsync code to be generic across all vms.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1325014a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1325014a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1325014a

Branch: refs/heads/master
Commit: 1325014a03efbe8d698f55c17ed70ecb8817c1b4
Parents: 7928963
Author: Alex Huang <al...@citrix.com>
Authored: Mon Jul 22 11:08:39 2013 -0700
Committer: Alex Huang <al...@citrix.com>
Committed: Mon Jul 22 11:48:11 2013 -0700

----------------------------------------------------------------------
 .../agent/manager/allocator/HostAllocator.java  |   6 +-
 .../cloud/deploy/DeploymentClusterPlanner.java  |   6 +-
 api/src/com/cloud/deploy/DeploymentPlanner.java |   7 +-
 .../com/cloud/hypervisor/HypervisorGuru.java    |   2 +-
 .../network/NetworkMigrationResponder.java      |   6 +-
 .../network/element/DhcpServiceProvider.java    |   4 +-
 .../cloud/network/element/NetworkElement.java   |   4 +-
 .../element/UserDataServiceProvider.java        |   8 +-
 api/src/com/cloud/network/guru/NetworkGuru.java |   8 +-
 api/src/com/cloud/vm/VirtualMachineProfile.java |   8 +-
 .../affinity/AffinityGroupProcessor.java        |   5 +-
 .../affinity/AffinityProcessorBase.java         |   5 +-
 .../api/storage/StoragePoolAllocator.java       |   3 +-
 .../cloud/entity/api/VMEntityManagerImpl.java   |   6 +-
 .../allocator/AbstractStoragePoolAllocator.java |  10 +-
 .../ClusterScopeStoragePoolAllocator.java       |  10 +-
 .../GarbageCollectingStoragePoolAllocator.java  |   2 +-
 .../allocator/LocalStoragePoolAllocator.java    |   2 +-
 .../allocator/UseLocalForRootAllocator.java     |   2 +-
 .../allocator/ZoneWideStoragePoolAllocator.java |   2 +-
 .../affinity/ExplicitDedicationProcessor.java   |   5 +-
 .../affinity/HostAntiAffinityProcessor.java     |   4 +-
 .../cloud/deploy/ImplicitDedicationPlanner.java |   4 +-
 .../implicitplanner/ImplicitPlannerTest.java    |  16 +-
 .../deploy/UserConcentratedPodPlanner.java      |   4 +-
 .../com/cloud/deploy/UserDispersingPlanner.java |   4 +-
 .../manager/allocator/impl/RandomAllocator.java |   6 +-
 .../cloud/baremetal/manager/BareMetalGuru.java  |  11 +-
 .../baremetal/manager/BareMetalPlanner.java     |  16 +-
 .../BareMetalPingServiceImpl.java               |  20 +-
 .../networkservice/BaremetaNetworkGuru.java     |   4 +-
 .../networkservice/BaremetalDhcpElement.java    |   8 +-
 .../networkservice/BaremetalDhcpManager.java    |   2 +-
 .../BaremetalDhcpManagerImpl.java               |   2 +-
 .../BaremetalKickStartServiceImpl.java          |  10 +-
 .../networkservice/BaremetalPxeElement.java     |   4 +-
 .../networkservice/BaremetalPxeManager.java     |  11 +-
 .../networkservice/BaremetalPxeManagerImpl.java |  13 +-
 .../networkservice/BaremetalPxeService.java     |  14 +-
 .../BaremetalUserdataElement.java               |  14 +-
 .../src/com/cloud/ovm/hypervisor/OvmGuru.java   |   6 +-
 .../src/com/cloud/simulator/SimulatorGuru.java  |   9 +-
 .../com/cloud/hypervisor/guru/VMwareGuru.java   |   2 +-
 .../network/element/CiscoNexusVSMElement.java   |   4 +-
 .../src/com/cloud/hypervisor/XenServerGuru.java |   6 +-
 .../network/element/BigSwitchVnsElement.java    |   4 +-
 .../guru/BigSwitchVnsGuestNetworkGuru.java      |   4 +-
 .../cloud/network/element/CiscoVnmcElement.java |   4 +-
 .../cloudstack/network/element/DnsNotifier.java |   4 +-
 .../element/ElasticLoadBalancerElement.java     |   4 +-
 .../lb/ElasticLoadBalancerManagerImpl.java      |  21 +-
 .../element/F5ExternalLoadBalancerElement.java  |   4 +-
 .../element/InternalLoadBalancerElement.java    |   4 +-
 .../lb/InternalLoadBalancerVMManagerImpl.java   |  23 +-
 .../JuniperSRXExternalFirewallElement.java      |   4 +-
 .../cloud/network/element/MidoNetElement.java   |   8 +-
 .../network/guru/MidoNetGuestNetworkGuru.java   |   4 +-
 .../network/guru/MidoNetPublicNetworkGuru.java  |  10 +-
 .../network/element/MidoNetElementTest.java     |   4 +-
 .../cloud/network/element/NetscalerElement.java |   4 +-
 .../cloud/network/element/NiciraNvpElement.java |   4 +-
 .../network/guru/NiciraNvpGuestNetworkGuru.java |   4 +-
 .../com/cloud/network/element/OvsElement.java   |   4 +-
 .../com/cloud/network/ovs/OvsTunnelManager.java |   2 +-
 .../cloud/network/ovs/OvsTunnelManagerImpl.java |   2 +-
 .../cloudstack/network/element/SspElement.java  |  10 +-
 .../network/guru/SspGuestNetworkGuru.java       |  10 +-
 .../allocator/RandomStoragePoolAllocator.java   |   2 +-
 .../allocator/impl/FirstFitAllocator.java       |   6 +-
 .../impl/FirstFitRoutingAllocator.java          |   2 +-
 .../allocator/impl/RecreateHostAllocator.java   |   2 +-
 .../allocator/impl/TestingAllocator.java        |   6 +-
 .../consoleproxy/ConsoleProxyManagerImpl.java   |  18 +-
 .../cloud/deploy/DeploymentPlanningManager.java |   5 +-
 .../deploy/DeploymentPlanningManagerImpl.java   |  14 +-
 .../src/com/cloud/deploy/FirstFitPlanner.java   |  20 +-
 .../cloud/hypervisor/HypervisorGuruBase.java    |   2 +-
 server/src/com/cloud/hypervisor/KVMGuru.java    |   4 +-
 server/src/com/cloud/hypervisor/LXCGuru.java    |   4 +-
 .../src/com/cloud/network/NetworkManager.java   |  49 +-
 .../com/cloud/network/NetworkManagerImpl.java   |  42 +-
 .../element/CloudZonesNetworkElement.java       |  31 +-
 .../network/element/SecurityGroupElement.java   |   4 +-
 .../network/element/VirtualRouterElement.java   |  36 +-
 .../element/VpcVirtualRouterElement.java        |   2 +-
 .../cloud/network/guru/ControlNetworkGuru.java  |   8 +-
 .../cloud/network/guru/DirectNetworkGuru.java   |  10 +-
 .../network/guru/DirectPodBasedNetworkGuru.java |   6 +-
 .../network/guru/ExternalGuestNetworkGuru.java  |   8 +-
 .../cloud/network/guru/GuestNetworkGuru.java    |   8 +-
 .../cloud/network/guru/PodBasedNetworkGuru.java |   8 +-
 .../cloud/network/guru/PrivateNetworkGuru.java  |   8 +-
 .../cloud/network/guru/PublicNetworkGuru.java   |  10 +-
 .../cloud/network/guru/StorageNetworkGuru.java  |   8 +-
 .../router/VirtualNetworkApplianceManager.java  |  12 +-
 .../VirtualNetworkApplianceManagerImpl.java     |  86 +-
 .../VpcVirtualNetworkApplianceManagerImpl.java  |  18 +-
 .../com/cloud/server/ManagementServerImpl.java  |   6 +-
 .../com/cloud/storage/StorageManagerImpl.java   |   2 +-
 server/src/com/cloud/storage/VolumeManager.java |  13 +-
 .../com/cloud/storage/VolumeManagerImpl.java    |  12 +-
 .../secondary/SecondaryStorageManagerImpl.java  |  23 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java  |  37 +-
 server/src/com/cloud/vm/VirtualMachineGuru.java |  14 +-
 .../src/com/cloud/vm/VirtualMachineManager.java |   2 +-
 .../com/cloud/vm/VirtualMachineManagerImpl.java |  47 +-
 .../com/cloud/vm/VirtualMachineProfileImpl.java |  20 +-
 .../cloud/network/MockNetworkManagerImpl.java   | 962 -------------------
 .../cloud/vm/VirtualMachineManagerImplTest.java |   2 +-
 .../com/cloud/vpc/MockNetworkManagerImpl.java   |  62 +-
 .../MockVpcVirtualNetworkApplianceManager.java  |  12 +-
 111 files changed, 548 insertions(+), 1552 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/api/src/com/cloud/agent/manager/allocator/HostAllocator.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/manager/allocator/HostAllocator.java b/api/src/com/cloud/agent/manager/allocator/HostAllocator.java
index fcd1fc1..14525aa 100755
--- a/api/src/com/cloud/agent/manager/allocator/HostAllocator.java
+++ b/api/src/com/cloud/agent/manager/allocator/HostAllocator.java
@@ -47,7 +47,7 @@ public interface HostAllocator extends Adapter {
 	* @return List<Host> List of hosts that are suitable for VM allocation
 	**/
 	
-	public List<Host> allocateTo(VirtualMachineProfile<?extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo);
+	public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo);
 	
     /**
     * Determines which physical hosts are suitable to
@@ -62,7 +62,7 @@ public interface HostAllocator extends Adapter {
     * @return List<Host> List of hosts that are suitable for VM allocation
     **/
     
-    public List<Host> allocateTo(VirtualMachineProfile<?extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity);
+    public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity);
 
     /**
      * Determines which physical hosts are suitable to
@@ -77,7 +77,7 @@ public interface HostAllocator extends Adapter {
      * @param boolean considerReservedCapacity (default should be true, set to false if host capacity calculation should not look at reserved capacity)
      * @return List<Host> List of hosts that are suitable for VM allocation
      **/
-    public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, List<? extends Host> hosts,
+    public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, List<? extends Host> hosts,
             int returnUpTo, boolean considerReservedCapacity);
 
      public static int RETURN_UPTO_ALL = -1;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/api/src/com/cloud/deploy/DeploymentClusterPlanner.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/deploy/DeploymentClusterPlanner.java b/api/src/com/cloud/deploy/DeploymentClusterPlanner.java
index 8b15ea5..ca73267 100644
--- a/api/src/com/cloud/deploy/DeploymentClusterPlanner.java
+++ b/api/src/com/cloud/deploy/DeploymentClusterPlanner.java
@@ -18,9 +18,7 @@ package com.cloud.deploy;
 
 import java.util.List;
 
-import com.cloud.deploy.DeploymentPlanner.ExcludeList;
 import com.cloud.exception.InsufficientServerCapacityException;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 /**
@@ -38,10 +36,10 @@ public interface DeploymentClusterPlanner extends DeploymentPlanner {
      *            avoid these data centers, pods, clusters, or hosts.
      * @return DeployDestination for that virtual machine.
      */
-    List<Long> orderClusters(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid)
+    List<Long> orderClusters(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid)
             throws InsufficientServerCapacityException;
 
-    PlannerResourceUsage getResourceUsage(VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+    PlannerResourceUsage getResourceUsage(VirtualMachineProfile vmProfile,
             DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/api/src/com/cloud/deploy/DeploymentPlanner.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/deploy/DeploymentPlanner.java b/api/src/com/cloud/deploy/DeploymentPlanner.java
index 769da39..741a804 100644
--- a/api/src/com/cloud/deploy/DeploymentPlanner.java
+++ b/api/src/com/cloud/deploy/DeploymentPlanner.java
@@ -29,7 +29,6 @@ import com.cloud.host.Host;
 import com.cloud.org.Cluster;
 import com.cloud.storage.StoragePool;
 import com.cloud.utils.component.Adapter;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 /**
@@ -48,7 +47,7 @@ public interface DeploymentPlanner extends Adapter {
      * @return DeployDestination for that virtual machine.
      */
     @Deprecated
-    DeployDestination plan(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
+    DeployDestination plan(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException;
 
     /**
      * check() is called right before the virtual machine starts to make sure
@@ -65,7 +64,7 @@ public interface DeploymentPlanner extends Adapter {
      * @return true if it's okay to start; false if not. If false, the exclude list will include what should be
      *         excluded.
      */
-    boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, DeployDestination dest, ExcludeList exclude);
+    boolean check(VirtualMachineProfile vm, DeploymentPlan plan, DeployDestination dest, ExcludeList exclude);
 
     /**
      * canHandle is called before plan to determine if the plan can do the allocation. Planers should be exclusive so
@@ -80,7 +79,7 @@ public interface DeploymentPlanner extends Adapter {
      *            avoid these data centers, pods, clusters, or hosts.
      * @return true if it's okay to allocate; false or not
      */
-    boolean canHandle(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid);
+    boolean canHandle(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid);
 
     public enum AllocationAlgorithm {
         random,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/api/src/com/cloud/hypervisor/HypervisorGuru.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/hypervisor/HypervisorGuru.java b/api/src/com/cloud/hypervisor/HypervisorGuru.java
index 47ca17a..182f06a 100644
--- a/api/src/com/cloud/hypervisor/HypervisorGuru.java
+++ b/api/src/com/cloud/hypervisor/HypervisorGuru.java
@@ -36,7 +36,7 @@ public interface HypervisorGuru extends Adapter {
      * @param vm
      * @return
      */
-    <T extends VirtualMachine> VirtualMachineTO implement(VirtualMachineProfile<T> vm);
+    VirtualMachineTO implement(VirtualMachineProfile vm);
 
     /**
      * Give hypervisor guru opportunity to decide if certain command needs to be delegated to other host, mainly to secondary storage VM host

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/api/src/com/cloud/network/NetworkMigrationResponder.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/NetworkMigrationResponder.java b/api/src/com/cloud/network/NetworkMigrationResponder.java
index 6283cc5..951e1c2 100644
--- a/api/src/com/cloud/network/NetworkMigrationResponder.java
+++ b/api/src/com/cloud/network/NetworkMigrationResponder.java
@@ -38,7 +38,7 @@ public interface NetworkMigrationResponder {
      * @param context
      * @return true when operation was successful.
      */
-    public boolean prepareMigration(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context);
+    public boolean prepareMigration(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context);
 
     /**
      * Cancel for migration preparation.
@@ -52,7 +52,7 @@ public interface NetworkMigrationResponder {
      * @param src The context nic migrates from.
      * @param dst The context nic migrates to.
      */
-    public void rollbackMigration(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext src, ReservationContext dst);
+    public void rollbackMigration(NicProfile nic, Network network, VirtualMachineProfile vm, ReservationContext src, ReservationContext dst);
 
     /**
      * Commit the migration resource.
@@ -66,5 +66,5 @@ public interface NetworkMigrationResponder {
      * @param src the context nic migrates from.
      * @param dst the context nic migrates to.
      */
-    public void commitMigration(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext src, ReservationContext dst);
+    public void commitMigration(NicProfile nic, Network network, VirtualMachineProfile vm, ReservationContext src, ReservationContext dst);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/api/src/com/cloud/network/element/DhcpServiceProvider.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/element/DhcpServiceProvider.java b/api/src/com/cloud/network/element/DhcpServiceProvider.java
index 6363d7c..62c650b 100644
--- a/api/src/com/cloud/network/element/DhcpServiceProvider.java
+++ b/api/src/com/cloud/network/element/DhcpServiceProvider.java
@@ -27,7 +27,7 @@ import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 public interface DhcpServiceProvider extends NetworkElement {
-    boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
-    boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
+    boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
+    boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
     boolean  removeDhcpSupportForSubnet(Network network) throws ResourceUnavailableException;
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/api/src/com/cloud/network/element/NetworkElement.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/element/NetworkElement.java b/api/src/com/cloud/network/element/NetworkElement.java
index d89c2a3..5f603ce 100644
--- a/api/src/com/cloud/network/element/NetworkElement.java
+++ b/api/src/com/cloud/network/element/NetworkElement.java
@@ -71,7 +71,7 @@ public interface NetworkElement extends Adapter {
      * @throws ResourceUnavailableException
      * @throws InsufficientNetworkCapacityException
      */
-    boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, 
+    boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, 
             DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, 
             ResourceUnavailableException, InsufficientCapacityException;
 
@@ -85,7 +85,7 @@ public interface NetworkElement extends Adapter {
      * @throws ConcurrentOperationException
      * @throws ResourceUnavailableException
      */
-    boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, 
+    boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, 
             ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException;
 
     /**

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/api/src/com/cloud/network/element/UserDataServiceProvider.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/element/UserDataServiceProvider.java b/api/src/com/cloud/network/element/UserDataServiceProvider.java
index d9ddf93..29cd5ae 100644
--- a/api/src/com/cloud/network/element/UserDataServiceProvider.java
+++ b/api/src/com/cloud/network/element/UserDataServiceProvider.java
@@ -27,8 +27,8 @@ import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 public interface UserDataServiceProvider extends NetworkElement {
-    public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
-    boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws ResourceUnavailableException;
-    boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws ResourceUnavailableException;
-    boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String SSHPublicKey) throws ResourceUnavailableException;
+    public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
+    boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException;
+    boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException;
+    boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile vm, String SSHPublicKey) throws ResourceUnavailableException;
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/api/src/com/cloud/network/guru/NetworkGuru.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/guru/NetworkGuru.java b/api/src/com/cloud/network/guru/NetworkGuru.java
index 4a9b871..4127233 100755
--- a/api/src/com/cloud/network/guru/NetworkGuru.java
+++ b/api/src/com/cloud/network/guru/NetworkGuru.java
@@ -127,7 +127,7 @@ public interface NetworkGuru extends Adapter {
      * @throws InsufficientAddressCapacityException if there are not addresses
      *         to be assigned.
      */
-    NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
+    NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
 
     /**
      * Once a guest network is implemented, then the virtual machine must
@@ -147,7 +147,7 @@ public interface NetworkGuru extends Adapter {
      * @throws ConcurrentOperationException if there are multiple operations
      *         happening on this guest network or vm.
      */
-    void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
+    void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
 
     /**
      * When a virtual machine is stopped, the NetworkGuru is informed via the
@@ -158,7 +158,7 @@ public interface NetworkGuru extends Adapter {
      * @param reservationId reservation id passed to it in the ReservationContext
      * @return true if release is successful or false if unsuccessful.
      */
-    boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId);
+    boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId);
 
     /**
      * When a virtual machine is destroyed, the NetworkGuru is informed via
@@ -169,7 +169,7 @@ public interface NetworkGuru extends Adapter {
      * @param nic nic that the vm was using to access the guest network.
      * @param vm virtual machine being destroyed.
      */
-    void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm);
+    void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm);
 
     /**
      * @deprecated This method should not be here in the first place. What does this really mean? Is it always persisted

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/api/src/com/cloud/vm/VirtualMachineProfile.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VirtualMachineProfile.java b/api/src/com/cloud/vm/VirtualMachineProfile.java
index 6861372..3da8397 100644
--- a/api/src/com/cloud/vm/VirtualMachineProfile.java
+++ b/api/src/com/cloud/vm/VirtualMachineProfile.java
@@ -19,9 +19,7 @@ package com.cloud.vm;
 import java.util.List;
 import java.util.Map;
 
-import com.cloud.agent.api.to.DataTO;
 import com.cloud.agent.api.to.DiskTO;
-import com.cloud.agent.api.to.VolumeTO;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.offering.ServiceOffering;
 import com.cloud.template.VirtualMachineTemplate;
@@ -33,10 +31,8 @@ import com.cloud.user.Account;
  * on what the virtual machine profile should look like before it is
  * actually started on the hypervisor.
  *
- * @param <T>
- *            a VirtualMachine
  */
-public interface VirtualMachineProfile<T extends VirtualMachine> {
+public interface VirtualMachineProfile {
 
     public static class Param {
 
@@ -69,7 +65,7 @@ public interface VirtualMachineProfile<T extends VirtualMachine> {
     /**
      * @return the virtual machine that backs up this profile.
      */
-    T getVirtualMachine();
+    VirtualMachine getVirtualMachine();
 
     /**
      * @return service offering for this virtual machine.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java b/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
index e3a9b62..8e9fabd 100644
--- a/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
+++ b/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
@@ -21,7 +21,6 @@ import com.cloud.deploy.DeploymentPlan;
 import com.cloud.deploy.DeploymentPlanner.ExcludeList;
 import com.cloud.exception.AffinityConflictException;
 import com.cloud.utils.component.Adapter;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 public interface AffinityGroupProcessor extends Adapter {
@@ -37,7 +36,7 @@ public interface AffinityGroupProcessor extends Adapter {
      * @param avoid
      *            avoid these data centers, pods, clusters, or hosts.
      */
-    void process(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid)
+    void process(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid)
             throws AffinityConflictException;
 
     /**
@@ -57,6 +56,6 @@ public interface AffinityGroupProcessor extends Adapter {
      * @param plannedDestination
      *            deployment destination where VM is planned to be deployed
      */
-    boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination plannedDestination)
+    boolean check(VirtualMachineProfile vm, DeployDestination plannedDestination)
             throws AffinityConflictException;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java b/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java
index 325ab80..779ca32 100644
--- a/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java
+++ b/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java
@@ -21,7 +21,6 @@ import com.cloud.deploy.DeploymentPlan;
 import com.cloud.deploy.DeploymentPlanner.ExcludeList;
 import com.cloud.exception.AffinityConflictException;
 import com.cloud.utils.component.AdapterBase;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 public class AffinityProcessorBase extends AdapterBase implements AffinityGroupProcessor {
@@ -29,7 +28,7 @@ public class AffinityProcessorBase extends AdapterBase implements AffinityGroupP
     protected String _type;
 
     @Override
-    public void process(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid)
+    public void process(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid)
             throws AffinityConflictException {
 
     }
@@ -44,7 +43,7 @@ public class AffinityProcessorBase extends AdapterBase implements AffinityGroupP
     }
 
     @Override
-    public boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination plannedDestination)
+    public boolean check(VirtualMachineProfile vm, DeployDestination plannedDestination)
             throws AffinityConflictException {
         return true;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StoragePoolAllocator.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StoragePoolAllocator.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StoragePoolAllocator.java
index eccf0f4..54808c1 100644
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StoragePoolAllocator.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StoragePoolAllocator.java
@@ -23,7 +23,6 @@ import com.cloud.deploy.DeploymentPlanner.ExcludeList;
 import com.cloud.storage.StoragePool;
 import com.cloud.utils.component.Adapter;
 import com.cloud.vm.DiskProfile;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 /**
@@ -44,7 +43,7 @@ public interface StoragePoolAllocator extends Adapter {
      * @return List<StoragePool> List of storage pools that are suitable for the
      *         VM
      **/
-    List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+    List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile vmProfile,
             DeploymentPlan plan, ExcludeList avoid, int returnUpTo);
 
     static int RETURN_UPTO_ALL = -1;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
index ee5ae2d..aae0962 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
@@ -129,7 +129,7 @@ public class VMEntityManagerImpl implements VMEntityManager {
 
 	}
 
-    protected boolean areAffinityGroupsAssociated(VirtualMachineProfile<? extends VirtualMachine> vmProfile) {
+    protected boolean areAffinityGroupsAssociated(VirtualMachineProfile vmProfile) {
         VirtualMachine vm = vmProfile.getVirtualMachine();
         long vmGroupCount = _affinityGroupVMMapDao.countAffinityGroupsForVm(vm.getId());
 
@@ -147,7 +147,7 @@ public class VMEntityManagerImpl implements VMEntityManager {
         //load vm instance and offerings and call virtualMachineManagerImpl
         //FIXME: profile should work on VirtualMachineEntity
         VMInstanceVO vm = _vmDao.findByUuid(vmEntityVO.getUuid());
-        VirtualMachineProfileImpl<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
+        VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vm);
         DataCenterDeployment plan = new DataCenterDeployment(vm.getDataCenterId(), vm.getPodIdToDeployIn(), null, null, null, null);
         if(planToDeploy != null && planToDeploy.getDataCenterId() != 0){
             plan = new DataCenterDeployment(planToDeploy.getDataCenterId(), planToDeploy.getPodId(), planToDeploy.getClusterId(), planToDeploy.getHostId(), planToDeploy.getPoolId(), planToDeploy.getPhysicalNetworkId());
@@ -256,8 +256,6 @@ public class VMEntityManagerImpl implements VMEntityManager {
 
          VMInstanceVO vm = _vmDao.findByUuid(vmEntityVO.getUuid());
          return _itMgr.destroy(vm, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()));
-
-
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/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 89e0974..851377e 100755
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
@@ -27,10 +27,11 @@ import java.util.Random;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
-import org.apache.log4j.Logger;
 
 import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.dc.ClusterVO;
@@ -49,7 +50,6 @@ import com.cloud.user.Account;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.component.AdapterBase;
 import com.cloud.vm.DiskProfile;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 public abstract class AbstractStoragePoolAllocator extends AdapterBase implements StoragePoolAllocator {
@@ -99,12 +99,12 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement
     }
 
     protected abstract List<StoragePool> select(DiskProfile dskCh,
-            VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid,
+            VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid,
             int returnUpTo);
 
     @Override
     public List<StoragePool> allocateToPool(DiskProfile dskCh,
-            VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid,
+            VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid,
             int returnUpTo) {
         List<StoragePool> pools = select(dskCh, vmProfile, plan, avoid, returnUpTo);
         return reOrder(pools, vmProfile, plan);
@@ -144,7 +144,7 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement
     }
 
     protected List<StoragePool> reOrder(List<StoragePool> pools,
-            VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan) {
+            VirtualMachineProfile vmProfile, DeploymentPlan plan) {
         if (pools == null) {
             return null;
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/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 41afa83..b1105ba 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
@@ -25,18 +25,18 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
-import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
+import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+
 import com.cloud.deploy.DeploymentPlan;
 import com.cloud.deploy.DeploymentPlanner.ExcludeList;
 import com.cloud.offering.ServiceOffering;
 import com.cloud.storage.StoragePool;
 import com.cloud.storage.dao.DiskOfferingDao;
 import com.cloud.vm.DiskProfile;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 @Component
@@ -49,7 +49,7 @@ public class ClusterScopeStoragePoolAllocator extends AbstractStoragePoolAllocat
     DiskOfferingDao _diskOfferingDao;
 
     @Override
-    protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+    protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile,
             DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
 
         s_logger.debug("ClusterScopeStoragePoolAllocator looking for storage pool");
@@ -91,7 +91,7 @@ public class ClusterScopeStoragePoolAllocator extends AbstractStoragePoolAllocat
             if (suitablePools.size() == returnUpTo) {
                 break;
             }
-            StoragePool pol = (StoragePool) this.dataStoreMgr.getPrimaryDataStore(pool.getId());
+            StoragePool pol = (StoragePool) dataStoreMgr.getPrimaryDataStore(pool.getId());
             if (filter(avoid, pol, dskCh, plan)) {
                 suitablePools.add(pol);
             } else {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/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 979ea73..15b4407 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/GarbageCollectingStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/GarbageCollectingStoragePoolAllocator.java
@@ -49,7 +49,7 @@ public class GarbageCollectingStoragePoolAllocator extends AbstractStoragePoolAl
     boolean _storagePoolCleanupEnabled;
 
     @Override
-    public List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+    public List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile,
             DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
         s_logger.debug("GarbageCollectingStoragePoolAllocator looking for storage pool");
         if (!_storagePoolCleanupEnabled) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/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 4056fe7..310f4a1 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,7 @@ public class LocalStoragePoolAllocator extends AbstractStoragePoolAllocator {
     ConfigurationDao _configDao;
 
     @Override
-    protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+    protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile,
             DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
 
         List<StoragePool> suitablePools = new ArrayList<StoragePool>();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/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 d057138..6d7ac93 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/UseLocalForRootAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/UseLocalForRootAllocator.java
@@ -42,7 +42,7 @@ public class UseLocalForRootAllocator extends LocalStoragePoolAllocator implemen
 
     @Override
     public List<StoragePool> allocateToPool(DiskProfile dskCh,
-            VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid,
+            VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid,
             int returnUpTo) {
         DataCenterVO dc = _dcDao.findById(plan.getDataCenterId());
         if (!dc.isLocalStorageEnabled()) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/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 300d932..0288b17 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
@@ -56,7 +56,7 @@ public class ZoneWideStoragePoolAllocator extends AbstractStoragePoolAllocator {
 
 	@Override
 	protected List<StoragePool> select(DiskProfile dskCh,
-			VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+			VirtualMachineProfile vmProfile,
 			DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
 	    s_logger.debug("ZoneWideStoragePoolAllocator to find storage pool");
 		List<StoragePool> suitablePools = new ArrayList<StoragePool>();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/affinity-group-processors/explicit-dedication/src/org/apache/cloudstack/affinity/ExplicitDedicationProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/affinity-group-processors/explicit-dedication/src/org/apache/cloudstack/affinity/ExplicitDedicationProcessor.java b/plugins/affinity-group-processors/explicit-dedication/src/org/apache/cloudstack/affinity/ExplicitDedicationProcessor.java
index a0eb56c..2169359 100644
--- a/plugins/affinity-group-processors/explicit-dedication/src/org/apache/cloudstack/affinity/ExplicitDedicationProcessor.java
+++ b/plugins/affinity-group-processors/explicit-dedication/src/org/apache/cloudstack/affinity/ExplicitDedicationProcessor.java
@@ -23,9 +23,10 @@ import java.util.Set;
 import javax.ejb.Local;
 import javax.inject.Inject;
 
+import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
 import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
-import org.apache.log4j.Logger;
 
 import com.cloud.dc.ClusterVO;
 import com.cloud.dc.DataCenter;
@@ -82,7 +83,7 @@ public class ExplicitDedicationProcessor extends AffinityProcessorBase implement
      * This IncludeList is then used to update the avoid list for a given data center.
      */
     @Override
-    public void process(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan,
+    public void process(VirtualMachineProfile vmProfile, DeploymentPlan plan,
             ExcludeList avoid) throws AffinityConflictException {
         VirtualMachine vm = vmProfile.getVirtualMachine();
         List<AffinityGroupVMMapVO> vmGroupMappings = _affinityGroupVMMapDao.findByVmIdType(vm.getId(), getType());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java b/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
index 1569c7e..c4a847d 100644
--- a/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
+++ b/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
@@ -66,7 +66,7 @@ public class HostAntiAffinityProcessor extends AffinityProcessorBase implements
     protected VMReservationDao _reservationDao;
 
     @Override
-    public void process(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan,
+    public void process(VirtualMachineProfile vmProfile, DeploymentPlan plan,
             ExcludeList avoid)
             throws AffinityConflictException {
         VirtualMachine vm = vmProfile.getVirtualMachine();
@@ -118,7 +118,7 @@ public class HostAntiAffinityProcessor extends AffinityProcessorBase implements
     }
 
     @Override
-    public boolean check(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeployDestination plannedDestination)
+    public boolean check(VirtualMachineProfile vmProfile, DeployDestination plannedDestination)
             throws AffinityConflictException {
 
         if (plannedDestination.getHost() == null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java
----------------------------------------------------------------------
diff --git a/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java b/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java
index be016cb..6eee28d 100644
--- a/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java
+++ b/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java
@@ -67,7 +67,7 @@ public class ImplicitDedicationPlanner extends FirstFitPlanner implements Deploy
     }
 
     @Override
-    public List<Long> orderClusters(VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+    public List<Long> orderClusters(VirtualMachineProfile vmProfile,
             DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException {
         List<Long> clusterList = super.orderClusters(vmProfile, plan, avoid);
         Set<Long> hostsToAvoid = avoid.getHostsToAvoid();
@@ -251,7 +251,7 @@ public class ImplicitDedicationPlanner extends FirstFitPlanner implements Deploy
     }
 
     @Override
-    public PlannerResourceUsage getResourceUsage(VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+    public PlannerResourceUsage getResourceUsage(VirtualMachineProfile vmProfile,
             DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException {
         // Check if strict or preferred mode should be used.
         boolean preferred = isServiceOfferingUsingPlannerInPreferredMode(vmProfile.getServiceOfferingId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/deployment-planners/implicit-dedication/test/org/apache/cloudstack/implicitplanner/ImplicitPlannerTest.java
----------------------------------------------------------------------
diff --git a/plugins/deployment-planners/implicit-dedication/test/org/apache/cloudstack/implicitplanner/ImplicitPlannerTest.java b/plugins/deployment-planners/implicit-dedication/test/org/apache/cloudstack/implicitplanner/ImplicitPlannerTest.java
index 02124a2..73fd249 100644
--- a/plugins/deployment-planners/implicit-dedication/test/org/apache/cloudstack/implicitplanner/ImplicitPlannerTest.java
+++ b/plugins/deployment-planners/implicit-dedication/test/org/apache/cloudstack/implicitplanner/ImplicitPlannerTest.java
@@ -176,8 +176,7 @@ public class ImplicitPlannerTest {
     public void checkWhenDcInAvoidList() throws InsufficientServerCapacityException {
         DataCenterVO mockDc = mock(DataCenterVO.class);
         ExcludeList avoids = mock(ExcludeList.class);
-        @SuppressWarnings("unchecked")
-        VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
+        VirtualMachineProfileImpl vmProfile = mock(VirtualMachineProfileImpl.class);
         VMInstanceVO vm = mock(VMInstanceVO.class);
         DataCenterDeployment plan = mock(DataCenterDeployment.class);
 
@@ -193,8 +192,7 @@ public class ImplicitPlannerTest {
 
     @Test
     public void checkStrictModeWithCurrentAccountVmsPresent() throws InsufficientServerCapacityException {
-        @SuppressWarnings("unchecked")
-        VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
+        VirtualMachineProfileImpl vmProfile = mock(VirtualMachineProfileImpl.class);
         DataCenterDeployment plan = mock(DataCenterDeployment.class);
         ExcludeList avoids = new ExcludeList();
 
@@ -230,7 +228,7 @@ public class ImplicitPlannerTest {
     @Test
     public void checkStrictModeHostWithCurrentAccountVmsFull() throws InsufficientServerCapacityException {
         @SuppressWarnings("unchecked")
-        VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
+        VirtualMachineProfileImpl vmProfile = mock(VirtualMachineProfileImpl.class);
         DataCenterDeployment plan = mock(DataCenterDeployment.class);
         ExcludeList avoids = new ExcludeList();
 
@@ -268,7 +266,7 @@ public class ImplicitPlannerTest {
     @Test
     public void checkStrictModeNoHostsAvailable() throws InsufficientServerCapacityException {
         @SuppressWarnings("unchecked")
-        VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
+        VirtualMachineProfileImpl vmProfile = mock(VirtualMachineProfileImpl.class);
         DataCenterDeployment plan = mock(DataCenterDeployment.class);
         ExcludeList avoids = new ExcludeList();
 
@@ -289,7 +287,7 @@ public class ImplicitPlannerTest {
     @Test
     public void checkPreferredModePreferredHostAvailable() throws InsufficientServerCapacityException {
         @SuppressWarnings("unchecked")
-        VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
+        VirtualMachineProfileImpl vmProfile = mock(VirtualMachineProfileImpl.class);
         DataCenterDeployment plan = mock(DataCenterDeployment.class);
         ExcludeList avoids = new ExcludeList();
 
@@ -328,7 +326,7 @@ public class ImplicitPlannerTest {
     @Test
     public void checkPreferredModeNoHostsAvailable() throws InsufficientServerCapacityException {
         @SuppressWarnings("unchecked")
-        VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
+        VirtualMachineProfileImpl vmProfile = mock(VirtualMachineProfileImpl.class);
         DataCenterDeployment plan = mock(DataCenterDeployment.class);
         ExcludeList avoids = new ExcludeList();
 
@@ -347,7 +345,7 @@ public class ImplicitPlannerTest {
         assertTrue("Cluster list should not be null/empty", (clusterList == null || clusterList.isEmpty()));
     }
 
-    private void initializeForTest(VirtualMachineProfileImpl<VMInstanceVO> vmProfile, DataCenterDeployment plan) {
+    private void initializeForTest(VirtualMachineProfileImpl vmProfile, DataCenterDeployment plan) {
         DataCenterVO mockDc = mock(DataCenterVO.class);
         VMInstanceVO vm = mock(VMInstanceVO.class);
         UserVmVO userVm = mock(UserVmVO.class);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/deployment-planners/user-concentrated-pod/src/com/cloud/deploy/UserConcentratedPodPlanner.java
----------------------------------------------------------------------
diff --git a/plugins/deployment-planners/user-concentrated-pod/src/com/cloud/deploy/UserConcentratedPodPlanner.java b/plugins/deployment-planners/user-concentrated-pod/src/com/cloud/deploy/UserConcentratedPodPlanner.java
index d917893..2d73425 100644
--- a/plugins/deployment-planners/user-concentrated-pod/src/com/cloud/deploy/UserConcentratedPodPlanner.java
+++ b/plugins/deployment-planners/user-concentrated-pod/src/com/cloud/deploy/UserConcentratedPodPlanner.java
@@ -41,7 +41,7 @@ public class UserConcentratedPodPlanner extends FirstFitPlanner implements Deplo
      * @return List<Long> ordered list of Cluster Ids
      */
     @Override
-    protected List<Long> reorderClusters(long id, boolean isZone, Pair<List<Long>, Map<Long, Double>> clusterCapacityInfo, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan){
+    protected List<Long> reorderClusters(long id, boolean isZone, Pair<List<Long>, Map<Long, Double>> clusterCapacityInfo, VirtualMachineProfile vmProfile, DeploymentPlan plan){
         List<Long> clusterIdsByCapacity = clusterCapacityInfo.first();
         if(vmProfile.getOwner() == null || !isZone){
             return clusterIdsByCapacity;
@@ -118,7 +118,7 @@ public class UserConcentratedPodPlanner extends FirstFitPlanner implements Deplo
      * @return List<Long> ordered list of Pod Ids
      */
     @Override
-    protected List<Long> reorderPods(Pair<List<Long>, Map<Long, Double>> podCapacityInfo, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan){
+    protected List<Long> reorderPods(Pair<List<Long>, Map<Long, Double>> podCapacityInfo, VirtualMachineProfile vmProfile, DeploymentPlan plan){
         List<Long> podIdsByCapacity = podCapacityInfo.first();
         if(vmProfile.getOwner() == null){
             return podIdsByCapacity;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/deployment-planners/user-dispersing/src/com/cloud/deploy/UserDispersingPlanner.java
----------------------------------------------------------------------
diff --git a/plugins/deployment-planners/user-dispersing/src/com/cloud/deploy/UserDispersingPlanner.java b/plugins/deployment-planners/user-dispersing/src/com/cloud/deploy/UserDispersingPlanner.java
index 2b0b158..d70eb31 100755
--- a/plugins/deployment-planners/user-dispersing/src/com/cloud/deploy/UserDispersingPlanner.java
+++ b/plugins/deployment-planners/user-dispersing/src/com/cloud/deploy/UserDispersingPlanner.java
@@ -46,7 +46,7 @@ public class UserDispersingPlanner extends FirstFitPlanner implements Deployment
      * @return List<Long> ordered list of Cluster Ids
      */
     @Override
-    protected List<Long> reorderClusters(long id, boolean isZone, Pair<List<Long>, Map<Long, Double>> clusterCapacityInfo, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan){
+    protected List<Long> reorderClusters(long id, boolean isZone, Pair<List<Long>, Map<Long, Double>> clusterCapacityInfo, VirtualMachineProfile vmProfile, DeploymentPlan plan){
         List<Long> clusterIdsByCapacity = clusterCapacityInfo.first();
         if(vmProfile.getOwner() == null){
             return clusterIdsByCapacity;
@@ -76,7 +76,7 @@ public class UserDispersingPlanner extends FirstFitPlanner implements Deployment
      * @return List<Long> ordered list of Pod Ids
      */
     @Override
-    protected List<Long> reorderPods(Pair<List<Long>, Map<Long, Double>> podCapacityInfo, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan){
+    protected List<Long> reorderPods(Pair<List<Long>, Map<Long, Double>> podCapacityInfo, VirtualMachineProfile vmProfile, DeploymentPlan plan){
         List<Long> podIdsByCapacity = podCapacityInfo.first();
         if(vmProfile.getOwner() == null){
             return podIdsByCapacity;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java
----------------------------------------------------------------------
diff --git a/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java b/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java
index 303e438..d4a6277 100755
--- a/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java
+++ b/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java
@@ -47,13 +47,13 @@ public class RandomAllocator extends AdapterBase implements HostAllocator {
     @Inject private ResourceManager _resourceMgr;
 
     @Override
-    public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type,
+    public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type,
             ExcludeList avoid, int returnUpTo) {
         return allocateTo(vmProfile, plan, type, avoid, returnUpTo, true);
     }
 
     @Override
-    public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type,
+    public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type,
             ExcludeList avoid, List<? extends Host> hosts, int returnUpTo, boolean considerReservedCapacity) {
         long dcId = plan.getDataCenterId();
         Long podId = plan.getPodId();
@@ -109,7 +109,7 @@ public class RandomAllocator extends AdapterBase implements HostAllocator {
     }
 
     @Override
-    public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type,
+    public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type,
             ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity) {
 
         long dcId = plan.getDataCenterId();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalGuru.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalGuru.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalGuru.java
index 03ba3fa..b2f1287 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalGuru.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalGuru.java
@@ -5,20 +5,20 @@
 // 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.
-// 
+//
 // Automatically generated by addcopyright.py at 01/29/2013
 // Apache License, Version 2.0 (the "License"); you may not use this
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// 
+//
 // Automatically generated by addcopyright.py at 04/03/2012
 package com.cloud.baremetal.manager;
 
@@ -38,7 +38,6 @@ import com.cloud.hypervisor.HypervisorGuruBase;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.dao.GuestOSDao;
 import com.cloud.vm.VMInstanceVO;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 import com.cloud.vm.dao.VMInstanceDao;
 
@@ -59,7 +58,7 @@ public class BareMetalGuru extends HypervisorGuruBase implements HypervisorGuru
 	}
 
 	@Override
-	public <T extends VirtualMachine> VirtualMachineTO implement(VirtualMachineProfile<T> vm) {
+    public VirtualMachineTO implement(VirtualMachineProfile vm) {
 		VirtualMachineTO to = toVirtualMachineTO(vm);
 
 		VMInstanceVO vo = _vmDao.findById(vm.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java
index e6ddcbe..cf3ceed 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java
@@ -23,20 +23,21 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import com.cloud.dc.*;
-import com.cloud.dc.ClusterDetailsDao;
 import org.apache.log4j.Logger;
 
 import com.cloud.capacity.CapacityManager;
-import com.cloud.configuration.Config;
 import com.cloud.configuration.dao.ConfigurationDao;
+import com.cloud.dc.ClusterDetailsDao;
+import com.cloud.dc.ClusterDetailsVO;
+import com.cloud.dc.ClusterVO;
+import com.cloud.dc.DataCenter;
+import com.cloud.dc.Pod;
 import com.cloud.dc.dao.ClusterDao;
 import com.cloud.dc.dao.DataCenterDao;
 import com.cloud.dc.dao.HostPodDao;
 import com.cloud.deploy.DeployDestination;
 import com.cloud.deploy.DeploymentPlan;
 import com.cloud.deploy.DeploymentPlanner;
-import com.cloud.deploy.DeploymentPlanner.ExcludeList;
 import com.cloud.exception.InsufficientServerCapacityException;
 import com.cloud.host.Host;
 import com.cloud.host.HostVO;
@@ -45,7 +46,6 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.offering.ServiceOffering;
 import com.cloud.org.Cluster;
 import com.cloud.resource.ResourceManager;
-import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.component.AdapterBase;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
@@ -63,7 +63,7 @@ public class BareMetalPlanner extends AdapterBase implements DeploymentPlanner {
     @Inject protected ClusterDetailsDao _clusterDetailsDao;
 	
 	@Override
-	public DeployDestination plan(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException {
+    public DeployDestination plan(VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException {
 		VirtualMachine vm = vmProfile.getVirtualMachine();
 		ServiceOffering offering = vmProfile.getServiceOffering();
 		String hostTag = null;
@@ -143,7 +143,7 @@ public class BareMetalPlanner extends AdapterBase implements DeploymentPlanner {
 	}
 
 	@Override
-	public boolean canHandle(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) {
+    public boolean canHandle(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid) {
 		return vm.getHypervisorType() == HypervisorType.BareMetal;
 	}
 
@@ -163,7 +163,7 @@ public class BareMetalPlanner extends AdapterBase implements DeploymentPlanner {
 	}
 
 	@Override
-	public boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, DeployDestination dest, ExcludeList exclude) {
+    public boolean check(VirtualMachineProfile vm, DeploymentPlan plan, DeployDestination dest, ExcludeList exclude) {
 		// TODO Auto-generated method stub
 		return false;
 	}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
index 77958ae..772898d 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
@@ -5,20 +5,20 @@
 // 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.
-// 
+//
 // Automatically generated by addcopyright.py at 01/29/2013
 // Apache License, Version 2.0 (the "License"); you may not use this
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// 
+//
 // Automatically generated by addcopyright.py at 04/03/2012
 package com.cloud.baremetal.networkservice;
 
@@ -31,10 +31,11 @@ import java.util.Map;
 import javax.ejb.Local;
 import javax.inject.Inject;
 
+import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.api.AddBaremetalPxeCmd;
 import org.apache.cloudstack.api.AddBaremetalPxePingServerCmd;
 import org.apache.cloudstack.api.ListBaremetalPxePingServersCmd;
-import org.apache.log4j.Logger;
 
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.baremetal.IpmISetBootDevCommand;
@@ -68,7 +69,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.NicVO;
 import com.cloud.vm.ReservationContext;
-import com.cloud.vm.UserVmVO;
 import com.cloud.vm.VirtualMachineProfile;
 
 @Local(value=BaremetalPxeService.class)
@@ -82,7 +82,7 @@ public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements
 	
 	
 	@Override
-	public boolean prepare(VirtualMachineProfile<UserVmVO> profile, NicProfile pxeNic, DeployDestination dest, ReservationContext context) {
+    public boolean prepare(VirtualMachineProfile profile, NicProfile pxeNic, DeployDestination dest, ReservationContext context) {
 	    SearchCriteriaService<BaremetalPxeVO, BaremetalPxeVO> sc = SearchCriteria2.create(BaremetalPxeVO.class);
         sc.addAnd(sc.getEntity().getDeviceType(), Op.EQ, BaremetalPxeType.PING.toString());
         sc.addAnd(sc.getEntity().getPodId(), Op.EQ, dest.getPod().getId());
@@ -127,7 +127,7 @@ public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements
 
 	
     @Override
-    public boolean prepareCreateTemplate(Long pxeServerId, UserVm vm, String templateUrl) {        
+    public boolean prepareCreateTemplate(Long pxeServerId, UserVm vm, String templateUrl) {
         List<NicVO> nics = _nicDao.listByVmId(vm.getId());
         if (nics.size() != 1) {
             throw new CloudRuntimeException("Wrong nic number " + nics.size() + " of vm " + vm.getId());
@@ -168,7 +168,7 @@ public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements
         
         if (cmd.getPhysicalNetworkId() == null || cmd.getUrl() == null || cmd.getUsername() == null || cmd.getPassword() == null) {
             throw new IllegalArgumentException("At least one of the required parameters(physical network id, url, username, password) is null");
-        } 
+        }
         
         pNetwork = _physicalNetworkDao.findById(cmd.getPhysicalNetworkId());
         if (pNetwork == null) {
@@ -188,7 +188,7 @@ public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements
         HostPodVO pod = _podDao.findById(cmd.getPodId());
         if (pod == null) {
             throw new IllegalArgumentException("Could not find pod with ID: " + cmd.getPodId());
-        } 
+        }
         
         List<HostVO> pxes = _resourceMgr.listAllUpAndEnabledHosts(Host.Type.BaremetalPxe, null, cmd.getPodId(), zoneId);
         if (pxes.size() != 0) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetaNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetaNetworkGuru.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetaNetworkGuru.java
index 6d14e3f..7501882 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetaNetworkGuru.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetaNetworkGuru.java
@@ -76,7 +76,7 @@ public class BaremetaNetworkGuru extends DirectPodBasedNetworkGuru {
     PodVlanMapDao _podVlanDao;
 
     @Override
-    public void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context)
+    public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
         if (dest.getHost().getHypervisorType() != HypervisorType.BareMetal) {
             super.reserve(nic, network, vm, dest, context);
@@ -149,7 +149,7 @@ public class BaremetaNetworkGuru extends DirectPodBasedNetworkGuru {
         s_logger.debug("Allocated a nic " + nic + " for " + vm);
     }
 
-    private void getBaremetalIp(NicProfile nic, Pod pod, VirtualMachineProfile<? extends VirtualMachine> vm, Network network, String requiredIp)
+    private void getBaremetalIp(NicProfile nic, Pod pod, VirtualMachineProfile vm, Network network, String requiredIp)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
         DataCenter dc = _dcDao.findById(pod.getDataCenterId());
         if (nic.getIp4Address() == null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
index 96d702d..1eb1c74 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
@@ -103,7 +103,7 @@ public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProv
 
     @Override
     @DB
-    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest,
+    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest,
             ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
         Host host = dest.getHost();
         if (vm.getType() != Type.User || vm.getHypervisorType() != HypervisorType.BareMetal) {
@@ -122,7 +122,7 @@ public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProv
     }
 
     @Override
-    public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context)
+    public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context)
             throws ConcurrentOperationException, ResourceUnavailableException {
         return true;
     }
@@ -158,7 +158,7 @@ public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProv
         return true;
     }
     
-    public boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest,
+    public boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest,
             ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
         if (vm.getHypervisorType() != HypervisorType.BareMetal || !canHandle(dest, network.getTrafficType(), network.getGuestType())) {
             return false;
@@ -167,7 +167,7 @@ public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProv
     }
 
     @Override
-    public boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
+    public boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
     	//TODO Add support for baremetal
         return true;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManager.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManager.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManager.java
index 9c00731..8a83c32 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManager.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManager.java
@@ -47,7 +47,7 @@ public interface BaremetalDhcpManager extends Manager, PluggableService {
         DHCPD,
     }
 	
-	boolean addVirtualMachineIntoNetwork(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException;
+	boolean addVirtualMachineIntoNetwork(Network network, NicProfile nic, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException;
 	
 	BaremetalDhcpVO addDchpServer(AddBaremetalDhcpCmd cmd);
 	

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
index 17e4481..1e2ad54 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
@@ -133,7 +133,7 @@ public class BaremetalDhcpManagerImpl extends ManagerBase implements BaremetalDh
     }
 
     @Override
-    public boolean addVirtualMachineIntoNetwork(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> profile,
+    public boolean addVirtualMachineIntoNetwork(Network network, NicProfile nic, VirtualMachineProfile profile,
             DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
         Long zoneId = profile.getVirtualMachine().getDataCenterId();
         Long podId = profile.getVirtualMachine().getPodIdToDeployIn();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
index 5858e7e..9a6c1c6 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
@@ -5,9 +5,9 @@
 // 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
@@ -27,10 +27,11 @@ import java.util.Map;
 import javax.ejb.Local;
 import javax.inject.Inject;
 
+import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.api.AddBaremetalKickStartPxeCmd;
 import org.apache.cloudstack.api.AddBaremetalPxeCmd;
 import org.apache.cloudstack.api.ListBaremetalPxePingServersCmd;
-import org.apache.log4j.Logger;
 
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.baremetal.IpmISetBootDevCommand;
@@ -62,7 +63,6 @@ import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.ReservationContext;
-import com.cloud.vm.UserVmVO;
 import com.cloud.vm.VirtualMachineProfile;
 
 @Local(value = BaremetalPxeService.class)
@@ -84,7 +84,7 @@ public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase imple
     VMTemplateDao _tmpDao;
 
     @Override
-    public boolean prepare(VirtualMachineProfile<UserVmVO> profile, NicProfile nic, DeployDestination dest, ReservationContext context) {
+    public boolean prepare(VirtualMachineProfile profile, NicProfile nic, DeployDestination dest, ReservationContext context) {
         NetworkVO nwVO = _nwDao.findById(nic.getNetworkId());
         SearchCriteriaService<BaremetalPxeVO, BaremetalPxeVO> sc = SearchCriteria2.create(BaremetalPxeVO.class);
         sc.addAnd(sc.getEntity().getDeviceType(), Op.EQ, BaremetalPxeType.KICK_START.toString());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java
index 7b8d528..82094d8 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java
@@ -111,7 +111,7 @@ public class BaremetalPxeElement extends AdapterBase implements NetworkElement {
 
     @Override
     @DB
-    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest,
+    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest,
             ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
         if (vm.getType() != Type.User || vm.getHypervisorType() != HypervisorType.BareMetal) {
             return false;
@@ -138,7 +138,7 @@ public class BaremetalPxeElement extends AdapterBase implements NetworkElement {
     }
 
     @Override
-    public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context)
+    public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context)
             throws ConcurrentOperationException, ResourceUnavailableException {
         return true;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManager.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManager.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManager.java
index 7984ddd..73243b5 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManager.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManager.java
@@ -5,20 +5,20 @@
 // 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.
-// 
+//
 // Automatically generated by addcopyright.py at 01/29/2013
 // Apache License, Version 2.0 (the "License"); you may not use this
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// 
+//
 // Automatically generated by addcopyright.py at 04/03/2012
 package com.cloud.baremetal.networkservice;
 
@@ -37,7 +37,6 @@ import com.cloud.utils.component.Manager;
 import com.cloud.utils.component.PluggableService;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.ReservationContext;
-import com.cloud.vm.UserVmVO;
 import com.cloud.vm.VirtualMachineProfile;
 
 public interface BaremetalPxeManager extends Manager, PluggableService {
@@ -58,7 +57,7 @@ public interface BaremetalPxeManager extends Manager, PluggableService {
 	
 	List<BaremetalPxeResponse> listPxeServers(ListBaremetalPxePingServersCmd cmd);
 	
-	boolean addUserData(NicProfile nic, VirtualMachineProfile<UserVm> vm);
+    boolean addUserData(NicProfile nic, VirtualMachineProfile vm);
 		
 	public static final Network.Service BAREMETAL_PXE_SERVICE = new Network.Service("BaremetalPxeService");
 	public static final String BAREMETAL_PXE_CAPABILITY = "BaremetalPxe";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
index 555adf7..4e9a11d 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
@@ -5,20 +5,20 @@
 // 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.
-// 
+//
 // Automatically generated by addcopyright.py at 01/29/2013
 // Apache License, Version 2.0 (the "License"); you may not use this
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// 
+//
 // Automatically generated by addcopyright.py at 04/03/2012
 package com.cloud.baremetal.networkservice;
 
@@ -31,11 +31,12 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.api.AddBaremetalKickStartPxeCmd;
 import org.apache.cloudstack.api.AddBaremetalPxeCmd;
 import org.apache.cloudstack.api.AddBaremetalPxePingServerCmd;
 import org.apache.cloudstack.api.ListBaremetalPxePingServersCmd;
-import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
@@ -183,7 +184,7 @@ public class BaremetalPxeManagerImpl extends ManagerBase implements BaremetalPxe
     }
 
     @Override
-    public boolean addUserData(NicProfile nic, VirtualMachineProfile<UserVm> profile) {
+    public boolean addUserData(NicProfile nic, VirtualMachineProfile profile) {
         UserVmVO vm = (UserVmVO) profile.getVirtualMachine();
         _vmDao.loadDetails(vm);
         

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeService.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeService.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeService.java
index af6a6c8..d74e31d 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeService.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeService.java
@@ -5,20 +5,20 @@
 // 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.
-// 
+//
 // Automatically generated by addcopyright.py at 01/29/2013
 // Apache License, Version 2.0 (the "License"); you may not use this
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// 
+//
 // Automatically generated by addcopyright.py at 04/03/2012
 package com.cloud.baremetal.networkservice;
 
@@ -29,17 +29,15 @@ import org.apache.cloudstack.api.ListBaremetalPxePingServersCmd;
 
 import com.cloud.baremetal.database.BaremetalPxeVO;
 import com.cloud.deploy.DeployDestination;
-import com.cloud.host.Host;
 import com.cloud.uservm.UserVm;
 import com.cloud.utils.component.Adapter;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.ReservationContext;
-import com.cloud.vm.UserVmVO;
 import com.cloud.vm.VirtualMachineProfile;
 
 public interface BaremetalPxeService extends Adapter {
 	
-	public boolean prepare(VirtualMachineProfile<UserVmVO> profile, NicProfile nic, DeployDestination dest, ReservationContext context);
+    public boolean prepare(VirtualMachineProfile profile, NicProfile nic, DeployDestination dest, ReservationContext context);
 
     public boolean prepareCreateTemplate(Long pxeServerId, UserVm vm, String templateUrl);
     
@@ -62,5 +60,5 @@ public interface BaremetalPxeService extends Adapter {
 	public static final String PXE_PARAM_PING_STORAGE_SERVER_IP = "pingStorageServerIp";
 	public static final String PXE_PARAM_PING_ROOT_DIR = "pingDir";
 	public static final String PXE_PARAM_PING_STORAGE_SERVER_USERNAME = "pingStorageServerUserName";
-	public static final String PXE_PARAM_PING_STORAGE_SERVER_PASSWORD = "pingStorageServerPassword";	
+	public static final String PXE_PARAM_PING_STORAGE_SERVER_PASSWORD = "pingStorageServerPassword";
 }


[3/7] Changed VirtualMachineProfile to be non-generic. From here on VirtualMachineManager will only manage vm instance. It doesn't understand the difference between different types of VMs. This makes the vmsync code to be generic across all vms.

Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/storage/VolumeManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeManager.java b/server/src/com/cloud/storage/VolumeManager.java
index 2e44a3c..d9bbd54 100644
--- a/server/src/com/cloud/storage/VolumeManager.java
+++ b/server/src/com/cloud/storage/VolumeManager.java
@@ -41,7 +41,6 @@ import com.cloud.storage.Volume.Type;
 import com.cloud.user.Account;
 import com.cloud.vm.DiskProfile;
 import com.cloud.vm.VMInstanceVO;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 public interface VolumeManager extends VolumeApiService {
@@ -85,7 +84,7 @@ public interface VolumeManager extends VolumeApiService {
     @Override
     Volume detachVolumeFromVM(DetachVolumeCmd cmmd);
 
-    void release(VirtualMachineProfile<? extends VMInstanceVO> profile);
+    void release(VirtualMachineProfile profile);
 
     void cleanupVolumes(long vmId) throws ConcurrentOperationException;
 
@@ -95,15 +94,11 @@ public interface VolumeManager extends VolumeApiService {
     <T extends VMInstanceVO> void migrateVolumes(T vm, VirtualMachineTO vmTo, Host srcHost, Host destHost,
             Map<VolumeVO, StoragePoolVO> volumeToPool);
 
-    boolean storageMigration(
-            VirtualMachineProfile<? extends VirtualMachine> vm,
-            StoragePool destPool);
+    boolean storageMigration(VirtualMachineProfile vm, StoragePool destPool);
 
-    void prepareForMigration(
-            VirtualMachineProfile<? extends VirtualMachine> vm,
-            DeployDestination dest);
+    void prepareForMigration(VirtualMachineProfile vm, DeployDestination dest);
 
-    void prepare(VirtualMachineProfile<? extends VirtualMachine> vm,
+    void prepare(VirtualMachineProfile vm,
             DeployDestination dest) throws StorageUnavailableException,
             InsufficientStorageCapacityException, ConcurrentOperationException;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/storage/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java
index 7b44c5c..fa7a33a 100644
--- a/server/src/com/cloud/storage/VolumeManagerImpl.java
+++ b/server/src/com/cloud/storage/VolumeManagerImpl.java
@@ -2031,7 +2031,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
 
     @DB
     protected VolumeVO switchVolume(VolumeVO existingVolume,
-            VirtualMachineProfile<? extends VirtualMachine> vm)
+            VirtualMachineProfile vm)
             throws StorageUnavailableException {
         Transaction txn = Transaction.currentTxn();
 
@@ -2070,7 +2070,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
 
 
     @Override
-    public void release(VirtualMachineProfile<? extends VMInstanceVO> profile) {
+    public void release(VirtualMachineProfile profile) {
         // add code here
     }
 
@@ -2269,7 +2269,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
 
     @Override
     public boolean storageMigration(
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             StoragePool destPool) {
         List<VolumeVO> vols = _volsDao.findUsableVolumesForInstance(vm.getId());
         List<Volume> volumesNeedToMigrate = new ArrayList<Volume>();
@@ -2307,7 +2307,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
 
     @Override
     public void prepareForMigration(
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             DeployDestination dest) {
         List<VolumeVO> vols = _volsDao.findUsableVolumesForInstance(vm.getId());
         if (s_logger.isDebugEnabled()) {
@@ -2439,7 +2439,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
         return tasks;
     }
 
-    private Pair<VolumeVO, DataStore> recreateVolume(VolumeVO vol, VirtualMachineProfile<? extends VirtualMachine> vm,
+    private Pair<VolumeVO, DataStore> recreateVolume(VolumeVO vol, VirtualMachineProfile vm,
             DeployDestination dest) throws StorageUnavailableException {
         VolumeVO newVol;
         boolean recreate = _recreateSystemVmEnabled;
@@ -2506,7 +2506,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
     }
 
     @Override
-    public void prepare(VirtualMachineProfile<? extends VirtualMachine> vm,
+    public void prepare(VirtualMachineProfile vm,
             DeployDestination dest) throws StorageUnavailableException,
             InsufficientStorageCapacityException, ConcurrentOperationException {
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
index f7a7219..037eb25 100755
--- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
+++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
@@ -107,7 +107,6 @@ import com.cloud.storage.template.TemplateConstants;
 import com.cloud.template.TemplateManager;
 import com.cloud.user.Account;
 import com.cloud.user.AccountService;
-import com.cloud.user.User;
 import com.cloud.utils.DateUtil;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
@@ -257,8 +256,6 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
     public SecondaryStorageVmVO startSecStorageVm(long secStorageVmId) {
         try {
             SecondaryStorageVmVO secStorageVm = _secStorageVmDao.findById(secStorageVmId);
-            Account systemAcct = _accountMgr.getSystemAccount();
-            User systemUser = _accountMgr.getSystemUser();
             _itMgr.advanceStart(secStorageVm.getUuid(), null);
             return _secStorageVmDao.findById(secStorageVm.getId());
         } catch (StorageUnavailableException e) {
@@ -1011,9 +1008,9 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
     }
 
     @Override
-    public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<SecondaryStorageVmVO> profile, DeployDestination dest, ReservationContext context) {
+    public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {
 
-    	SecondaryStorageVmVO vm = profile.getVirtualMachine();
+        SecondaryStorageVmVO vm = _secStorageVmDao.findById(profile.getId());
         Map<String, String> details = _vmDetailsDao.findDetails(vm.getId());
         vm.setDetails(details);
 
@@ -1044,7 +1041,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
         }
         buf.append(" instance=SecStorage");
         buf.append(" sslcopy=").append(Boolean.toString(_useSSlCopy));
-        buf.append(" role=").append(profile.getVirtualMachine().getRole().toString());
+        buf.append(" role=").append(vm.getRole().toString());
         buf.append(" mtu=").append(_secStorageVmMtuSize);
 
         boolean externalDhcp = false;
@@ -1110,11 +1107,11 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
     }
 
     @Override
-    public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile<SecondaryStorageVmVO> profile, DeployDestination dest, ReservationContext context) {
+    public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {
 
         finalizeCommandsOnStart(cmds, profile);
 
-        SecondaryStorageVmVO secVm = profile.getVirtualMachine();
+        SecondaryStorageVmVO secVm = _secStorageVmDao.findById(profile.getId());
         DataCenter dc = dest.getDataCenter();
         List<NicProfile> nics = profile.getNics();
         for (NicProfile nic : nics) {
@@ -1133,7 +1130,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
     }
 
     @Override
-    public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<SecondaryStorageVmVO> profile) {
+    public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) {
 
         NicProfile managementNic = null;
         NicProfile controlNic = null;
@@ -1160,7 +1157,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
     }
 
     @Override
-    public boolean finalizeStart(VirtualMachineProfile<SecondaryStorageVmVO> profile, long hostId, Commands cmds, ReservationContext context) {
+    public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Commands cmds, ReservationContext context) {
         CheckSshAnswer answer = (CheckSshAnswer) cmds.getAnswer("checkSsh");
         if (!answer.getResult()) {
             s_logger.warn("Unable to ssh to the VM: " + answer.getDetails());
@@ -1172,7 +1169,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
             _rulesMgr.getSystemIpAndEnableStaticNatForVm(profile.getVirtualMachine(), false);
             IPAddressVO ipaddr = _ipAddressDao.findByAssociatedVmId(profile.getVirtualMachine().getId());
             if (ipaddr != null && ipaddr.getSystem()) {
-                SecondaryStorageVmVO secVm = profile.getVirtualMachine();
+                SecondaryStorageVmVO secVm = _secStorageVmDao.findById(profile.getId());
                 // override SSVM guest IP with EIP, so that download url's with be prepared with EIP
                 secVm.setPublicIpAddress(ipaddr.getAddress().addr());
                 _secStorageVmDao.update(secVm.getId(), secVm);
@@ -1186,7 +1183,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
     }
 
     @Override
-    public void finalizeStop(VirtualMachineProfile<SecondaryStorageVmVO> profile, StopAnswer answer) {
+    public void finalizeStop(VirtualMachineProfile profile, StopAnswer answer) {
         //release elastic IP here
         IPAddressVO ip = _ipAddressDao.findByAssociatedVmId(profile.getId());
         if (ip != null && ip.getSystem()) {
@@ -1381,7 +1378,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
     }
 
 	@Override
-	public void prepareStop(VirtualMachineProfile<SecondaryStorageVmVO> profile) {
+	public void prepareStop(VirtualMachineProfile profile) {
 
 	}
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index f353bb7..1493871 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -539,7 +539,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
 
             Network defaultNetwork = _networkDao.findById(defaultNic.getNetworkId());
             NicProfile defaultNicProfile = new NicProfile(defaultNic, defaultNetwork, null, null, null, _networkModel.isSecurityGroupSupportedInNetwork(defaultNetwork), _networkModel.getNetworkTag(template.getHypervisorType(), defaultNetwork));
-            VirtualMachineProfile<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>(vmInstance);
+            VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(vmInstance);
             vmProfile.setParameter(VirtualMachineProfile.Param.VmPassword, password);
 
             UserDataServiceProvider element = _networkMgr.getPasswordResetProvider(defaultNetwork);
@@ -656,7 +656,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
                 _networkModel.isSecurityGroupSupportedInNetwork(defaultNetwork),
                 _networkModel.getNetworkTag(template.getHypervisorType(), defaultNetwork));
 
-        VirtualMachineProfile<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>(vmInstance);
+        VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(vmInstance);
 
         if (template != null && template.getEnablePassword()) {
             vmProfile.setParameter(VirtualMachineProfile.Param.VmPassword, password);
@@ -1831,7 +1831,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
                  _networkModel.isSecurityGroupSupportedInNetwork(network),
                  _networkModel.getNetworkTag(template.getHypervisorType(), network));
 
-             VirtualMachineProfile<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>((VMInstanceVO)vm);
+             VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(vm);
 
              UserDataServiceProvider element = _networkModel.getUserDataUpdateProvider(network);
              if (element == null) {
@@ -2888,10 +2888,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
     }
 
     @Override
-    public boolean finalizeVirtualMachineProfile(
-            VirtualMachineProfile<UserVmVO> profile, DeployDestination dest,
-            ReservationContext context) {
-        UserVmVO vm = profile.getVirtualMachine();
+    public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {
+        UserVmVO vm = _vmDao.findById(profile.getId());
         Map<String, String> details = _vmDetailsDao.findDetails(vm.getId());
         vm.setDetails(details);
 
@@ -2959,9 +2957,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
 
     @Override
     public boolean finalizeDeployment(Commands cmds,
-            VirtualMachineProfile<UserVmVO> profile, DeployDestination dest,
+            VirtualMachineProfile profile, DeployDestination dest,
             ReservationContext context) {
-        UserVmVO userVm = profile.getVirtualMachine();
+        UserVmVO userVm = _vmDao.findById(profile.getId());
         List<NicVO> nics = _nicDao.listByVmId(userVm.getId());
         for (NicVO nic : nics) {
             NetworkVO network = _networkDao.findById(nic.getNetworkId());
@@ -2987,14 +2985,14 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
 
     @Override
     public boolean finalizeCommandsOnStart(Commands cmds,
-            VirtualMachineProfile<UserVmVO> profile) {
+            VirtualMachineProfile profile) {
         return true;
     }
 
     @Override
-    public boolean finalizeStart(VirtualMachineProfile<UserVmVO> profile,
+    public boolean finalizeStart(VirtualMachineProfile profile,
             long hostId, Commands cmds, ReservationContext context) {
-        UserVmVO vm = profile.getVirtualMachine();
+        UserVmVO vm = _vmDao.findById(profile.getId());
 
         Answer[] answersToCmds = cmds.getAnswers();
         if (answersToCmds == null) {
@@ -3055,7 +3053,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
         }
         if (ipChanged) {
             DataCenterVO dc = _dcDao.findById(vm.getDataCenterId());
-            UserVmVO userVm = profile.getVirtualMachine();
+            UserVmVO userVm = _vmDao.findById(profile.getId());
             // dc.getDhcpProvider().equalsIgnoreCase(Provider.ExternalDhcpServer.getName())
             if (_ntwkSrvcDao.canProviderSupportServiceInNetwork(
                     guestNetwork.getId(), Service.Dhcp,
@@ -3135,8 +3133,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
     }
 
     @Override
-    public void finalizeStop(VirtualMachineProfile<UserVmVO> profile,
-            StopAnswer answer) {
+    public void finalizeStop(VirtualMachineProfile profile, StopAnswer answer) {
+        VirtualMachine vm = profile.getVirtualMachine();
         // release elastic IP here
         IPAddressVO ip = _ipAddressDao.findByAssociatedVmId(profile.getId());
         if (ip != null && ip.getSystem()) {
@@ -3156,7 +3154,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
             }
         }
 
-        VMInstanceVO vm = profile.getVirtualMachine();
         List<NicVO> nics = _nicDao.listByVmId(vm.getId());
         for (NicVO nic : nics) {
             NetworkVO network = _networkDao.findById(nic.getNetworkId());
@@ -4210,7 +4207,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
         txn.commit();
 
         VMInstanceVO vmoi = _itMgr.findByIdAndType(vm.getType(), vm.getId());
-        VirtualMachineProfileImpl<VMInstanceVO> vmOldProfile = new VirtualMachineProfileImpl<VMInstanceVO>(
+        VirtualMachineProfileImpl vmOldProfile = new VirtualMachineProfileImpl(
                 vmoi);
 
         // OS 3: update the network
@@ -4288,7 +4285,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
                     profile));
 
             VMInstanceVO vmi = _itMgr.findByIdAndType(vm.getType(), vm.getId());
-            VirtualMachineProfileImpl<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>(
+            VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(
                     vmi);
             _networkMgr.allocate(vmProfile, networks);
 
@@ -4423,7 +4420,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
                 }
                 VMInstanceVO vmi = _itMgr.findByIdAndType(vm.getType(),
                         vm.getId());
-                VirtualMachineProfileImpl<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>(
+                VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(
                         vmi);
                 _networkMgr.allocate(vmProfile, networks);
                 s_logger.debug("AssignVM: Advance virtual, adding networks no "
@@ -4604,7 +4601,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
     }
 
     @Override
-    public void prepareStop(VirtualMachineProfile<UserVmVO> profile) {
+    public void prepareStop(VirtualMachineProfile profile) {
         UserVmVO vm = _vmDao.findById(profile.getId());
         if (vm.getState() == State.Running)
             collectVmDiskStatistics(vm);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/vm/VirtualMachineGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineGuru.java b/server/src/com/cloud/vm/VirtualMachineGuru.java
index df34e0e..3318b46 100644
--- a/server/src/com/cloud/vm/VirtualMachineGuru.java
+++ b/server/src/com/cloud/vm/VirtualMachineGuru.java
@@ -5,7 +5,7 @@
 // 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,
@@ -28,7 +28,7 @@ import com.cloud.exception.ResourceUnavailableException;
 public interface VirtualMachineGuru<T extends VirtualMachine> {
     T findById(long id);
     
-    boolean finalizeVirtualMachineProfile(VirtualMachineProfile<T> profile, DeployDestination dest, ReservationContext context);
+    boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context);
     
     /**
      * finalize the virtual machine deployment.
@@ -37,7 +37,7 @@ public interface VirtualMachineGuru<T extends VirtualMachine> {
      * @param dest destination to send the command.
      * @return true if everything checks out.  false if not and we should try again.
      */
-    boolean finalizeDeployment(Commands cmds, VirtualMachineProfile<T> profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException;
+    boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException;
     
     /**
      * Check the deployment results.
@@ -46,11 +46,11 @@ public interface VirtualMachineGuru<T extends VirtualMachine> {
      * @param dest destination it was sent to.
      * @return true if deployment was fine; false if it didn't go well.
      */
-    boolean finalizeStart(VirtualMachineProfile<T> profile, long hostId, Commands cmds, ReservationContext context);
+    boolean finalizeStart(VirtualMachineProfile profile, long hostId, Commands cmds, ReservationContext context);
     
-    boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<T> profile);
+    boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile);
     
-    void finalizeStop(VirtualMachineProfile<T> profile, StopAnswer answer);
+    void finalizeStop(VirtualMachineProfile profile, StopAnswer answer);
     
     void finalizeExpunge(T vm);
     
@@ -59,5 +59,5 @@ public interface VirtualMachineGuru<T extends VirtualMachine> {
      * @param profile
      * @return
      */
-    void prepareStop(VirtualMachineProfile<T> profile);
+    void prepareStop(VirtualMachineProfile profile);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/vm/VirtualMachineManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineManager.java b/server/src/com/cloud/vm/VirtualMachineManager.java
index 49953b9..0086bdb 100644
--- a/server/src/com/cloud/vm/VirtualMachineManager.java
+++ b/server/src/com/cloud/vm/VirtualMachineManager.java
@@ -179,7 +179,7 @@ public interface VirtualMachineManager extends Manager {
      * @param hvGuru
      * @return
      */
-    VirtualMachineTO toVmTO(VirtualMachineProfile<? extends VMInstanceVO> profile);
+    VirtualMachineTO toVmTO(VirtualMachineProfile profile);
 
 
     VMInstanceVO reConfigureVm(VMInstanceVO vm, ServiceOffering newServiceOffering, boolean sameHost)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 363bb45..88faea0 100755
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -470,7 +470,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
               removeDhcpServiceInsubnet(vm);
         }
 
-        VirtualMachineProfile<T> profile = new VirtualMachineProfileImpl<T>(vm);
+        VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
 
         HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vm.getHypervisorType());
 
@@ -737,7 +737,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         }
     }
 
-    protected boolean areAffinityGroupsAssociated(VirtualMachineProfile<? extends VirtualMachine> vmProfile) {
+    protected boolean areAffinityGroupsAssociated(VirtualMachineProfile vmProfile) {
         VirtualMachine vm = vmProfile.getVirtualMachine();
         long vmGroupCount = _affinityGroupVMMapDao.countAffinityGroupsForVm(vm.getId());
 
@@ -1060,8 +1060,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         }
     }
 
-    protected <T extends VMInstanceVO> boolean sendStop(VirtualMachineGuru<T> guru, VirtualMachineProfile<T> profile, boolean force) {
-        VMInstanceVO vm = profile.getVirtualMachine();
+    protected boolean sendStop(VirtualMachineGuru guru, VirtualMachineProfile profile, boolean force) {
+        VirtualMachine vm = profile.getVirtualMachine();
         StopCommand stop = new StopCommand(vm, _mgmtServer.getExecuteInSequence());
         try {
             Answer answer = _agentMgr.send(vm.getHostId(), stop);
@@ -1195,7 +1195,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         }
 
         VirtualMachineGuru<T> vmGuru = getVmGuru(vm);
-        VirtualMachineProfile<T> profile = new VirtualMachineProfileImpl<T>(vm);
+        VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
 
         try {
             if (!stateTransitTo(vm, Event.StopRequested, vm.getHostId())) {
@@ -1223,7 +1223,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
             }
 
             if (doCleanup) {
-                if (cleanup(vmGuru, new VirtualMachineProfileImpl<T>(vm), work, Event.StopRequested, forced, user, account)) {
+                if (cleanup(vmGuru, new VirtualMachineProfileImpl(vm), work, Event.StopRequested, forced, user, account)) {
                     try {
                         if (s_logger.isDebugEnabled()) {
                             s_logger.debug("Updating work item to Done, id:" + work.getId());
@@ -1440,7 +1440,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
             throw new CloudRuntimeException("Unable to migrate vm: " + e.toString());
         }
 
-        VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
+        VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
         boolean migrationResult = false;
         try {
             migrationResult = volumeMgr.storageMigration(profile, destPool);
@@ -1450,7 +1450,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
 
                 if (!vm.getPodIdToDeployIn().equals(destPool.getPodId())) {
                     DataCenterDeployment plan = new DataCenterDeployment(vm.getDataCenterId(), destPool.getPodId(), null, null, null, null);
-                    VirtualMachineProfileImpl<T> vmProfile = new VirtualMachineProfileImpl<T>(vm, null, null, null, null);
+                    VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vm, null, null, null, null);
                     _networkMgr.reallocate(vmProfile, plan);
                 }
 
@@ -1526,12 +1526,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
             alertType = AlertManager.ALERT_TYPE_CONSOLE_PROXY_MIGRATE;
         }
 
-        VirtualMachineProfile<VMInstanceVO> vmSrc = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
+        VirtualMachineProfile vmSrc = new VirtualMachineProfileImpl(vm);
         for(NicProfile nic: _networkMgr.getNicProfiles(vm)){
             vmSrc.addNic(nic);
         }
 
-        VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
+        VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
         _networkMgr.prepareNicForMigration(profile, dest);
         volumeMgr.prepareForMigration(profile, dest);
 
@@ -1611,7 +1611,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
                     } catch (AgentUnavailableException e) {
                         s_logger.error("AgentUnavailableException while cleanup on source host: " + srcHostId);
                     }
-                    cleanup(vmGuru, new VirtualMachineProfileImpl<T>(vm), work, Event.AgentReportStopped, true, _accountMgr.getSystemUser(), _accountMgr.getSystemAccount());
+                    cleanup(vmGuru, new VirtualMachineProfileImpl(vm), work, Event.AgentReportStopped, true, _accountMgr.getSystemUser(), _accountMgr.getSystemAccount());
                     return null;
                 }
             } catch (OperationTimedoutException e) {
@@ -1646,7 +1646,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         }
     }
 
-    private Map<VolumeVO, StoragePoolVO> getPoolListForVolumesForMigration(VirtualMachineProfile<VMInstanceVO> profile,
+    private Map<VolumeVO, StoragePoolVO> getPoolListForVolumesForMigration(VirtualMachineProfile profile,
             Host host, Map<VolumeVO, StoragePoolVO> volumeToPool) {
         List<VolumeVO> allVolumes = _volsDao.findUsableVolumesForInstance(profile.getId());
         for (VolumeVO volume : allVolumes) {
@@ -1750,7 +1750,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         // Create a map of which volume should go in which storage pool.
         long vmId = vm.getId();
         vm = vmGuru.findById(vmId);
-        VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
+        VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
         volumeToPool = getPoolListForVolumesForMigration(profile, destHost, volumeToPool);
 
         // If none of the volumes have to be migrated, fail the call. Administrator needs to make a call for migrating
@@ -1798,7 +1798,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
                     } catch (AgentUnavailableException e) {
                         s_logger.error("AgentUnavailableException while cleanup on source host: " + srcHostId);
                     }
-                    cleanup(vmGuru, new VirtualMachineProfileImpl<T>(vm), work, Event.AgentReportStopped, true,
+                    cleanup(vmGuru, new VirtualMachineProfileImpl(vm), work, Event.AgentReportStopped, true,
                             _accountMgr.getSystemUser(), _accountMgr.getSystemAccount());
                     return null;
                 }
@@ -1829,8 +1829,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         }
     }
 
-    @Override
-    public VirtualMachineTO toVmTO(VirtualMachineProfile<? extends VMInstanceVO> profile) {
+    public VirtualMachineTO toVmTO(VirtualMachineProfile profile) {
         HypervisorGuru hvGuru = _hvGuruMgr.getGuru(profile.getVirtualMachine().getHypervisorType());
         VirtualMachineTO to = hvGuru.implement(profile);
         return to;
@@ -1884,7 +1883,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
             return true;
         }
 
-        VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
+        VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
 
         Long hostId = vm.getHostId();
         if (hostId == null) {
@@ -2563,7 +2562,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         vm = vmGuru.findById(vm.getId()); // this should ensure vm has the most
         // up to date info
 
-        VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
+        VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
         List<NicVO> nics = _nicsDao.listByVmId(profile.getId());
         for (NicVO nic : nics) {
             Network network = _networkModel.getNetwork(nic.getNetworkId());
@@ -2878,7 +2877,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         ReservationContext context = new ReservationContextImpl(null, null, _accountMgr.getActiveUser(User.UID_SYSTEM),
                 _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM));
 
-        VirtualMachineProfileImpl<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>(vmVO, null,
+        VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmVO, null,
                 null, null, null);
 
         DataCenter dc = _configMgr.getZone(network.getDataCenterId());
@@ -2947,7 +2946,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         ReservationContext context = new ReservationContextImpl(null, null, _accountMgr.getActiveUser(User.UID_SYSTEM),
                 _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM));
 
-        VirtualMachineProfileImpl<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>(vmVO, null,
+        VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmVO, null,
                 null, null, null);
 
         DataCenter dc = _configMgr.getZone(network.getDataCenterId());
@@ -3011,7 +3010,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         ReservationContext context = new ReservationContextImpl(null, null, _accountMgr.getActiveUser(User.UID_SYSTEM),
                 _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM));
 
-        VirtualMachineProfileImpl<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>(vmVO, null,
+        VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmVO, null,
                 null, null, null);
 
         DataCenter dc = _configMgr.getZone(network.getDataCenterId());
@@ -3075,7 +3074,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
     public VMInstanceVO findHostAndMigrate(VirtualMachine.Type vmType, VMInstanceVO vm, Long newSvcOfferingId, ExcludeList excludes)
             throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, VirtualMachineMigrationException, ManagementServerException {
 
-        VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
+        VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
 
         Long srcHostId = vm.getHostId();
         Long oldSvcOfferingId = vm.getServiceOfferingId();
@@ -3179,7 +3178,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
             alertType = AlertManager.ALERT_TYPE_CONSOLE_PROXY_MIGRATE;
         }
 
-        VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
+        VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
         _networkMgr.prepareNicForMigration(profile, dest);
         volumeMgr.prepareForMigration(profile, dest);
 
@@ -3259,7 +3258,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
                     } catch (AgentUnavailableException e) {
                         s_logger.error("AgentUnavailableException while cleanup on source host: " + srcHostId);
                     }
-                    cleanup(vmGuru, new VirtualMachineProfileImpl<T>(vm), work, Event.AgentReportStopped, true, _accountMgr.getSystemUser(), _accountMgr.getSystemAccount());
+                    cleanup(vmGuru, new VirtualMachineProfileImpl(vm), work, Event.AgentReportStopped, true, _accountMgr.getSystemUser(), _accountMgr.getSystemAccount());
                     return null;
                 }
             } catch (OperationTimedoutException e) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/vm/VirtualMachineProfileImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineProfileImpl.java b/server/src/com/cloud/vm/VirtualMachineProfileImpl.java
index 033daf3..5e84c1f 100644
--- a/server/src/com/cloud/vm/VirtualMachineProfileImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineProfileImpl.java
@@ -21,9 +21,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-
 import com.cloud.agent.api.to.DiskTO;
-
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.offering.ServiceOffering;
 import com.cloud.service.ServiceOfferingVO;
@@ -39,9 +37,9 @@ import com.cloud.user.dao.AccountDao;
  * Implementation of VirtualMachineProfile.
  *
  */
-public class VirtualMachineProfileImpl<T extends VMInstanceVO> implements VirtualMachineProfile<T> {
+public class VirtualMachineProfileImpl implements VirtualMachineProfile {
 
-    T _vm;
+    VirtualMachine _vm;
     ServiceOfferingVO _offering;
     VMTemplateVO _template;
     UserVmDetailVO _userVmDetails;
@@ -56,7 +54,7 @@ public class VirtualMachineProfileImpl<T extends VMInstanceVO> implements Virtua
 
     VirtualMachine.Type _type;
 
-    public VirtualMachineProfileImpl(T vm, VMTemplateVO template, ServiceOfferingVO offering, Account owner, Map<Param, Object> params) {
+    public VirtualMachineProfileImpl(VirtualMachine vm, VMTemplateVO template, ServiceOfferingVO offering, Account owner, Map<Param, Object> params) {
         _vm = vm;
         _template = template;
         _offering = offering;
@@ -69,7 +67,7 @@ public class VirtualMachineProfileImpl<T extends VMInstanceVO> implements Virtua
         	_type = vm.getType();
     }
 
-    public VirtualMachineProfileImpl(T vm) {
+    public VirtualMachineProfileImpl(VirtualMachine vm) {
         this(vm, null, null, null, null);
     }
 
@@ -83,7 +81,7 @@ public class VirtualMachineProfileImpl<T extends VMInstanceVO> implements Virtua
     }
 
     @Override
-    public T getVirtualMachine() {
+    public VirtualMachine getVirtualMachine() {
         return _vm;
     }
 
@@ -102,7 +100,7 @@ public class VirtualMachineProfileImpl<T extends VMInstanceVO> implements Virtua
 
     @Override
     public void setBootLoaderType(BootloaderType bootLoader) {
-    	this._bootloader = bootLoader;
+    	_bootloader = bootLoader;
     }
 
     @Override
@@ -232,7 +230,7 @@ public class VirtualMachineProfileImpl<T extends VMInstanceVO> implements Virtua
 
 	@Override
 	public BootloaderType getBootLoaderType() {
-		return this._bootloader;
+		return _bootloader;
 	}
 
 	@Override
@@ -256,11 +254,11 @@ public class VirtualMachineProfileImpl<T extends VMInstanceVO> implements Virtua
 
     @Override
     public Float getCpuOvercommitRatio() {
-        return  this.cpuOvercommitRatio;
+        return  cpuOvercommitRatio;
     }
 
     @Override
     public Float getMemoryOvercommitRatio() {
-        return this.memoryOvercommitRatio;
+        return memoryOvercommitRatio;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/test/com/cloud/network/MockNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/MockNetworkManagerImpl.java b/server/test/com/cloud/network/MockNetworkManagerImpl.java
deleted file mode 100755
index 4577d0a..0000000
--- a/server/test/com/cloud/network/MockNetworkManagerImpl.java
+++ /dev/null
@@ -1,962 +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 com.cloud.network;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.ejb.Local;
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.acl.ControlledEntity.ACLType;
-import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
-import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
-import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
-import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
-import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
-import org.springframework.stereotype.Component;
-
-import com.cloud.dc.DataCenter;
-import com.cloud.dc.Pod;
-import com.cloud.dc.Vlan.VlanType;
-import com.cloud.deploy.DataCenterDeployment;
-import com.cloud.deploy.DeployDestination;
-import com.cloud.deploy.DeploymentPlan;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientAddressCapacityException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.Network.Provider;
-import com.cloud.network.Network.Service;
-import com.cloud.network.Networks.TrafficType;
-import com.cloud.network.addr.PublicIp;
-import com.cloud.network.dao.IPAddressVO;
-import com.cloud.network.dao.NetworkVO;
-import com.cloud.network.GuestVlan;
-import com.cloud.network.element.DhcpServiceProvider;
-import com.cloud.network.element.LoadBalancingServiceProvider;
-import com.cloud.network.element.StaticNatServiceProvider;
-import com.cloud.network.element.UserDataServiceProvider;
-import com.cloud.network.guru.NetworkGuru;
-import com.cloud.network.rules.FirewallRule;
-import com.cloud.network.rules.FirewallRule.Purpose;
-import com.cloud.network.rules.FirewallRule.State;
-import com.cloud.network.rules.LoadBalancerContainer.Scheme;
-import com.cloud.network.rules.StaticNat;
-import com.cloud.offering.NetworkOffering;
-import com.cloud.offerings.NetworkOfferingVO;
-import com.cloud.user.Account;
-import com.cloud.user.User;
-import com.cloud.utils.Pair;
-import com.cloud.utils.component.ManagerBase;
-import com.cloud.vm.*;
-import com.cloud.vm.VirtualMachine.Type;
-import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
-import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
-import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
-import org.apache.cloudstack.api.command.user.network.*;
-import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
-import org.springframework.stereotype.Component;
-
-import javax.ejb.Local;
-import javax.naming.ConfigurationException;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-@Component
-@Local(value = { NetworkManager.class, NetworkService.class })
-public class MockNetworkManagerImpl extends ManagerBase implements NetworkManager, NetworkService {
-
-    @Override
-    public List<? extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public IPAddressVO associateIPToGuestNetwork(long ipId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException, ResourceUnavailableException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public IPAddressVO associatePortableIPToGuestNetwork(long ipAddrId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException, ResourceUnavailableException {
-        return null;// TODO Auto-generated method stub
-    }
-
-    @Override
-    public IPAddressVO disassociatePortableIPToGuestNetwork(long ipAddrId, long networkId) throws ResourceAllocationException, ResourceUnavailableException, InsufficientAddressCapacityException, ConcurrentOperationException {
-        return null;  // TODO Auto-generated method stub
-    }
-
-    @Override
-    public boolean isPortableIpTransferableFromNetwork(long ipAddrId, long networkId) {
-        return false;
-    }
-
-    @Override
-    public void transferPortableIP(long ipAddrId, long currentNetworkId, long newNetworkId)  throws ResourceAllocationException, ResourceUnavailableException,
-            InsufficientAddressCapacityException, ConcurrentOperationException {
-
-    }
-
-    @Override
-    public boolean releaseIpAddress(long ipAddressId) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public List<? extends Network> searchForNetworks(ListNetworksCmd cmd) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public boolean deleteNetwork(long networkId) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public int getActiveNicsInNetwork(long networkId) {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    @Override
-    public Network getNetwork(long networkId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Network getNetwork(String networkUuid) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public IpAddress getIp(long id) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public NetworkProfile convertNetworkToNetworkProfile(long networkId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-
-    @Override
-    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-        return true;
-    }
-
-    @Override
-    public boolean start() {
-        return true;
-    }
-
-    @Override
-    public boolean stop() {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public String getName() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-
-    @Override
-    public boolean disassociatePublicIpAddress(long id, long userId, Account caller) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-
-
-    @Override
-    public List<NetworkVO> setupNetwork(Account owner, NetworkOffering offering, DeploymentPlan plan, String name, String displayText, boolean isDefault)
-            throws ConcurrentOperationException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public List<NetworkVO> setupNetwork(Account owner, NetworkOffering offering, Network predefined, DeploymentPlan plan, String name, String displayText, boolean errorIfAlreadySetup, Long domainId,
-            ACLType aclType, Boolean subdomainAccess, Long vpcId, Boolean isDisplayNetworkEnabled) throws ConcurrentOperationException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-
-
-    @Override
-    public void allocate(VirtualMachineProfile<? extends VMInstanceVO> vm, List<Pair<NetworkVO, NicProfile>> networks) throws InsufficientCapacityException, ConcurrentOperationException {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void prepare(VirtualMachineProfile<? extends VMInstanceVO> profile, DeployDestination dest, ReservationContext context) throws InsufficientCapacityException, ConcurrentOperationException,
-    ResourceUnavailableException {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void release(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, boolean forced) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void cleanupNics(VirtualMachineProfile<? extends VMInstanceVO> vm) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void expungeNics(VirtualMachineProfile<? extends VMInstanceVO> vm) {
-        // TODO Auto-generated method stub
-
-    }
-
-
-    @Override
-    public List<NicProfile> getNicProfiles(VirtualMachine vm) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-
-
-
-
-    @Override
-    public Pair<NetworkGuru, NetworkVO> implementNetwork(long networkId, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException,
-    InsufficientCapacityException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-
-    @Override
-    public boolean destroyNetwork(long networkId, ReservationContext context) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public Network createGuestNetwork(long networkOfferingId, String name, String displayText, String gateway, String cidr, String vlanId, String networkDomain, Account owner, Long domainId,
-                                      PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String gatewayv6, String cidrv6, Boolean displayNetworkEnabled, String isolatedPvlan) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public boolean associateIpAddressListToAccount(long userId, long accountId, long zoneId, Long vlanId, Network networkToAssociateWith) throws InsufficientCapacityException,
-    ConcurrentOperationException, ResourceUnavailableException {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-
-
-
-
-    @Override
-    public boolean applyIpAssociations(Network network, boolean continueOnError) throws ResourceUnavailableException {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-
-
-    @Override
-    public boolean startNetwork(long networkId, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-
-    @Override
-    public IPAddressVO markIpAsUnavailable(long addrId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public String acquireGuestIpAddress(Network network, String requestedIp) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-
-    @Override
-    public boolean applyStaticNats(List<? extends StaticNat> staticNats, boolean continueOnError, boolean forRevoke) throws ResourceUnavailableException {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-
-
-    public Map<Service, Set<Provider>> getNetworkOfferingServiceProvidersMap(long networkOfferingId) {
-        return null;
-    }
-
-
-
-
-
-    @Override
-    public PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed, List<String> isolationMethods, String broadcastDomainRange, Long domainId, List<String> tags, String name) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Pair<List<? extends PhysicalNetwork>, Integer> searchPhysicalNetworks(Long id, Long zoneId, String keyword, Long startIndex, Long pageSize, String name) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<String> tags, String newVnetRangeString, String state, String removeVlan) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public boolean deletePhysicalNetwork(Long id) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public GuestVlan dedicateGuestVlanRange(DedicateGuestVlanRangeCmd cmd) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Pair<List<? extends GuestVlan>, Integer> listDedicatedGuestVlanRanges(ListDedicatedGuestVlanRangesCmd cmd) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public boolean releaseDedicatedGuestVlanRange(Long dedicatedGuestVlanRangeId) {
-        // TODO Auto-generated method stub
-        return true;
-    }
-
-        @Override
-    public List<? extends Service> listNetworkServices(String providerName) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-
-    @Override
-    public PhysicalNetworkServiceProvider addProviderToPhysicalNetwork(Long physicalNetworkId, String providerName, Long destinationPhysicalNetworkId, List<String> enabledServices) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Pair<List<? extends PhysicalNetworkServiceProvider>, Integer> listNetworkServiceProviders(Long physicalNetworkId, String name, String state, Long startIndex, Long pageSize) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public boolean deleteNetworkServiceProvider(Long id) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public PhysicalNetwork getPhysicalNetwork(Long physicalNetworkId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public PhysicalNetwork getCreatedPhysicalNetwork(Long physicalNetworkId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public PhysicalNetworkServiceProvider getPhysicalNetworkServiceProvider(Long providerId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public PhysicalNetworkServiceProvider getCreatedPhysicalNetworkServiceProvider(Long providerId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public long findPhysicalNetworkId(long zoneId, String tag, TrafficType trafficType) {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    @Override
-    public PhysicalNetworkTrafficType getPhysicalNetworkTrafficType(Long id) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public PhysicalNetworkTrafficType updatePhysicalNetworkTrafficType(Long id, String xenLabel, String kvmLabel, String vmwareLabel) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public boolean deletePhysicalNetworkTrafficType(Long id) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public Pair<List<? extends PhysicalNetworkTrafficType>, Integer> listTrafficTypes(Long physicalNetworkId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-
-    @Override
-    public Network getExclusiveGuestNetwork(long zoneId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public UserDataServiceProvider getPasswordResetProvider(Network network) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public UserDataServiceProvider getSSHKeyResetProvider(Network network) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public PhysicalNetworkServiceProvider updateNetworkServiceProvider(Long id, String state, List<String> enabledServices) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId, String trafficType, String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#applyRules(java.util.List, com.cloud.network.rules.FirewallRule.Purpose, com.cloud.network.NetworkRuleApplier, boolean)
-     */
-    @Override
-    public boolean applyRules(List<? extends FirewallRule> rules, Purpose purpose, NetworkRuleApplier applier,
-            boolean continueOnError) throws ResourceUnavailableException {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#applyIpAssociations(com.cloud.network.Network, boolean, boolean, java.util.List)
-     */
-    @Override
-    public boolean applyIpAssociations(Network network, boolean rulesRevoked, boolean continueOnError,
-            List<? extends PublicIpAddress> publicIps) throws ResourceUnavailableException {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#restartNetwork(java.lang.Long, com.cloud.user.Account, com.cloud.user.User, boolean)
-     */
-    @Override
-    public boolean restartNetwork(Long networkId, Account callerAccount, User callerUser, boolean cleanup)
-            throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#shutdownNetworkElementsAndResources(com.cloud.vm.ReservationContext, boolean, com.cloud.network.NetworkVO)
-     */
-    @Override
-    public boolean shutdownNetworkElementsAndResources(ReservationContext context, boolean b, NetworkVO network) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#implementNetworkElementsAndResources(com.cloud.deploy.DeployDestination, com.cloud.vm.ReservationContext, com.cloud.network.NetworkVO, com.cloud.offerings.NetworkOfferingVO)
-     */
-    @Override
-    public void implementNetworkElementsAndResources(DeployDestination dest, ReservationContext context,
-            NetworkVO network, NetworkOfferingVO findById) throws ConcurrentOperationException,
-            InsufficientAddressCapacityException, ResourceUnavailableException, InsufficientCapacityException {
-        // TODO Auto-generated method stub
-
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#allocateIp(com.cloud.user.Account, boolean, com.cloud.user.Account, com.cloud.dc.DataCenter)
-     */
-    @Override
-    public IpAddress allocateIp(Account ipOwner, boolean isSystem, Account caller, long callerId, DataCenter zone)
-            throws ConcurrentOperationException, ResourceAllocationException, InsufficientAddressCapacityException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#finalizeServicesAndProvidersForNetwork(com.cloud.offering.NetworkOffering, java.lang.Long)
-     */
-    @Override
-    public Map<String, String> finalizeServicesAndProvidersForNetwork(NetworkOffering offering, Long physicalNetworkId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#getNicProfileForVm(com.cloud.network.Network, com.cloud.vm.NicProfile, com.cloud.vm.VirtualMachine)
-     */
-    protected NicProfile getNicProfileForVm(Network network, NicProfile requested, VirtualMachine vm) {
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#getOnePhysicalNetworkByZoneAndTrafficType(long, com.cloud.network.Networks.TrafficType)
-     */
-    protected PhysicalNetwork getOnePhysicalNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType) {
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#getZoneNetworkDomain(long)
-     */
-    protected String getZoneNetworkDomain(long zoneId) {
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#getNicInNetworkIncludingRemoved(long, long)
-     */
-    protected Nic getNicInNetworkIncludingRemoved(long vmId, long networkId) {
-        return null;
-    }
-
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkService#restartNetwork(com.cloud.api.commands.RestartNetworkCmd, boolean)
-     */
-    @Override
-    public boolean restartNetwork(RestartNetworkCmd cmd, boolean cleanup) throws ConcurrentOperationException,
-    ResourceUnavailableException, InsufficientCapacityException {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkService#updateGuestNetwork(long, java.lang.String, java.lang.String, com.cloud.user.Account, com.cloud.user.User, java.lang.String, java.lang.Long, java.lang.Boolean)
-     */
-    @Override
-    public Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount,
-                                      User callerUser, String domainSuffix, Long networkOfferingId, Boolean changeCidr, String guestVmCidr, Boolean displayNetwork) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkService#listTrafficTypeImplementor(com.cloud.api.commands.ListTrafficTypeImplementorsCmd)
-     */
-    @Override
-    public List<Pair<TrafficType, String>> listTrafficTypeImplementor(ListTrafficTypeImplementorsCmd cmd) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkService#getIsolatedNetworksWithSourceNATOwnedByAccountInZone(long, com.cloud.user.Account)
-     */
-    @Override
-    public List<? extends Network> getIsolatedNetworksWithSourceNATOwnedByAccountInZone(long zoneId, Account owner) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkService#associateIPToNetwork(long, long)
-     */
-    @Override
-    public IpAddress associateIPToNetwork(long ipId, long networkId) throws InsufficientAddressCapacityException,
-    ResourceAllocationException, ResourceUnavailableException, ConcurrentOperationException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-
-    public Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String vlan,
-                                        String startIp, String endIP, String gateway, String netmask, long networkOwnerId, Long vpcId, Boolean sourceNat)
-                    throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#assignPublicIpAddress(long, java.lang.Long, com.cloud.user.Account, com.cloud.dc.Vlan.VlanType, java.lang.Long, java.lang.String, boolean)
-     */
-    @Override
-    public PublicIp assignPublicIpAddress(long dcId, Long podId, Account owner, VlanType type, Long networkId,
-            String requestedIp, boolean isSystem) throws InsufficientAddressCapacityException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#shutdownNetwork(long, com.cloud.vm.ReservationContext, boolean)
-     */
-    @Override
-    public boolean shutdownNetwork(long networkId, ReservationContext context, boolean cleanupElements) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#reallocate(com.cloud.vm.VirtualMachineProfile, com.cloud.deploy.DataCenterDeployment)
-     */
-    @Override
-    public boolean reallocate(VirtualMachineProfile<? extends VMInstanceVO> vm, DataCenterDeployment dest)
-            throws InsufficientCapacityException, ConcurrentOperationException {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#assignSystemIp(long, com.cloud.user.Account, boolean, boolean)
-     */
-    @Override
-    public IpAddress assignSystemIp(long networkId, Account owner, boolean forElasticLb, boolean forElasticIp)
-            throws InsufficientAddressCapacityException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#handleSystemIpRelease(com.cloud.network.IpAddress)
-     */
-    @Override
-    public boolean handleSystemIpRelease(IpAddress ip) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#allocateDirectIp(com.cloud.vm.NicProfile, com.cloud.dc.DataCenter, com.cloud.vm.VirtualMachineProfile, com.cloud.network.Network, java.lang.String)
-     */
-    @Override
-    public void allocateDirectIp(NicProfile nic, DataCenter dc, VirtualMachineProfile<? extends VirtualMachine> vm,
-            Network network, String requestedIpv4, String requestedIpv6) throws InsufficientVirtualNetworkCapcityException,
-            InsufficientAddressCapacityException {
-        // TODO Auto-generated method stub
-
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#assignSourceNatIpAddressToGuestNetwork(com.cloud.user.Account, com.cloud.network.Network)
-     */
-    @Override
-    public PublicIp assignSourceNatIpAddressToGuestNetwork(Account owner, Network guestNetwork)
-            throws InsufficientAddressCapacityException, ConcurrentOperationException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#allocateNic(com.cloud.vm.NicProfile, com.cloud.network.Network, java.lang.Boolean, int, com.cloud.vm.VirtualMachineProfile)
-     */
-    @Override
-    public Pair<NicProfile, Integer> allocateNic(NicProfile requested, Network network, Boolean isDefaultNic,
-            int deviceId, VirtualMachineProfile<? extends VMInstanceVO> vm)
-                    throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException,
-                    ConcurrentOperationException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#prepareNic(com.cloud.vm.VirtualMachineProfile, com.cloud.deploy.DeployDestination, com.cloud.vm.ReservationContext, long, com.cloud.network.NetworkVO)
-     */
-    @Override
-    public NicProfile prepareNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, DeployDestination dest,
-            ReservationContext context, long nicId, NetworkVO network)
-                    throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException,
-                    ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#removeNic(com.cloud.vm.VirtualMachineProfile, com.cloud.vm.Nic)
-     */
-    @Override
-    public void removeNic(VirtualMachineProfile<? extends VMInstanceVO> vm, Nic nic) {
-        // TODO Auto-generated method stub
-
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#setupDns(com.cloud.network.Network, com.cloud.network.Network.Provider)
-     */
-    @Override
-    public boolean setupDns(Network network, Provider provider) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#releaseNic(com.cloud.vm.VirtualMachineProfile, com.cloud.vm.Nic)
-     */
-    @Override
-    public void releaseNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, Nic nic)
-            throws ConcurrentOperationException, ResourceUnavailableException {
-        // TODO Auto-generated method stub
-
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#createNicForVm(com.cloud.network.Network, com.cloud.vm.NicProfile, com.cloud.vm.ReservationContext, com.cloud.vm.VirtualMachineProfileImpl, boolean)
-     */
-    @Override
-    public NicProfile createNicForVm(Network network, NicProfile requested, ReservationContext context,
-            VirtualMachineProfile<? extends VMInstanceVO> vmProfile, boolean prepare)
-                    throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException,
-                    ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#markPublicIpAsAllocated(com.cloud.network.IPAddressVO)
-     */
-    @Override
-    public void markPublicIpAsAllocated(IPAddressVO addr) {
-        // TODO Auto-generated method stub
-
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#assignDedicateIpAddress(com.cloud.user.Account, java.lang.Long, java.lang.Long, long, boolean)
-     */
-    @Override
-    public PublicIp assignDedicateIpAddress(Account owner, Long guestNtwkId, Long vpcId, long dcId, boolean isSourceNat)
-            throws ConcurrentOperationException, InsufficientAddressCapacityException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkManager#getNetworkLockTimeout()
-     */
-    @Override
-    public int getNetworkLockTimeout() {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    @Override
-    public boolean isNetworkInlineMode(Network network) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public StaticNatServiceProvider getStaticNatProviderForNetwork(Network network) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public List<Provider> getProvidersForServiceInNetwork(Network network,
-            Service service) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public int getRuleCountForIp(Long addressId, Purpose purpose, State state) {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    @Override
-    public LoadBalancingServiceProvider getLoadBalancingProviderForNetwork(Network network, Scheme lbScheme) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.NetworkService#allocateIP(com.cloud.user.Account, boolean, long)
-     */
-    @Override
-    public IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException,
-    InsufficientAddressCapacityException, ConcurrentOperationException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public IpAddress allocatePortableIp(Account ipOwner, Account caller, long dcId, Long networkId, Long vpcID)
-            throws ConcurrentOperationException, ResourceAllocationException, InsufficientAddressCapacityException {
-        return null;// TODO Auto-generated method stub
-    }
-
-    @Override
-    public IpAddress allocatePortableIP(Account ipOwner, int regionId, Long zoneId, Long networkId, Long vpcId) throws ResourceAllocationException,
-            InsufficientAddressCapacityException, ConcurrentOperationException {
-        return null;
-    }
-
-    @Override
-    public boolean releasePortableIpAddress(long ipAddressId)  {
-        return false;// TODO Auto-generated method stub
-    }
-
-    @Override
-    public boolean isSecondaryIpSetForNic(long nicId) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public boolean releaseSecondaryIpFromNic(long ipAddressId) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public NicSecondaryIp allocateSecondaryGuestIP(Account account, long zoneId,
-            Long nicId, Long networkId, String ipaddress) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public String allocateGuestIP(Account ipOwner, boolean isSystem,
-            long zoneId, Long networkId, String requestedIp)
-            throws InsufficientAddressCapacityException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-
-    @Override
-    public List<? extends Nic> listVmNics(Long vmId, Long nicId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public List<? extends Nic> listNics(ListNicsCmd listNicsCmd) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Map<Network.Capability, String> getNetworkOfferingServiceCapabilities(NetworkOffering offering, Service service) {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public String allocatePublicIpForGuestNic(Long networkId, DataCenter dc,
-            Pod pod, Account caller, String requestedIp)
-            throws InsufficientAddressCapacityException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-
-    @Override
-    public NicVO savePlaceholderNic(Network network, String ip4Address, String ip6Address, Type vmType) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public DhcpServiceProvider getDhcpServiceProvider(Network network) {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public PublicIp assignPublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List<Long> vlanDbIds, Long networkId, String requestedIp, boolean isSystem) throws InsufficientAddressCapacityException {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public void prepareNicForMigration(
-            VirtualMachineProfile<? extends VMInstanceVO> vm,
-            DeployDestination dest) {
-        // TODO Auto-generated method stub
-
-            }
-
-    @Override
-    public void commitNicForMigration(
-            VirtualMachineProfile<? extends VMInstanceVO> src,
-            VirtualMachineProfile<? extends VMInstanceVO> dst) {
-        // TODO Auto-generated method stub
-
-            }
-
-    @Override
-    public void rollbackNicForMigration(
-            VirtualMachineProfile<? extends VMInstanceVO> src,
-            VirtualMachineProfile<? extends VMInstanceVO> dst) {
-        // TODO Auto-generated method stub
-            }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/test/com/cloud/vm/VirtualMachineManagerImplTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/VirtualMachineManagerImplTest.java b/server/test/com/cloud/vm/VirtualMachineManagerImplTest.java
index 1e6d005..a49b0e0 100644
--- a/server/test/com/cloud/vm/VirtualMachineManagerImplTest.java
+++ b/server/test/com/cloud/vm/VirtualMachineManagerImplTest.java
@@ -270,7 +270,7 @@ public class VirtualMachineManagerImplTest {
     @Test (expected=CloudRuntimeException.class)
     public void testScaleVM3()  throws Exception {
 
-        /*VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
+        /*VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
 
         Long srcHostId = vm.getHostId();
         Long oldSvcOfferingId = vm.getServiceOfferingId();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
index fd61bc6..c10ec32 100644
--- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
@@ -24,7 +24,9 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import com.cloud.vm.*;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
 import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
@@ -33,8 +35,6 @@ import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
 import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
 import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
 import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
 
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.Pod;
@@ -66,7 +66,11 @@ import com.cloud.network.addr.PublicIp;
 import com.cloud.network.dao.IPAddressVO;
 import com.cloud.network.dao.NetworkServiceMapDao;
 import com.cloud.network.dao.NetworkVO;
-import com.cloud.network.element.*;
+import com.cloud.network.element.DhcpServiceProvider;
+import com.cloud.network.element.LoadBalancingServiceProvider;
+import com.cloud.network.element.NetworkElement;
+import com.cloud.network.element.StaticNatServiceProvider;
+import com.cloud.network.element.UserDataServiceProvider;
 import com.cloud.network.guru.NetworkGuru;
 import com.cloud.network.rules.FirewallRule;
 import com.cloud.network.rules.FirewallRule.Purpose;
@@ -80,19 +84,15 @@ import com.cloud.user.Account;
 import com.cloud.user.User;
 import com.cloud.utils.Pair;
 import com.cloud.utils.component.ManagerBase;
+import com.cloud.vm.Nic;
+import com.cloud.vm.NicProfile;
+import com.cloud.vm.NicSecondaryIp;
+import com.cloud.vm.NicVO;
+import com.cloud.vm.ReservationContext;
+import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachine.Type;
-
 import com.cloud.vm.VirtualMachineProfile;
 
-import org.apache.cloudstack.acl.ControlledEntity.ACLType;
-import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
-import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
-import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
-import org.apache.cloudstack.api.command.user.network.*;
-import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
 
 @Component
 @Local(value = { NetworkManager.class, NetworkService.class })
@@ -738,7 +738,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
      * @see com.cloud.network.NetworkManager#allocate(com.cloud.vm.VirtualMachineProfile, java.util.List)
      */
     @Override
-    public void allocate(VirtualMachineProfile<? extends VMInstanceVO> vm, List<Pair<NetworkVO, NicProfile>> networks)
+    public void allocate(VirtualMachineProfile vm, List<Pair<NetworkVO, NicProfile>> networks)
             throws InsufficientCapacityException, ConcurrentOperationException {
         // TODO Auto-generated method stub
         
@@ -752,7 +752,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
      * @see com.cloud.network.NetworkManager#prepare(com.cloud.vm.VirtualMachineProfile, com.cloud.deploy.DeployDestination, com.cloud.vm.ReservationContext)
      */
     @Override
-    public void prepare(VirtualMachineProfile<? extends VMInstanceVO> profile, DeployDestination dest,
+    public void prepare(VirtualMachineProfile profile, DeployDestination dest,
             ReservationContext context) throws InsufficientCapacityException, ConcurrentOperationException,
             ResourceUnavailableException {
         // TODO Auto-generated method stub
@@ -767,7 +767,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
      * @see com.cloud.network.NetworkManager#release(com.cloud.vm.VirtualMachineProfile, boolean)
      */
     @Override
-    public void release(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, boolean forced)
+    public void release(VirtualMachineProfile vmProfile, boolean forced)
             throws ConcurrentOperationException, ResourceUnavailableException {
         // TODO Auto-generated method stub
         
@@ -781,7 +781,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
      * @see com.cloud.network.NetworkManager#cleanupNics(com.cloud.vm.VirtualMachineProfile)
      */
     @Override
-    public void cleanupNics(VirtualMachineProfile<? extends VMInstanceVO> vm) {
+    public void cleanupNics(VirtualMachineProfile vm) {
         // TODO Auto-generated method stub
         
     }
@@ -794,7 +794,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
      * @see com.cloud.network.NetworkManager#expungeNics(com.cloud.vm.VirtualMachineProfile)
      */
     @Override
-    public void expungeNics(VirtualMachineProfile<? extends VMInstanceVO> vm) {
+    public void expungeNics(VirtualMachineProfile vm) {
         // TODO Auto-generated method stub
         
     }
@@ -1001,7 +1001,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
      * @see com.cloud.network.NetworkManager#reallocate(com.cloud.vm.VirtualMachineProfile, com.cloud.deploy.DataCenterDeployment)
      */
     @Override
-    public boolean reallocate(VirtualMachineProfile<? extends VMInstanceVO> vm, DataCenterDeployment dest)
+    public boolean reallocate(VirtualMachineProfile vm, DataCenterDeployment dest)
             throws InsufficientCapacityException, ConcurrentOperationException {
         // TODO Auto-generated method stub
         return false;
@@ -1042,7 +1042,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
      * @see com.cloud.network.NetworkManager#allocateDirectIp(com.cloud.vm.NicProfile, com.cloud.dc.DataCenter, com.cloud.vm.VirtualMachineProfile, com.cloud.network.Network, java.lang.String)
      */
     @Override
-    public void allocateDirectIp(NicProfile nic, DataCenter dc, VirtualMachineProfile<? extends VirtualMachine> vm,
+    public void allocateDirectIp(NicProfile nic, DataCenter dc, VirtualMachineProfile vm,
             Network network, String requestedIpv4, String requestedIpv6) throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException {
         // TODO Auto-generated method stub
@@ -1071,7 +1071,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
      */
     @Override
     public Pair<NicProfile, Integer> allocateNic(NicProfile requested, Network network, Boolean isDefaultNic,
-            int deviceId, VirtualMachineProfile<? extends VMInstanceVO> vm)
+            int deviceId, VirtualMachineProfile vm)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException,
             ConcurrentOperationException {
         // TODO Auto-generated method stub
@@ -1086,7 +1086,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
      * @see com.cloud.network.NetworkManager#prepareNic(com.cloud.vm.VirtualMachineProfile, com.cloud.deploy.DeployDestination, com.cloud.vm.ReservationContext, long, com.cloud.network.NetworkVO)
      */
     @Override
-    public NicProfile prepareNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, DeployDestination dest,
+    public NicProfile prepareNic(VirtualMachineProfile vmProfile, DeployDestination dest,
             ReservationContext context, long nicId, NetworkVO network)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException,
             ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
@@ -1102,7 +1102,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
      * @see com.cloud.network.NetworkManager#removeNic(com.cloud.vm.VirtualMachineProfile, com.cloud.vm.Nic)
      */
     @Override
-    public void removeNic(VirtualMachineProfile<? extends VMInstanceVO> vm, Nic nic) {
+    public void removeNic(VirtualMachineProfile vm, Nic nic) {
         // TODO Auto-generated method stub
         
     }
@@ -1147,7 +1147,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
      * @see com.cloud.network.NetworkManager#releaseNic(com.cloud.vm.VirtualMachineProfile, com.cloud.vm.Nic)
      */
     @Override
-    public void releaseNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, Nic nic)
+    public void releaseNic(VirtualMachineProfile vmProfile, Nic nic)
             throws ConcurrentOperationException, ResourceUnavailableException {
         // TODO Auto-generated method stub
         
@@ -1158,7 +1158,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
      */
     @Override
     public NicProfile createNicForVm(Network network, NicProfile requested, ReservationContext context,
-            VirtualMachineProfile<? extends VMInstanceVO> vmProfile, boolean prepare)
+            VirtualMachineProfile vmProfile, boolean prepare)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException,
             ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
         // TODO Auto-generated method stub
@@ -1419,7 +1419,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
 
 	@Override
 	public void prepareNicForMigration(
-			VirtualMachineProfile<? extends VMInstanceVO> vm,
+            VirtualMachineProfile vm,
 			DeployDestination dest) {
 		// TODO Auto-generated method stub
 		
@@ -1431,8 +1431,8 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
 
 	@Override
 	public void commitNicForMigration(
-			VirtualMachineProfile<? extends VMInstanceVO> src,
-			VirtualMachineProfile<? extends VMInstanceVO> dst) {
+            VirtualMachineProfile src,
+            VirtualMachineProfile dst) {
 		// TODO Auto-generated method stub
 		
 	}
@@ -1443,8 +1443,8 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
 
 	@Override
 	public void rollbackNicForMigration(
-			VirtualMachineProfile<? extends VMInstanceVO> src,
-			VirtualMachineProfile<? extends VMInstanceVO> dst) {
+            VirtualMachineProfile src,
+            VirtualMachineProfile dst) {
 		// TODO Auto-generated method stub
 		
 	}


[2/7] Changed VirtualMachineProfile to be non-generic. From here on VirtualMachineManager will only manage vm instance. It doesn't understand the difference between different types of VMs. This makes the vmsync code to be generic across all vms.

Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java b/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
index f325c4a..7f1048f 100644
--- a/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
+++ b/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
@@ -72,14 +72,14 @@ VpcVirtualNetworkApplianceService {
      * @see com.cloud.network.router.VirtualNetworkApplianceManager#savePasswordToRouter(com.cloud.network.Network, com.cloud.vm.NicProfile, com.cloud.vm.VirtualMachineProfile, java.util.List)
      */
     @Override
-    public boolean savePasswordToRouter(Network network, NicProfile nic, VirtualMachineProfile<UserVm> profile,
+    public boolean savePasswordToRouter(Network network, NicProfile nic, VirtualMachineProfile profile,
             List<? extends VirtualRouter> routers) throws ResourceUnavailableException {
         // TODO Auto-generated method stub
         return false;
     }
 
     @Override
-    public boolean saveSSHPublicKeyToRouter(Network network, NicProfile nic, VirtualMachineProfile<UserVm> profile, List<? extends VirtualRouter> routers, String SSHPublicKey) throws ResourceUnavailableException {
+    public boolean saveSSHPublicKeyToRouter(Network network, NicProfile nic, VirtualMachineProfile profile, List<? extends VirtualRouter> routers, String SSHPublicKey) throws ResourceUnavailableException {
         return false;  //To change body of implemented methods use File | Settings | File Templates.
     }
 
@@ -87,7 +87,7 @@ VpcVirtualNetworkApplianceService {
      * @see com.cloud.network.router.VirtualNetworkApplianceManager#saveUserDataToRouter(com.cloud.network.Network, com.cloud.vm.NicProfile, com.cloud.vm.VirtualMachineProfile, java.util.List)
      */
     @Override
-    public boolean saveUserDataToRouter(Network network, NicProfile nic, VirtualMachineProfile<UserVm> profile,
+    public boolean saveUserDataToRouter(Network network, NicProfile nic, VirtualMachineProfile profile,
             List<? extends VirtualRouter> routers) throws ResourceUnavailableException {
         // TODO Auto-generated method stub
         return false;
@@ -196,7 +196,7 @@ VpcVirtualNetworkApplianceService {
      * @see com.cloud.network.router.VirtualNetworkApplianceManager#applyDhcpEntry(com.cloud.network.Network, com.cloud.vm.NicProfile, com.cloud.vm.VirtualMachineProfile, com.cloud.deploy.DeployDestination, java.util.List)
      */
     @Override
-    public boolean applyDhcpEntry(Network config, NicProfile nic, VirtualMachineProfile<UserVm> vm,
+    public boolean applyDhcpEntry(Network config, NicProfile nic, VirtualMachineProfile vm,
             DeployDestination dest, List<DomainRouterVO> routers) throws ResourceUnavailableException {
         // TODO Auto-generated method stub
         return false;
@@ -206,14 +206,14 @@ VpcVirtualNetworkApplianceService {
      * @see com.cloud.network.router.VirtualNetworkApplianceManager#applyUserData(com.cloud.network.Network, com.cloud.vm.NicProfile, com.cloud.vm.VirtualMachineProfile, com.cloud.deploy.DeployDestination, java.util.List)
      */
     @Override
-    public boolean applyUserData(Network config, NicProfile nic, VirtualMachineProfile<UserVm> vm,
+    public boolean applyUserData(Network config, NicProfile nic, VirtualMachineProfile vm,
             DeployDestination dest, List<DomainRouterVO> routers) throws ResourceUnavailableException {
         // TODO Auto-generated method stub
         return false;
     }
 
     @Override
-    public boolean configDhcpForSubnet(Network network, NicProfile nic, VirtualMachineProfile<UserVm> uservm, DeployDestination dest, List<DomainRouterVO> routers) throws ResourceUnavailableException {
+    public boolean configDhcpForSubnet(Network network, NicProfile nic, VirtualMachineProfile uservm, DeployDestination dest, List<DomainRouterVO> routers) throws ResourceUnavailableException {
         return false;  //To change body of implemented methods use File | Settings | File Templates.
     }
 


[7/7] git commit: updated refs/heads/master to 0223657

Posted by ah...@apache.org.
Changed some debug logs to trace


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/02236576
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/02236576
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/02236576

Branch: refs/heads/master
Commit: 02236576c0d3bc28c5ec9c806d11adf7af2ec9e9
Parents: 1325014
Author: Alex Huang <al...@citrix.com>
Authored: Mon Jul 22 11:46:21 2013 -0700
Committer: Alex Huang <al...@citrix.com>
Committed: Mon Jul 22 11:48:12 2013 -0700

----------------------------------------------------------------------
 .../org/apache/cloudstack/context/CallContext.java    | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/02236576/api/src/org/apache/cloudstack/context/CallContext.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/context/CallContext.java b/api/src/org/apache/cloudstack/context/CallContext.java
index 9689a99..e3c1bf2 100644
--- a/api/src/org/apache/cloudstack/context/CallContext.java
+++ b/api/src/org/apache/cloudstack/context/CallContext.java
@@ -110,7 +110,9 @@ public class CallContext {
         CallContext callingContext = new CallContext(callingUser, callingAccount, contextId);
         s_currentContext.set(callingContext);
         NDC.push("ctx-" + UuidUtils.first(contextId));
-        s_logger.debug("Setting calling context: " + callingContext);
+        if (s_logger.isTraceEnabled()) {
+            s_logger.trace("Registered: " + callingContext);
+        }
         return callingContext;
     }
 
@@ -161,11 +163,13 @@ public class CallContext {
     public static CallContext unregister() {
         CallContext context = s_currentContext.get();
         if (context == null) {
-            s_logger.trace("No context to remove");
+            s_logger.debug("No context to remove");
             return null;
         }
         s_currentContext.remove();
-        s_logger.debug("Context removed " + context);
+        if (s_logger.isTraceEnabled()) {
+            s_logger.trace("Unregistered: " + context);
+        }
         String contextId = context.getContextId();
         String sessionIdOnStack = null;
         String sessionIdPushedToNDC = "ctx-" + UuidUtils.first(contextId);
@@ -210,9 +214,9 @@ public class CallContext {
 
     @Override
     public String toString() {
-        return new StringBuffer("CallContext[acct=").append(account.getId())
+        return new StringBuffer("CCtxt[acct=").append(account.getId())
                 .append("; user=").append(user.getId())
-                .append("; session=").append(contextId)
+                .append("; id=").append(contextId)
                 .append("]").toString();
     }
 }


[5/7] Changed VirtualMachineProfile to be non-generic. From here on VirtualMachineManager will only manage vm instance. It doesn't understand the difference between different types of VMs. This makes the vmsync code to be generic across all vms.

Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalUserdataElement.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalUserdataElement.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalUserdataElement.java
index 49c6fd9..524db26 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalUserdataElement.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalUserdataElement.java
@@ -72,7 +72,7 @@ public class BaremetalUserdataElement extends AdapterBase implements NetworkElem
     }
 
     @Override
-    public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest,
+    public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest,
             ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
         if (!canHandle(dest)) {
             return false;
@@ -82,17 +82,17 @@ public class BaremetalUserdataElement extends AdapterBase implements NetworkElem
             return false;
         }
 
-        return pxeMgr.addUserData(nic, (VirtualMachineProfile<UserVm>) vm);
+        return pxeMgr.addUserData(nic, (VirtualMachineProfile) vm);
     }
 
     @Override
-    public boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws ResourceUnavailableException {
+    public boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException {
         // TODO Auto-generated method stub
         return false;
     }
 
     @Override
-    public boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String SSHPublicKey) throws ResourceUnavailableException {
+    public boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile vm, String SSHPublicKey) throws ResourceUnavailableException {
         // TODO Auto-generated method stub
         return false;
     }
@@ -115,14 +115,14 @@ public class BaremetalUserdataElement extends AdapterBase implements NetworkElem
     }
 
     @Override
-    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest,
+    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest,
             ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
         // TODO Auto-generated method stub
         return false;
     }
 
     @Override
-    public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context)
+    public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context)
             throws ConcurrentOperationException, ResourceUnavailableException {
         // TODO Auto-generated method stub
         return false;
@@ -154,7 +154,7 @@ public class BaremetalUserdataElement extends AdapterBase implements NetworkElem
 
 
     @Override
-    public boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm)
+    public boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile vm)
             throws ResourceUnavailableException {
         // TODO Auto-generated method stub
         return false;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmGuru.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmGuru.java b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmGuru.java
index cb2cb13..206454b 100755
--- a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmGuru.java
+++ b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmGuru.java
@@ -20,12 +20,11 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 
 import com.cloud.agent.api.to.VirtualMachineTO;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.hypervisor.HypervisorGuru;
 import com.cloud.hypervisor.HypervisorGuruBase;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.dao.GuestOSDao;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 @Local(value=HypervisorGuru.class)
@@ -41,8 +40,7 @@ public class OvmGuru extends HypervisorGuruBase implements HypervisorGuru {
 	}
 
 	@Override
-	public <T extends VirtualMachine> VirtualMachineTO implement(
-			VirtualMachineProfile<T> vm) {
+    public VirtualMachineTO implement(VirtualMachineProfile vm) {
 		VirtualMachineTO to = toVirtualMachineTO(vm);
 		to.setBootloader(vm.getBootLoaderType());
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorGuru.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorGuru.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorGuru.java
index 57a38f1..8f36e16 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorGuru.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorGuru.java
@@ -16,18 +16,17 @@
 // under the License.
 package com.cloud.simulator;
 
+import javax.ejb.Local;
+import javax.inject.Inject;
+
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.hypervisor.HypervisorGuru;
 import com.cloud.hypervisor.HypervisorGuruBase;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.dao.GuestOSDao;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
-import javax.ejb.Local;
-import javax.inject.Inject;
-
 
 @Local(value=HypervisorGuru.class)
 public class SimulatorGuru extends HypervisorGuruBase implements HypervisorGuru {
@@ -43,7 +42,7 @@ public class SimulatorGuru extends HypervisorGuruBase implements HypervisorGuru
     }
 
     @Override
-    public <T extends VirtualMachine> VirtualMachineTO implement(VirtualMachineProfile<T> vm) {
+    public VirtualMachineTO implement(VirtualMachineProfile vm) {
         VirtualMachineTO to = toVirtualMachineTO(vm);
 
         // Determine the VM's OS description

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
index b86b6d9..78a596e 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
@@ -122,7 +122,7 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru {
     }
 
     @Override
-    public <T extends VirtualMachine> VirtualMachineTO implement(VirtualMachineProfile<T> vm) {
+    public VirtualMachineTO implement(VirtualMachineProfile vm) {
         VirtualMachineTO to = toVirtualMachineTO(vm);
         to.setBootloader(BootloaderType.HVM);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java b/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java
index 4629b6c..e1f4a27 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java
@@ -100,7 +100,7 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme
     
     @Override
     public boolean prepare(Network network, NicProfile nic,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
             throws ConcurrentOperationException, ResourceUnavailableException,
             InsufficientCapacityException {
@@ -109,7 +109,7 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme
     
     @Override
     public boolean release(Network network, NicProfile nic,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             ReservationContext context) throws ConcurrentOperationException,
             ResourceUnavailableException {
         return true;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
index c52020e..6dd6f3f 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
@@ -11,7 +11,7 @@
 // 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 
+// KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
 package com.cloud.hypervisor;
@@ -24,9 +24,7 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.dao.GuestOSDao;
 import com.cloud.template.VirtualMachineTemplate.BootloaderType;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
-import com.cloud.vm.VirtualMachineProfileImpl;
 
 @Local(value=HypervisorGuru.class)
 public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru {
@@ -42,7 +40,7 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru
     }
 
     @Override
-    public <T extends VirtualMachine> VirtualMachineTO implement(VirtualMachineProfile<T> vm) {
+    public VirtualMachineTO implement(VirtualMachineProfile vm) {
         BootloaderType bt = BootloaderType.PyGrub;
         if (vm.getBootLoaderType() == BootloaderType.CD) {
         	 bt = vm.getBootLoaderType();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java
index 411feab..54623e9 100644
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java
@@ -182,7 +182,7 @@ public class BigSwitchVnsElement extends AdapterBase implements
 
     @Override
     public boolean prepare(Network network, NicProfile nic,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
             throws ConcurrentOperationException, ResourceUnavailableException,
             InsufficientCapacityException {
@@ -228,7 +228,7 @@ public class BigSwitchVnsElement extends AdapterBase implements
 
     @Override
     public boolean release(Network network, NicProfile nic,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             ReservationContext context) throws ConcurrentOperationException,
             ResourceUnavailableException {
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
index f660b7c..52303a4 100644
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
@@ -211,7 +211,7 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
 
     @Override
     public void reserve(NicProfile nic, Network network,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
             throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException {
@@ -221,7 +221,7 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
 
     @Override
     public boolean release(NicProfile nic,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             String reservationId) {
         // TODO Auto-generated method stub
         return super.release(nic, vm, reservationId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
index de52c21..5291ad1 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
@@ -422,7 +422,7 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
 
     @Override
     public boolean prepare(Network network, NicProfile nic,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
             throws ConcurrentOperationException, ResourceUnavailableException,
             InsufficientCapacityException {
@@ -441,7 +441,7 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
 
     @Override
     public boolean release(Network network, NicProfile nic,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             ReservationContext context) throws ConcurrentOperationException,
             ResourceUnavailableException {
         return true;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/dns-notifier/src/org/apache/cloudstack/network/element/DnsNotifier.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/dns-notifier/src/org/apache/cloudstack/network/element/DnsNotifier.java b/plugins/network-elements/dns-notifier/src/org/apache/cloudstack/network/element/DnsNotifier.java
index c421344..4a403c4 100644
--- a/plugins/network-elements/dns-notifier/src/org/apache/cloudstack/network/element/DnsNotifier.java
+++ b/plugins/network-elements/dns-notifier/src/org/apache/cloudstack/network/element/DnsNotifier.java
@@ -71,7 +71,7 @@ public class DnsNotifier extends AdapterBase implements NetworkElement {
     }
 
     @Override
-    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
+    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
     ResourceUnavailableException, InsufficientCapacityException {
         // signal to the dns server that this vm is up and running and set the ip address to hostname mapping.
         vm.getHostName();
@@ -81,7 +81,7 @@ public class DnsNotifier extends AdapterBase implements NetworkElement {
     }
 
     @Override
-    public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
+    public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
         vm.getHostName();
         nic.getIp4Address();
         nic.getIp6Address();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/element/ElasticLoadBalancerElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/element/ElasticLoadBalancerElement.java b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/element/ElasticLoadBalancerElement.java
index 8b1b414..fd7274d 100644
--- a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/element/ElasticLoadBalancerElement.java
+++ b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/element/ElasticLoadBalancerElement.java
@@ -123,14 +123,14 @@ public class ElasticLoadBalancerElement extends AdapterBase implements LoadBalan
     }
 
     @Override
-    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context)
+    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
             throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
        
         return true;
     }
 
     @Override
-    public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context) throws ConcurrentOperationException,
+    public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException,
             ResourceUnavailableException {
         
         return true;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
index 24ec87a..8d32f43 100644
--- a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
+++ b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
@@ -127,7 +127,6 @@ import com.cloud.utils.net.Ip;
 import com.cloud.vm.DomainRouterVO;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VMInstanceVO;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachine.State;
 import com.cloud.vm.VirtualMachineGuru;
@@ -783,8 +782,7 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
     }
 
     @Override
-    public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest, ReservationContext context) {
-        DomainRouterVO elbVm = profile.getVirtualMachine();
+    public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {
         
         List<NicProfile> elbNics = profile.getNics();
         Long guestNtwkId = null;
@@ -864,8 +862,8 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
     }
 
     @Override
-    public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
-        DomainRouterVO elbVm = profile.getVirtualMachine();
+    public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
+        DomainRouterVO elbVm = _routerDao.findById(profile.getVirtualMachine().getId());
 
         List<NicProfile> nics = profile.getNics();
         for (NicProfile nic : nics) {
@@ -885,7 +883,7 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
     }
 
     @Override
-    public boolean finalizeStart(VirtualMachineProfile<DomainRouterVO> profile, long hostId, Commands cmds, ReservationContext context) {
+    public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Commands cmds, ReservationContext context) {
         CheckSshAnswer answer = (CheckSshAnswer) cmds.getAnswer("checkSsh");
         if (answer == null || !answer.getResult()) {
             s_logger.warn("Unable to ssh to the ELB VM: " + answer.getDetails());
@@ -896,8 +894,8 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
     }
 
     @Override
-    public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile) {
-        DomainRouterVO elbVm = profile.getVirtualMachine();
+    public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) {
+        DomainRouterVO elbVm = _routerDao.findById(profile.getVirtualMachine().getId());
         DataCenterVO dcVo = _dcDao.findById(elbVm.getDataCenterId());
 
         NicProfile controlNic = null;
@@ -950,10 +948,9 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
     }
 
     @Override
-    public void finalizeStop(VirtualMachineProfile<DomainRouterVO> profile, StopAnswer answer) {
+    public void finalizeStop(VirtualMachineProfile profile, StopAnswer answer) {
         if (answer != null) {
-            VMInstanceVO vm = profile.getVirtualMachine();
-            DomainRouterVO elbVm = _routerDao.findById(vm.getId());
+            DomainRouterVO elbVm = _routerDao.findById(profile.getVirtualMachine().getId());
             processStopOrRebootAnswer(elbVm, answer);
         }
     }
@@ -969,7 +966,7 @@ ElasticLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
     }
 
     @Override
-    public void prepareStop(VirtualMachineProfile<DomainRouterVO> profile) {
+    public void prepareStop(VirtualMachineProfile profile) {
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java b/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
index 80b42e0..8ea4d61 100644
--- a/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
+++ b/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
@@ -159,13 +159,13 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
     }
 
     @Override
-    public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
+    public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
     InsufficientNetworkCapacityException, ResourceUnavailableException {
         return true;
     }
 
     @Override
-    public boolean release(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context) {
+    public boolean release(Network config, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) {
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/element/InternalLoadBalancerElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/element/InternalLoadBalancerElement.java b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/element/InternalLoadBalancerElement.java
index 18ac13b..2376038 100644
--- a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/element/InternalLoadBalancerElement.java
+++ b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/element/InternalLoadBalancerElement.java
@@ -170,7 +170,7 @@ public class InternalLoadBalancerElement extends AdapterBase implements LoadBala
 
     
     @Override
-    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
+    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
             ResourceUnavailableException, InsufficientCapacityException {
         
         if (!canHandle(network, null)) {
@@ -218,7 +218,7 @@ public class InternalLoadBalancerElement extends AdapterBase implements LoadBala
     }
 
     @Override
-    public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
+    public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
index 90ff9bc..481bbca 100644
--- a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
+++ b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
@@ -156,7 +156,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
     }
 
     @Override
-    public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<DomainRouterVO> profile,
+    public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile,
             DeployDestination dest, ReservationContext context) {
 
         //Internal LB vm starts up with 2 Nics
@@ -231,8 +231,9 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
     }
 
     @Override
-    public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
-        DomainRouterVO internalLbVm = profile.getVirtualMachine();
+    public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
+
+        DomainRouterVO internalLbVm = _internalLbVmDao.findById(profile.getId());
 
         List<NicProfile> nics = profile.getNics();
         for (NicProfile nic : nics) {
@@ -248,8 +249,8 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
     }
 
     @Override
-    public boolean finalizeStart(VirtualMachineProfile<DomainRouterVO> profile, long hostId, Commands cmds, ReservationContext context) {
-        DomainRouterVO internalLbVm = profile.getVirtualMachine();
+    public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Commands cmds, ReservationContext context) {
+        DomainRouterVO internalLbVm = _internalLbVmDao.findById(profile.getId());
         
         boolean result = true;
 
@@ -297,8 +298,8 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
     }
 
     @Override
-    public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile) {
-        DomainRouterVO internalLbVm = profile.getVirtualMachine();
+    public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) {
+        DomainRouterVO internalLbVm = _internalLbVmDao.findById(profile.getId());
         NicProfile controlNic = getNicProfileByTrafficType(profile, TrafficType.Control);
 
         if (controlNic == null) {
@@ -334,7 +335,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
     }
 
     @Override
-    public void finalizeStop(VirtualMachineProfile<DomainRouterVO> profile, StopAnswer answer) {
+    public void finalizeStop(VirtualMachineProfile profile, StopAnswer answer) {
     }
 
     @Override
@@ -342,7 +343,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
     }
 
     @Override
-    public void prepareStop(VirtualMachineProfile<DomainRouterVO> profile) {
+    public void prepareStop(VirtualMachineProfile profile) {
     }
     
     @Override
@@ -391,7 +392,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
         return _name;
     }
     
-    protected NicProfile getNicProfileByTrafficType(VirtualMachineProfile<DomainRouterVO> profile, TrafficType trafficType) {
+    protected NicProfile getNicProfileByTrafficType(VirtualMachineProfile profile, TrafficType trafficType) {
         for (NicProfile nic : profile.getNics()) {
             if (nic.getTrafficType() == trafficType && nic.getIp4Address() != null) {
                 return nic;
@@ -400,7 +401,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
         return null;
      }
     
-    protected void finalizeSshAndVersionOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile, DomainRouterVO router, NicProfile controlNic) {
+    protected void finalizeSshAndVersionOnStart(Commands cmds, VirtualMachineProfile profile, DomainRouterVO router, NicProfile controlNic) {
         cmds.addCommand("checkSsh", new CheckSshCommand(profile.getInstanceName(), controlNic.getIp4Address(), 3922));
 
         // Update internal lb vm template/scripts version

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java b/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
index c00d99a..85d6de6 100644
--- a/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
+++ b/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
@@ -145,13 +145,13 @@ PortForwardingServiceProvider, RemoteAccessVPNServiceProvider, IpDeployer, Junip
     }
 
     @Override
-    public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
+    public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
     InsufficientNetworkCapacityException, ResourceUnavailableException {
         return true;
     }
 
     @Override
-    public boolean release(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context) {
+    public boolean release(Network config, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) {
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/midonet/src/com/cloud/network/element/MidoNetElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/midonet/src/com/cloud/network/element/MidoNetElement.java b/plugins/network-elements/midonet/src/com/cloud/network/element/MidoNetElement.java
index ab6a6de..b02e51d 100644
--- a/plugins/network-elements/midonet/src/com/cloud/network/element/MidoNetElement.java
+++ b/plugins/network-elements/midonet/src/com/cloud/network/element/MidoNetElement.java
@@ -391,7 +391,7 @@ public class MidoNetElement extends AdapterBase implements
      * From interface DHCPServiceProvider
      */
     @Override
-    public boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
+    public boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm,
                                 DeployDestination dest, ReservationContext context)
         throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
 
@@ -455,7 +455,7 @@ public class MidoNetElement extends AdapterBase implements
     }
 
     @Override
-    public boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
+    public boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
         return false;  //To change body of implemented methods use File | Settings | File Templates.
     }
 
@@ -768,7 +768,7 @@ public class MidoNetElement extends AdapterBase implements
     }
 
     @Override
-    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
+    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm,
                            DeployDestination dest, ReservationContext context)
             throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
         s_logger.debug("prepare called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());
@@ -832,7 +832,7 @@ public class MidoNetElement extends AdapterBase implements
     }
 
     @Override
-    public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
+    public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm,
                            ReservationContext context)
             throws ConcurrentOperationException, ResourceUnavailableException {
         s_logger.debug("release called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetGuestNetworkGuru.java b/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetGuestNetworkGuru.java
index d57affc..ac77cf6 100644
--- a/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetGuestNetworkGuru.java
+++ b/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetGuestNetworkGuru.java
@@ -145,7 +145,7 @@ public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
 
     @Override
     public void reserve(NicProfile nic, Network network,
-                        VirtualMachineProfile<? extends VirtualMachine> vm,
+                        VirtualMachineProfile vm,
                         DeployDestination dest, ReservationContext context)
             throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException {
@@ -156,7 +156,7 @@ public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
 
     @Override
     public boolean release(NicProfile nic,
-                           VirtualMachineProfile<? extends VirtualMachine> vm,
+                           VirtualMachineProfile vm,
                            String reservationId) {
         s_logger.debug("release called with nic: " + nic.toString() + " vm: " + vm.toString());
         return super.release(nic, vm, reservationId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetPublicNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetPublicNetworkGuru.java b/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetPublicNetworkGuru.java
index 1daf0ba..38da02b 100644
--- a/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetPublicNetworkGuru.java
+++ b/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetPublicNetworkGuru.java
@@ -78,7 +78,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
         super();
     }
 
-    protected void getIp(NicProfile nic, DataCenter dc, VirtualMachineProfile<? extends VirtualMachine> vm, Network network) throws InsufficientVirtualNetworkCapcityException,
+    protected void getIp(NicProfile nic, DataCenter dc, VirtualMachineProfile vm, Network network) throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException, ConcurrentOperationException {
         if (nic.getIp4Address() == null) {
             PublicIp ip = _networkMgr.assignPublicIpAddress(dc.getId(), null, vm.getOwner(), Vlan.VlanType.VirtualNetwork, null, null, false);
@@ -117,7 +117,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
     }
 
     @Override
-    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm)
+    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm)
             throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException, ConcurrentOperationException {
 
@@ -148,7 +148,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
     }
 
     @Override
-    public void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context)
+    public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
         s_logger.debug("reserve called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());
         if (nic.getIp4Address() == null) {
@@ -157,7 +157,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
     }
 
     @Override
-    public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
+    public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
         s_logger.debug("release called with nic: " + nic.toString() + " vm: " + vm.toString());
         return true;
     }
@@ -189,7 +189,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
     }
 
     @Override @DB
-    public void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
+    public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
         s_logger.debug("deallocate called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("public network deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java b/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java
index a7d96b0..9023c6e 100644
--- a/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java
+++ b/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java
@@ -97,8 +97,8 @@ public class MidoNetElementTest extends TestCase {
 
         //mockVm
         @SuppressWarnings("unchecked")
-        VirtualMachineProfile<? extends VirtualMachine> mockVm =
-                (VirtualMachineProfile<? extends VirtualMachine>)mock(VirtualMachineProfile.class);
+        VirtualMachineProfile mockVm =
+                (VirtualMachineProfile)mock(VirtualMachineProfile.class);
         when(mockVm.getType()).thenReturn(VirtualMachine.Type.User);
 
         MidoNetElement elem = new MidoNetElement();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
index e7f6347..fa51fdc 100644
--- a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
+++ b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
@@ -200,13 +200,13 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
     }
 
     @Override
-    public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
+    public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
     InsufficientNetworkCapacityException, ResourceUnavailableException {
         return true;
     }
 
     @Override
-    public boolean release(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context) {
+    public boolean release(Network config, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) {
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
index c22f669..754e7b1 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
@@ -296,7 +296,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
 
     @Override
     public boolean prepare(Network network, NicProfile nic,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
                     throws ConcurrentOperationException, ResourceUnavailableException,
                     InsufficientCapacityException {
@@ -373,7 +373,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
 
     @Override
     public boolean release(Network network, NicProfile nic,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             ReservationContext context) throws ConcurrentOperationException,
             ResourceUnavailableException {
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
index b78d165..ff238ed 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
@@ -212,7 +212,7 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
 
     @Override
     public void reserve(NicProfile nic, Network network,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
             throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException {
@@ -222,7 +222,7 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
 
     @Override
     public boolean release(NicProfile nic,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             String reservationId) {
         // TODO Auto-generated method stub
         return super.release(nic, vm, reservationId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
index 40be5ff..0366143 100644
--- a/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
+++ b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
@@ -72,7 +72,7 @@ public class OvsElement extends AdapterBase implements NetworkElement {
 
     @Override
     public boolean prepare(Network network, NicProfile nic,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
             throws ConcurrentOperationException, ResourceUnavailableException,
             InsufficientCapacityException {
@@ -92,7 +92,7 @@ public class OvsElement extends AdapterBase implements NetworkElement {
 
     @Override
     public boolean release(Network network, NicProfile nic,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             ReservationContext context) throws ConcurrentOperationException,
             ResourceUnavailableException {
         if (nic.getBroadcastType() != Networks.BroadcastDomainType.Vswitch) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManager.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManager.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManager.java
index 2a2a935..36fd25f 100644
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManager.java
+++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManager.java
@@ -26,7 +26,7 @@ public interface OvsTunnelManager extends Manager {
 	
 	boolean isOvsTunnelEnabled();
 
-    public void VmCheckAndCreateTunnel(VirtualMachineProfile<? extends VirtualMachine> vm,
+    public void VmCheckAndCreateTunnel(VirtualMachineProfile vm,
     		Network nw, DeployDestination dest);
     
     public void CheckAndDestroyTunnel(VirtualMachine vm, Network nw);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java
index b1ecaac..d3db89f 100644
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java
+++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java
@@ -383,7 +383,7 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage
 
     @Override
     public void VmCheckAndCreateTunnel(
-    		VirtualMachineProfile<? extends VirtualMachine> vm,
+    		VirtualMachineProfile vm,
     		Network nw, DeployDestination dest) {
         CheckAndCreateTunnel(vm.getVirtualMachine(), nw, dest);    
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/element/SspElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/element/SspElement.java b/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/element/SspElement.java
index 823c16b..6e1461a 100644
--- a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/element/SspElement.java
+++ b/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/element/SspElement.java
@@ -509,7 +509,7 @@ public class SspElement extends AdapterBase implements ConnectivityProvider, Ssp
      */
     @Override
     public boolean prepare(Network network, NicProfile nic,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
                     throws ConcurrentOperationException, ResourceUnavailableException,
                     InsufficientCapacityException {
@@ -526,7 +526,7 @@ public class SspElement extends AdapterBase implements ConnectivityProvider, Ssp
      */
     @Override
     public boolean release(Network network, NicProfile nic,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             ReservationContext context) throws ConcurrentOperationException,
             ResourceUnavailableException {
         s_logger.trace("release");
@@ -569,7 +569,7 @@ public class SspElement extends AdapterBase implements ConnectivityProvider, Ssp
 
     @Override
     public boolean prepareMigration(NicProfile nic, Network network,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context) {
         try {
             prepare(network, nic, vm, dest, context);
@@ -588,7 +588,7 @@ public class SspElement extends AdapterBase implements ConnectivityProvider, Ssp
 
     @Override
     public void rollbackMigration(NicProfile nic, Network network,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             ReservationContext src, ReservationContext dst) {
         try {
             release(network, nic, vm, dst);
@@ -601,7 +601,7 @@ public class SspElement extends AdapterBase implements ConnectivityProvider, Ssp
 
     @Override
     public void commitMigration(NicProfile nic, Network network,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             ReservationContext src, ReservationContext dst) {
         try {
             release(network, nic, vm, src);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/guru/SspGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/guru/SspGuestNetworkGuru.java b/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/guru/SspGuestNetworkGuru.java
index 6d5d871..3deded9 100644
--- a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/guru/SspGuestNetworkGuru.java
+++ b/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/guru/SspGuestNetworkGuru.java
@@ -119,7 +119,7 @@ public class SspGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigr
 
     @Override
     public void reserve(NicProfile nic, Network network,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
                     throws InsufficientVirtualNetworkCapcityException,
                     InsufficientAddressCapacityException {
@@ -129,7 +129,7 @@ public class SspGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigr
 
     @Override
     public boolean release(NicProfile nic,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             String reservationId) {
         Network network = _networkDao.findById(nic.getNetworkId());
         _sspMgr.deleteNicEnv(network, nic, new ReservationContextImpl(reservationId, null, null));
@@ -143,7 +143,7 @@ public class SspGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigr
 
     @Override
     public boolean prepareMigration(NicProfile nic, Network network,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context) {
         try {
             reserve(nic, network, vm, dest, context);
@@ -159,14 +159,14 @@ public class SspGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigr
 
     @Override
     public void rollbackMigration(NicProfile nic, Network network,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             ReservationContext src, ReservationContext dst) {
         release(nic, vm, dst.getReservationId());
     }
 
     @Override
     public void commitMigration(NicProfile nic, Network network,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             ReservationContext src, ReservationContext dst) {
         release(nic, vm, src.getReservationId());
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/plugins/storage-allocators/random/src/org/apache/cloudstack/storage/allocator/RandomStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git a/plugins/storage-allocators/random/src/org/apache/cloudstack/storage/allocator/RandomStoragePoolAllocator.java b/plugins/storage-allocators/random/src/org/apache/cloudstack/storage/allocator/RandomStoragePoolAllocator.java
index fda787f..025a969 100644
--- a/plugins/storage-allocators/random/src/org/apache/cloudstack/storage/allocator/RandomStoragePoolAllocator.java
+++ b/plugins/storage-allocators/random/src/org/apache/cloudstack/storage/allocator/RandomStoragePoolAllocator.java
@@ -38,7 +38,7 @@ public class RandomStoragePoolAllocator extends AbstractStoragePoolAllocator {
     private static final Logger s_logger = Logger.getLogger(RandomStoragePoolAllocator.class);
 
     @Override
-    public List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+    public List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile,
             DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
 
         List<StoragePool> suitablePools = new ArrayList<StoragePool>();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java b/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java
index 4329c70..088591f 100755
--- a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java
+++ b/server/src/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java
@@ -105,13 +105,13 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator {
     CapacityManager _capacityMgr;
 
     @Override
-    public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type,
+    public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type,
             ExcludeList avoid, int returnUpTo) {
         return allocateTo(vmProfile, plan, type, avoid, returnUpTo, true);
     }
 
     @Override
-    public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo,
+    public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo,
             boolean considerReservedCapacity) {
 
         long dcId = plan.getDataCenterId();
@@ -195,7 +195,7 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator {
     }
 
     @Override
-    public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan,
+    public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan,
             Type type, ExcludeList avoid, List<? extends Host> hosts, int returnUpTo, boolean considerReservedCapacity) {
         long dcId = plan.getDataCenterId();
         Long podId = plan.getPodId();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitRoutingAllocator.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitRoutingAllocator.java b/server/src/com/cloud/agent/manager/allocator/impl/FirstFitRoutingAllocator.java
index 102c6a5..912a325 100644
--- a/server/src/com/cloud/agent/manager/allocator/impl/FirstFitRoutingAllocator.java
+++ b/server/src/com/cloud/agent/manager/allocator/impl/FirstFitRoutingAllocator.java
@@ -32,7 +32,7 @@ import com.cloud.vm.VirtualMachineProfile;
 @Local(value={HostAllocator.class})
 public class FirstFitRoutingAllocator extends FirstFitAllocator {
     @Override
-    public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type,
+    public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type,
 			ExcludeList avoid, int returnUpTo) {
         try {
             NDC.push("FirstFitRoutingAllocator");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java b/server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java
index 3b659c0..bb4051f 100755
--- a/server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java
+++ b/server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java
@@ -69,7 +69,7 @@ public class RecreateHostAllocator extends FirstFitRoutingAllocator {
     @Inject ResourceManager _resourceMgr;
     
     @Override
-    public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vm,DeploymentPlan plan, Type type,
+    public List<Host> allocateTo(VirtualMachineProfile vm,DeploymentPlan plan, Type type,
 			ExcludeList avoid, int returnUpTo) {
     	
     	List<Host> hosts = super.allocateTo(vm, plan, type, avoid, returnUpTo);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/agent/manager/allocator/impl/TestingAllocator.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/allocator/impl/TestingAllocator.java b/server/src/com/cloud/agent/manager/allocator/impl/TestingAllocator.java
index 3c69694..6b586d1 100755
--- a/server/src/com/cloud/agent/manager/allocator/impl/TestingAllocator.java
+++ b/server/src/com/cloud/agent/manager/allocator/impl/TestingAllocator.java
@@ -42,19 +42,19 @@ public class TestingAllocator extends AdapterBase implements HostAllocator {
     Long _routingHost;
 
     @Override
-    public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type,
+    public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type,
             ExcludeList avoid, int returnUpTo) {
         return allocateTo(vmProfile, plan, type, avoid, returnUpTo, true);
     }
 
     @Override
-    public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type,
+    public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type,
             ExcludeList avoid, List<? extends Host> hosts, int returnUpTo, boolean considerReservedCapacity) {
         return allocateTo(vmProfile, plan, type, avoid, returnUpTo, considerReservedCapacity);
     }
 
     @Override
-    public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, Type type,
+    public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type,
             ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity) {
         List<Host> availableHosts = new ArrayList<Host>();
         Host host = null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
index 5d6719d..5aeb6dc 100755
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@ -1310,9 +1310,9 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
     }
 
     @Override
-    public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<ConsoleProxyVO> profile, DeployDestination dest, ReservationContext context) {
+    public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {
 
-        ConsoleProxyVO vm = profile.getVirtualMachine();
+        ConsoleProxyVO vm = _consoleProxyDao.findById(profile.getId());
         Map<String, String> details = _vmDetailsDao.findDetails(vm.getId());
         vm.setDetails(details);
 
@@ -1388,11 +1388,11 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
     }
 
     @Override
-    public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile<ConsoleProxyVO> profile, DeployDestination dest, ReservationContext context) {
+    public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {
 
         finalizeCommandsOnStart(cmds, profile);
 
-        ConsoleProxyVO proxy = profile.getVirtualMachine();
+        ConsoleProxyVO proxy = _consoleProxyDao.findById(profile.getId());
         DataCenter dc = dest.getDataCenter();
         List<NicProfile> nics = profile.getNics();
         for (NicProfile nic : nics) {
@@ -1411,7 +1411,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
     }
 
     @Override
-    public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<ConsoleProxyVO> profile) {
+    public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) {
 
         NicProfile managementNic = null;
         NicProfile controlNic = null;
@@ -1438,7 +1438,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
     }
 
     @Override
-    public boolean finalizeStart(VirtualMachineProfile<ConsoleProxyVO> profile, long hostId, Commands cmds, ReservationContext context) {
+    public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Commands cmds, ReservationContext context) {
         CheckSshAnswer answer = (CheckSshAnswer) cmds.getAnswer("checkSsh");
         if (answer == null || !answer.getResult()) {
             if (answer != null) {
@@ -1454,7 +1454,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
             _rulesMgr.getSystemIpAndEnableStaticNatForVm(profile.getVirtualMachine(), false);
             IPAddressVO ipaddr = _ipAddressDao.findByAssociatedVmId(profile.getVirtualMachine().getId());
             if (ipaddr != null && ipaddr.getSystem()) {
-                ConsoleProxyVO consoleVm = profile.getVirtualMachine();
+                ConsoleProxyVO consoleVm = _consoleProxyDao.findById(profile.getId());
                 // override CPVM guest IP with EIP, so that console url's will be prepared with EIP
                 consoleVm.setPublicIpAddress(ipaddr.getAddress().addr());
                 _consoleProxyDao.update(consoleVm.getId(), consoleVm);
@@ -1483,7 +1483,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
     }
 
     @Override
-    public void finalizeStop(VirtualMachineProfile<ConsoleProxyVO> profile, StopAnswer answer) {
+    public void finalizeStop(VirtualMachineProfile profile, StopAnswer answer) {
         //release elastic IP here if assigned
         IPAddressVO ip = _ipAddressDao.findByAssociatedVmId(profile.getId());
         if (ip != null && ip.getSystem()) {
@@ -1685,7 +1685,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
     }
 
     @Override
-    public void prepareStop(VirtualMachineProfile<ConsoleProxyVO> profile) {
+    public void prepareStop(VirtualMachineProfile profile) {
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/deploy/DeploymentPlanningManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/deploy/DeploymentPlanningManager.java b/server/src/com/cloud/deploy/DeploymentPlanningManager.java
index 9458df2..7dde815 100644
--- a/server/src/com/cloud/deploy/DeploymentPlanningManager.java
+++ b/server/src/com/cloud/deploy/DeploymentPlanningManager.java
@@ -20,7 +20,6 @@ import com.cloud.deploy.DeploymentPlanner.ExcludeList;
 import com.cloud.exception.AffinityConflictException;
 import com.cloud.exception.InsufficientServerCapacityException;
 import com.cloud.utils.component.Manager;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 public interface DeploymentPlanningManager extends Manager {
@@ -40,11 +39,11 @@ public interface DeploymentPlanningManager extends Manager {
      *
      *
      */
-    DeployDestination planDeployment(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan,
+    DeployDestination planDeployment(VirtualMachineProfile vmProfile, DeploymentPlan plan,
             ExcludeList avoids) throws InsufficientServerCapacityException, AffinityConflictException;
 
     String finalizeReservation(DeployDestination plannedDestination,
-            VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoids)
+            VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoids)
             throws InsufficientServerCapacityException, AffinityConflictException;
 
     void cleanupVMReservations();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
index 975f80b..5336d30 100644
--- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
+++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
@@ -207,7 +207,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
     }
 
     @Override
-    public DeployDestination planDeployment(VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+    public DeployDestination planDeployment(VirtualMachineProfile vmProfile,
             DeploymentPlan plan, ExcludeList avoids) throws InsufficientServerCapacityException,
             AffinityConflictException {
 
@@ -449,7 +449,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
         return dest;
     }
 
-    private void checkForNonDedicatedResources(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DataCenter dc, ExcludeList avoids) {
+    private void checkForNonDedicatedResources(VirtualMachineProfile vmProfile, DataCenter dc, ExcludeList avoids) {
         boolean isExplicit = false;
         VirtualMachine vm = vmProfile.getVirtualMachine();
         // check affinity group of type Explicit dedication exists
@@ -534,7 +534,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
         }
     }
 
-    private PlannerResourceUsage getPlannerUsage(DeploymentPlanner planner, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoids) throws InsufficientServerCapacityException {
+    private PlannerResourceUsage getPlannerUsage(DeploymentPlanner planner, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoids) throws InsufficientServerCapacityException {
         if (planner != null && planner instanceof DeploymentClusterPlanner) {
             return ((DeploymentClusterPlanner) planner).getResourceUsage(vmProfile, plan, avoids);
         } else {
@@ -843,7 +843,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
 
     // /refactoring planner methods
     private DeployDestination checkClustersforDestination(List<Long> clusterList,
-            VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid,
+            VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid,
             DataCenter dc, DeploymentPlanner.PlannerResourceUsage resourceUsageRequired, ExcludeList PlannerAvoidOutput) {
 
         if (s_logger.isTraceEnabled()) {
@@ -1035,7 +1035,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
         return hostCanAccessSPool;
     }
 
-    protected List<Host> findSuitableHosts(VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+    protected List<Host> findSuitableHosts(VirtualMachineProfile vmProfile,
             DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
         List<Host> suitableHosts = new ArrayList<Host>();
         for (HostAllocator allocator : _hostAllocators) {
@@ -1052,7 +1052,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
     }
 
     protected Pair<Map<Volume, List<StoragePool>>, List<Volume>> findSuitablePoolsForVolumes(
-            VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid,
+            VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid,
             int returnUpTo) {
         List<VolumeVO> volumesTobeCreated = _volsDao.findUsableVolumesForInstance(vmProfile.getId());
         Map<Volume, List<StoragePool>> suitableVolumeStoragePools = new HashMap<Volume, List<StoragePool>>();
@@ -1219,7 +1219,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
     @DB
     @Override
     public String finalizeReservation(DeployDestination plannedDestination,
-            VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoids)
+            VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoids)
             throws InsufficientServerCapacityException, AffinityConflictException {
 
         VirtualMachine vm = vmProfile.getVirtualMachine();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/deploy/FirstFitPlanner.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/deploy/FirstFitPlanner.java b/server/src/com/cloud/deploy/FirstFitPlanner.java
index 7124de2..d2e0c14 100755
--- a/server/src/com/cloud/deploy/FirstFitPlanner.java
+++ b/server/src/com/cloud/deploy/FirstFitPlanner.java
@@ -110,7 +110,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
 
 
     @Override
-    public List<Long> orderClusters(VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+    public List<Long> orderClusters(VirtualMachineProfile vmProfile,
             DeploymentPlan plan, ExcludeList avoid)
                     throws InsufficientServerCapacityException {
         VirtualMachine vm = vmProfile.getVirtualMachine();
@@ -178,7 +178,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
 
     }
 
-    private List<Long> scanPodsForDestination(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid){
+    private List<Long> scanPodsForDestination(VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid){
 
         ServiceOffering offering = vmProfile.getServiceOffering();
         int requiredCpu = offering.getCpu() * offering.getSpeed();
@@ -264,7 +264,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
     }
 
     private void removeClustersCrossingThreshold(List<Long> clusterListForVmAllocation, ExcludeList avoid,
-            VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan) {
+            VirtualMachineProfile vmProfile, DeploymentPlan plan) {
 
         List<Short> capacityList = getCapacitiesForCheckingThreshold();
         List<Long> clustersCrossingThreshold = new ArrayList<Long>();
@@ -302,7 +302,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
     }
 
     private List<Long> scanClustersForDestinationInZoneOrPod(long id, boolean isZone,
-            VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid) {
+            VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid) {
 
         VirtualMachine vm = vmProfile.getVirtualMachine();
         ServiceOffering offering = vmProfile.getServiceOffering();
@@ -362,7 +362,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
      * other than the capacity based ordering which is done by default.
      * @return List<Long> ordered list of Cluster Ids
      */
-    protected List<Long> reorderClusters(long id, boolean isZone, Pair<List<Long>, Map<Long, Double>> clusterCapacityInfo, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan){
+    protected List<Long> reorderClusters(long id, boolean isZone, Pair<List<Long>, Map<Long, Double>> clusterCapacityInfo, VirtualMachineProfile vmProfile, DeploymentPlan plan){
         List<Long> reordersClusterIds = clusterCapacityInfo.first();
         return reordersClusterIds;
     }
@@ -374,7 +374,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
      * other than the capacity based ordering which is done by default.
      * @return List<Long> ordered list of Pod Ids
      */
-    protected List<Long> reorderPods(Pair<List<Long>, Map<Long, Double>> podCapacityInfo, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan){
+    protected List<Long> reorderPods(Pair<List<Long>, Map<Long, Double>> podCapacityInfo, VirtualMachineProfile vmProfile, DeploymentPlan plan){
         List<Long> podIdsByCapacity = podCapacityInfo.first();
         return podIdsByCapacity;
     }
@@ -476,14 +476,14 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
     }
 
     @Override
-    public boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan,
+    public boolean check(VirtualMachineProfile vm, DeploymentPlan plan,
             DeployDestination dest, ExcludeList exclude) {
         // TODO Auto-generated method stub
         return false;
     }
 
     @Override
-    public boolean canHandle(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) {
+    public boolean canHandle(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid) {
         // check what the ServiceOffering says. If null, check the global config
         ServiceOffering offering = vm.getServiceOffering();
         if (vm.getHypervisorType() != HypervisorType.BareMetal) {
@@ -510,14 +510,14 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
 
 
     @Override
-    public DeployDestination plan(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan,
+    public DeployDestination plan(VirtualMachineProfile vm, DeploymentPlan plan,
             ExcludeList avoid) throws InsufficientServerCapacityException {
         // TODO Auto-generated method stub
         return null;
     }
 
     @Override
-    public PlannerResourceUsage getResourceUsage(VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+    public PlannerResourceUsage getResourceUsage(VirtualMachineProfile vmProfile,
             DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException {
         return PlannerResourceUsage.Shared;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
index 2ffd682..34584ab 100644
--- a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
+++ b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
@@ -85,7 +85,7 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis
     }
 
 
-    protected <T extends VirtualMachine> VirtualMachineTO  toVirtualMachineTO(VirtualMachineProfile<T> vmProfile) {
+    protected VirtualMachineTO toVirtualMachineTO(VirtualMachineProfile vmProfile) {
 
         ServiceOffering offering = vmProfile.getServiceOffering();
         VirtualMachine vm = vmProfile.getVirtualMachine();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/hypervisor/KVMGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/KVMGuru.java b/server/src/com/cloud/hypervisor/KVMGuru.java
index 662ee3e..58e46e1 100644
--- a/server/src/com/cloud/hypervisor/KVMGuru.java
+++ b/server/src/com/cloud/hypervisor/KVMGuru.java
@@ -23,7 +23,6 @@ import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.dao.GuestOSDao;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 @Local(value=HypervisorGuru.class)
@@ -40,8 +39,7 @@ public class KVMGuru extends HypervisorGuruBase implements HypervisorGuru {
 	}
 
 	@Override
-	public <T extends VirtualMachine> VirtualMachineTO implement(
-			VirtualMachineProfile<T> vm) {
+    public VirtualMachineTO implement(VirtualMachineProfile vm) {
 		VirtualMachineTO to = toVirtualMachineTO(vm);
 
 		// Determine the VM's OS description

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/hypervisor/LXCGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/LXCGuru.java b/server/src/com/cloud/hypervisor/LXCGuru.java
index 7a530b5..dd61b20 100644
--- a/server/src/com/cloud/hypervisor/LXCGuru.java
+++ b/server/src/com/cloud/hypervisor/LXCGuru.java
@@ -23,7 +23,6 @@ import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.dao.GuestOSDao;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 @Local(value=HypervisorGuru.class)
@@ -40,8 +39,7 @@ public class LXCGuru extends HypervisorGuruBase implements HypervisorGuru {
     }
 
     @Override
-    public <T extends VirtualMachine> VirtualMachineTO implement(
-            VirtualMachineProfile<T> vm) {
+    public VirtualMachineTO implement(VirtualMachineProfile vm) {
         VirtualMachineTO to = toVirtualMachineTO(vm);
 
         // Determine the VM's OS description


[4/7] Changed VirtualMachineProfile to be non-generic. From here on VirtualMachineManager will only manage vm instance. It doesn't understand the difference between different types of VMs. This makes the vmsync code to be generic across all vms.

Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/NetworkManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManager.java b/server/src/com/cloud/network/NetworkManager.java
index 8dc7743..f6dbb19 100755
--- a/server/src/com/cloud/network/NetworkManager.java
+++ b/server/src/com/cloud/network/NetworkManager.java
@@ -5,7 +5,7 @@
 // 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,
@@ -55,7 +55,6 @@ import com.cloud.vm.Nic;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.NicVO;
 import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VMInstanceVO;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachine.Type;
 import com.cloud.vm.VirtualMachineProfile;
@@ -82,7 +81,7 @@ public interface NetworkManager  {
      * @throws InsufficientAddressCapacityException
      */
 
-    PublicIp assignPublicIpAddress(long dcId, Long podId, Account owner, VlanType type, Long networkId, String requestedIp, 
+    PublicIp assignPublicIpAddress(long dcId, Long podId, Account owner, VlanType type, Long networkId, String requestedIp,
             boolean isSystem) throws InsufficientAddressCapacityException;
 
 
@@ -103,17 +102,17 @@ public interface NetworkManager  {
     List<NetworkVO> setupNetwork(Account owner, NetworkOffering offering, Network predefined, DeploymentPlan plan, String name, String displayText, boolean errorIfAlreadySetup, Long domainId,
             ACLType aclType, Boolean subdomainAccess, Long vpcId, Boolean isDisplayNetworkEnabled) throws ConcurrentOperationException;
 
-    void allocate(VirtualMachineProfile<? extends VMInstanceVO> vm, List<Pair<NetworkVO, NicProfile>> networks) throws InsufficientCapacityException, ConcurrentOperationException;
+    void allocate(VirtualMachineProfile vm, List<Pair<NetworkVO, NicProfile>> networks) throws InsufficientCapacityException, ConcurrentOperationException;
 
-    void prepare(VirtualMachineProfile<? extends VMInstanceVO> profile, DeployDestination dest, ReservationContext context) throws InsufficientCapacityException, ConcurrentOperationException,
+    void prepare(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws InsufficientCapacityException, ConcurrentOperationException,
             ResourceUnavailableException;
 
-    void release(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, boolean forced) throws
+    void release(VirtualMachineProfile vmProfile, boolean forced) throws
 			ConcurrentOperationException, ResourceUnavailableException;
 
-    void cleanupNics(VirtualMachineProfile<? extends VMInstanceVO> vm);
+    void cleanupNics(VirtualMachineProfile vm);
 
-    void expungeNics(VirtualMachineProfile<? extends VMInstanceVO> vm);
+    void expungeNics(VirtualMachineProfile vm);
 
     List<NicProfile> getNicProfiles(VirtualMachine vm);
 
@@ -129,27 +128,27 @@ public interface NetworkManager  {
      * @param vm
      * @param dest
      */
-    void prepareNicForMigration(VirtualMachineProfile<? extends VMInstanceVO> vm, DeployDestination dest);
+    void prepareNicForMigration(VirtualMachineProfile vm, DeployDestination dest);
 
     /**
      * commit vm nic change for migration
      * 
-     * This method will be called in migration transaction after the successful 
+     * This method will be called in migration transaction after the successful
      * vm migration.
      * @param src
      * @param dst
      */
-    void commitNicForMigration(VirtualMachineProfile<? extends VMInstanceVO> src, VirtualMachineProfile<? extends VMInstanceVO> dst);
+    void commitNicForMigration(VirtualMachineProfile src, VirtualMachineProfile dst);
 
     /**
      * rollback vm nic change for migration
      * 
-     * This method will be called in migaration transaction after vm migration 
+     * This method will be called in migaration transaction after vm migration
      * failure.
      * @param src
      * @param dst
      */
-    void rollbackNicForMigration(VirtualMachineProfile<? extends VMInstanceVO> src, VirtualMachineProfile<? extends VMInstanceVO> dst);
+    void rollbackNicForMigration(VirtualMachineProfile src, VirtualMachineProfile dst);
 
     boolean shutdownNetwork(long networkId, ReservationContext context, boolean cleanupElements);
 
@@ -193,8 +192,7 @@ public interface NetworkManager  {
 
     boolean applyStaticNats(List<? extends StaticNat> staticNats, boolean continueOnError, boolean forRevoke) throws ResourceUnavailableException;
 
-    boolean reallocate(VirtualMachineProfile<? extends VMInstanceVO> vm,
-            DataCenterDeployment dest) throws InsufficientCapacityException, ConcurrentOperationException;
+    boolean reallocate(VirtualMachineProfile vm, DataCenterDeployment dest) throws InsufficientCapacityException, ConcurrentOperationException;
 
     IpAddress assignSystemIp(long networkId, Account owner,
             boolean forElasticLb, boolean forElasticIp)
@@ -203,7 +201,7 @@ public interface NetworkManager  {
     boolean handleSystemIpRelease(IpAddress ip);
 
     void allocateDirectIp(NicProfile nic, DataCenter dc,
-            VirtualMachineProfile<? extends VirtualMachine> vm,
+            VirtualMachineProfile vm,
             Network network, String requestedIpv4, String requestedIpv6)
             throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException;
@@ -212,8 +210,8 @@ public interface NetworkManager  {
      * @param owner
      * @param guestNetwork
      * @return
-     * @throws ConcurrentOperationException 
-     * @throws InsufficientAddressCapacityException 
+     * @throws ConcurrentOperationException
+     * @throws InsufficientAddressCapacityException
      */
     PublicIp assignSourceNatIpAddressToGuestNetwork(Account owner, Network guestNetwork) throws InsufficientAddressCapacityException, ConcurrentOperationException;
 
@@ -229,8 +227,8 @@ public interface NetworkManager  {
      * @throws InsufficientAddressCapacityException
      * @throws ConcurrentOperationException
      */
-    Pair<NicProfile,Integer> allocateNic(NicProfile requested, Network network, Boolean isDefaultNic, int deviceId, 
-            VirtualMachineProfile<? extends VMInstanceVO> vm) throws InsufficientVirtualNetworkCapcityException,
+    Pair<NicProfile,Integer> allocateNic(NicProfile requested, Network network, Boolean isDefaultNic, int deviceId,
+            VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException, ConcurrentOperationException;
 
 
@@ -247,7 +245,7 @@ public interface NetworkManager  {
      * @throws InsufficientCapacityException
      * @throws ResourceUnavailableException
      */
-    NicProfile prepareNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, DeployDestination dest, 
+    NicProfile prepareNic(VirtualMachineProfile vmProfile, DeployDestination dest,
             ReservationContext context, long nicId, NetworkVO network) throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException, ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
 
@@ -256,7 +254,7 @@ public interface NetworkManager  {
      * @param vm
      * @param nic TODO
      */
-    void removeNic(VirtualMachineProfile<? extends VMInstanceVO> vm, Nic nic);
+    void removeNic(VirtualMachineProfile vm, Nic nic);
 
 
     /**
@@ -264,7 +262,7 @@ public interface NetworkManager  {
      * @param networkId
      * @param releaseOnFailure TODO
      */
-    IPAddressVO associateIPToGuestNetwork(long ipAddrId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException, ResourceUnavailableException, 
+    IPAddressVO associateIPToGuestNetwork(long ipAddrId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException, ResourceUnavailableException,
         InsufficientAddressCapacityException, ConcurrentOperationException;
 
     IpAddress allocatePortableIp(Account ipOwner, Account caller, long dcId, Long networkId, Long vpcID)
@@ -297,7 +295,7 @@ public interface NetworkManager  {
      * @throws ConcurrentOperationException
      * @throws ResourceUnavailableException
      */
-    void releaseNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, Nic nic) 
+    void releaseNic(VirtualMachineProfile vmProfile, Nic nic)
             throws ConcurrentOperationException, ResourceUnavailableException;
 
 
@@ -314,7 +312,8 @@ public interface NetworkManager  {
      * @throws InsufficientCapacityException
      * @throws ResourceUnavailableException
      */
-    NicProfile createNicForVm(Network network, NicProfile requested, ReservationContext context, VirtualMachineProfile<? extends VMInstanceVO> vmProfile, boolean prepare) throws InsufficientVirtualNetworkCapcityException,
+    NicProfile createNicForVm(Network network, NicProfile requested, ReservationContext context, VirtualMachineProfile vmProfile, boolean prepare)
+            throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException, ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
 
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index 279ea84..30c4242 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -1615,7 +1615,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
 
     @Override
     @DB
-    public void allocate(VirtualMachineProfile<? extends VMInstanceVO> vm, List<Pair<NetworkVO, NicProfile>> networks)
+    public void allocate(VirtualMachineProfile vm, List<Pair<NetworkVO, NicProfile>> networks)
             throws InsufficientCapacityException, ConcurrentOperationException {
         Transaction txn = Transaction.currentTxn();
         txn.start();
@@ -1690,7 +1690,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
     @DB
     @Override
     public Pair<NicProfile,Integer> allocateNic(NicProfile requested, Network network, Boolean isDefaultNic,
-            int deviceId, VirtualMachineProfile<? extends VMInstanceVO> vm) throws InsufficientVirtualNetworkCapcityException,
+            int deviceId, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException, ConcurrentOperationException{
 
         NetworkVO ntwkVO = _networksDao.findById(network.getId());
@@ -1997,7 +1997,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
     }
 
     protected boolean prepareElement(NetworkElement element, NetworkVO network,
-            NicProfile profile, VirtualMachineProfile<? extends VMInstanceVO> vmProfile,
+            NicProfile profile, VirtualMachineProfile vmProfile,
             DeployDestination dest, ReservationContext context) throws InsufficientCapacityException,
             ConcurrentOperationException, ResourceUnavailableException {
         element.prepare(network, profile, vmProfile, dest, context);
@@ -2044,7 +2044,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
     }
 
     @Override
-    public void prepare(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, DeployDestination dest, ReservationContext context) throws InsufficientCapacityException,
+    public void prepare(VirtualMachineProfile vmProfile, DeployDestination dest, ReservationContext context) throws InsufficientCapacityException,
             ConcurrentOperationException, ResourceUnavailableException {
         List<NicVO> nics = _nicDao.listByVmId(vmProfile.getId());
 
@@ -2072,7 +2072,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
     }
 
     @Override
-    public NicProfile prepareNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, DeployDestination
+    public NicProfile prepareNic(VirtualMachineProfile vmProfile, DeployDestination
             dest, ReservationContext context, long nicId, NetworkVO network)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException,
             ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
@@ -2136,7 +2136,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
     }
 
     @Override
-    public void prepareNicForMigration(VirtualMachineProfile<? extends VMInstanceVO> vm, DeployDestination dest) {
+    public void prepareNicForMigration(VirtualMachineProfile vm, DeployDestination dest) {
         List<NicVO> nics = _nicDao.listByVmId(vm.getId());
         ReservationContext context = new ReservationContextImpl(UUID.randomUUID().toString(), null, null);
         for (NicVO nic : nics) {
@@ -2163,7 +2163,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
         }
     }
 
-    private NicProfile findNicProfileById(VirtualMachineProfile<? extends VMInstanceVO> vm, long id){
+    private NicProfile findNicProfileById(VirtualMachineProfile vm, long id){
         for(NicProfile nic: vm.getNics()){
             if(nic.getId() == id){
                 return nic;
@@ -2174,8 +2174,8 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
 
     @Override
     public void commitNicForMigration(
-            VirtualMachineProfile<? extends VMInstanceVO> src,
-            VirtualMachineProfile<? extends VMInstanceVO> dst) {
+            VirtualMachineProfile src,
+            VirtualMachineProfile dst) {
         for(NicProfile nicSrc: src.getNics()){
             NetworkVO network = _networksDao.findById(nicSrc.getNetworkId());
             NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName());
@@ -2200,8 +2200,8 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
 
     @Override
     public void rollbackNicForMigration(
-            VirtualMachineProfile<? extends VMInstanceVO> src,
-            VirtualMachineProfile<? extends VMInstanceVO> dst) {
+            VirtualMachineProfile src,
+            VirtualMachineProfile dst) {
         for(NicProfile nicDst: dst.getNics()){
             NetworkVO network = _networksDao.findById(nicDst.getNetworkId());
             NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName());
@@ -2222,7 +2222,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
 
     @Override
     @DB
-    public void release(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, boolean forced) throws
+    public void release(VirtualMachineProfile vmProfile, boolean forced) throws
             ConcurrentOperationException, ResourceUnavailableException {
         List<NicVO> nics = _nicDao.listByVmId(vmProfile.getId());
         for (NicVO nic : nics) {
@@ -2233,14 +2233,14 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
 
     @Override
     @DB
-    public void releaseNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, Nic nic)
+    public void releaseNic(VirtualMachineProfile vmProfile, Nic nic)
             throws ConcurrentOperationException, ResourceUnavailableException {
         NicVO nicVO = _nicDao.findById(nic.getId());
         releaseNic(vmProfile, nicVO);
     }
 
     @DB
-    protected void releaseNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, NicVO nicVO)
+    protected void releaseNic(VirtualMachineProfile vmProfile, NicVO nicVO)
             throws ConcurrentOperationException, ResourceUnavailableException {
         //lock the nic
         Transaction txn = Transaction.currentTxn();
@@ -2292,7 +2292,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
     }
 
     @Override
-    public void cleanupNics(VirtualMachineProfile<? extends VMInstanceVO> vm) {
+    public void cleanupNics(VirtualMachineProfile vm) {
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Cleaning network for vm: " + vm.getId());
         }
@@ -2305,12 +2305,12 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
 
 
     @Override
-    public void removeNic(VirtualMachineProfile<? extends VMInstanceVO> vm, Nic nic) {
+    public void removeNic(VirtualMachineProfile vm, Nic nic) {
         removeNic(vm, _nicDao.findById(nic.getId()));
     }
 
 
-    protected void removeNic(VirtualMachineProfile<? extends VMInstanceVO> vm, NicVO nic) {
+    protected void removeNic(VirtualMachineProfile vm, NicVO nic) {
         nic.setState(Nic.State.Deallocating);
         _nicDao.update(nic.getId(), nic);
         NetworkVO network = _networksDao.findById(nic.getNetworkId());
@@ -2347,7 +2347,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
     }
 
     @Override
-    public void expungeNics(VirtualMachineProfile<? extends VMInstanceVO> vm) {
+    public void expungeNics(VirtualMachineProfile vm) {
         List<NicVO> nics = _nicDao.listByVmIdIncludingRemoved(vm.getId());
         for (NicVO nic : nics) {
             _nicDao.expunge(nic.getId());
@@ -3704,7 +3704,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
 
     @DB
     @Override
-    public boolean reallocate(VirtualMachineProfile<? extends VMInstanceVO> vm, DataCenterDeployment dest) throws InsufficientCapacityException, ConcurrentOperationException {
+    public boolean reallocate(VirtualMachineProfile vm, DataCenterDeployment dest) throws InsufficientCapacityException, ConcurrentOperationException {
         VMInstanceVO vmInstance = _vmDao.findById(vm.getId());
         DataCenterVO dc = _dcDao.findById(vmInstance.getDataCenterId());
         if (dc.getNetworkType() == NetworkType.Basic) {
@@ -4198,7 +4198,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
 
     @Override
     @DB
-    public void allocateDirectIp(NicProfile nic, DataCenter dc, VirtualMachineProfile<? extends VirtualMachine> vm, Network network,
+    public void allocateDirectIp(NicProfile nic, DataCenter dc, VirtualMachineProfile vm, Network network,
     							 String requestedIpv4, String requestedIpv6) throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException {
         //This method allocates direct ip for the Shared network in Advance zones
@@ -4300,7 +4300,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
     }
     
     @Override
-    public NicProfile createNicForVm(Network network, NicProfile requested, ReservationContext context, VirtualMachineProfile<? extends VMInstanceVO> vmProfile, boolean prepare)
+    public NicProfile createNicForVm(Network network, NicProfile requested, ReservationContext context, VirtualMachineProfile vmProfile, boolean prepare)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException,
             ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
                 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/element/CloudZonesNetworkElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/CloudZonesNetworkElement.java b/server/src/com/cloud/network/element/CloudZonesNetworkElement.java
index bdd8e61..5c7f333 100644
--- a/server/src/com/cloud/network/element/CloudZonesNetworkElement.java
+++ b/server/src/com/cloud/network/element/CloudZonesNetworkElement.java
@@ -50,7 +50,6 @@ import com.cloud.network.PhysicalNetworkServiceProvider;
 import com.cloud.network.dao.NetworkDao;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.service.dao.ServiceOfferingDao;
-import com.cloud.uservm.UserVm;
 import com.cloud.utils.PasswordGenerator;
 import com.cloud.utils.component.AdapterBase;
 import com.cloud.vm.NicProfile;
@@ -112,13 +111,13 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
     }
 
     @Override
-    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
+    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vmProfile, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
             InsufficientCapacityException, ResourceUnavailableException {
         return true;
     }
 
     @Override
-    public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context) {
+    public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) {
         return true;
     }
 
@@ -200,7 +199,7 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
     }
 
     @Override
-    public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context)
+    public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
             throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
         if (canHandle(dest, network.getTrafficType())) {
 
@@ -208,16 +207,16 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
                 return false;
             }
             @SuppressWarnings("unchecked")
-            VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
-            _userVmDao.loadDetails((UserVmVO) uservm.getVirtualMachine());
-            String password = (String) uservm.getParameter(VirtualMachineProfile.Param.VmPassword);
-            String userData = uservm.getVirtualMachine().getUserData();
-            String sshPublicKey = uservm.getVirtualMachine().getDetail("SSH.PublicKey");
+            UserVmVO uservm = _userVmDao.findById(vm.getId());
+            _userVmDao.loadDetails(uservm);
+            String password = (String)vm.getParameter(VirtualMachineProfile.Param.VmPassword);
+            String userData = uservm.getUserData();
+            String sshPublicKey = uservm.getDetail("SSH.PublicKey");
 
             Commands cmds = new Commands(OnError.Continue);
             if (password != null && nic.isDefaultNic()) {
                 final String encodedPassword = PasswordGenerator.rot13(password);
-                SavePasswordCommand cmd = new SavePasswordCommand(encodedPassword, nic.getIp4Address(), uservm.getVirtualMachine().getHostName(), _networkMgr.getExecuteInSeqNtwkElmtCmd());
+                SavePasswordCommand cmd = new SavePasswordCommand(encodedPassword, nic.getIp4Address(), uservm.getHostName(), _networkMgr.getExecuteInSeqNtwkElmtCmd());
                 cmds.addCommand("password", cmd);
             }
             String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(uservm.getServiceOfferingId()).getDisplayText();
@@ -225,7 +224,7 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
 
             cmds.addCommand(
                     "vmdata",
-                    generateVmDataCommand(nic.getIp4Address(), userData, serviceOffering, zoneName, nic.getIp4Address(), uservm.getVirtualMachine().getHostName(),
+                    generateVmDataCommand(nic.getIp4Address(), userData, serviceOffering, zoneName, nic.getIp4Address(), uservm.getHostName(),
                             uservm.getInstanceName(), uservm.getId(), uservm.getUuid(), sshPublicKey));
             try {
                 _agentManager.send(dest.getHost().getId(), cmds);
@@ -235,29 +234,29 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
             }
             Answer dataAnswer = cmds.getAnswer("vmdata");
             if (dataAnswer != null && dataAnswer.getResult()) {
-                s_logger.info("Sent vm data successfully to vm " + uservm.getVirtualMachine().getInstanceName());
+                s_logger.info("Sent vm data successfully to vm " + uservm.getInstanceName());
                 return true;
             }
-            s_logger.info("Failed to send vm data to vm " + uservm.getVirtualMachine().getInstanceName());
+            s_logger.info("Failed to send vm data to vm " + uservm.getInstanceName());
             return false;
         }
         return false;
     }
 
     @Override
-    public boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws ResourceUnavailableException {
+    public boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException {
         // TODO Auto-generated method stub
         return false;
     }
 
     @Override
-    public boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String SSHPublicKey) throws ResourceUnavailableException {
+    public boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile vm, String SSHPublicKey) throws ResourceUnavailableException {
         // TODO Auto-generated method stub
         return false;
     }
 
     @Override
-    public boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws ResourceUnavailableException {
+    public boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException {
         // TODO Auto-generated method stub
         return false;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/element/SecurityGroupElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/SecurityGroupElement.java b/server/src/com/cloud/network/element/SecurityGroupElement.java
index 0659db7..4a740c0 100644
--- a/server/src/com/cloud/network/element/SecurityGroupElement.java
+++ b/server/src/com/cloud/network/element/SecurityGroupElement.java
@@ -68,13 +68,13 @@ public class SecurityGroupElement extends AdapterBase implements NetworkElement
     }
 
     @Override @DB
-    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest,
+    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest,
             ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
        return true;
     }
 
     @Override
-    public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext context)
+    public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context)
             throws ConcurrentOperationException, ResourceUnavailableException {
         return true;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/element/VirtualRouterElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/VirtualRouterElement.java b/server/src/com/cloud/network/element/VirtualRouterElement.java
index d26c1e1..15b7f13 100755
--- a/server/src/com/cloud/network/element/VirtualRouterElement.java
+++ b/server/src/com/cloud/network/element/VirtualRouterElement.java
@@ -212,7 +212,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
     }
 
     @Override
-    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, 
+    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, 
             DeployDestination dest, ReservationContext context)
             throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
         if (vm.getType() != VirtualMachine.Type.User || vm.getHypervisorType() == HypervisorType.BareMetal) {
@@ -232,7 +232,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
         }
 
         @SuppressWarnings("unchecked")
-        VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
+        VirtualMachineProfile uservm = (VirtualMachineProfile) vm;
         List<DomainRouterVO> routers = _routerMgr.deployVirtualRouterInGuestNetwork(network, dest, 
                 _accountMgr.getAccount(network.getAccountId()),
                 uservm.getParameters(), offering.getRedundantRouter());
@@ -685,7 +685,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
     }
 
     @Override
-    public boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) 
+    public boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile vm) 
             throws ResourceUnavailableException {
         if (!canHandle(network, null)) {
             return false;
@@ -697,13 +697,13 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
         }
 
         @SuppressWarnings("unchecked")
-        VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
+        VirtualMachineProfile uservm = (VirtualMachineProfile) vm;
 
         return _routerMgr.savePasswordToRouter(network, nic, uservm, routers);
     }
 
     @Override
-    public boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String SSHPublicKey)
+    public boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile vm, String SSHPublicKey)
             throws ResourceUnavailableException {
         if (!canHandle(network, null)) {
             return false;
@@ -715,13 +715,13 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
         }
 
         @SuppressWarnings("unchecked")
-        VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
+        VirtualMachineProfile uservm = (VirtualMachineProfile) vm;
 
         return _routerMgr.saveSSHPublicKeyToRouter(network, nic, uservm, routers, SSHPublicKey);
     }
 
     @Override
-    public boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm)
+    public boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile vm)
             throws ResourceUnavailableException {
         if (!canHandle(network, null)) {
             return false;
@@ -733,7 +733,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
         }
 
         @SuppressWarnings("unchecked")
-        VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
+        VirtualMachineProfile uservm = (VirtualMachineProfile) vm;
 
         return _routerMgr.saveUserDataToRouter(network, nic, uservm, routers);
     }
@@ -848,21 +848,21 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
     }
 
     @Override
-    public boolean release(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
+    public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm,
             ReservationContext context) throws ConcurrentOperationException,
             ResourceUnavailableException {
         return true;
     }
 
     @Override
-    public  boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
+    public  boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm,
                                                DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
         if (canHandle(network, Service.Dhcp)) {
             if (vm.getType() != VirtualMachine.Type.User) {
                 return false;
             }
             @SuppressWarnings("unchecked")
-            VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
+            VirtualMachineProfile uservm = (VirtualMachineProfile) vm;
 
             List<DomainRouterVO> routers = getRouters(network, dest);
 
@@ -893,7 +893,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
     }
 
     @Override
-    public boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, 
+    public boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm, 
             DeployDestination dest, ReservationContext context)
             throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
         if (canHandle(network, Service.Dhcp)) {
@@ -902,7 +902,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
             }
 
             @SuppressWarnings("unchecked")
-            VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
+            VirtualMachineProfile uservm = (VirtualMachineProfile) vm;
 
             List<DomainRouterVO> routers = getRouters(network, dest);
 
@@ -916,7 +916,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
     }
 
     @Override
-    public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm,
+    public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
             throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
         if (canHandle(network, Service.UserData)) {
@@ -930,7 +930,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
             }
 
             @SuppressWarnings("unchecked")
-            VirtualMachineProfile<UserVm> uservm = (VirtualMachineProfile<UserVm>) vm;
+            VirtualMachineProfile uservm = (VirtualMachineProfile) vm;
 
             List<DomainRouterVO> routers = getRouters(network, dest);
 
@@ -1049,7 +1049,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
 
 	@Override
 	public boolean prepareMigration(NicProfile nic, Network network,
-			VirtualMachineProfile<? extends VirtualMachine> vm,
+			VirtualMachineProfile vm,
 			DeployDestination dest, ReservationContext context) {
 		if (nic.getBroadcastType() != Networks.BroadcastDomainType.Pvlan) {
 			return true;
@@ -1068,7 +1068,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
 
 	@Override
 	public void rollbackMigration(NicProfile nic, Network network,
-			VirtualMachineProfile<? extends VirtualMachine> vm,
+			VirtualMachineProfile vm,
 			ReservationContext src, ReservationContext dst) {
 		if (nic.getBroadcastType() != Networks.BroadcastDomainType.Pvlan) {
 			return;
@@ -1086,7 +1086,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
 
 	@Override
 	public void commitMigration(NicProfile nic, Network network,
-			VirtualMachineProfile<? extends VirtualMachine> vm,
+			VirtualMachineProfile vm,
 			ReservationContext src, ReservationContext dst) {
 		if (nic.getBroadcastType() != Networks.BroadcastDomainType.Pvlan) {
 			return;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
index 966710c..979d8fe 100644
--- a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
+++ b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
@@ -185,7 +185,7 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
     }
 
     @Override
-    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, 
+    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, 
             DeployDestination dest, ReservationContext context) 
                     throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/guru/ControlNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/ControlNetworkGuru.java b/server/src/com/cloud/network/guru/ControlNetworkGuru.java
index e7c5cba..6060dac 100755
--- a/server/src/com/cloud/network/guru/ControlNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/ControlNetworkGuru.java
@@ -106,7 +106,7 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
     }
 
     @Override
-    public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException,
+    public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
     InsufficientAddressCapacityException {
 
         if(vm.getHypervisorType() == HypervisorType.VMware && vm.getType() != VirtualMachine.Type.DomainRouter) {
@@ -124,11 +124,11 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
     }
 
     @Override
-    public void deallocate(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
+    public void deallocate(Network config, NicProfile nic, VirtualMachineProfile vm) {
     }
 
     @Override
-    public void reserve(NicProfile nic, Network config, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException,
+    public void reserve(NicProfile nic, Network config, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException,
     InsufficientAddressCapacityException {
         assert nic.getTrafficType() == TrafficType.Control;
 
@@ -163,7 +163,7 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
     }
 
     @Override
-    public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
+    public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
         assert nic.getTrafficType() == TrafficType.Control;
 
         if (vm.getHypervisorType() == HypervisorType.VMware && vm.getType() == VirtualMachine.Type.DomainRouter) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/guru/DirectNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/DirectNetworkGuru.java b/server/src/com/cloud/network/guru/DirectNetworkGuru.java
index b4577ac..5d0e7b1 100755
--- a/server/src/com/cloud/network/guru/DirectNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/DirectNetworkGuru.java
@@ -188,7 +188,7 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
     }
 
     @Override
-    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException,
+    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException, ConcurrentOperationException {
 
         DataCenter dc = _dcDao.findById(network.getDataCenterId());    
@@ -208,7 +208,7 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
     }
 
     @Override
-    public void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context)
+    public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
         if (nic.getIp4Address() == null && nic.getIp6Address() == null) {
             allocateDirectIp(nic, network, vm, dest.getDataCenter(), null, null);
@@ -217,7 +217,7 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
     }
 
     @DB
-    protected void allocateDirectIp(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DataCenter dc, String requestedIp4Addr, String requestedIp6Addr)
+    protected void allocateDirectIp(NicProfile nic, Network network, VirtualMachineProfile vm, DataCenter dc, String requestedIp4Addr, String requestedIp6Addr)
             throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException {
         
@@ -236,7 +236,7 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
     }
 
     @Override
-    public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
+    public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
         return true;
     }
 
@@ -246,7 +246,7 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
     }
 
     @Override @DB
-    public void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
+    public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
     	if (s_logger.isDebugEnabled()) {
             s_logger.debug("Deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java b/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
index f21e352..110096b 100755
--- a/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
@@ -88,7 +88,7 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
     }
 
     @Override
-    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException,
+    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException, ConcurrentOperationException {
 
         DataCenterVO dc = _dcDao.findById(network.getDataCenterId());
@@ -119,7 +119,7 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
     }
 
     @Override @DB
-    public void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context)
+    public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
         
         String oldIp = nic.getIp4Address();
@@ -159,7 +159,7 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
     }
 
     @DB
-    protected void getIp(NicProfile nic, Pod pod, VirtualMachineProfile<? extends VirtualMachine> vm, Network network) throws InsufficientVirtualNetworkCapcityException,
+    protected void getIp(NicProfile nic, Pod pod, VirtualMachineProfile vm, Network network) throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException, ConcurrentOperationException {
         DataCenter dc = _dcDao.findById(pod.getDataCenterId());
         if (nic.getIp4Address() == null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
index 36ea6a5..9355d77 100644
--- a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
@@ -198,7 +198,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
     }
 
     @Override
-    public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException,
+    public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException {
 
         if (_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCenterId(), config.getId()) && nic != null && nic.getRequestedIpv4() != null) {
@@ -224,7 +224,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
     }
 
     @Override @DB
-    public void deallocate(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
+    public void deallocate(Network config, NicProfile nic, VirtualMachineProfile vm) {
         super.deallocate(config, nic, vm);
 
         if (Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()))) {
@@ -241,7 +241,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
     }
 
     @Override
-    public void reserve(NicProfile nic, Network config, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context)
+    public void reserve(NicProfile nic, Network config, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
         assert (nic.getReservationStrategy() == ReservationStrategy.Start) : "What can I do for nics that are not allocated at start? ";
     	boolean _isEnabled = Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()));
@@ -278,7 +278,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
     }
 
     @Override
-    public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
+    public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
 
         if (Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()))) {
             return true;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/guru/GuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/GuestNetworkGuru.java b/server/src/com/cloud/network/guru/GuestNetworkGuru.java
index 9adffa2..f2eeb12 100755
--- a/server/src/com/cloud/network/guru/GuestNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/GuestNetworkGuru.java
@@ -216,7 +216,7 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
     }
 
     @Override @DB
-    public void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
+    public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
         if (network.getSpecifyIpRanges()) {
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("Deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());
@@ -316,7 +316,7 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
     }
 
     @Override
-    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm)
+    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm)
             throws InsufficientVirtualNetworkCapcityException,
     InsufficientAddressCapacityException {
 
@@ -393,7 +393,7 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
     }
 
     @Override
-    public void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm,
+    public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
         assert (nic.getReservationStrategy() == ReservationStrategy.Start) : "What can I do for nics that are not allocated at start? ";
@@ -403,7 +403,7 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
     }
 
     @Override
-    public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
+    public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
         nic.setBroadcastUri(null);
         nic.setIsolationUri(null);
         return true;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java b/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java
index 5a24fe5..3862465 100755
--- a/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java
@@ -90,11 +90,11 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
     }
 
     @Override
-    public void deallocate(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
+    public void deallocate(Network config, NicProfile nic, VirtualMachineProfile vm) {
     }
     
     @Override
-    public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException,
+    public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException {
         TrafficType trafficType = config.getTrafficType();
         assert trafficType == TrafficType.Management || trafficType == TrafficType.Storage: "Well, I can't take care of this config now can I? " + config; 
@@ -112,7 +112,7 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
     }
 
     @Override
-    public void reserve(NicProfile nic, Network config, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException,
+    public void reserve(NicProfile nic, Network config, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException,
             InsufficientAddressCapacityException {
         Pod pod = dest.getPod();
         
@@ -144,7 +144,7 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
     }
     
     @Override
-    public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
+    public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
         _dcDao.releasePrivateIpAddress(nic.getId(), nic.getReservationId());
         
         nic.deallocate();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/guru/PrivateNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/PrivateNetworkGuru.java b/server/src/com/cloud/network/guru/PrivateNetworkGuru.java
index 2e266e7..6521cf4 100644
--- a/server/src/com/cloud/network/guru/PrivateNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/PrivateNetworkGuru.java
@@ -132,7 +132,7 @@ public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
     }
 
     @Override
-    public void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
+    public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());
         }
@@ -153,7 +153,7 @@ public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
     }
 
     @Override
-    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm)
+    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
         DataCenter dc = _configMgr.getZone(network.getDataCenterId());
         NetworkOffering offering = _configMgr.getNetworkOffering(network.getNetworkOfferingId());
@@ -212,7 +212,7 @@ public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
     }
 
     @Override
-    public void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm,
+    public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
         if (nic.getIp4Address() == null) {
@@ -222,7 +222,7 @@ public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
     }
 
     @Override
-    public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
+    public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/guru/PublicNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/PublicNetworkGuru.java b/server/src/com/cloud/network/guru/PublicNetworkGuru.java
index a83cdb3..8beb42e 100755
--- a/server/src/com/cloud/network/guru/PublicNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/PublicNetworkGuru.java
@@ -107,7 +107,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
         super();
     }
 
-    protected void getIp(NicProfile nic, DataCenter dc, VirtualMachineProfile<? extends VirtualMachine> vm, Network network) throws InsufficientVirtualNetworkCapcityException,
+    protected void getIp(NicProfile nic, DataCenter dc, VirtualMachineProfile vm, Network network) throws InsufficientVirtualNetworkCapcityException,
     InsufficientAddressCapacityException, ConcurrentOperationException {
         if (nic.getIp4Address() == null) {
             PublicIp ip = _networkMgr.assignPublicIpAddress(dc.getId(), null, vm.getOwner(), VlanType.VirtualNetwork, null, null, false);
@@ -136,7 +136,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
     }
 
     @Override
-    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) 
+    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) 
             throws InsufficientVirtualNetworkCapcityException,
     InsufficientAddressCapacityException, ConcurrentOperationException {
 
@@ -164,7 +164,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
     }
 
     @Override
-    public void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context)
+    public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
         if (nic.getIp4Address() == null) {
             getIp(nic, dest.getDataCenter(), vm, network);
@@ -172,7 +172,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
     }
 
     @Override
-    public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
+    public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
         return true;
     }
 
@@ -183,7 +183,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
     }
 
     @Override @DB
-    public void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
+    public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("public network deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/guru/StorageNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/StorageNetworkGuru.java b/server/src/com/cloud/network/guru/StorageNetworkGuru.java
index 1d01184..86dd5f6 100755
--- a/server/src/com/cloud/network/guru/StorageNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/StorageNetworkGuru.java
@@ -103,7 +103,7 @@ public class StorageNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
 	}
 
 	@Override
-	public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm)
+	public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm)
 	        throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
 		assert network.getTrafficType() == TrafficType.Storage : "Well, I can't take care of this config now can I? " + network; 
 		if (!_sNwMgr.isStorageIpRangeAvailable(network.getDataCenterId())) {
@@ -114,7 +114,7 @@ public class StorageNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
 	}
 
 	@Override
-	public void reserve(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context)
+	public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
 	        throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
 		if (!_sNwMgr.isStorageIpRangeAvailable(dest.getDataCenter().getId())) {
 			super.reserve(nic, network, vm, dest, context);
@@ -146,7 +146,7 @@ public class StorageNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
 	}
 
 	@Override
-	public boolean release(NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, String reservationId) {
+	public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
 	    Network nw = _nwDao.findById(nic.getNetworkId());
 		if (!_sNwMgr.isStorageIpRangeAvailable(nw.getDataCenterId())) {
 			return super.release(nic, vm, reservationId);
@@ -159,7 +159,7 @@ public class StorageNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
 	}
 
 	@Override
-	public void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
+	public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
 		// TODO Auto-generated method stub
 
 	}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
index 72fddf4..dbbc2d5 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
@@ -61,13 +61,13 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA
      * @param routers TODO
      * 
      */
-    boolean savePasswordToRouter(Network network, NicProfile nic, VirtualMachineProfile<UserVm> profile, 
+    boolean savePasswordToRouter(Network network, NicProfile nic, VirtualMachineProfile profile, 
             List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
 
-    boolean saveSSHPublicKeyToRouter(Network network, NicProfile nic, VirtualMachineProfile<UserVm> profile,
+    boolean saveSSHPublicKeyToRouter(Network network, NicProfile nic, VirtualMachineProfile profile,
             List<? extends VirtualRouter> routers, String SSHPublicKey) throws ResourceUnavailableException;
 
-    boolean saveUserDataToRouter(Network network, NicProfile nic, VirtualMachineProfile<UserVm> profile,
+    boolean saveUserDataToRouter(Network network, NicProfile nic, VirtualMachineProfile profile,
             List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
 
 	List<DomainRouterVO> deployVirtualRouterInGuestNetwork(Network guestNetwork, DeployDestination dest, Account owner, 
@@ -99,16 +99,16 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA
     boolean applyStaticNats(Network network, final List<? extends StaticNat> rules, List<? extends VirtualRouter> routers) 
             throws ResourceUnavailableException;
     
-	boolean applyDhcpEntry(Network config, NicProfile nic, VirtualMachineProfile<UserVm> vm, DeployDestination dest, 
+	boolean applyDhcpEntry(Network config, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, 
 	        List<DomainRouterVO> routers) throws ResourceUnavailableException;
 	
-	boolean applyUserData(Network config, NicProfile nic, VirtualMachineProfile<UserVm> vm, DeployDestination dest, 
+	boolean applyUserData(Network config, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, 
 	        List<DomainRouterVO> routers) throws ResourceUnavailableException;
 
     boolean applyLoadBalancingRules(Network network, List<? extends LoadBalancingRule> rules, List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
 
 
-    boolean configDhcpForSubnet(Network network, NicProfile nic, VirtualMachineProfile<UserVm> uservm, DeployDestination dest, List<DomainRouterVO> routers) throws ResourceUnavailableException ;
+    boolean configDhcpForSubnet(Network network, NicProfile nic, VirtualMachineProfile uservm, DeployDestination dest, List<DomainRouterVO> routers) throws ResourceUnavailableException ;
 
     boolean removeDhcpSupportForSubnet(Network network, List<DomainRouterVO> routers) throws ResourceUnavailableException;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index d05d8e8..ef7f50b 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -485,10 +485,10 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
     }
 
     @Override
-    public boolean savePasswordToRouter(Network network, final NicProfile nic, VirtualMachineProfile<UserVm> profile, List<? extends VirtualRouter> routers) throws ResourceUnavailableException {
+    public boolean savePasswordToRouter(Network network, final NicProfile nic, VirtualMachineProfile profile, List<? extends VirtualRouter> routers) throws ResourceUnavailableException {
         _userVmDao.loadDetails((UserVmVO) profile.getVirtualMachine());
 
-        final VirtualMachineProfile<UserVm> updatedProfile = profile;
+        final VirtualMachineProfile updatedProfile = profile;
 
         return applyRules(network, routers, "save password entry", false, null, false, new RuleApplier() {
             @Override
@@ -503,10 +503,11 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
     }
 
     @Override
-    public boolean saveSSHPublicKeyToRouter(Network network, final NicProfile nic, VirtualMachineProfile<UserVm> profile, List<? extends VirtualRouter> routers, final String SSHPublicKey) throws ResourceUnavailableException {
-        _userVmDao.loadDetails((UserVmVO) profile.getVirtualMachine());
+    public boolean saveSSHPublicKeyToRouter(Network network, final NicProfile nic, VirtualMachineProfile profile, List<? extends VirtualRouter> routers, final String SSHPublicKey) throws ResourceUnavailableException {
+        final UserVmVO vm = _userVmDao.findById(profile.getVirtualMachine().getId());
+        _userVmDao.loadDetails(vm);
 
-        final VirtualMachineProfile<UserVm> updatedProfile = profile;
+        final VirtualMachineProfile updatedProfile = profile;
 
         return applyRules(network, routers, "save SSHkey entry", false, null, false, new RuleApplier() {
             @Override
@@ -518,17 +519,16 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
                 if(template != null && template.getEnablePassword()) {
 			createPasswordCommand(router, updatedProfile, nicVo, cmds);
                 }
-                createVmDataCommand(router, updatedProfile.getVirtualMachine(), nicVo, SSHPublicKey, cmds);
+                createVmDataCommand(router, vm, nicVo, SSHPublicKey, cmds);
                 return sendCommandsToRouter(router, cmds);
             }
         });
     }
 
     @Override
-    public boolean saveUserDataToRouter(Network network, final NicProfile nic, VirtualMachineProfile<UserVm> profile, List<? extends VirtualRouter> routers) throws ResourceUnavailableException {
-        _userVmDao.loadDetails((UserVmVO) profile.getVirtualMachine());
-
-        final VirtualMachineProfile<UserVm> updatedProfile = profile;
+    public boolean saveUserDataToRouter(Network network, final NicProfile nic, VirtualMachineProfile profile, List<? extends VirtualRouter> routers) throws ResourceUnavailableException {
+        final UserVmVO vm = _userVmDao.findById(profile.getVirtualMachine().getId());
+        _userVmDao.loadDetails(vm);
 
         return applyRules(network, routers, "save userdata entry", false, null, false, new RuleApplier() {
             @Override
@@ -536,7 +536,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
                 // for basic zone, send vm data/password information only to the router in the same pod
                 Commands cmds = new Commands(OnError.Stop);
                 NicVO nicVo = _nicDao.findById(nic.getId());
-                createVmDataCommand(router, updatedProfile.getVirtualMachine(), nicVo, null, cmds);
+                createVmDataCommand(router, vm, nicVo, null, cmds);
                 return sendCommandsToRouter(router, cmds);
             }
         });
@@ -1979,7 +1979,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
     }
 
     @Override
-    public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest,
+    public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest,
             ReservationContext context) {
         
         boolean dnsProvided = true;
@@ -1989,7 +1989,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
         _dcDao.loadDetails(dc);
 
         //1) Set router details
-        DomainRouterVO router = profile.getVirtualMachine();
+        DomainRouterVO router = _routerDao.findById(profile.getVirtualMachine().getId());
         Map<String, String> details = _vmDetailsDao.findDetails(router.getId());
         router.setDetails(details);
 
@@ -2262,9 +2262,9 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
     }
     
     @Override
-    public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile,
+    public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile,
             DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
-        DomainRouterVO router = profile.getVirtualMachine();
+        DomainRouterVO router = _routerDao.findById(profile.getId());
 
         List<NicProfile> nics = profile.getNics();
         for (NicProfile nic : nics) {
@@ -2284,8 +2284,8 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
     }
 
     @Override
-    public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile) {
-        DomainRouterVO router = profile.getVirtualMachine();
+    public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) {
+        DomainRouterVO router = _routerDao.findById(profile.getId());
         NicProfile controlNic = getControlNic(profile);
 
         if (controlNic == null) {
@@ -2324,8 +2324,8 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
         return true;
     }
 
-    protected NicProfile getControlNic(VirtualMachineProfile<DomainRouterVO> profile) {
-        DomainRouterVO router = profile.getVirtualMachine();
+    protected NicProfile getControlNic(VirtualMachineProfile profile) {
+        DomainRouterVO router = _routerDao.findById(profile.getId());
         DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
         NicProfile controlNic = null;
         if (profile.getHypervisorType() == HypervisorType.VMware && dcVo.getNetworkType() == NetworkType.Basic) {
@@ -2346,7 +2346,8 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
         return controlNic;
     }
 
-    protected void finalizeSshAndVersionAndNetworkUsageOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile, DomainRouterVO router, NicProfile controlNic) {
+    protected void finalizeSshAndVersionAndNetworkUsageOnStart(Commands cmds, VirtualMachineProfile profile, DomainRouterVO router, NicProfile controlNic) {
+        DomainRouterVO vr = _routerDao.findById(profile.getId());
         cmds.addCommand("checkSsh", new CheckSshCommand(profile.getInstanceName(), controlNic.getIp4Address(), 3922));
 
         // Update router template/scripts version
@@ -2356,7 +2357,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
         cmds.addCommand("getDomRVersion", command);
 
         // Network usage command to create iptables rules
-        boolean forVpc = profile.getVirtualMachine().getVpcId() != null;
+        boolean forVpc = vr.getVpcId() != null;
         if (!forVpc)
             cmds.addCommand("networkUsage", new NetworkUsageCommand(controlNic.getIp4Address(), router.getHostName(), "create", forVpc));
     }
@@ -2561,9 +2562,9 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
     }
 
     @Override
-    public boolean finalizeStart(VirtualMachineProfile<DomainRouterVO> profile, long hostId, Commands cmds,
+    public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Commands cmds,
             ReservationContext context) {
-        DomainRouterVO router = profile.getVirtualMachine();
+        DomainRouterVO router = _routerDao.findById(profile.getId());
         
         boolean result = true;
 
@@ -2620,9 +2621,9 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
     }
 
     @Override
-    public void finalizeStop(VirtualMachineProfile<DomainRouterVO> profile, StopAnswer answer) {
+    public void finalizeStop(VirtualMachineProfile profile, StopAnswer answer) {
         if (answer != null) {
-            VMInstanceVO vm = profile.getVirtualMachine();
+            VirtualMachine vm = profile.getVirtualMachine();
             DomainRouterVO domR = _routerDao.findById(vm.getId());
             processStopOrRebootAnswer(domR, answer);
             List<? extends Nic> routerNics = _nicDao.listByVmId(profile.getId());
@@ -2765,10 +2766,10 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
     }
 
     @Override
-    public boolean configDhcpForSubnet(Network network, final NicProfile nic, VirtualMachineProfile<UserVm> profile, DeployDestination dest, List<DomainRouterVO> routers) throws ResourceUnavailableException {
-        _userVmDao.loadDetails((UserVmVO) profile.getVirtualMachine());
+    public boolean configDhcpForSubnet(Network network, final NicProfile nic, VirtualMachineProfile profile, DeployDestination dest, List<DomainRouterVO> routers) throws ResourceUnavailableException {
+        UserVmVO vm = _userVmDao.findById(profile.getId());
+        _userVmDao.loadDetails(vm);
 
-        final VirtualMachineProfile<UserVm> updatedProfile = profile;
         final boolean isZoneBasic = (dest.getDataCenter().getNetworkType() == NetworkType.Basic);
         final Long podId = isZoneBasic ? dest.getPod().getId() : null;
 
@@ -2780,7 +2781,6 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
                     router.getState(), DataCenter.class, network.getDataCenterId());
         }
         //check if this is not the primary subnet.
-        UserVm vm = updatedProfile.getVirtualMachine();
         NicVO domr_guest_nic = _nicDao.findByInstanceIdAndIpAddressAndVmtype(router.getId(), _nicDao.getIpAddress(nic.getNetworkId(), router.getId()), VirtualMachine.Type.DomainRouter);
         //check if the router ip address and the vm ip address belong to same subnet.
         //if they do not belong to same netwoek check for the alias ips. if not create one.
@@ -2895,12 +2895,16 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
 
 
     @Override
-    public boolean applyDhcpEntry(Network network, final NicProfile nic, VirtualMachineProfile<UserVm> profile,
+    public boolean applyDhcpEntry(Network network, final NicProfile nic, VirtualMachineProfile profile,
             DeployDestination dest, List<DomainRouterVO> routers)
             throws ResourceUnavailableException {
-        _userVmDao.loadDetails((UserVmVO) profile.getVirtualMachine());
+        if(s_logger.isTraceEnabled()) {
+            s_logger.trace("applyDhcpEntry(" + network.getCidr() + ", " + nic.getMacAddress() + ", " + profile.getUuid() + ", " + dest.getHost() + ", " + routers + ")");
+        }
+        final UserVmVO vm = _userVmDao.findById(profile.getId());
+        _userVmDao.loadDetails(vm);
         
-        final VirtualMachineProfile<UserVm> updatedProfile = profile;
+        final VirtualMachineProfile updatedProfile = profile;
         final boolean isZoneBasic = (dest.getDataCenter().getNetworkType() == NetworkType.Basic);
         final Long podId = isZoneBasic ? dest.getPod().getId() : null;
         
@@ -2918,7 +2922,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
                 Commands cmds = new Commands(OnError.Stop);
                 if (!(isZoneBasic && router.getPodIdToDeployIn().longValue() != podId.longValue() && _dnsBasicZoneUpdates.equalsIgnoreCase("pod"))) {
                     NicVO nicVo = _nicDao.findById(nic.getId());
-                    createDhcpEntryCommand(router, updatedProfile.getVirtualMachine(), nicVo, cmds);
+                    createDhcpEntryCommand(router, vm, nicVo, cmds);
                     return sendCommandsToRouter(router, cmds);
                 }
                 return true;
@@ -2970,11 +2974,12 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
      }
 
     @Override
-    public boolean applyUserData(Network network, final NicProfile nic, VirtualMachineProfile<UserVm> profile, DeployDestination dest, List<DomainRouterVO> routers)
+    public boolean applyUserData(Network network, final NicProfile nic, VirtualMachineProfile profile, DeployDestination dest, List<DomainRouterVO> routers)
             throws ResourceUnavailableException {
-        _userVmDao.loadDetails((UserVmVO) profile.getVirtualMachine());
+        final UserVmVO vm = _userVmDao.findById(profile.getId());
+        _userVmDao.loadDetails(vm);
         
-        final VirtualMachineProfile<UserVm> updatedProfile = profile;
+        final VirtualMachineProfile updatedProfile = profile;
         final boolean isZoneBasic = (dest.getDataCenter().getNetworkType() == NetworkType.Basic);
         final Long podId = isZoneBasic ? dest.getPod().getId() : null;
         
@@ -2993,7 +2998,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
                 if (!(isZoneBasic && router.getPodIdToDeployIn().longValue() != podId.longValue())) {
                     NicVO nicVo = _nicDao.findById(nic.getId());
                     createPasswordCommand(router, updatedProfile, nicVo, cmds);
-                    createVmDataCommand(router, updatedProfile.getVirtualMachine(), nicVo, updatedProfile.getVirtualMachine().getDetail("SSH.PublicKey"), cmds);
+                    createVmDataCommand(router, vm, nicVo, vm.getDetail("SSH.PublicKey"), cmds);
                     return sendCommandsToRouter(router, cmds);
                 }
                 return true;
@@ -3352,7 +3357,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
         cmds.addCommand("startVpn", startVpnCmd);
     }
     
-    private void createPasswordCommand(VirtualRouter router, VirtualMachineProfile<UserVm> profile, NicVO nic, Commands cmds) {
+    private void createPasswordCommand(VirtualRouter router, VirtualMachineProfile profile, NicVO nic, Commands cmds) {
         String password = (String) profile.getParameter(VirtualMachineProfile.Param.VmPassword);
         DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
 
@@ -3960,11 +3965,10 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
 
 
     @Override
-    public void prepareStop(VirtualMachineProfile<DomainRouterVO> profile){
+    public void prepareStop(VirtualMachineProfile profile){
         //Collect network usage before stopping Vm
-        VMInstanceVO vm = profile.getVirtualMachine();
 
-        DomainRouterVO router = _routerDao.findById(vm.getId());
+        DomainRouterVO router = _routerDao.findById(profile.getVirtualMachine().getId());
         if(router == null){
             return;
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index 5dbecb7..6fafa3e 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -27,7 +27,6 @@ import java.util.TreeSet;
 import javax.ejb.Local;
 import javax.inject.Inject;
 
-import com.cloud.configuration.ZoneConfig;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
@@ -38,14 +37,12 @@ import com.cloud.agent.api.PlugNicCommand;
 import com.cloud.agent.api.SetupGuestNetworkAnswer;
 import com.cloud.agent.api.SetupGuestNetworkCommand;
 import com.cloud.agent.api.StopAnswer;
-import com.cloud.agent.api.routing.DnsMasqConfigCommand;
 import com.cloud.agent.api.routing.IpAssocVpcCommand;
 import com.cloud.agent.api.routing.NetworkElementCommand;
 import com.cloud.agent.api.routing.SetNetworkACLCommand;
 import com.cloud.agent.api.routing.SetSourceNatCommand;
 import com.cloud.agent.api.routing.SetStaticRouteCommand;
 import com.cloud.agent.api.routing.Site2SiteVpnCfgCommand;
-import com.cloud.agent.api.to.DhcpTO;
 import com.cloud.agent.api.to.IpAddressTO;
 import com.cloud.agent.api.to.NetworkACLTO;
 import com.cloud.agent.api.to.NicTO;
@@ -599,10 +596,11 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
     
     
     @Override
-    public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest,
+    public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest,
             ReservationContext context) {
+        DomainRouterVO vr = _routerDao.findById(profile.getId());
         
-        if (profile.getVirtualMachine().getVpcId() != null) {
+        if (vr.getVpcId() != null) {
             String defaultDns1 = null;
             String defaultDns2 = null;
             //remove public and guest nics as we will plug them later
@@ -623,7 +621,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
             
             //add vpc cidr/dns/networkdomain to the boot load args
             StringBuilder buf = profile.getBootArgsBuilder();
-            Vpc vpc = _vpcMgr.getVpc(profile.getVirtualMachine().getVpcId());
+            Vpc vpc = _vpcMgr.getVpc(vr.getVpcId());
             buf.append(" vpccidr=" + vpc.getCidr() + " domain=" + vpc.getNetworkDomain());
             
             buf.append(" dns1=").append(defaultDns1);
@@ -695,8 +693,8 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
     }
 
     @Override
-    public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile) {
-        DomainRouterVO router = profile.getVirtualMachine();
+    public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) {
+        DomainRouterVO router = _routerDao.findById(profile.getId());
 
         boolean isVpc = (router.getVpcId() != null);
         if (!isVpc) {
@@ -1319,10 +1317,10 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
     }
     
     @Override
-    public void finalizeStop(VirtualMachineProfile<DomainRouterVO> profile, StopAnswer answer) {
+    public void finalizeStop(VirtualMachineProfile profile, StopAnswer answer) {
         super.finalizeStop(profile, answer);
         //Mark VPN connections as Disconnected
-        DomainRouterVO router = profile.getVirtualMachine();
+        DomainRouterVO router = _routerDao.findById(profile.getId());
         Long vpcId = router.getVpcId();
         if (vpcId != null) {
             _s2sVpnMgr.markDisconnectVpnConnByVpc(vpcId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 8d979c7..23e2ca1 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -1060,7 +1060,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
         }
 
         // Check if the vm is using any disks on local storage.
-        VirtualMachineProfile<VMInstanceVO> vmProfile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
+        VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(vm);
         List<VolumeVO> volumes = _volumeDao.findCreatedByInstance(vmProfile.getId());
         boolean usesLocal = false;
         for (VolumeVO volume : volumes) {
@@ -1156,7 +1156,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
                 suitableHosts, requiresStorageMotion);
     }
 
-    private Map<Volume, List<StoragePool>> findSuitablePoolsForVolumes(VirtualMachineProfile<VMInstanceVO> vmProfile,
+    private Map<Volume, List<StoragePool>> findSuitablePoolsForVolumes(VirtualMachineProfile vmProfile,
             Host host) {
         List<VolumeVO> volumes = _volumeDao.findCreatedByInstance(vmProfile.getId());
         Map<Volume, List<StoragePool>> suitableVolumeStoragePools = new HashMap<Volume, List<StoragePool>>();
@@ -1284,7 +1284,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
             // Volume stays in the same cluster after migration.
             DataCenterDeployment plan = new DataCenterDeployment(volume.getDataCenterId(), srcVolumePool.getPodId(),
                     srcVolumePool.getClusterId(), null, null, null);
-            VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
+            VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
 
             DiskOfferingVO diskOffering = _diskOfferingDao.findById(volume.getDiskOfferingId());
             DiskProfile diskProfile = new DiskProfile(volume, diskOffering, profile.getHypervisorType());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1325014a/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index 8a5085e..cd966cd 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -403,7 +403,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
     public StoragePool findStoragePool(DiskProfile dskCh, final DataCenterVO dc, Pod pod, Long clusterId, Long hostId, VMInstanceVO vm,
                                        final Set<StoragePool> avoid) {
 
-        VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
+        VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
         for (StoragePoolAllocator allocator : _storagePoolAllocators) {
 
             ExcludeList avoidList = new ExcludeList();