cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kous...@apache.org
Subject [2/2] git commit: updated refs/heads/master to 7095ea2
Date Thu, 07 Nov 2013 07:15:32 GMT
CLOUDSTACK-4738 Dynamic compute offering.

Signed-off-by: Koushik Das <koushik@apache.org>


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

Branch: refs/heads/master
Commit: 7095ea2b5e497620c8c879517565046e3b46e493
Parents: 01b29a0
Author: Bharat Kumar <bharat.kumar@citrix.com>
Authored: Wed Nov 6 21:42:44 2013 +0530
Committer: Koushik Das <koushik@apache.org>
Committed: Thu Nov 7 12:41:20 2013 +0530

----------------------------------------------------------------------
 api/src/com/cloud/offering/ServiceOffering.java |   8 +-
 api/src/com/cloud/vm/UserVmService.java         |  33 ++--
 .../org/apache/cloudstack/api/ApiConstants.java |   1 +
 .../offering/CreateServiceOfferingCmd.java      |  23 +--
 .../api/command/user/vm/DeployVMCmd.java        |  34 +++-
 .../service/VolumeOrchestrationService.java     |   2 +-
 .../service/api/OrchestrationService.java       |   4 +-
 .../src/com/cloud/event/UsageEventUtils.java    |  16 ++
 .../com/cloud/vm/VirtualMachineManagerImpl.java |   8 +-
 .../engine/orchestration/CloudOrchestrator.java |   7 +-
 .../orchestration/VolumeOrchestrator.java       |   6 +-
 .../spring-engine-schema-core-daos-context.xml  |   1 +
 .../com/cloud/event/UsageEventDetailsVO.java    |  72 +++++++++
 .../src/com/cloud/event/dao/UsageEventDao.java  |   3 +
 .../com/cloud/event/dao/UsageEventDaoImpl.java  |   9 +-
 .../cloud/event/dao/UsageEventDetailsDao.java   |  33 ++++
 .../event/dao/UsageEventDetailsDaoImpl.java     | 104 ++++++++++++
 .../com/cloud/service/ServiceOfferingVO.java    |  43 +++--
 .../cloud/service/dao/ServiceOfferingDao.java   |   5 +
 .../service/dao/ServiceOfferingDaoImpl.java     |  52 +++++-
 .../implicitplanner/ImplicitPlannerTest.java    |   3 +-
 .../networkservice/BaremetalPxeManagerImpl.java |   2 +-
 .../impl/UserConcentratedAllocator.java         |   2 +-
 .../com/cloud/api/query/QueryManagerImpl.java   |   2 +-
 .../com/cloud/capacity/CapacityManagerImpl.java |  25 +--
 .../configuration/ConfigurationManagerImpl.java |  24 +--
 .../VirtualNetworkApplianceManagerImpl.java     |   2 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java  | 158 ++++++++++++-------
 .../com/cloud/capacity/CapacityManagerTest.java |   2 +-
 server/test/com/cloud/vm/UserVmManagerTest.java |   2 +-
 .../CreateNetworkOfferingTest.java              |  12 ++
 .../service/ServiceOfferingVOTest.java          |  49 ++++++
 server/test/resources/createNetworkOffering.xml |   4 +-
 setup/db/db/schema-421to430.sql                 |  10 ++
 34 files changed, 618 insertions(+), 143 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/api/src/com/cloud/offering/ServiceOffering.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/offering/ServiceOffering.java b/api/src/com/cloud/offering/ServiceOffering.java
index 9f7bf8e..e4c65cd 100755
--- a/api/src/com/cloud/offering/ServiceOffering.java
+++ b/api/src/com/cloud/offering/ServiceOffering.java
@@ -61,17 +61,17 @@ public interface ServiceOffering extends DiskOffering, InfrastructureEntity, Int
     /**
      * @return # of cpu.
      */
-    int getCpu();
+    Integer getCpu();
 
     /**
      * @return speed in mhz
      */
-    int getSpeed();
+    Integer getSpeed();
 
     /**
      * @return ram size in megabytes
      */
-    int getRamSize();
+    Integer getRamSize();
 
     /**
      * @return Does this service plan offer HA?
@@ -117,4 +117,6 @@ public interface ServiceOffering extends DiskOffering, InfrastructureEntity, Int
     String getSystemVmType();
 
     String getDeploymentPlanner();
+
+    boolean isDynamic();
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/api/src/com/cloud/vm/UserVmService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/UserVmService.java b/api/src/com/cloud/vm/UserVmService.java
index 0b142e8..6fc8b54 100755
--- a/api/src/com/cloud/vm/UserVmService.java
+++ b/api/src/com/cloud/vm/UserVmService.java
@@ -136,6 +136,7 @@ public interface UserVmService {
      * Creates a Basic Zone User VM in the database and returns the VM to the
      * caller.
      *
+     *
      * @param zone
      *            - availability zone for the virtual machine
      * @param serviceOffering
@@ -181,13 +182,15 @@ public interface UserVmService {
      * @param displayVm
      *            - Boolean flag whether to the display the vm to the end user or not
      * @param affinityGroupIdList
-     *
      * @param accountName
      *            - an optional account for the virtual machine. Must be used
      *            with domainId
      * @param domainId
      *            - an optional domainId for the virtual machine. If the account
      *            parameter is used, domainId must also be used
+     * @param cpuSpeed
+     * @param memory
+     * @param cpuNumber
      * @return UserVm object if successful.
      *
      * @throws InsufficientCapacityException
@@ -201,15 +204,16 @@ public interface UserVmService {
      * @throws InsufficientResourcesException
      */
     UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList, Account owner, String hostName,
-        String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
-	    HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
-	    IpAddresses defaultIp, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList)
+                                                  String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
+                                                  HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
+                                                  IpAddresses defaultIp, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList, Integer cpuSpeed, Integer memory, Integer cpuNumber, Long rootdisksize)
             throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
 
     /**
      * Creates a User VM in Advanced Zone (Security Group feature is enabled) in
      * the database and returns the VM to the caller.
      *
+     *
      * @param zone
      *            - availability zone for the virtual machine
      * @param serviceOffering
@@ -257,13 +261,15 @@ public interface UserVmService {
      * @param displayVm
      *            - Boolean flag whether to the display the vm to the end user or not
      * @param affinityGroupIdList
-     *
      * @param accountName
      *            - an optional account for the virtual machine. Must be used
      *            with domainId
      * @param domainId
      *            - an optional domainId for the virtual machine. If the account
      *            parameter is used, domainId must also be used
+     * @param CpuSpeed
+     * @param memory
+     * @param cpuNumber
      * @return UserVm object if successful.
      *
      * @throws InsufficientCapacityException
@@ -277,14 +283,15 @@ public interface UserVmService {
      * @throws InsufficientResourcesException
      */
     UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, List<Long> securityGroupIdList,
