http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
----------------------------------------------------------------------
diff --cc 
api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
index cc62d9c,5fbe106..8d34cf9
--- 
a/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
@@@ -16,12 -16,9 +16,10 @@@
  // under the License.
  package org.apache.cloudstack.api.command.user.volume;
  
--import java.net.URISyntaxException;
- 
 +import org.apache.log4j.Logger;
  
  import org.apache.cloudstack.api.APICommand;
 +import org.apache.cloudstack.api.ApiCommandJobType;
  import org.apache.cloudstack.api.ApiConstants;
  import org.apache.cloudstack.api.ApiErrorCode;
  import org.apache.cloudstack.api.BaseAsyncCmd;
@@@ -96,10 -95,10 +94,12 @@@ public class ExtractVolumeCmd extends B
          return s_name;
      }
  
 -    public AsyncJob.Type getInstanceType() {
 -        return AsyncJob.Type.Volume;
++    @Override
 +    public ApiCommandJobType getInstanceType() {
 +        return ApiCommandJobType.Volume;
      }
  
++    @Override
      public Long getInstanceId() {
          return getId();
      }
@@@ -127,33 -126,26 +127,26 @@@
  
      @Override
      public void execute(){
-         try {
-             CallContext.current().setEventDetails("Volume Id: "+getId());
-             Long uploadId = _mgr.extractVolume(this);
-             if (uploadId != null){
-                 Upload uploadInfo = _entityMgr.findById(Upload.class, 
uploadId);
 -        UserContext.current().setEventDetails("Volume Id: " + getId());
++        CallContext.current().setEventDetails("Volume Id: " + getId());
+         String uploadUrl = _volumeService.extractVolume(this);
+         if (uploadUrl != null) {
 -            ExtractResponse response = new ExtractResponse();
 -            response.setResponseName(getCommandName());
 -            response.setObjectName("volume");
 -            Volume vol = _entityMgr.findById(Volume.class, id);
 -            response.setId(vol.getUuid());
 -            response.setName(vol.getName());
 -            DataCenter zone = _entityMgr.findById(DataCenter.class, zoneId);
 -            response.setZoneId(zone.getUuid());
 -            response.setZoneName(zone.getName());
 -            response.setMode(mode);
 +                ExtractResponse response = new ExtractResponse();
 +                response.setResponseName(getCommandName());
 +                response.setObjectName("volume");
 +                Volume vol = _entityMgr.findById(Volume.class, id);
 +                response.setId(vol.getUuid());
 +                response.setName(vol.getName());
 +                DataCenter zone = _entityMgr.findById(DataCenter.class, 
zoneId);
 +                response.setZoneId(zone.getUuid());
 +                response.setZoneName(zone.getName());
 +                response.setMode(mode);
-                 response.setUploadId(uploadInfo.getUuid());
-                 response.setState(uploadInfo.getUploadState().toString());
+             response.setState(Upload.Status.DOWNLOAD_URL_CREATED.toString());
 -            Account account = _entityMgr.findById(Account.class, 
getEntityOwnerId());
 -            response.setAccountId(account.getUuid());
 +                Account account = _entityMgr.findById(Account.class, 
getEntityOwnerId());
 +                response.setAccountId(account.getUuid());
-                 response.setUrl(uploadInfo.getUploadUrl());
-                 this.setResponseObject(response);
+             response.setUrl(uploadUrl);
 -            this.setResponseObject(response);
 -        } else {
 -            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed 
to extract volume");
 -        }
++                setResponseObject(response);
 +            } else {
 +                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, 
"Failed to extract volume");
 +            }
-         } catch (URISyntaxException ex) {
-             s_logger.info(ex);
-             throw new ServerApiException(ApiErrorCode.PARAM_ERROR, 
ex.getMessage());
-         }
      }
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/response/ClusterResponse.java
index 5d9bb05,68aa892..c9e909b
--- a/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
@@@ -47,10 -45,7 +47,7 @@@ public class ClusterResponse extends Ba
  
      @SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name 
of the cluster")
      private String zoneName;
 -
 +    