-        Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, String sshKeyPair,
-	    Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList)
+                                                     Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, String sshKeyPair,
+                                                     Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList, Integer cpuSpeed, Integer memory, Integer cpuNumber, Long rootdisksize)
             throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
 
     /**
      * Creates a User VM in Advanced Zone (Security Group feature is disabled)
      * in the database and returns the VM to the caller.
      * 
+     *
      * @param zone
      *            - availability zone for the virtual machine
      * @param serviceOffering
@@ -329,15 +336,17 @@ public interface UserVmService {
      * @param displayVm
      *            - Boolean flag whether to the display the vm to the end user or not
      * @param affinityGroupIdList
-     *
      * @param accountName
      *            - an optional account for the virtual machine. Must be used
      *            with domainId
      * @param domainId
      *            - an optional domainId for the virtual machine. If the account
      *            parameter is used, domainId must also be used
+     * @param cpuSpeed
+     * @param memory
+     * @param cpuNumber
      * @return UserVm object if successful.
-     * 
+     *
      * @throws InsufficientCapacityException
      *             if there is insufficient capacity to deploy the VM.
      * @throws ConcurrentOperationException
@@ -349,9 +358,9 @@ public interface UserVmService {
      * @throws InsufficientResourcesException
      */
     UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner, String hostName,