-     @SerializedName(ApiConstants.ZONE_TYPE) @Param(description = "network 
type of the availability zone")
-     private String zoneType;
-     
      @SerializedName("hypervisortype") @Param(description="the hypervisor type 
of the cluster")
      private String hypervisorType;
  

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/response/HostResponse.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/response/HostResponse.java
index e4eb01b,687687d..4cb2b1a
--- a/api/src/org/apache/cloudstack/api/response/HostResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/HostResponse.java
@@@ -60,10 -59,7 +60,7 @@@ public class HostResponse extends BaseR
  
      @SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name 
of the host")
      private String zoneName;
 -
 +    
-     @SerializedName(ApiConstants.ZONE_TYPE) @Param(description = "network 
type of the availability zone")
-     private String zoneType;
-     
      @SerializedName(ApiConstants.POD_ID) @Param(description="the Pod ID of 
the host")
      private String podId;
  

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/response/NetworkResponse.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/response/NetworkResponse.java
index 3a8b875,3102433..f9be96f
--- a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/NetworkResponse.java
@@@ -67,10 -66,7 +67,7 @@@ public class NetworkResponse extends Ba
  
      @SerializedName(ApiConstants.ZONE_NAME) @Param(description="the name of 
the zone the network belongs to")
      private String zoneName;
 -
 +    
-     @SerializedName(ApiConstants.ZONE_TYPE) @Param(description="the 
networktype of the zone the network belongs to")
-     private String zoneType;
- 
      @SerializedName("networkofferingid") @Param(description="network offering 
id the network is created from")
      private String networkOfferingId;
  

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/response/PodResponse.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
index ffb6002,e9cb109..2abc7bc
--- a/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
@@@ -180,14 -180,7 +172,7 @@@ public class SnapshotResponse extends B
      public void setZoneId(String zoneId) {
          this.zoneId = zoneId;
      }
-     public void setZoneName(String zoneName) {
-         this.zoneName = zoneName;
-     }
- 
-     public void setZoneType(String zoneType) {
-         this.zoneType = zoneType;
-     }
 - 
 +    
      public void setTags(List<ResourceTagResponse> tags) {
          this.tags = tags;
      }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
index 57257a7,0050000..d7b391d
--- a/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
@@@ -39,9 -37,7 +39,7 @@@ public class StoragePoolResponse extend
      @SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name 
of the storage pool")
      private String zoneName;
  
-     @SerializedName(ApiConstants.ZONE_TYPE) @Param(description = "network 
type of the availability zone")
-     private String zoneType;
 -
 +    
      @SerializedName("podid") @Param(description="the Pod ID of the storage 
pool")
      private String podId;
  

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/response/SystemVmResponse.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/response/SystemVmResponse.java
index 3f1d955,8d2798a..8612ff2
--- a/api/src/org/apache/cloudstack/api/response/SystemVmResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/SystemVmResponse.java
@@@ -148,15 -150,7 +145,7 @@@ public class SystemVmResponse extends B
      public void setZoneName(String zoneName) {
          this.zoneName = zoneName;
      }
 -
 +      
-     public String getZoneType() {
-         return zoneType;
-     }
- 
-     public void setZoneType(String zoneType) {
-         this.zoneType = zoneType;
-     }        
-     
      public String getDns1() {
          return dns1;
      }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/response/TemplateResponse.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/response/TemplateResponse.java
index 8bbfe47,e6221f7..00a5668
--- a/api/src/org/apache/cloudstack/api/response/TemplateResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/TemplateResponse.java
@@@ -17,11 -17,11 +17,13 @@@
  package org.apache.cloudstack.api.response;
  
  import java.util.Date;
+ import java.util.LinkedHashSet;
  import java.util.List;
  import java.util.Map;
+ import java.util.Set;
  
 +import com.google.gson.annotations.SerializedName;
 +
  import org.apache.cloudstack.api.ApiConstants;
  import org.apache.cloudstack.api.BaseResponse;
  import org.apache.cloudstack.api.EntityReference;
@@@ -88,10 -91,7 +92,7 @@@ public class TemplateResponse extends B
  
      @SerializedName(ApiConstants.ZONE_NAME) @Param(description="the name of 
the zone for this template")
      private String zoneName;
 -
 +    
-     @SerializedName(ApiConstants.ZONE_TYPE) @Param(description="the 
networktype of the zone for this template")
-     private String zoneType;
- 
      @SerializedName(ApiConstants.STATUS) @Param(description="the status of 
the template")
      private String status;
  

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/response/UserVmResponse.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/api/src/org/apache/cloudstack/api/response/VolumeResponse.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/response/VolumeResponse.java
index 47e620f,b643de1..a006e57
--- a/api/src/org/apache/cloudstack/api/response/VolumeResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/VolumeResponse.java
@@@ -47,11 -47,7 +47,7 @@@ public class VolumeResponse extends Bas
      @SerializedName(ApiConstants.ZONE_NAME)
      @Param(description = "name of the availability zone")
      private String zoneName;
 -
 +    
-     @SerializedName(ApiConstants.ZONE_TYPE)
-     @Param(description = "network type of the availability zone")
-     private String zoneType;
- 
      @SerializedName(ApiConstants.TYPE)
      @Param(description = "type of the disk volume (ROOT or DATADISK)")
      private String volumeType;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/client/tomcatconf/applicationContext.xml.in
----------------------------------------------------------------------
diff --cc client/tomcatconf/applicationContext.xml.in
index d3b5369,ac1f3e4..627c655
--- a/client/tomcatconf/applicationContext.xml.in
+++ b/client/tomcatconf/applicationContext.xml.in
@@@ -196,9 -196,8 +194,8 @@@
    <bean id="dataCenterJoinDaoImpl" 
class="com.cloud.api.query.dao.DataCenterJoinDaoImpl" />
    <bean id="dataCenterLinkLocalIpAddressDaoImpl" 
class="com.cloud.dc.dao.DataCenterLinkLocalIpAddressDaoImpl" />
    <bean id="dataCenterVnetDaoImpl" 
class="com.cloud.dc.dao.DataCenterVnetDaoImpl" />
-   <bean id="dataStoreProviderDaoImpl" 
class="org.apache.cloudstack.storage.datastore.db.DataStoreProviderDaoImpl" />
    <bean id="dcDetailsDaoImpl" class="com.cloud.dc.dao.DcDetailsDaoImpl" />
 -  <bean id="engineDcDetailsDaoImpl" 
class="org.apache.cloudstack.engine.datacenter.entity.api.db.dao.DcDetailsDaoImpl"
 />
 +  <bean id="engineDcDetailsDaoImpl" 
class="org.apache.cloudstack.engine.datacenter.entity.dao.DcDetailsDaoImpl" />
    <bean id="diskOfferingJoinDaoImpl" 
class="com.cloud.api.query.dao.DiskOfferingJoinDaoImpl" />
    <bean id="domainDaoImpl" class="com.cloud.domain.dao.DomainDaoImpl" />
    <bean id="domainRouterDaoImpl" class="com.cloud.vm.dao.DomainRouterDaoImpl" 
/>
@@@ -219,12 -218,13 +216,13 @@@
    <bean id="globalLoadBalancerLbRuleMapDaoImpl" 
class="org.apache.cloudstack.region.gslb.GlobalLoadBalancerLbRuleMapDaoImpl" />
    <bean id="guestOSCategoryDaoImpl" 
class="com.cloud.storage.dao.GuestOSCategoryDaoImpl" />
    <bean id="guestOSDaoImpl" class="com.cloud.storage.dao.GuestOSDaoImpl" />
+   <bean id="guestOSHypervisorDaoImpl" 
class="com.cloud.storage.dao.GuestOSHypervisorDaoImpl" />
    <bean id="highAvailabilityDaoImpl" 
class="com.cloud.ha.dao.HighAvailabilityDaoImpl" />
    <bean id="hostDaoImpl" class="com.cloud.host.dao.HostDaoImpl" />
 -  <bean id="engineHostDetailsDaoImpl" 
class="org.apache.cloudstack.engine.datacenter.entity.api.db.dao.HostDetailsDaoImpl"
 />
 +  <bean id="engineHostDetailsDaoImpl" 
class="org.apache.cloudstack.engine.datacenter.entity.dao.HostDetailsDaoImpl" />
    <bean id="hostDetailsDaoImpl" class="com.cloud.host.dao.HostDetailsDaoImpl" 
/>
    <bean id="hostJoinDaoImpl" class="com.cloud.api.query.dao.HostJoinDaoImpl" 
/>
 -  <bean id="engineHostTagsDaoImpl" 
class="org.apache.cloudstack.engine.datacenter.entity.api.db.dao.HostTagsDaoImpl"
 />
 +  <bean id="engineHostTagsDaoImpl" 
class="org.apache.cloudstack.engine.datacenter.entity.dao.HostTagsDaoImpl" />
    <bean id="hostTagsDaoImpl" class="com.cloud.host.dao.HostTagsDaoImpl" />
    <bean id="hostTransferMapDaoImpl" 
class="com.cloud.cluster.agentlb.dao.HostTransferMapDaoImpl" />
    <bean id="iPAddressDaoImpl" class="com.cloud.network.dao.IPAddressDaoImpl" 
/>
@@@ -773,11 -780,12 +773,10 @@@
    <bean id="snapshotStateMachineManagerImpl" 
class="org.apache.cloudstack.storage.snapshot.SnapshotStateMachineManagerImpl" 
/>
    <bean id="statsCollector" class="com.cloud.server.StatsCollector" />
    <bean id="storagePoolAutomationImpl" 
class="com.cloud.storage.StoragePoolAutomationImpl" />
-   <bean id="templateInstallStrategyImpl" 
class="org.apache.cloudstack.storage.volume.TemplateInstallStrategyImpl" />
    <bean id="unknown" 
class="org.apache.cloudstack.storage.image.format.Unknown" />
    <bean id="usageEventUtils" class="com.cloud.event.UsageEventUtils" />
 -  <bean id="userContextInitializer" 
class="com.cloud.user.UserContextInitializer" />
    <bean id="VHD" class="org.apache.cloudstack.storage.image.format.VHD" />
 -  <bean id="vMEntityManagerImpl" 
class="org.apache.cloudstack.engine.cloud.entity.api.VMEntityManagerImpl" />
 -  <bean id="virtualMachineEntityFactory" 
class="org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityFactory"
 />
 +  <bean id="vMEntityManagerImpl" 
class="org.apache.cloudstack.engine.vm.VMEntityManagerImpl" />
    <bean id="virtualMachineEntityImpl" 
class="org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityImpl" 
/>
    <bean id="virtualMachineRestService" 
class="org.apache.cloudstack.engine.rest.service.api.VirtualMachineRestService" 
/>
    <bean id="volumeDataFactoryImpl" 
class="org.apache.cloudstack.storage.volume.VolumeDataFactoryImpl" />
@@@ -799,11 -807,13 +798,15 @@@
    <bean id="vMSnapshotManagerImpl" 
class="com.cloud.vm.snapshot.VMSnapshotManagerImpl" />
    <bean id="volumeManagerImpl" class="com.cloud.storage.VolumeManagerImpl" />
    <bean id="ClassicalPrimaryDataStoreProvider" 
class="org.apache.cloudstack.storage.datastore.provider.CloudStackPrimaryDataStoreProviderImpl"
 />
+   <bean id="cloudStackImageStoreProviderImpl" 
class="org.apache.cloudstack.storage.datastore.provider.CloudStackImageStoreProviderImpl"
 />
+   <bean id="s3ImageStoreProviderImpl" 
class="org.apache.cloudstack.storage.datastore.provider.S3ImageStoreProviderImpl"
 />
+   <bean id="swiftImageStoreProviderImpl" 
class="org.apache.cloudstack.storage.datastore.provider.SwiftImageStoreProviderImpl"
 />  
    <bean id="ApplicationLoadBalancerService" 
class="org.apache.cloudstack.network.lb.ApplicationLoadBalancerManagerImpl" />
    <bean id="InternalLoadBalancerVMManager" 
class="org.apache.cloudstack.network.lb.InternalLoadBalancerVMManagerImpl" />
+   <bean id="StorageCacheReplacementAlgorithm" 
class="org.apache.cloudstack.storage.cache.manager.StorageCacheReplacementAlgorithmLRU"
 />
  
 +  <bean id="VirtualMachinePowerStateSyncImpl" 
class="com.cloud.vm.VirtualMachinePowerStateSyncImpl" />
 +
  
  
<!--=======================================================================================================-->
  <!--                                                                          
                             -->
@@@ -873,8 -858,7 +875,7 @@@
    <bean id="BAREMETAL" 
class="org.apache.cloudstack.storage.image.format.BAREMETAL" />
    <bean id="baremetalDhcpDaoImpl" 
class="com.cloud.baremetal.database.BaremetalDhcpDaoImpl" />
    <bean id="baremetalPxeDaoImpl" 
class="com.cloud.baremetal.database.BaremetalPxeDaoImpl" />
- -->
 -
 +  
    <bean id="AffinityGroupServiceImpl" 
class="org.apache.cloudstack.affinity.AffinityGroupServiceImpl"/>
    <bean id="DeploymentPlanningManager" 
class="com.cloud.deploy.DeploymentPlanningManagerImpl">
      <property name="Planners" value="#{deploymentPlanners.Adapters}" />

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/core/src/com/cloud/agent/api/StopCommand.java
----------------------------------------------------------------------
diff --cc core/src/com/cloud/agent/api/StopCommand.java
index 7d3fd43,a3ee3c9..e0dde7d
--- a/core/src/com/cloud/agent/api/StopCommand.java
+++ b/core/src/com/cloud/agent/api/StopCommand.java
@@@ -23,34 -23,33 +23,38 @@@ public class StopCommand extends Reboot
      private boolean isProxy=false;
      private String urlPort=null;
      private String publicConsoleProxyIpAddress=null;
 +    private boolean cleanupOnly;
+     boolean executeInSequence = false;
  
      protected StopCommand() {
      }
  
-     public StopCommand(VirtualMachine vm, boolean isProxy, String urlPort, 
String publicConsoleProxyIpAddress, boolean cleanupOnly) {
 -    public StopCommand(VirtualMachine vm, boolean isProxy, String urlPort, 
String publicConsoleProxyIpAddress, boolean executeInSequence) {
++    public StopCommand(VirtualMachine vm, boolean isProxy, String urlPort, 
String publicConsoleProxyIpAddress, boolean cleanupOnly, boolean 
executeInSequence) {
        super(vm);
        this.isProxy = isProxy;
        this.urlPort = urlPort;
        this.publicConsoleProxyIpAddress = publicConsoleProxyIpAddress;
 -      this.executeInSequence = executeInSequence;
 +        this.cleanupOnly = cleanupOnly;
      }
  
-     public StopCommand(VirtualMachine vm, String vnet) {
+     public StopCommand(VirtualMachine vm, String vnet, boolean 
executeInSequence) {
          super(vm);
          this.vnet = vnet;
+         this.executeInSequence = executeInSequence;
      }
      
 +    public boolean isCleanupOnly() {
 +        return cleanupOnly;
 +    }
 +
-     public StopCommand(VirtualMachine vm) {
+     public StopCommand(VirtualMachine vm, boolean executeInSequence) {
          super(vm);
+         this.executeInSequence = executeInSequence;
      }
  
-     public StopCommand(String vmName) {
+     public StopCommand(String vmName, boolean executeInSequence) {
          super(vmName);
+         this.executeInSequence = executeInSequence;
      }
  
      public String getVnet() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/core/src/com/cloud/hypervisor/hyperv/resource/HypervResource.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StoragePoolAllocator.java
----------------------------------------------------------------------
diff --cc 
engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StoragePoolAllocator.java
index 51714ec,eccf0f4..01b5e78
--- 
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,23 -23,29 +23,28 @@@ import com.cloud.deploy.DeploymentPlann
  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;
  
  /**
   */
  public interface StoragePoolAllocator extends Adapter {
-       /** 
-       * Determines which storage pools are suitable for the guest virtual 
machine 
 -    /**
 -     * Determines which storage pools are suitable for the guest virtual 
machine
 -     * 
++      /**
++      * Determines which storage pools are suitable for the guest virtual 
machine
 +      * 
-       * @param DiskProfile dskCh
-       * @param VirtualMachineProfile vmProfile
-       * @param DeploymentPlan plan
-       * @param ExcludeList avoid
+      * @param DiskProfile
+      *            dskCh
+      * @param VirtualMachineProfile
+      *            vmProfile
+      * @param DeploymentPlan
+      *            plan
+      * @param ExcludeList
+      *            avoid
 -     * @param int returnUpTo (use -1 to return all possible pools)
 +      * @param int returnUpTo (use -1 to return all possible pools)
-       * @return List<StoragePool> List of storage pools that are suitable for 
the VM 
-       **/ 
-       List<StoragePool> allocateToPool(DiskProfile dskCh, 
VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int 
returnUpTo);   
+      * @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);
 -
 +      
-       public static int RETURN_UPTO_ALL = -1;
+     static int RETURN_UPTO_ALL = -1;
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/engine/components-api/src/com/cloud/agent/AgentManager.java
----------------------------------------------------------------------
diff --cc engine/components-api/src/com/cloud/agent/AgentManager.java
index 306a40f,0000000..5b12ff1
mode 100755,000000..100755
--- a/engine/components-api/src/com/cloud/agent/AgentManager.java
+++ b/engine/components-api/src/com/cloud/agent/AgentManager.java
@@@ -1,153 -1,0 +1,150 @@@
 +// 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.agent;
 +
 +import com.cloud.agent.api.Answer;
 +import com.cloud.agent.api.Command;
 +import com.cloud.agent.manager.Commands;
 +import com.cloud.exception.AgentUnavailableException;
 +import com.cloud.exception.OperationTimedoutException;
 +import com.cloud.host.HostVO;
 +import com.cloud.host.Status;
 +import com.cloud.host.Status.Event;
 +import com.cloud.hypervisor.Hypervisor.HypervisorType;
 +import com.cloud.utils.component.Manager;
 +
 +/**
 + * AgentManager manages hosts. It directly coordinates between the DAOs and 
the connections it manages.
 + */
 +public interface AgentManager extends Manager {
 +    public enum OnError {
 +        Continue, Stop
 +    }
 +
 +    public enum TapAgentsAction {
 +        Add,
 +        Del,
 +        Contains,
 +    }
 +    
 +    /**
 +     * easy send method that returns null if there's any errors. It handles 
all exceptions.
 +     * 
 +     * @param hostId
 +     *            host id
 +     * @param cmd
 +     *            command to send.
 +     * @return Answer if successful; null if not.
 +     */
 +    Answer easySend(Long hostId, Command cmd);
 +
 +    /**
 +     * Synchronous sending a command to the agent.
 +     * 
 +     * @param hostId
 +     *            id of the agent on host
 +     * @param cmd
 +     *            command
 +     * @return an Answer
 +     */
 +
 +    Answer send(Long hostId, Command cmd) throws AgentUnavailableException, 
OperationTimedoutException;
 +
 +    /**
 +     * Synchronous sending a list of commands to the agent.
 +     * 
 +     * @param hostId
 +     *            id of the agent on host
 +     * @param cmds
 +     *            array of commands
 +     * @param isControl
 +     *            Commands sent contains control commands
 +     * @param stopOnError
 +     *            should the agent stop execution on the first error.
 +     * @return an array of Answer
 +     */
 +    Answer[] send(Long hostId, Commands cmds) throws 
AgentUnavailableException, OperationTimedoutException;
 +
 +    Answer[] send(Long hostId, Commands cmds, int timeout) throws 
AgentUnavailableException, OperationTimedoutException;
 +
 +    /**
 +     * Asynchronous sending of a command to the agent.
 +     * 
 +     * @param hostId
 +     *            id of the agent on the host.
 +     * @param cmds
 +     *            Commands to send.
 +     * @param stopOnError
 +     *            should the agent stop execution on the first error.
 +     * @param listener
 +     *            the listener to process the answer.
 +     * @return sequence number.
 +     */
 +    long send(Long hostId, Commands cmds, Listener listener) throws 
AgentUnavailableException;
 +
 +    /**
 +     * Register to listen for host events. These are mostly connection and 
disconnection events.
 +     * 
 +     * @param listener
 +     * @param connections
 +     *            listen for connections
 +     * @param commands
 +     *            listen for connections
 +     * @param priority
 +     *            in listening for events.
 +     * @return id to unregister if needed.
 +     */
 +    int registerForHostEvents(Listener listener, boolean connections, boolean 
commands, boolean priority);
 +
 +
 +    /**
 +     * Register to listen for initial agent connections.
 +     * @param creator
 +     * @param priority in listening for events.
 +     * @return id to unregister if needed.
 +     */
 +    int registerForInitialConnects(StartupCommandProcessor creator,  boolean 
priority);
 +
 +    /**
 +     * Unregister for listening to host events.
 +     * 
 +     * @param id
 +     *            returned from registerForHostEvents
 +     */
 +    void unregisterForHostEvents(int id);
 +
 +    public boolean executeUserRequest(long hostId, Event event) throws 
AgentUnavailableException;
 +
 +    Answer sendTo(Long dcId, HypervisorType type, Command cmd);
 +
-     void sendToSecStorage(HostVO ssHost, Command cmd, Listener listener) 
throws AgentUnavailableException;
 +
-     Answer sendToSecStorage(HostVO ssHost, Command cmd);
-     
 +    /* working as a lock while agent is being loaded */
 +    public boolean tapLoadingAgents(Long hostId, TapAgentsAction action);
 +    
 +    public boolean agentStatusTransitTo(HostVO host, Status.Event e, long 
msId);
 +    
 +    void disconnectWithoutInvestigation(long hostId, Status.Event event);
 +    
 +    public void pullAgentToMaintenance(long hostId);
 +    
 +    public void pullAgentOutMaintenance(long hostId);
 +
 +      boolean reconnect(long hostId);
 +    Answer sendToSSVM(Long dcId, final Command cmd);
 +
 +    void disconnectWithInvestigation(final long hostId, final Status.Event 
event);
 +}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/engine/components-api/src/com/cloud/agent/Listener.java
----------------------------------------------------------------------
diff --cc engine/components-api/src/com/cloud/agent/Listener.java
index 47b9bc3,0000000..242f90c
mode 100755,000000..100755
--- a/engine/components-api/src/com/cloud/agent/Listener.java
+++ b/engine/components-api/src/com/cloud/agent/Listener.java
@@@ -1,119 -1,0 +1,119 @@@
 +// 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.agent;
 +
 +import com.cloud.agent.api.AgentControlAnswer;
 +import com.cloud.agent.api.AgentControlCommand;
 +import com.cloud.agent.api.Answer;
 +import com.cloud.agent.api.Command;
 +import com.cloud.agent.api.StartupCommand;
 +import com.cloud.exception.ConnectionException;
- import com.cloud.host.HostVO;
++import com.cloud.host.Host;
 +import com.cloud.host.Status;
 +
 +/**
 + * There are several types of events that the AgentManager forwards
-  * 
++ *
 + *   1. Agent Connect & Disconnect
 + *   2. Commands sent by the agent.
 + *   3. Answers sent by the agent.
 + */
 +public interface Listener {
 +
-       /**
-        * 
-        * @param agentId id of the agent
-        * @param seq sequence number return by the send() method.
-        * @param answers answers to the commands.
-        * @return true if processed.  false if not.
-        */
++    /**
++     *
++     * @param agentId id of the agent
++     * @param seq sequence number return by the send() method.
++     * @param answers answers to the commands.
++     * @return true if processed.  false if not.
++     */
 +    boolean processAnswers(long agentId, long seq, Answer[] answers);
 +
 +    /**
 +     * This method is called by the AgentManager when an agent sent
 +     * a command to the server.  In order to process these commands,
 +     * the Listener must be registered for host commands.
-      * 
++     *
 +     * @param agentId id of the agent.
 +     * @param seq sequence number of the command sent.
 +     * @param commands commands that were sent.
 +     * @return true if you processed the commands.  false if not.
 +     */
 +    boolean processCommands(long agentId, long seq, Command[] commands);
-     
++
 +    /**
 +     * process control command sent from agent under its management
 +     * @param agentId
 +     * @param cmd
 +     * @return
 +     */
 +    AgentControlAnswer processControlCommand(long agentId, 
AgentControlCommand cmd);
 +
 +    /**
 +     * This method is called by AgentManager when an agent made a
 +     * connection to this server if the listener has
 +     * been registered for host events.
 +     * @param cmd command sent by the agent to the server on startup.
 +     * @param forRebalance TODO
 +     * @param agentId id of the agent
 +     * @throws ConnectionException if host has problems and needs to put into 
maintenance state.
 +     */
-     void processConnect(HostVO host, StartupCommand cmd, boolean 
forRebalance) throws ConnectionException;
-     
++    void processConnect(Host host, StartupCommand cmd, boolean forRebalance) 
throws ConnectionException;
++
 +    /**
 +     * This method is called by AgentManager when an agent disconnects
 +     * from this server if the listener has been registered for host events.
-      * 
++     *
 +     * If the Listener is passed to the send() method, this method is
 +     * also called by AgentManager if the agent disconnected.
-      * 
++     *
 +     * @param agentId id of the agent
 +     * @param state the current state of the agent.
 +     */
 +    boolean processDisconnect(long agentId, Status state);
-         
++
 +    /**
 +     * If this Listener is passed to the send() method, this method
 +     * is called by AgentManager after processing an answer
 +     * from the agent.  Returning true means you're expecting more
 +     * answers from the agent using the same sequence number.
-      * 
++     *
 +     * @return true if expecting more answers using the same sequence number.
 +     */
 +    boolean isRecurring();
 +
 +    /**
 +     * If the Listener is passed to the send() method, this method is
 +     * called to determine how long to wait for the reply.  The value
 +     * is in seconds.  -1 indicates to wait forever.  0 indicates to
 +     * use the default timeout.  If the timeout is
 +     * reached, processTimeout on this same Listener is called.
-      * 
++     *
 +     * @return timeout in seconds before processTimeout is called.
 +     */
 +    int getTimeout();
 +
 +    /**
 +     * If the Listener is passed to the send() method, this method is
 +     * called by the AgentManager to process a command timeout.
 +     * @param agentId id of the agent
 +     * @param seq sequence number returned by the send().
 +     * @return true if processed; false if not.
 +     */
 +    boolean processTimeout(long agentId, long seq);
-   
++
 +}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/engine/components-api/src/com/cloud/network/NetworkManager.java
----------------------------------------------------------------------
diff --cc engine/components-api/src/com/cloud/network/NetworkManager.java
index 0054c9a,0000000..3e73a8c
mode 100755,000000..100755
--- a/engine/components-api/src/com/cloud/network/NetworkManager.java
+++ b/engine/components-api/src/com/cloud/network/NetworkManager.java
@@@ -1,388 -1,0 +1,389 @@@
 +// 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 org.apache.cloudstack.acl.ControlledEntity.ACLType;
 +
 +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.addr.PublicIp;
 +import com.cloud.network.dao.IPAddressVO;
 +import com.cloud.network.dao.NetworkVO;
 +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.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.vm.Nic;
 +import com.cloud.vm.NicProfile;
 +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;
 +
 +/**
 + * NetworkManager manages the network for the different end users.
 + * 
 + */
 +public interface NetworkManager  {
 +    /**
 +     * Assigns a new public ip address.
 +     * 
 +     * @param dcId
 +     * @param podId
 +     *            TODO
 +     * @param owner
 +     * @param type
 +     * @param networkId
 +     * @param requestedIp
 +     *            TODO
 +     * @param allocatedBy
 +     *            TODO
 +     * @return
 +     * @throws InsufficientAddressCapacityException
 +     */
 +
 +    PublicIp assignPublicIpAddress(long dcId, Long podId, Account owner, 
VlanType type, Long networkId, String requestedIp,
 +            boolean isSystem) throws InsufficientAddressCapacityException;
 +
 +
 +    /**
 +     * Do all of the work of releasing public ip addresses. Note that if this 
method fails, there can be side effects.
 +     * 
 +     * @param userId
 +     * @param caller
 +     *            TODO
 +     * @param IpAddress
 +     * @return true if it did; false if it didn't
 +     */
 +    public boolean disassociatePublicIpAddress(long id, long userId, Account 
caller);
 +
 +    List<NetworkVO> setupNetwork(Account owner, NetworkOffering offering, 
DeploymentPlan plan, String name, String displayText, boolean isDefault)
 +            throws ConcurrentOperationException;
 +
 +    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 vm, List<Pair<NetworkVO, NicProfile>> 
networks) throws InsufficientCapacityException, ConcurrentOperationException;
 +
 +    void prepare(VirtualMachineProfile profile, DeployDestination dest, 
ReservationContext context) throws InsufficientCapacityException, 
ConcurrentOperationException,
 +            ResourceUnavailableException;
 +
 +    void release(VirtualMachineProfile vmProfile, boolean forced) throws
 +                      ConcurrentOperationException, 
ResourceUnavailableException;
 +
 +    void cleanupNics(VirtualMachineProfile vm);
 +
 +    void expungeNics(VirtualMachineProfile vm);
 +
 +    List<NicProfile> getNicProfiles(VirtualMachine vm);
 +
 +    boolean applyRules(List<? extends FirewallRule> rules, 
FirewallRule.Purpose purpose, NetworkRuleApplier applier, boolean 
continueOnError) throws ResourceUnavailableException;
 +
 +    Pair<NetworkGuru, NetworkVO> implementNetwork(long networkId, 
DeployDestination dest, ReservationContext context) throws 
ConcurrentOperationException, ResourceUnavailableException,
 +            InsufficientCapacityException;
 +
 +    /**
 +     * prepares vm nic change for migration
 +     * 
 +     * This method will be called in migration transaction before the vm 
migration.
 +     * @param vm
 +     * @param dest
 +     */
 +    void prepareNicForMigration(VirtualMachineProfile vm, DeployDestination 
dest);
 +
 +    /**
 +     * commit vm nic change for migration
 +     * 
 +     * This method will be called in migration transaction after the 
successful
 +     * vm migration.
 +     * @param src
 +     * @param dst
 +     */
 +    void commitNicForMigration(VirtualMachineProfile src, 
VirtualMachineProfile dst);
 +
 +    /**
 +     * rollback vm nic change for migration
 +     * 
 +     * This method will be called in migaration transaction after vm migration
 +     * failure.
 +     * @param src
 +     * @param dst
 +     */
 +    void rollbackNicForMigration(VirtualMachineProfile src, 
VirtualMachineProfile dst);
 +
 +    boolean shutdownNetwork(long networkId, ReservationContext context, 
boolean cleanupElements);
 +
 +    boolean destroyNetwork(long networkId, ReservationContext context);
 +
 +    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 ip6Gateway, String ip6Cidr,
 +                               Boolean displayNetworkEnabled, String 
isolatedPvlan)
 +                    throws ConcurrentOperationException, 
InsufficientCapacityException, ResourceAllocationException;
 +
 +    /**
 +     * @throws ResourceAllocationException TODO
 +     * @throws InsufficientCapacityException
 +     *             Associates an ip address list to an account. The list of 
ip addresses are all addresses associated
 +     *             with the
 +     *             given vlan id.
 +     * @param userId
 +     * @param accountId
 +     * @param zoneId
 +     * @param vlanId
 +     * @throws InsufficientAddressCapacityException
 +     * @throws
 +     */
 +    boolean associateIpAddressListToAccount(long userId, long accountId, long 
zoneId, Long vlanId, Network guestNetwork) throws 
InsufficientCapacityException, ConcurrentOperationException,
 +            ResourceUnavailableException, ResourceAllocationException;
 +
 +    UserDataServiceProvider getPasswordResetProvider(Network network);
 +
 +    UserDataServiceProvider getSSHKeyResetProvider(Network network);
 +
 +    boolean applyIpAssociations(Network network, boolean continueOnError) 
throws ResourceUnavailableException;
 +    
 +    boolean applyIpAssociations(Network network, boolean rulesRevoked, 
boolean continueOnError, List<? extends PublicIpAddress> publicIps) throws 
ResourceUnavailableException;
 +
 +    boolean startNetwork(long networkId, DeployDestination dest, 
ReservationContext context) throws ConcurrentOperationException, 
ResourceUnavailableException, InsufficientCapacityException;
 +
 +    IPAddressVO markIpAsUnavailable(long addrId);
 +
 +    public String acquireGuestIpAddress(Network network, String requestedIp);
 +
 +    boolean applyStaticNats(List<? extends StaticNat> staticNats, boolean 
continueOnError) throws ResourceUnavailableException;
 +
 +    boolean reallocate(VirtualMachineProfile vm,
 +            DataCenterDeployment dest) throws InsufficientCapacityException, 
ConcurrentOperationException;
 +
 +    IpAddress assignSystemIp(long networkId, Account owner,
 +            boolean forElasticLb, boolean forElasticIp)
 +            throws InsufficientAddressCapacityException;
 +
 +    boolean handleSystemIpRelease(IpAddress ip);
 +
 +    void allocateDirectIp(NicProfile nic, DataCenter dc,
 +            VirtualMachineProfile vm,
 +            Network network, String requestedIpv4, String requestedIpv6)
 +            throws InsufficientVirtualNetworkCapcityException,
 +            InsufficientAddressCapacityException;
 +
 +    /**
 +     * @param owner
 +     * @param guestNetwork
 +     * @return
 +     * @throws ConcurrentOperationException
 +     * @throws InsufficientAddressCapacityException
 +     */
 +    PublicIp assignSourceNatIpAddressToGuestNetwork(Account owner, Network 
guestNetwork) throws InsufficientAddressCapacityException, 
ConcurrentOperationException;
 +
 +
 +    /**
 +     * @param requested
 +     * @param network
 +     * @param isDefaultNic
 +     * @param deviceId
 +     * @param vm
 +     * @return
 +     * @throws InsufficientVirtualNetworkCapcityException
 +     * @throws InsufficientAddressCapacityException
 +     * @throws ConcurrentOperationException
 +     */
 +    Pair<NicProfile,Integer> allocateNic(NicProfile requested, Network 
network, Boolean isDefaultNic, int deviceId,
 +            VirtualMachineProfile vm) throws 
InsufficientVirtualNetworkCapcityException,
 +            InsufficientAddressCapacityException, 
ConcurrentOperationException;
 +
 +
 +    /**
 +     * @param vmProfile
 +     * @param dest
 +     * @param context
 +     * @param nicId
 +     * @param network
 +     * @return
 +     * @throws InsufficientVirtualNetworkCapcityException
 +     * @throws InsufficientAddressCapacityException
 +     * @throws ConcurrentOperationException
 +     * @throws InsufficientCapacityException
 +     * @throws ResourceUnavailableException
 +     */
 +    NicProfile prepareNic(VirtualMachineProfile vmProfile, DeployDestination 
dest,
 +            ReservationContext context, long nicId, NetworkVO network) throws 
InsufficientVirtualNetworkCapcityException,
 +            InsufficientAddressCapacityException, 
ConcurrentOperationException, InsufficientCapacityException, 
ResourceUnavailableException;
 +
 +
 +    /**
 +     * @param vm
 +     * @param nic TODO
 +     */
 +    void removeNic(VirtualMachineProfile vm, Nic nic);
 +
 +
 +    /**
 +     * @param ipAddrId
 +     * @param networkId
 +     * @param releaseOnFailure TODO
 +     */
 +    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)
 +            throws ConcurrentOperationException, ResourceAllocationException, 
InsufficientAddressCapacityException;
 +
 +    boolean releasePortableIpAddress(long addrId);
 +
 +    IPAddressVO associatePortableIPToGuestNetwork(long ipAddrId, long 
networkId, boolean releaseOnFailure) throws ResourceAllocationException, 
ResourceUnavailableException,
 +            InsufficientAddressCapacityException, 
ConcurrentOperationException;
 +
 +    IPAddressVO disassociatePortableIPToGuestNetwork(long ipAddrId, long 
networkId) throws ResourceAllocationException, ResourceUnavailableException,
 +            InsufficientAddressCapacityException, 
ConcurrentOperationException;
 +
 +    boolean isPortableIpTransferableFromNetwork(long ipAddrId, long 
networkId);
 +
 +    void transferPortableIP(long ipAddrId, long currentNetworkId, long 
newNetworkId)  throws ResourceAllocationException, ResourceUnavailableException,
 +            InsufficientAddressCapacityException, 
ConcurrentOperationException;;
 +
 +    /**
 +     * @param network
 +     * @param provider
 +     * @return
 +     */
 +    boolean setupDns(Network network, Provider provider);
 +
 +
 +    /**
 +     * @param vmProfile
 +     * @param nic TODO
 +     * @throws ConcurrentOperationException
 +     * @throws ResourceUnavailableException
 +     */
 +    void releaseNic(VirtualMachineProfile vmProfile, Nic nic)
 +            throws ConcurrentOperationException, ResourceUnavailableException;
 +
 +
 +    /**
 +     * @param network
 +     * @param requested
 +     * @param context
 +     * @param vmProfile
 +     * @param prepare TODO
 +     * @return
 +     * @throws InsufficientVirtualNetworkCapcityException
 +     * @throws InsufficientAddressCapacityException
 +     * @throws ConcurrentOperationException
 +     * @throws InsufficientCapacityException
 +     * @throws ResourceUnavailableException
 +     */
 +    NicProfile createNicForVm(Network network, NicProfile requested, 
ReservationContext context, VirtualMachineProfile vmProfile, boolean prepare) 
throws InsufficientVirtualNetworkCapcityException,
 +            InsufficientAddressCapacityException, 
ConcurrentOperationException, InsufficientCapacityException, 
ResourceUnavailableException;
 +
 +
 +    /**
 +     * @param addr
 +     */
 +    void markPublicIpAsAllocated(IPAddressVO addr);
 +
 +
 +    /**
 +     * @param owner
 +     * @param guestNtwkId
 +     * @param vpcId
 +     * @param dcId
 +     * @param isSourceNat
 +     * @return
 +     * @throws ConcurrentOperationException
 +     * @throws InsufficientAddressCapacityException
 +     */
 +    PublicIp assignDedicateIpAddress(Account owner, Long guestNtwkId, Long 
vpcId, long dcId, boolean isSourceNat) throws ConcurrentOperationException, 
InsufficientAddressCapacityException;
 +
 +    NetworkProfile convertNetworkToNetworkProfile(long networkId);
 +
 +    /**
 +     * @return
 +     */
 +    int getNetworkLockTimeout();
 +
 +
 +    boolean restartNetwork(Long networkId, Account callerAccount,
 +            User callerUser, boolean cleanup) throws 
ConcurrentOperationException, ResourceUnavailableException, 
InsufficientCapacityException;
 +
 +
 +    boolean shutdownNetworkElementsAndResources(ReservationContext context,
 +            boolean b, NetworkVO network);
 +
 +
 +      void implementNetworkElementsAndResources(DeployDestination dest,
 +                      ReservationContext context, NetworkVO network,
 +                      NetworkOfferingVO findById) throws 
ConcurrentOperationException, InsufficientAddressCapacityException, 
ResourceUnavailableException, InsufficientCapacityException;
 +
 +
 +      IpAddress allocateIp(Account ipOwner, boolean isSystem, Account caller, 
long callerId,
 +                      DataCenter zone) throws ConcurrentOperationException, 
ResourceAllocationException, InsufficientAddressCapacityException;
 +
 +      Map<String, String> 
finalizeServicesAndProvidersForNetwork(NetworkOffering offering,
 +                      Long physicalNetworkId);
 +
 +    List<Provider> getProvidersForServiceInNetwork(Network network, Service 
service);
 +
 +    StaticNatServiceProvider getStaticNatProviderForNetwork(Network network);
 +    
 +    boolean isNetworkInlineMode(Network network);
 +
 +    int getRuleCountForIp(Long addressId, FirewallRule.Purpose purpose, 
FirewallRule.State state);
 +
 +    LoadBalancingServiceProvider getLoadBalancingProviderForNetwork(Network 
network, Scheme lbScheme);
 +
 +    boolean isSecondaryIpSetForNic(long nicId);
 +
 +    public String allocateGuestIP(Account ipOwner, boolean isSystem, long 
zoneId, Long networkId, String requestedIp) throws 
InsufficientAddressCapacityException;
 +
 +    List<? extends Nic> listVmNics(Long vmId, Long nicId);
 +    
 +    String allocatePublicIpForGuestNic(Long networkId, DataCenter dc, Pod 
pod, Account caller, String requestedIp) throws 
InsufficientAddressCapacityException;
 +
 +    NicVO savePlaceholderNic(Network network, String ip4Address, String 
ip6Address, Type vmType);
 +
 +    DhcpServiceProvider getDhcpServiceProvider(Network network);
 +
 +    PublicIp assignPublicIpAddressFromVlans(long dcId, Long podId, Account 
owner, VlanType type, List<Long> vlanDbIds, Long networkId, String requestedIp, 
boolean isSystem) throws InsufficientAddressCapacityException;
++
 +}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b7db056/engine/components-api/src/com/cloud/storage/VolumeManager.java
----------------------------------------------------------------------
diff --cc engine/components-api/src/com/cloud/storage/VolumeManager.java
index 5345aa7,0000000..15f24f7
mode 100644,000000..100644
--- a/engine/components-api/src/com/cloud/storage/VolumeManager.java
+++ b/engine/components-api/src/com/cloud/storage/VolumeManager.java
@@@ -1,121 -1,0 +1,122 @@@
 +/*
 + * 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.storage;
 +
 +import java.util.Map;
 +
 +import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
 +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 +
 +import com.cloud.agent.api.to.VirtualMachineTO;
 +import com.cloud.deploy.DeployDestination;
 +import com.cloud.exception.ConcurrentOperationException;
 +import com.cloud.exception.InsufficientStorageCapacityException;
 +import com.cloud.exception.ResourceAllocationException;
 +import com.cloud.exception.StorageUnavailableException;
 +import com.cloud.host.Host;
 +import com.cloud.hypervisor.Hypervisor.HypervisorType;
 +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 {
 +
 +    VolumeInfo moveVolume(VolumeInfo volume, long destPoolDcId, Long 
destPoolPodId,
 +            Long destPoolClusterId, HypervisorType dataDiskHyperType)
 +            throws ConcurrentOperationException;
 +
 +    @Override
 +    VolumeVO uploadVolume(UploadVolumeCmd cmd)
 +            throws ResourceAllocationException;
 +
 +    VolumeVO allocateDuplicateVolume(VolumeVO oldVol, Long templateId);
 +
 +    boolean volumeOnSharedStoragePool(VolumeVO volume);
 +
 +    boolean volumeInactive(Volume volume);
 +
 +    String getVmNameOnVolume(Volume volume);
 +
 +    @Override
 +    VolumeVO allocVolume(CreateVolumeCmd cmd)
 +            throws ResourceAllocationException;
 +
 +    @Override
 +    VolumeVO createVolume(CreateVolumeCmd cmd);
 +
 +    @Override
 +    VolumeVO resizeVolume(ResizeVolumeCmd cmd)
 +            throws ResourceAllocationException;
 +
 +    @Override
 +    boolean deleteVolume(long volumeId, Account caller)
 +            throws ConcurrentOperationException;
 +    
 +    void destroyVolume(VolumeVO volume);
 +
 +    DiskProfile allocateRawVolume(Type type, String name, DiskOfferingVO 
offering, Long size, VMInstanceVO vm, Account owner);
 +    @Override
 +    Volume attachVolumeToVM(AttachVolumeCmd command);
 +
 +    @Override
 +    Volume detachVolumeFromVM(DetachVolumeCmd cmmd);
 +
 +    void release(VirtualMachineProfile profile);
 +
 +    void cleanupVolumes(long vmId) throws ConcurrentOperationException;
 +
 +    @Override
 +    Volume migrateVolume(MigrateVolumeCmd cmd);
 +
 +    void migrateVolumes(VirtualMachine vm, VirtualMachineTO vmTo, Host 
srcHost, Host destHost,
 +            Map<Volume, StoragePool> volumeToPool);
 +
 +    boolean storageMigration(
 +            VirtualMachineProfile vm,
 +            StoragePool destPool);
 +
 +    void prepareForMigration(
 +            VirtualMachineProfile vm,
 +            DeployDestination dest);
 +
 +    void prepare(VirtualMachineProfile vm,
 +            DeployDestination dest) throws StorageUnavailableException,
 +            InsufficientStorageCapacityException, 
ConcurrentOperationException;
 +
 +    boolean canVmRestartOnAnotherServer(long vmId);
 +
 +    DiskProfile allocateTemplatedVolume(Type type, String name,
 +            DiskOfferingVO offering, VMTemplateVO template, VMInstanceVO vm,
 +            Account owner);
 +
++
 +    String getVmNameFromVolumeId(long volumeId);
 +
 +    String getStoragePoolOfVolume(long volumeId);
 +
 +    boolean validateVolumeSizeRange(long size);
 +}

Reply via email to