-            String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
-	        HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
-	        IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList)
+                                        String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
+                                        HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps,
+                                        IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList, Integer cpuSpeed, Integer memory, Integer cpuNumber, Long rootdkisksize)
 
             throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index 8ab6c5e..20e848d 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -61,6 +61,7 @@ public class ApiConstants {
     public static final String DEVICE_ID = "deviceid";
     public static final String DISK_OFFERING_ID = "diskofferingid";
     public static final String DISK_SIZE = "disksize";
+    public static final String ROOT_DISK_SIZE = "rootdisksize";
     public static final String DISPLAY_NAME = "displayname";
     public static final String DISPLAY_NETWORK = "displaynetwork";
     public static final String DISPLAY_NIC = "displaynic";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
index decac29..63f19cc 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
@@ -41,17 +41,17 @@ public class CreateServiceOfferingCmd extends BaseCmd {
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @Parameter(name=ApiConstants.CPU_NUMBER, type=CommandType.LONG, required=true, description="the CPU number of the service offering")
-    private Long cpuNumber;
+    @Parameter(name=ApiConstants.CPU_NUMBER, type=CommandType.INTEGER, required=false, description="the CPU number of the service offering")
+    private Integer cpuNumber;
 
-    @Parameter(name=ApiConstants.CPU_SPEED, type=CommandType.LONG, required=true, description="the CPU speed of the service offering in MHz.")
-    private Long cpuSpeed;
+    @Parameter(name=ApiConstants.CPU_SPEED, type=CommandType.INTEGER, required=false, description="the CPU speed of the service offering in MHz.")
+    private Integer cpuSpeed;
 
     @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of the service offering")
     private String displayText;
 
-    @Parameter(name=ApiConstants.MEMORY, type=CommandType.LONG, required=true, description="the total memory of the service offering in MB")
-    private Long memory;
+    @Parameter(name=ApiConstants.MEMORY, type=CommandType.INTEGER, required=false, description="the total memory of the service offering in MB")
+    private Integer memory;
 
     @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the service offering")
     private String serviceOfferingName;
@@ -109,11 +109,11 @@ public class CreateServiceOfferingCmd extends BaseCmd {
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    public Long getCpuNumber() {
+    public Integer getCpuNumber() {
         return cpuNumber;
     }
 
-    public Long getCpuSpeed() {
+    public Integer getCpuSpeed() {
         return cpuSpeed;
     }
 
@@ -121,7 +121,7 @@ public class CreateServiceOfferingCmd extends BaseCmd {
         return displayText;
     }
 
-    public Long getMemory() {
+    public Integer getMemory() {
         return memory;
     }
 
@@ -173,6 +173,11 @@ public class CreateServiceOfferingCmd extends BaseCmd {
         return deploymentPlanner;
     }
 
+    public boolean getCustomized() {
+        return (cpuNumber == null || memory == null || cpuSpeed == null);
+    }
+
+
     public Map<String, String> getDetails() {
         if (details == null || details.isEmpty()) {
             return null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
index 8a6cea7..3643f91 100755
--- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
@@ -188,6 +188,18 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
     @Parameter(name=ApiConstants.DISPLAY_VM, type=CommandType.BOOLEAN, since="4.2", description="an optional field, whether to the display the vm to the end user or not.")
     private Boolean displayVm;
 
+    @Parameter(name=ApiConstants.CPU_SPEED, type = CommandType.INTEGER, since="4.3", description = "optional field to specify the cpu speed when using dynamic compute offering.")
+    private Integer cpuSpeed;
+
+    @Parameter(name=ApiConstants.MEMORY, type = CommandType.INTEGER, since="4.3", description = "optional field to specify the memory when using dynamic compute offering")
+    private Integer memory;
+
+    @Parameter(name=ApiConstants.CPU_NUMBER, type=CommandType.INTEGER, since="4.3", description = "optional field to specify the number of cpu cores when using dynamic offering.")
+    private Integer cpuNumber;
+
+    @Parameter(name=ApiConstants.ROOT_DISK_SIZE, type=CommandType.LONG, since="4.3", description = "optional field to specify the number of cpu cores when using dynamic offering.")
+    private Long rootdisksize;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -227,6 +239,22 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
         return displayVm;
     }
 
+    public Integer getMemory() {
+        return memory;
+    }
+
+    public Integer getCpuSpeed() {
+        return cpuSpeed;
+    }
+
+    public Integer getCpuNumber() {
+        return cpuNumber;
+    }
+
+    public Long getRootdisksize() {
+        return rootdisksize;
+    }
+
     public List<Long> getSecurityGroupIdList() {
         if (securityGroupNameList != null && securityGroupIdList != null) {
             throw new InvalidParameterValueException("securitygroupids parameter is mutually exclusive with securitygroupnames parameter");
@@ -495,19 +523,19 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
                     throw new InvalidParameterValueException("Can't specify network Ids in Basic zone");
                 } else {
                     vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name,
-                            displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
+                            displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList(), cpuSpeed, memory, cpuNumber, rootdisksize);
                 }
             } else {
                 if (zone.isSecurityGroupEnabled())  {
                     vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(),
-                            owner, name, displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
+                            owner, name, displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList(), cpuSpeed, memory, cpuNumber, rootdisksize );
 
                 } else {
                     if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) {
                         throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone");
                     }
                     vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName,
-                            diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
+                            diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList(), cpuSpeed, memory, cpuNumber, rootdisksize);
 
                 }
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/VolumeOrchestrationService.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/VolumeOrchestrationService.java b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/VolumeOrchestrationService.java
index a773ac4..ad957d5 100644
--- a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/VolumeOrchestrationService.java
+++ b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/VolumeOrchestrationService.java
@@ -86,7 +86,7 @@ public interface VolumeOrchestrationService {
 
     boolean canVmRestartOnAnotherServer(long vmId);
 
-    DiskProfile allocateTemplatedVolume(Type type, String name, DiskOffering offering, VirtualMachineTemplate template, VirtualMachine vm, Account owner);
+    DiskProfile allocateTemplatedVolume(Type type, String name, DiskOffering offering, Long rootDisksize, VirtualMachineTemplate template, VirtualMachine vm, Account owner);
 
     String getVmNameFromVolumeId(long volumeId);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/engine/api/src/org/apache/cloudstack/engine/service/api/OrchestrationService.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/service/api/OrchestrationService.java b/engine/api/src/org/apache/cloudstack/engine/service/api/OrchestrationService.java
index 64ef063..8c58227 100755
--- a/engine/api/src/org/apache/cloudstack/engine/service/api/OrchestrationService.java
+++ b/engine/api/src/org/apache/cloudstack/engine/service/api/OrchestrationService.java
@@ -55,6 +55,7 @@ public interface OrchestrationService {
      * @param computeTags tags for the compute
      * @param rootDiskTags tags for the root disk
      * @param networks networks that this VM should join
+     * @param rootDiskSize size the root disk in case of templates.
      * @return VirtualMachineEntity
      */
     @POST
@@ -73,7 +74,8 @@ public interface OrchestrationService {
             @QueryParam("compute-tags") List<String> computeTags,
             @QueryParam("root-disk-tags") List<String> rootDiskTags,
             @QueryParam("network-nic-map") Map<String, NicProfile> networkNicMap,
-            @QueryParam("deploymentplan") DeploymentPlan plan
+            @QueryParam("deploymentplan") DeploymentPlan plan,
+            @QueryParam("root-disk-size") Long rootDiskSize
             ) throws InsufficientCapacityException;
 
     @POST

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/engine/components-api/src/com/cloud/event/UsageEventUtils.java
----------------------------------------------------------------------
diff --git a/engine/components-api/src/com/cloud/event/UsageEventUtils.java b/engine/components-api/src/com/cloud/event/UsageEventUtils.java
index b44ed32..a4be4dd 100644
--- a/engine/components-api/src/com/cloud/event/UsageEventUtils.java
+++ b/engine/components-api/src/com/cloud/event/UsageEventUtils.java
@@ -25,6 +25,7 @@ import java.util.Map;
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
+import com.cloud.event.dao.UsageEventDetailsDao;
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.NoSuchBeanDefinitionException;
 
@@ -38,6 +39,8 @@ import com.cloud.event.dao.UsageEventDao;
 import com.cloud.user.Account;
 import com.cloud.user.dao.AccountDao;
 import com.cloud.utils.component.ComponentContext;
+import org.springframework.beans.factory.annotation.Autowire;
+import org.springframework.beans.factory.annotation.Autowired;
 
 public class UsageEventUtils {
 
@@ -103,6 +106,19 @@ public class UsageEventUtils {
         publishUsageEvent(usageType, accountId, zoneId, entityType, entityUUID);
     }
 
+    public static void publishUsageEvent(String usageType, long accountId, long zoneId, long resourceId,
+                                         String resourceName, Long offeringId, Long templateId, String resourceType,
+                                         String entityType, String entityUUID, Map<String, String> details) {
+        saveUsageEvent(usageType, accountId, zoneId, resourceId, resourceName, offeringId, templateId, resourceType, details);
+        publishUsageEvent(usageType, accountId, zoneId, entityType, entityUUID);
+    }
+
+    private static void saveUsageEvent(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId, String resourceType, Map<String,String> details) {
+        UsageEventVO usageEvent = new UsageEventVO(usageType, accountId, zoneId, resourceId, resourceName, offeringId, templateId, resourceType);
+        _usageEventDao.persist(usageEvent);
+        _usageEventDao.saveDetails(usageEvent.getId(), details);
+    }
+
     public static void saveUsageEvent(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId, Long size) {
         _usageEventDao.persist( new UsageEventVO(usageType, accountId, zoneId, resourceId, resourceName, offeringId, templateId, size));
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index b74b4c5..555a58f 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -356,7 +356,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
                 } else if (template.getFormat() == ImageFormat.BAREMETAL) {
                     // Do nothing
                 } else {
-                    volumeMgr.allocateTemplatedVolume(Type.ROOT, "ROOT-" + vmFinal.getId(), rootDiskOffering.first(), template, vmFinal, owner);
+                    volumeMgr.allocateTemplatedVolume(Type.ROOT, "ROOT-" + vmFinal.getId(), rootDiskOffering.first(), rootDiskOffering.second(), template, vmFinal, owner);
                 }
         
                 for (Map.Entry<? extends DiskOffering, Long> offering : dataDiskOfferingsFinal.entrySet()) {
@@ -674,7 +674,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         ItWorkVO work = start.third();
 
         VMInstanceVO startedVm = null;
-        ServiceOfferingVO offering = _offeringDao.findById(vm.getServiceOfferingId());
+        ServiceOfferingVO offering = _offeringDao.findById(vm.getId(), vm.getServiceOfferingId());
         VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, vm.getTemplateId());
 
         if (s_logger.isDebugEnabled()) {
@@ -2771,7 +2771,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
 
     @Override
     public void checkIfCanUpgrade(VirtualMachine vmInstance, long newServiceOfferingId) {
-        ServiceOfferingVO newServiceOffering = _offeringDao.findById(newServiceOfferingId);
+        ServiceOfferingVO newServiceOffering = _offeringDao.findById(vmInstance.getId(), newServiceOfferingId);
         if (newServiceOffering == null) {
             throw new InvalidParameterValueException("Unable to find a service offering with id " + newServiceOfferingId);
         }
@@ -2793,7 +2793,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
                     newServiceOffering.getName() + ")");
         }
 
-        ServiceOfferingVO currentServiceOffering = _offeringDao.findByIdIncludingRemoved(vmInstance.getServiceOfferingId());
+        ServiceOfferingVO currentServiceOffering = _offeringDao.findByIdIncludingRemoved(vmInstance.getId(), vmInstance.getServiceOfferingId());
 
         // Check that the service offering being upgraded to has the same Guest IP type as the VM's current service offering
         // NOTE: With the new network refactoring in 2.2, we shouldn't need the check for same guest IP type anymore.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java
index 2fd10b6..5dd15ce 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java
@@ -164,7 +164,7 @@ public class CloudOrchestrator implements OrchestrationService {
             Long diskSize,
             List<String> computeTags,
             List<String> rootDiskTags,
-            Map<String, NicProfile> networkNicMap, DeploymentPlan plan) throws InsufficientCapacityException {
+            Map<String, NicProfile> networkNicMap, DeploymentPlan plan, Long rootDiskSize) throws InsufficientCapacityException {
 
     	// VirtualMachineEntityImpl vmEntity = new VirtualMachineEntityImpl(id, owner, hostName, displayName, cpu, speed, memory, computeTags, rootDiskTags, networks, vmEntityManager);
 
@@ -191,8 +191,9 @@ public class CloudOrchestrator implements OrchestrationService {
     	Pair<DiskOfferingVO, Long> rootDiskOffering = new Pair<DiskOfferingVO, Long>(null, null);
         LinkedHashMap<DiskOfferingVO, Long> dataDiskOfferings = new LinkedHashMap<DiskOfferingVO, Long>();
 
-		ServiceOfferingVO offering = _serviceOfferingDao.findById(vm.getServiceOfferingId());
+		ServiceOfferingVO offering = _serviceOfferingDao.findById(vm.getId(), vm.getServiceOfferingId());
 		rootDiskOffering.first(offering);
+        rootDiskOffering.second(rootDiskSize);
 
 		if(vm.getDiskOfferingId() != null){
     		DiskOfferingVO diskOffering = _diskOfferingDao.findById(vm.getDiskOfferingId());
@@ -238,7 +239,7 @@ public class CloudOrchestrator implements OrchestrationService {
     	VMInstanceVO vm = _vmDao.findByUuid(id);
 
 		Pair<DiskOffering, Long> rootDiskOffering = new Pair<DiskOffering, Long>(null, null);
-		ServiceOfferingVO offering = _serviceOfferingDao.findById(vm.getServiceOfferingId());
+		ServiceOfferingVO offering = _serviceOfferingDao.findById(vm.getId(), vm.getServiceOfferingId());
 		rootDiskOffering.first(offering);
 
         LinkedHashMap<DiskOffering, Long> dataDiskOfferings = new LinkedHashMap<DiskOffering, Long>();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
index ab626c8..f839d6c 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -586,11 +586,13 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
     }
 
     @Override
-    public DiskProfile allocateTemplatedVolume(Type type, String name, DiskOffering offering, VirtualMachineTemplate template, VirtualMachine vm, Account owner) {
+    public DiskProfile allocateTemplatedVolume(Type type, String name, DiskOffering offering, Long rootDisksize, VirtualMachineTemplate template, VirtualMachine vm, Account owner) {
         assert (template.getFormat() != ImageFormat.ISO) : "ISO is not a template really....";
 
         Long size = _tmpltMgr.getTemplateSize(template.getId(), vm.getDataCenterId());
-
+        if (rootDisksize != null) {
+            size = (rootDisksize * 1024 * 1024 * 1024);
+        }
         VolumeVO vol = new VolumeVO(type,
             name,
             vm.getDataCenterId(),

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
----------------------------------------------------------------------
diff --git a/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
index 98ef018..a64e5c0 100644
--- a/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
+++ b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
@@ -263,6 +263,7 @@
   <bean id="uploadDaoImpl" class="com.cloud.storage.dao.UploadDaoImpl" />
   <bean id="usageDaoImpl" class="com.cloud.usage.dao.UsageDaoImpl" />
   <bean id="usageEventDaoImpl" class="com.cloud.event.dao.UsageEventDaoImpl" />
+  <bean id="usageEventDetailsDaoImpl" class="com.cloud.event.dao.UsageEventDetailsDaoImpl" />
   <bean id="usageIPAddressDaoImpl" class="com.cloud.usage.dao.UsageIPAddressDaoImpl" />
   <bean id="usageJobDaoImpl" class="com.cloud.usage.dao.UsageJobDaoImpl" />
   <bean id="usageLoadBalancerPolicyDaoImpl" class="com.cloud.usage.dao.UsageLoadBalancerPolicyDaoImpl" />

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/engine/schema/src/com/cloud/event/UsageEventDetailsVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/UsageEventDetailsVO.java b/engine/schema/src/com/cloud/event/UsageEventDetailsVO.java
new file mode 100644
index 0000000..d6d118b
--- /dev/null
+++ b/engine/schema/src/com/cloud/event/UsageEventDetailsVO.java
@@ -0,0 +1,72 @@
+// 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.event;
+
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="usage_event_details")
+public class UsageEventDetailsVO {
+
+        @Id
+        @Column(name="id")
+        long id;
+
+        @Column(name = "usage_event_id", nullable = false)
+        long usageEventId;
+
+        @Column(name = "name", nullable = false)
+        String key;
+
+        @Column(name = "value")
+        String value;
+
+        public UsageEventDetailsVO() {
+        }
+
+
+        public UsageEventDetailsVO(long usageEventId, String key, String value) {
+            this.key = key;
+            this.value = value;
+            this.usageEventId = usageEventId;
+        }
+
+        public long getId() {
+            return id;
+        }
+
+        public void setUsageEventId(long usageEventId) {
+            this.usageEventId = usageEventId;
+        }
+
+        public long getUsageEventId() {
+            return usageEventId;
+        }
+
+        public String getKey() {
+            return this.key;
+        }
+
+        public String getValue() {
+            return this.value;
+        }
+
+    }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/engine/schema/src/com/cloud/event/dao/UsageEventDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/dao/UsageEventDao.java b/engine/schema/src/com/cloud/event/dao/UsageEventDao.java
index 01979e1..dc6f824 100644
--- a/engine/schema/src/com/cloud/event/dao/UsageEventDao.java
+++ b/engine/schema/src/com/cloud/event/dao/UsageEventDao.java
@@ -18,6 +18,7 @@ package com.cloud.event.dao;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 import com.cloud.event.UsageEventVO;
 import com.cloud.utils.db.GenericDao;
@@ -32,4 +33,6 @@ public interface UsageEventDao extends GenericDao<UsageEventVO, Long> {
 
     List<UsageEventVO> listDirectIpEvents(Date startDate, Date endDate, long zoneId);
 
+    void saveDetails(long eventId, Map<String, String> details);
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java b/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java
index 4333903..370afba 100644
--- a/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java
+++ b/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java
@@ -20,9 +20,11 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 import java.util.TimeZone;
 
 import javax.ejb.Local;
+import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
@@ -51,7 +53,7 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem
     private static final String COPY_ALL_EVENTS = "INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size) " +
             "SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size FROM cloud.usage_event vmevt WHERE vmevt.id <= ?";
     private static final String MAX_EVENT = "select max(id) from cloud.usage_event where created <= ?";
-
+    @Inject protected UsageEventDetailsDao usageEventDetailsDao;
 
     public UsageEventDaoImpl () {
         latestEventsSearch = createSearchBuilder();
@@ -184,4 +186,9 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem
         return listBy(sc, filter);
     }
 
+    @Override
+    public void saveDetails(long eventId, Map<String, String> details) {
+         usageEventDetailsDao.persist(eventId, details);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/engine/schema/src/com/cloud/event/dao/UsageEventDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/dao/UsageEventDetailsDao.java b/engine/schema/src/com/cloud/event/dao/UsageEventDetailsDao.java
new file mode 100644
index 0000000..fb9c0e2
--- /dev/null
+++ b/engine/schema/src/com/cloud/event/dao/UsageEventDetailsDao.java
@@ -0,0 +1,33 @@
+// 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.event.dao;
+import java.util.Map;
+
+import com.cloud.event.UsageEventDetailsVO;
+import com.cloud.utils.db.GenericDao;
+
+
+public interface UsageEventDetailsDao extends GenericDao<UsageEventDetailsVO, Long> {
+    Map<String, String> findDetails(long eventId);
+
+    void persist(long eventId, Map<String, String> details);
+
+    UsageEventDetailsVO findDetail(long eventId, String key);
+
+    void deleteDetails(long eventId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/engine/schema/src/com/cloud/event/dao/UsageEventDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/dao/UsageEventDetailsDaoImpl.java b/engine/schema/src/com/cloud/event/dao/UsageEventDetailsDaoImpl.java
new file mode 100644
index 0000000..a4382c4
--- /dev/null
+++ b/engine/schema/src/com/cloud/event/dao/UsageEventDetailsDaoImpl.java
@@ -0,0 +1,104 @@
+// 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.event.dao;
+
+import com.cloud.event.UsageEventDetailsVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.TransactionLegacy;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import javax.ejb.Local;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Component
+@Local(value={UsageEventDetailsDao.class})
+public class UsageEventDetailsDaoImpl extends GenericDaoBase<UsageEventDetailsVO, Long> implements UsageEventDetailsDao {
+    public static final Logger s_logger = Logger.getLogger(UsageEventDetailsDaoImpl.class.getName());
+
+    protected final SearchBuilder<UsageEventDetailsVO> EventDetailsSearch;
+    protected final SearchBuilder<UsageEventDetailsVO> DetailSearch;
+
+    public UsageEventDetailsDaoImpl() {
+
+        EventDetailsSearch =createSearchBuilder();
+        EventDetailsSearch.and("eventId", EventDetailsSearch.entity().getUsageEventId(), SearchCriteria.Op.EQ);
+        EventDetailsSearch.done();
+
+        DetailSearch = createSearchBuilder();
+        DetailSearch.and("eventId", DetailSearch.entity().getUsageEventId(), SearchCriteria.Op.EQ);
+        DetailSearch.and("key", DetailSearch.entity().getKey(), SearchCriteria.Op.EQ);
+        DetailSearch.done();
+
+
+    }
+
+    @Override
+    public void deleteDetails(long eventId) {
+        SearchCriteria<UsageEventDetailsVO> sc = EventDetailsSearch.create();
+        sc.setParameters("eventId", eventId);
+
+        List<UsageEventDetailsVO> results = search(sc, null);
+        for (UsageEventDetailsVO result : results) {
+            remove(result.getId());
+        }
+    }
+
+    @Override
+    public UsageEventDetailsVO findDetail(long eventId, String key) {
+        SearchCriteria<UsageEventDetailsVO> sc = DetailSearch.create();
+        sc.setParameters("eventId", eventId);
+        sc.setParameters("key", key);
+
+        return findOneBy(sc);
+    }
+
+    @Override
+    public Map<String, String> findDetails(long eventId) {
+        SearchCriteria<UsageEventDetailsVO> sc = EventDetailsSearch.create();
+        sc.setParameters("eventId", eventId);
+
+        List<UsageEventDetailsVO> results = search(sc, null);
+        Map<String, String> details = new HashMap<String, String>(results.size());
+        for (UsageEventDetailsVO result : results) {
+            details.put(result.getKey(), result.getValue());
+        }
+
+        return details;
+    }
+
+    @Override
+    public void persist(long eventId, Map<String, String> details) {
+        TransactionLegacy txn = TransactionLegacy.currentTxn();
+        txn.start();
+        SearchCriteria<UsageEventDetailsVO> sc = EventDetailsSearch.create();
+        sc.setParameters("eventId", eventId);
+        expunge(sc);
+
+        for (Map.Entry<String, String> detail : details.entrySet()) {
+            UsageEventDetailsVO vo = new UsageEventDetailsVO(eventId, detail.getKey(), detail.getValue());
+            persist(vo);
+        }
+        txn.commit();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/engine/schema/src/com/cloud/service/ServiceOfferingVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/service/ServiceOfferingVO.java b/engine/schema/src/com/cloud/service/ServiceOfferingVO.java
index 9a262c5..1e89add 100755
--- a/engine/schema/src/com/cloud/service/ServiceOfferingVO.java
+++ b/engine/schema/src/com/cloud/service/ServiceOfferingVO.java
@@ -18,12 +18,7 @@ package com.cloud.service;
 
 import java.util.Map;
 
-import javax.persistence.Column;
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.Entity;
-import javax.persistence.PrimaryKeyJoinColumn;
-import javax.persistence.Table;
-import javax.persistence.Transient;
+import javax.persistence.*;
 
 import com.cloud.offering.ServiceOffering;
 import com.cloud.storage.DiskOfferingVO;
@@ -34,14 +29,18 @@ import com.cloud.vm.VirtualMachine;
 @DiscriminatorValue(value="Service")
 @PrimaryKeyJoinColumn(name="id")
 public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering {
+    public enum DynamicParameters {
+        cpuSpeed, cpuNumber, memory
+    };
+
     @Column(name="cpu")
-	private int cpu;
+    private Integer cpu;
 
     @Column(name="speed")
-    private int speed;
+    private Integer speed;
 
     @Column(name="ram_size")
-	private int ramSize;
+    private Integer ramSize;
 
     @Column(name="nw_rate")
     private Integer rateMbps;
@@ -83,7 +82,8 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
         super();
     }
 
-    public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, boolean defaultUse) {
+    public ServiceOfferingVO(String name, Integer cpu, Integer ramSize, Integer speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText,
+                             boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, boolean defaultUse) {
         super(name, displayText, false, tags, recreatable, useLocalStorage, systemUse, true);
         this.cpu = cpu;
         this.ramSize = ramSize;
@@ -97,7 +97,8 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
         this.vm_type = vm_type == null ? null : vm_type.toString().toLowerCase();
     }
 
-    public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitCpuUse, boolean volatileVm, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId) {
+    public ServiceOfferingVO(String name, Integer cpu, Integer ramSize, Integer speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitCpuUse,
+                             boolean volatileVm, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId) {
         super(name, displayText, false, tags, recreatable, useLocalStorage, systemUse, true, domainId);
         this.cpu = cpu;
         this.ramSize = ramSize;
@@ -110,12 +111,14 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
         this.vm_type = vm_type == null ? null : vm_type.toString().toLowerCase();
     }
 
-    public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitResourceUse, boolean volatileVm, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId, String hostTag) {
-        this(name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, limitResourceUse, volatileVm, displayText, useLocalStorage, recreatable, tags, systemUse, vm_type, domainId);
+    public ServiceOfferingVO(String name, Integer cpu, Integer ramSize, Integer speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitResourceUse,
+                              boolean volatileVm, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId, String hostTag) {
+        this(name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, limitResourceUse, volatileVm, displayText, useLocalStorage, recreatable, tags, systemUse,
+            vm_type, domainId);
         this.hostTag = hostTag;
     }
 
-    public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps,
+    public ServiceOfferingVO(String name, Integer cpu, Integer ramSize, Integer speed, Integer rateMbps, Integer multicastRateMbps,
             boolean offerHA, boolean limitResourceUse, boolean volatileVm, String displayText, boolean useLocalStorage,
             boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId,
             String hostTag, String deploymentPlanner) {
@@ -159,7 +162,7 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
 	}
 
 	@Override
-	public int getCpu() {
+	public Integer getCpu() {
 	    return cpu;
 	}
 
@@ -176,12 +179,12 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
 	}
 
 	@Override
-	public int getSpeed() {
+	public Integer getSpeed() {
 	    return speed;
 	}
 
 	@Override
-	public int getRamSize() {
+	public Integer getRamSize() {
 	    return ramSize;
 	}
 
@@ -252,4 +255,10 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
     public void setDetails(Map<String, String> details) {
         this.details = details;
     }
+
+    public boolean isDynamic() {
+        return cpu == null || speed == null || ramSize == null;
+    }
+
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDao.java b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDao.java
index 7da7208..c5c4cff 100644
--- a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDao.java
+++ b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDao.java
@@ -17,6 +17,7 @@
 package com.cloud.service.dao;
 
 import java.util.List;
+import java.util.Map;
 
 import com.cloud.service.ServiceOfferingVO;
 import com.cloud.utils.db.GenericDao;
@@ -33,4 +34,8 @@ public interface ServiceOfferingDao extends GenericDao<ServiceOfferingVO, Long>
     ServiceOfferingVO persistDeafultServiceOffering(ServiceOfferingVO offering);
     void loadDetails(ServiceOfferingVO serviceOffering);
     void saveDetails(ServiceOfferingVO serviceOffering);
+    ServiceOfferingVO findById(Long vmId, long serviceOfferingId);
+    ServiceOfferingVO findByIdIncludingRemoved(Long vmId, long serviceOfferingId);
+     boolean isDynamic(long serviceOfferingId);
+    ServiceOfferingVO getcomputeOffering(long serviceOfferingId, Integer cpuCores, Integer cpuSpeed, Integer memory);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java
index f807f0d..917eaef 100644
--- a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java
+++ b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java
@@ -25,6 +25,9 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.persistence.EntityExistsException;
 
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.vm.dao.UserVmDetailsDao;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
@@ -41,13 +44,14 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
     protected static final Logger s_logger = Logger.getLogger(ServiceOfferingDaoImpl.class);
 
     @Inject protected ServiceOfferingDetailsDao detailsDao;
+    @Inject protected UserVmDetailsDao userVmDetailsDao;
 
     protected final SearchBuilder<ServiceOfferingVO> UniqueNameSearch;
     protected final SearchBuilder<ServiceOfferingVO> ServiceOfferingsByDomainIdSearch;
     protected final SearchBuilder<ServiceOfferingVO> SystemServiceOffering;
     protected final SearchBuilder<ServiceOfferingVO> ServiceOfferingsByKeywordSearch;
     protected final SearchBuilder<ServiceOfferingVO> PublicServiceOfferingSearch;
-    
+
     public ServiceOfferingDaoImpl() {
         super();
         
@@ -134,7 +138,7 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
     public List<ServiceOfferingVO> findPublicServiceOfferings(){
     	SearchCriteria<ServiceOfferingVO> sc = PublicServiceOfferingSearch.create();
     	sc.setParameters("system", false);
-        return listBy(sc);    	
+        return listBy(sc);
     }
     
     @Override @DB
@@ -180,4 +184,48 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
         
         detailsDao.saveDetails(resourceDetails);
     }
+
+    public ServiceOfferingVO findById(Long vmId, long serviceOfferingId) {
+        ServiceOfferingVO offering = super.findById(serviceOfferingId);
+        if (offering.isDynamic()) {
+            if (vmId == null) {
+                throw new CloudRuntimeException("missing argument vmId");
+            }
+            Map<String, String> dynamicOffering = userVmDetailsDao.listDetailsKeyPairs(vmId);
+            offering.setCpu(Integer.parseInt(dynamicOffering.get(ServiceOfferingVO.DynamicParameters.cpuNumber.name())));
+            offering.setSpeed(Integer.parseInt(dynamicOffering.get(ServiceOfferingVO.DynamicParameters.cpuSpeed.name())));
+            offering.setRamSize(Integer.parseInt(dynamicOffering.get(ServiceOfferingVO.DynamicParameters.memory.name())));
+            return offering;
+        }
+        return offering;
+    }
+
+    public ServiceOfferingVO findByIdIncludingRemoved(Long vmId, long serviceOfferingId) {
+        ServiceOfferingVO offering = super.findByIdIncludingRemoved(serviceOfferingId);
+        if (offering.isDynamic()) {
+            if (vmId == null) {
+                throw new CloudRuntimeException("missing argument vmId");
+            }
+            Map<String, String> dynamicOffering = userVmDetailsDao.listDetailsKeyPairs(vmId);
+            offering.setCpu(Integer.parseInt(dynamicOffering.get(ServiceOfferingVO.DynamicParameters.cpuNumber.name())));
+            offering.setSpeed(Integer.parseInt(dynamicOffering.get(ServiceOfferingVO.DynamicParameters.cpuSpeed.name())));
+            offering.setRamSize(Integer.parseInt(dynamicOffering.get(ServiceOfferingVO.DynamicParameters.memory.name())));
+            return offering;
+
+        }
+        return offering;
+    }
+
+    public boolean isDynamic(long serviceOfferingId) {
+        ServiceOfferingVO offering = super.findById(serviceOfferingId);
+        return offering.getCpu() == null || offering.getSpeed() == null || offering.getRamSize() == null;
+    }
+
+    public ServiceOfferingVO getcomputeOffering(long serviceOfferingId, Integer cpuCores, Integer cpuSpeed, Integer memory) {
+        ServiceOfferingVO offering = super.findById(serviceOfferingId);
+        offering.setCpu(cpuCores);
+        offering.setSpeed(cpuSpeed);
+        offering.setRamSize(memory);
+        return offering;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/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 f1fa71c..24368ee 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
@@ -19,6 +19,7 @@ package org.apache.cloudstack.implicitplanner;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.mockito.Matchers.anyLong;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -34,6 +35,7 @@ import java.util.UUID;
 
 import javax.inject.Inject;
 
+import com.cloud.hypervisor.Hypervisor;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -163,7 +165,6 @@ public class ImplicitPlannerTest {
         acct.setId(accountId);
 
         UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString());
-
         CallContext.register(user, acct);
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/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 ef6ec31..9618e6b 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
@@ -187,7 +187,7 @@ public class BaremetalPxeManagerImpl extends ManagerBase implements BaremetalPxe
         UserVmVO vm = (UserVmVO) profile.getVirtualMachine();
         _vmDao.loadDetails(vm);
         
-        String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getServiceOfferingId()).getDisplayText();
+        String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getId(), vm.getServiceOfferingId()).getDisplayText();
         String zoneName = _dcDao.findById(vm.getDataCenterId()).getName();
         NicVO nvo = _nicDao.findById(nic.getId());
         VmDataCommand cmd = new VmDataCommand(nvo.getIp4Address(), vm.getInstanceName(), _ntwkModel.getExecuteInSeqNtwkElmtCmd());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/server/src/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java b/server/src/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java
index 0da2c92..3f1994e 100755
--- a/server/src/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java
+++ b/server/src/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java
@@ -260,7 +260,7 @@ public class UserConcentratedAllocator extends AdapterBase implements PodAllocat
                 }
             }
 
-            so = _offeringDao.findById(vm.getServiceOfferingId());
+            so = _offeringDao.findById(vm.getId(), vm.getServiceOfferingId());
 
             if (capacityType == CapacityVO.CAPACITY_TYPE_MEMORY) {
                 usedCapacity += so.getRamSize() * 1024L * 1024L;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index f34e60e..2934641 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -2431,7 +2431,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
 
             _accountMgr.checkAccess(caller, null, true, vmInstance);
 
-            ServiceOfferingVO offering = _srvOfferingDao.findByIdIncludingRemoved(vmInstance.getServiceOfferingId());
+            ServiceOfferingVO offering = _srvOfferingDao.findByIdIncludingRemoved(vmInstance.getId(), vmInstance.getServiceOfferingId());
             sc.addAnd("id", SearchCriteria.Op.NEQ, offering.getId());
 
             // Only return offerings with the same Guest IP type and storage

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/server/src/com/cloud/capacity/CapacityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/capacity/CapacityManagerImpl.java b/server/src/com/cloud/capacity/CapacityManagerImpl.java
index 1c5f189..a9b9ae4 100755
--- a/server/src/com/cloud/capacity/CapacityManagerImpl.java
+++ b/server/src/com/cloud/capacity/CapacityManagerImpl.java
@@ -60,7 +60,6 @@ import com.cloud.host.dao.HostDao;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao;
 import com.cloud.offering.ServiceOffering;
-import com.cloud.org.Cluster;
 import com.cloud.org.Grouping.AllocationState;
 import com.cloud.resource.ResourceListener;
 import com.cloud.resource.ResourceManager;
@@ -81,7 +80,6 @@ import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.Transaction;
-import com.cloud.utils.db.TransactionCallback;
 import com.cloud.utils.db.TransactionCallbackNoReturn;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.fsm.StateListener;
@@ -174,7 +172,7 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
     @DB
     @Override
     public boolean releaseVmCapacity(VirtualMachine vm, final boolean moveFromReserved, final boolean moveToReservered, final Long hostId) {
-        final ServiceOfferingVO svo = _offeringsDao.findById(vm.getServiceOfferingId());
+        final ServiceOfferingVO svo = _offeringsDao.findById(vm.getId(), vm.getServiceOfferingId());
         CapacityVO capacityCpu = _capacityDao.findByHostIdType(hostId, CapacityVO.CAPACITY_TYPE_CPU);
         CapacityVO capacityMemory = _capacityDao.findByHostIdType(hostId, CapacityVO.CAPACITY_TYPE_MEMORY);
         Long clusterId = null;
@@ -270,7 +268,7 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
         final float cpuOvercommitRatio = Float.parseFloat(_clusterDetailsDao.findDetail(clusterId, "cpuOvercommitRatio").getValue());
         final float memoryOvercommitRatio = Float.parseFloat(_clusterDetailsDao.findDetail(clusterId, "memoryOvercommitRatio").getValue());
 
-        final ServiceOfferingVO svo = _offeringsDao.findById(vm.getServiceOfferingId());
+        final ServiceOfferingVO svo = _offeringsDao.findById(vm.getId(), vm.getServiceOfferingId());
 
         CapacityVO capacityCpu = _capacityDao.findByHostIdType(hostId, CapacityVO.CAPACITY_TYPE_CPU);
         CapacityVO capacityMem = _capacityDao.findByHostIdType(hostId, CapacityVO.CAPACITY_TYPE_MEMORY);
@@ -549,16 +547,23 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
         Float cpuOvercommitRatio = 1f;
         Float ramOvercommitRatio = 1f;
         for (VMInstanceVO vm : vms) {
-            UserVmDetailVO vmDetailCpu = _userVmDetailsDao.findDetail(vm.getId(), "cpuOvercommitRatio");
-            UserVmDetailVO vmDetailRam = _userVmDetailsDao.findDetail(vm.getId(),"memoryOvercommitRatio");
+            Map<String, String> vmDetails = _userVmDetailsDao.listDetailsKeyPairs(vm.getId());
+            String vmDetailCpu = vmDetails.get("cpuOvercommitRatio");
+            String vmDetailRam = vmDetails.get("memoryOvercommitRatio");
             if (vmDetailCpu != null ) {
                 //if vmDetail_cpu is not null it means it is running in a overcommited cluster.
-                cpuOvercommitRatio = Float.parseFloat(vmDetailCpu.getValue());
-                ramOvercommitRatio = Float.parseFloat(vmDetailRam.getValue());
+                cpuOvercommitRatio = Float.parseFloat(vmDetailCpu);
+                ramOvercommitRatio = Float.parseFloat(vmDetailRam);
             }
             ServiceOffering so = offeringsMap.get(vm.getServiceOfferingId());
-            usedMemory += ((so.getRamSize() * 1024L * 1024L)/ramOvercommitRatio)*clusterRamOvercommitRatio;
-            usedCpu += ((so.getCpu() * so.getSpeed())/cpuOvercommitRatio)*clusterCpuOvercommitRatio;
+            if (so.isDynamic()) {
+                usedMemory += ((Integer.parseInt(vmDetails.get(ServiceOfferingVO.DynamicParameters.memory.name())) * 1024L * 1024L)/ramOvercommitRatio)*clusterRamOvercommitRatio;
+                usedCpu += ((Integer.parseInt(vmDetails.get(ServiceOfferingVO.DynamicParameters.cpuNumber.name())) * Integer.parseInt(vmDetails.get(ServiceOfferingVO.DynamicParameters.cpuSpeed.name())))/cpuOvercommitRatio)*clusterCpuOvercommitRatio;
+            }
+            else {
+                usedMemory += ((so.getRamSize() * 1024L * 1024L)/ramOvercommitRatio)*clusterRamOvercommitRatio;
+                usedCpu += ((so.getCpu() * so.getSpeed())/cpuOvercommitRatio)*clusterCpuOvercommitRatio;
+            }
         }
 
         List<VMInstanceVO> vmsByLastHostId = _vmDao.listByLastHostId(host.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index a31d06f..e4bbe8e 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -206,7 +206,8 @@ import com.cloud.vm.dao.NicIpAliasVO;
 import com.cloud.vm.dao.NicSecondaryIpDao;
 
 @Local(value = { ConfigurationManager.class, ConfigurationService.class })
-public class ConfigurationManagerImpl extends ManagerBase implements ConfigurationManager, ConfigurationService {
+public class
+        ConfigurationManagerImpl extends ManagerBase implements ConfigurationManager, ConfigurationService {
     public static final Logger s_logger = Logger.getLogger(ConfigurationManagerImpl.class);
 
     @Inject
@@ -1995,20 +1996,20 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
                     + ": specify the display text that has non-zero length");
         }
 
-        Long cpuNumber = cmd.getCpuNumber();
-        if ((cpuNumber == null) || (cpuNumber.intValue() <= 0) || (cpuNumber.intValue() > 2147483647)) {
+        Integer cpuNumber = cmd.getCpuNumber();
+        Integer cpuSpeed = cmd.getCpuSpeed();
+        Integer memory = cmd.getMemory();
+        boolean customized = cmd.getCustomized();
+
+        if ((cpuNumber != null) && ((cpuNumber.intValue() <=0) || (cpuNumber.intValue() > 2147483647))) {
             throw new InvalidParameterValueException("Failed to create service offering " + name
                     + ": specify the cpu number value between 1 and 2147483647");
         }
-
-        Long cpuSpeed = cmd.getCpuSpeed();
-        if ((cpuSpeed == null) || (cpuSpeed.intValue() <= 0) || (cpuSpeed.intValue() > 2147483647)) {
+        if ((cpuSpeed != null) && ((cpuSpeed.intValue() < 0) || (cpuSpeed.intValue() > 2147483647))) {
             throw new InvalidParameterValueException("Failed to create service offering " + name
                     + ": specify the cpu speed value between 1 and 2147483647");
         }
-
-        Long memory = cmd.getMemory();
-        if ((memory == null) || (memory.intValue() < 32) || (memory.intValue() > 2147483647)) {
+        if (( memory != null ) && ((memory.intValue() < 32) || (memory.intValue() > 2147483647))) {
             throw new InvalidParameterValueException("Failed to create service offering " + name
                     + ": specify the memory value between 32 and 2147483647 MB");
         }
@@ -2074,21 +2075,20 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
         }
 
         return createServiceOffering(userId, cmd.getIsSystem(), vmType, cmd.getServiceOfferingName(),
-                cpuNumber.intValue(), memory.intValue(), cpuSpeed.intValue(), cmd.getDisplayText(),
+                cpuNumber, memory, cpuSpeed, cmd.getDisplayText(),
                 localStorageRequired, offerHA, limitCpuUse, volatileVm, cmd.getTags(), cmd.getDomainId(),
                 cmd.getHostTag(), cmd.getNetworkRate(), cmd.getDeploymentPlanner(), cmd.getDetails(),
                 cmd.getBytesReadRate(), cmd.getBytesWriteRate(), cmd.getIopsReadRate(), cmd.getIopsWriteRate());
     }
 
     protected ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_type,
-            String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired,
+            String name, Integer cpu, Integer ramSize, Integer speed, String displayText, boolean localStorageRequired,
             boolean offerHA, boolean limitResourceUse, boolean volatileVm,  String tags, Long domainId, String hostTag,
             Integer networkRate, String deploymentPlanner, Map<String, String> details, Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate) {
         tags = StringUtils.cleanupTags(tags);
         ServiceOfferingVO offering = new ServiceOfferingVO(name, cpu, ramSize, speed, networkRate, null, offerHA,
                 limitResourceUse, volatileVm, displayText, localStorageRequired, false, tags, isSystem, vm_type,
                 domainId, hostTag, deploymentPlanner);
-
         if ((bytesReadRate != null) && (bytesReadRate > 0))
             offering.setBytesReadRate(bytesReadRate);
         if ((bytesWriteRate != null) && (bytesWriteRate > 0))

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7095ea2b/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 9b35a4b..fb75cb7 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -3433,7 +3433,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
     }
     
     private void createVmDataCommand(VirtualRouter router, UserVm vm, NicVO nic, String publicKey, Commands cmds) {
-        String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getServiceOfferingId()).getDisplayText();
+        String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getId(), vm.getServiceOfferingId()).getDisplayText();
         String zoneName = _dcDao.findById(router.getDataCenterId()).getName();
         cmds.addCommand("vmdata",
                 generateVmDataCommand(router, nic.getIp4Address(), vm.getUserData(), serviceOffering, zoneName, nic.getIp4Address(),


Mime
View raw message