cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mlsoren...@apache.org
Subject [1/3] CLOUDSTACK-6191 Add support for specifying volume provisioning type (thin, sparse, fat) in disk/compute offerings.
Date Thu, 10 Apr 2014 15:28:58 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 4ba688f07 -> 11f5bdd78


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11f5bdd7/server/src/com/cloud/test/DatabaseConfig.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/test/DatabaseConfig.java b/server/src/com/cloud/test/DatabaseConfig.java
index 8d7b42a..07e4348 100755
--- a/server/src/com/cloud/test/DatabaseConfig.java
+++ b/server/src/com/cloud/test/DatabaseConfig.java
@@ -53,6 +53,7 @@ import com.cloud.service.ServiceOfferingVO;
 import com.cloud.service.dao.ServiceOfferingDaoImpl;
 import com.cloud.storage.DiskOfferingVO;
 import com.cloud.storage.dao.DiskOfferingDaoImpl;
+import com.cloud.storage.Storage.ProvisioningType;
 import com.cloud.utils.PropertiesUtil;
 import com.cloud.utils.component.ComponentContext;
 import com.cloud.utils.db.DB;
@@ -906,6 +907,7 @@ public class DatabaseConfig {
         long id = Long.parseLong(_currentObjectParams.get("id"));
         String name = _currentObjectParams.get("name");
         String displayText = _currentObjectParams.get("displayText");
+        ProvisioningType provisioningType = ProvisioningType.valueOf(_currentObjectParams.get("provisioningType"));
         int cpu = Integer.parseInt(_currentObjectParams.get("cpu"));
         int ramSize = Integer.parseInt(_currentObjectParams.get("ramSize"));
         int speed = Integer.parseInt(_currentObjectParams.get("speed"));
@@ -928,7 +930,8 @@ public class DatabaseConfig {
         }
 
         ServiceOfferingVO serviceOffering =
-            new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, ha, displayText,
useLocalStorage, false, null, false, null, false);
+            new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, ha, displayText,
+                    provisioningType, useLocalStorage, false, null, false, null, false);
 
         Long bytesReadRate = Long.parseLong(_currentObjectParams.get("bytesReadRate"));
         if ((bytesReadRate != null) && (bytesReadRate > 0))
@@ -971,6 +974,7 @@ public class DatabaseConfig {
         long domainId = Long.parseLong(_currentObjectParams.get("domainId"));
         String name = _currentObjectParams.get("name");
         String displayText = _currentObjectParams.get("displayText");
+        ProvisioningType provisioningType = ProvisioningType.valueOf(_currentObjectParams.get("provisioningtype"));
         long diskSpace = Long.parseLong(_currentObjectParams.get("diskSpace"));
         diskSpace = diskSpace * 1024 * 1024;
 //        boolean mirroring = Boolean.parseBoolean(_currentObjectParams.get("mirrored"));
@@ -990,7 +994,7 @@ public class DatabaseConfig {
             newTags.delete(newTags.length() - 1, newTags.length());
             tags = newTags.toString();
         }
-        DiskOfferingVO diskOffering = new DiskOfferingVO(domainId, name, displayText, diskSpace,
tags, false, null, null, null);
+        DiskOfferingVO diskOffering = new DiskOfferingVO(domainId, name, displayText, provisioningType,
diskSpace, tags, false, null, null, null);
         diskOffering.setUseLocalStorage(local);
 
         Long bytesReadRate = Long.parseLong(_currentObjectParams.get("bytesReadRate"));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11f5bdd7/server/test/com/cloud/storage/VolumeApiServiceImplTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/storage/VolumeApiServiceImplTest.java b/server/test/com/cloud/storage/VolumeApiServiceImplTest.java
index 0be6f3a..b7d041d 100644
--- a/server/test/com/cloud/storage/VolumeApiServiceImplTest.java
+++ b/server/test/com/cloud/storage/VolumeApiServiceImplTest.java
@@ -116,7 +116,7 @@ public class VolumeApiServiceImplTest {
         TransactionLegacy txn = TransactionLegacy.open("runVolumeDaoImplTest");
         try {
             // volume of running vm id=1
-            VolumeVO volumeOfRunningVm = new VolumeVO("root", 1L, 1L, 1L, 1L, 1L, "root",
"root", 1, null,
+            VolumeVO volumeOfRunningVm = new VolumeVO("root", 1L, 1L, 1L, 1L, 1L, "root",
"root", Storage.ProvisioningType.THIN, 1, null,
                     null, "root", Volume.Type.ROOT);
             when(_svc._volsDao.findById(1L)).thenReturn(volumeOfRunningVm);
 
@@ -127,7 +127,7 @@ public class VolumeApiServiceImplTest {
             when(_svc._userVmDao.findById(1L)).thenReturn(runningVm);
 
             // volume of stopped vm id=2
-            VolumeVO volumeOfStoppedVm = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root",
"root", 1, null,
+            VolumeVO volumeOfStoppedVm = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root",
"root", Storage.ProvisioningType.THIN, 1, null,
                     null, "root", Volume.Type.ROOT);
             volumeOfStoppedVm.setPoolId(1L);
             when(_svc._volsDao.findById(2L)).thenReturn(volumeOfStoppedVm);
@@ -146,7 +146,7 @@ public class VolumeApiServiceImplTest {
             hyperVVm.setDataCenterId(1L);
             when(_svc._userVmDao.findById(3L)).thenReturn(hyperVVm);
 
-            VolumeVO volumeOfStoppeHyperVVm = new VolumeVO("root", 1L, 1L, 1L, 1L, 3L, "root",
"root", 1, null,
+            VolumeVO volumeOfStoppeHyperVVm = new VolumeVO("root", 1L, 1L, 1L, 1L, 3L, "root",
"root", Storage.ProvisioningType.THIN, 1, null,
                     null, "root", Volume.Type.ROOT);
             volumeOfStoppeHyperVVm.setPoolId(1L);
             when(_svc._volsDao.findById(3L)).thenReturn(volumeOfStoppeHyperVVm);
@@ -158,7 +158,7 @@ public class VolumeApiServiceImplTest {
             StoragePoolVO managedPool = new StoragePoolVO();
             managedPool.setManaged(true);
             when(_svc._storagePoolDao.findById(2L)).thenReturn(managedPool);
-            VolumeVO managedPoolVolume = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root",
"root", 1, null,
+            VolumeVO managedPoolVolume = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root",
"root", Storage.ProvisioningType.THIN, 1, null,
                     null, "root", Volume.Type.ROOT);
             managedPoolVolume.setPoolId(2L);
             when(_svc._volsDao.findById(4L)).thenReturn(managedPoolVolume);
@@ -177,7 +177,7 @@ public class VolumeApiServiceImplTest {
             when(correctRootVolume.getInstanceId()).thenReturn(null);
             when(_svc.volFactory.getVolume(6L)).thenReturn(correctRootVolume);
 
-            VolumeVO correctRootVolumeVO = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root",
"root", 1, null,
+            VolumeVO correctRootVolumeVO = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root",
"root", Storage.ProvisioningType.THIN, 1, null,
                     null, "root", Volume.Type.ROOT);
             when(_svc._volsDao.findById(6L)).thenReturn(correctRootVolumeVO);
 
@@ -190,7 +190,7 @@ public class VolumeApiServiceImplTest {
             when(managedVolume.getPoolId()).thenReturn(2L);
             when(_svc.volFactory.getVolume(7L)).thenReturn(managedVolume);
 
-            VolumeVO managedVolume1 = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root", "root",
1, null,
+            VolumeVO managedVolume1 = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root", "root",
Storage.ProvisioningType.THIN, 1, null,
                     null, "root", Volume.Type.ROOT);
             managedVolume1.setPoolId(2L);
             managedVolume1.setDataCenterId(1L);
@@ -216,7 +216,7 @@ public class VolumeApiServiceImplTest {
             when(uploadedVolume.getState()).thenReturn(Volume.State.Uploaded);
             when(_svc.volFactory.getVolume(8L)).thenReturn(uploadedVolume);
 
-            VolumeVO upVolume = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root", "root",
1, null,
+            VolumeVO upVolume = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root", "root",
Storage.ProvisioningType.THIN, 1, null,
                     null, "root", Volume.Type.ROOT);
             upVolume.setPoolId(1L);
             upVolume.setDataCenterId(1L);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11f5bdd7/server/test/com/cloud/vm/DeploymentPlanningManagerImplTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/DeploymentPlanningManagerImplTest.java b/server/test/com/cloud/vm/DeploymentPlanningManagerImplTest.java
index fb63766..94c1d18 100644
--- a/server/test/com/cloud/vm/DeploymentPlanningManagerImplTest.java
+++ b/server/test/com/cloud/vm/DeploymentPlanningManagerImplTest.java
@@ -81,6 +81,7 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.resource.ResourceManager;
 import com.cloud.service.ServiceOfferingVO;
 import com.cloud.service.dao.ServiceOfferingDetailsDao;
+import com.cloud.storage.Storage.ProvisioningType;
 import com.cloud.storage.StorageManager;
 import com.cloud.storage.dao.DiskOfferingDao;
 import com.cloud.storage.dao.GuestOSCategoryDao;
@@ -163,7 +164,8 @@ public class DeploymentPlanningManagerImplTest {
     @Test
     public void dataCenterAvoidTest() throws InsufficientServerCapacityException, AffinityConflictException
{
         ServiceOfferingVO svcOffering =
-            new ServiceOfferingVO("testOffering", 1, 512, 500, 1, 1, false, false, false,
"test dpm", false, false, null, false, VirtualMachine.Type.User, domainId,
+            new ServiceOfferingVO("testOffering", 1, 512, 500, 1, 1, false, false, false,
"test dpm",
+                    ProvisioningType.THIN, false, false, null, false, VirtualMachine.Type.User,
domainId,
                 null, "FirstFitPlanner");
         Mockito.when(vmProfile.getServiceOffering()).thenReturn(svcOffering);
 
@@ -177,7 +179,8 @@ public class DeploymentPlanningManagerImplTest {
     @Test
     public void plannerCannotHandleTest() throws InsufficientServerCapacityException, AffinityConflictException
{
         ServiceOfferingVO svcOffering =
-            new ServiceOfferingVO("testOffering", 1, 512, 500, 1, 1, false, false, false,
"test dpm", false, false, null, false, VirtualMachine.Type.User, domainId,
+            new ServiceOfferingVO("testOffering", 1, 512, 500, 1, 1, false, false, false,
"test dpm",
+                    ProvisioningType.THIN, false, false, null, false, VirtualMachine.Type.User,
domainId,
                 null, "UserDispersingPlanner");
         Mockito.when(vmProfile.getServiceOffering()).thenReturn(svcOffering);
 
@@ -192,7 +195,8 @@ public class DeploymentPlanningManagerImplTest {
     @Test
     public void emptyClusterListTest() throws InsufficientServerCapacityException, AffinityConflictException
{
         ServiceOfferingVO svcOffering =
-            new ServiceOfferingVO("testOffering", 1, 512, 500, 1, 1, false, false, false,
"test dpm", false, false, null, false, VirtualMachine.Type.User, domainId,
+            new ServiceOfferingVO("testOffering", 1, 512, 500, 1, 1, false, false, false,
"test dpm",
+                ProvisioningType.THIN, false, false, null, false, VirtualMachine.Type.User,
domainId,
                 null, "FirstFitPlanner");
         Mockito.when(vmProfile.getServiceOffering()).thenReturn(svcOffering);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11f5bdd7/server/test/com/cloud/vm/UserVmManagerTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/UserVmManagerTest.java b/server/test/com/cloud/vm/UserVmManagerTest.java
index 927d5e3..b07f725 100755
--- a/server/test/com/cloud/vm/UserVmManagerTest.java
+++ b/server/test/com/cloud/vm/UserVmManagerTest.java
@@ -35,6 +35,7 @@ import java.lang.reflect.Field;
 import java.util.List;
 import java.util.UUID;
 
+import com.cloud.storage.Storage;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
@@ -538,7 +539,8 @@ public class UserVmManagerTest {
         boolean useLocalStorage = false;
 
         ServiceOfferingVO serviceOffering =
-            new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, ha, displayText,
useLocalStorage, false, null, false, null, false);
+            new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, ha, displayText,
Storage.ProvisioningType.THIN,
+                    useLocalStorage, false, null, false, null, false);
         return serviceOffering;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11f5bdd7/server/test/org/apache/cloudstack/service/ServiceOfferingVOTest.java
----------------------------------------------------------------------
diff --git a/server/test/org/apache/cloudstack/service/ServiceOfferingVOTest.java b/server/test/org/apache/cloudstack/service/ServiceOfferingVOTest.java
index a3f8afb..0d4630a 100644
--- a/server/test/org/apache/cloudstack/service/ServiceOfferingVOTest.java
+++ b/server/test/org/apache/cloudstack/service/ServiceOfferingVOTest.java
@@ -21,6 +21,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.mockito.MockitoAnnotations;
 
+import com.cloud.storage.Storage;
 import com.cloud.service.ServiceOfferingVO;
 import com.cloud.vm.VirtualMachine;
 
@@ -31,8 +32,8 @@ public class ServiceOfferingVOTest {
     @Before
     public void setup() {
         MockitoAnnotations.initMocks(this);
-        offeringCustom = new ServiceOfferingVO("custom", null, null, 500, 10, 10, false,
"custom", false, false, "", false, VirtualMachine.Type.User, false);
-        offering = new ServiceOfferingVO("normal", 1, 1000, 500, 10, 10, false, "normal",
false, false, "", false, VirtualMachine.Type.User, false);
+        offeringCustom = new ServiceOfferingVO("custom", null, null, 500, 10, 10, false,
"custom", Storage.ProvisioningType.THIN, false, false, "", false, VirtualMachine.Type.User,
false);
+        offering = new ServiceOfferingVO("normal", 1, 1000, 500, 10, 10, false, "normal",
Storage.ProvisioningType.THIN, false, false, "", false, VirtualMachine.Type.User, false);
     }
 
     // Test restoreVm when VM state not in running/stopped case

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11f5bdd7/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
index f8edefa..1ddc8f5 100755
--- a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
+++ b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
@@ -32,6 +32,7 @@ import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
 import org.apache.cloudstack.config.ApiServiceConfiguration;
+
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
@@ -109,6 +110,7 @@ import com.cloud.storage.secondary.SecStorageVmAlertEventArgs;
 import com.cloud.storage.secondary.SecondaryStorageListener;
 import com.cloud.storage.secondary.SecondaryStorageVmAllocator;
 import com.cloud.storage.secondary.SecondaryStorageVmManager;
+import com.cloud.storage.Storage;
 import com.cloud.storage.template.TemplateConstants;
 import com.cloud.template.TemplateManager;
 import com.cloud.user.Account;
@@ -849,8 +851,8 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements
Secondar
             int cpuFreq = NumbersUtil.parseInt(_configDao.getValue("ssvm.cpu.mhz"), DEFAULT_SS_VM_CPUMHZ);
             _useLocalStorage = Boolean.parseBoolean(configs.get(Config.SystemVMUseLocalStorage.key()));
             _serviceOffering =
-                new ServiceOfferingVO("System Offering For Secondary Storage VM", 1, ramSize,
cpuFreq, null, null, false, null, _useLocalStorage, true, null, true,
-                    VirtualMachine.Type.SecondaryStorageVm, true);
+                new ServiceOfferingVO("System Offering For Secondary Storage VM", 1, ramSize,
cpuFreq, null, null, false, null,
+                        Storage.ProvisioningType.THIN,  _useLocalStorage, true, null, true,
VirtualMachine.Type.SecondaryStorageVm, true);
             _serviceOffering.setUniqueName(ServiceOffering.ssvmDefaultOffUniqueName);
             _serviceOffering = _offeringDao.persistSystemServiceOffering(_serviceOffering);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11f5bdd7/setup/db/db/schema-440to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-440to450.sql b/setup/db/db/schema-440to450.sql
index 2bd5386..4cc4879 100644
--- a/setup/db/db/schema-440to450.sql
+++ b/setup/db/db/schema-440to450.sql
@@ -22,3 +22,204 @@
 -- Disable foreign key checking
 -- SET foreign_key_checks = 0;
 
+ALTER TABLE `cloud`.`volumes` ADD COLUMN `provisioning_type` VARCHAR(32) NOT NULL DEFAULT
'Off' COMMENT 'pre allocation setting of the volume';
+ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `provisioning_type` VARCHAR(32) NOT NULL DEFAULT
'Off' COMMENT 'pre allocation setting of the volume';
+
+DROP VIEW IF EXISTS `cloud`.`disk_offering_view`;
+CREATE VIEW `cloud`.`disk_offering_view` AS
+    select
+        disk_offering.id,
+        disk_offering.uuid,
+        disk_offering.name,
+        disk_offering.display_text,
+        disk_offering.provisioning_type,
+        disk_offering.disk_size,
+        disk_offering.min_iops,
+        disk_offering.max_iops,
+        disk_offering.created,
+        disk_offering.tags,
+        disk_offering.customized,
+        disk_offering.customized_iops,
+        disk_offering.removed,
+        disk_offering.use_local_storage,
+        disk_offering.system_use,
+        disk_offering.hv_ss_reserve,
+        disk_offering.bytes_read_rate,
+        disk_offering.bytes_write_rate,
+        disk_offering.iops_read_rate,
+        disk_offering.iops_write_rate,
+        disk_offering.cache_mode,
+        disk_offering.sort_key,
+        disk_offering.type,
+        disk_offering.display_offering,
+        domain.id domain_id,
+        domain.uuid domain_uuid,
+        domain.name domain_name,
+        domain.path domain_path
+    from
+        `cloud`.`disk_offering`
+            left join
+        `cloud`.`domain` ON disk_offering.domain_id = domain.id
+    where
+        disk_offering.state='ACTIVE';
+
+
+DROP VIEW IF EXISTS `cloud`.`service_offering_view`;
+CREATE VIEW `cloud`.`service_offering_view` AS
+    select
+        service_offering.id,
+        disk_offering.uuid,
+        disk_offering.name,
+        disk_offering.display_text,
+        disk_offering.provisioning_type,
+        disk_offering.created,
+        disk_offering.tags,
+        disk_offering.removed,
+        disk_offering.use_local_storage,
+        disk_offering.system_use,
+        disk_offering.customized_iops,
+        disk_offering.min_iops,
+        disk_offering.max_iops,
+        disk_offering.hv_ss_reserve,
+        disk_offering.bytes_read_rate,
+        disk_offering.bytes_write_rate,
+        disk_offering.iops_read_rate,
+        disk_offering.iops_write_rate,
+        disk_offering.cache_mode,
+        service_offering.cpu,
+        service_offering.speed,
+        service_offering.ram_size,
+        service_offering.nw_rate,
+        service_offering.mc_rate,
+        service_offering.ha_enabled,
+        service_offering.limit_cpu_use,
+        service_offering.host_tag,
+        service_offering.default_use,
+        service_offering.vm_type,
+        service_offering.sort_key,
+        service_offering.is_volatile,
+        service_offering.deployment_planner,
+        domain.id domain_id,
+        domain.uuid domain_uuid,
+        domain.name domain_name,
+        domain.path domain_path
+    from
+        `cloud`.`service_offering`
+            inner join
+        `cloud`.`disk_offering` ON service_offering.id = disk_offering.id
+            left join
+        `cloud`.`domain` ON disk_offering.domain_id = domain.id
+    where
+        disk_offering.state='Active';
+
+DROP VIEW IF EXISTS `cloud`.`volume_view`;
+CREATE VIEW `cloud`.`volume_view` AS
+    select
+        volumes.id,
+        volumes.uuid,
+        volumes.name,
+        volumes.device_id,
+        volumes.volume_type,
+        volumes.provisioning_type,
+        volumes.size,
+        volumes.min_iops,
+        volumes.max_iops,
+        volumes.created,
+        volumes.state,
+        volumes.attached,
+        volumes.removed,
+        volumes.pod_id,
+        volumes.display_volume,
+        volumes.format,
+        volumes.path,
+        volumes.chain_info,
+        account.id account_id,
+        account.uuid account_uuid,
+        account.account_name account_name,
+        account.type account_type,
+        domain.id domain_id,
+        domain.uuid domain_uuid,
+        domain.name domain_name,
+        domain.path domain_path,
+        projects.id project_id,
+        projects.uuid project_uuid,
+        projects.name project_name,
+        data_center.id data_center_id,
+        data_center.uuid data_center_uuid,
+        data_center.name data_center_name,
+        data_center.networktype data_center_type,
+        vm_instance.id vm_id,
+        vm_instance.uuid vm_uuid,
+        vm_instance.name vm_name,
+        vm_instance.state vm_state,
+        vm_instance.vm_type,
+        user_vm.display_name vm_display_name,
+        volume_store_ref.size volume_store_size,
+        volume_store_ref.download_pct,
+        volume_store_ref.download_state,
+        volume_store_ref.error_str,
+        volume_store_ref.created created_on_store,
+        disk_offering.id disk_offering_id,
+        disk_offering.uuid disk_offering_uuid,
+        disk_offering.name disk_offering_name,
+        disk_offering.display_text disk_offering_display_text,
+        disk_offering.use_local_storage,
+        disk_offering.system_use,
+        disk_offering.bytes_read_rate,
+        disk_offering.bytes_write_rate,
+        disk_offering.iops_read_rate,
+        disk_offering.iops_write_rate,
+        disk_offering.cache_mode,
+        storage_pool.id pool_id,
+        storage_pool.uuid pool_uuid,
+        storage_pool.name pool_name,
+        cluster.hypervisor_type,
+        vm_template.id template_id,
+        vm_template.uuid template_uuid,
+        vm_template.extractable,
+        vm_template.type template_type,
+        resource_tags.id tag_id,
+        resource_tags.uuid tag_uuid,
+        resource_tags.key tag_key,
+        resource_tags.value tag_value,
+        resource_tags.domain_id tag_domain_id,
+        resource_tags.account_id tag_account_id,
+        resource_tags.resource_id tag_resource_id,
+        resource_tags.resource_uuid tag_resource_uuid,
+        resource_tags.resource_type tag_resource_type,
+        resource_tags.customer tag_customer,
+        async_job.id job_id,
+        async_job.uuid job_uuid,
+        async_job.job_status job_status,
+        async_job.account_id job_account_id
+    from
+        `cloud`.`volumes`
+            inner join
+        `cloud`.`account` ON volumes.account_id = account.id
+            inner join
+        `cloud`.`domain` ON volumes.domain_id = domain.id
+            left join
+        `cloud`.`projects` ON projects.project_account_id = account.id
+            left join
+        `cloud`.`data_center` ON volumes.data_center_id = data_center.id
+            left join
+        `cloud`.`vm_instance` ON volumes.instance_id = vm_instance.id
+            left join
+        `cloud`.`user_vm` ON user_vm.id = vm_instance.id
+            left join
+        `cloud`.`volume_store_ref` ON volumes.id = volume_store_ref.volume_id
+            left join
+        `cloud`.`disk_offering` ON volumes.disk_offering_id = disk_offering.id
+            left join
+        `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id
+            left join
+        `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id
+            left join
+        `cloud`.`vm_template` ON volumes.template_id = vm_template.id OR volumes.iso_id =
vm_template.id
+            left join
+        `cloud`.`resource_tags` ON resource_tags.resource_id = volumes.id
+            and resource_tags.resource_type = 'Volume'
+            left join
+        `cloud`.`async_job` ON async_job.instance_id = volumes.id
+            and async_job.instance_type = 'Volume'
+            and async_job.job_status = 0;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11f5bdd7/test/integration/smoke/test_disk_offerings.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_disk_offerings.py b/test/integration/smoke/test_disk_offerings.py
index 4c8a34c..8c52d88 100644
--- a/test/integration/smoke/test_disk_offerings.py
+++ b/test/integration/smoke/test_disk_offerings.py
@@ -38,6 +38,18 @@ class Services:
                                         "displaytext": "Disk offering",
                                         "disksize": 1   # in GB
                                 },
+                         "sparse": {
+                                        "name": "Sparse Type Disk offering",
+                                        "displaytext": "Sparse Type Disk offering",
+                                        "disksize": 1,   # in GB
+                                        "provisioningtype" : "sparse"
+                                },
+                                 "fat": {
+                                        "name": "Fat Type Disk offering",
+                                        "displaytext": "Fat Type Disk offering",
+                                        "disksize": 1,   # in GB
+                                        "provisioningtype" : "fat"
+                                }
                          }
 
 class TestCreateDiskOffering(cloudstackTestCase):
@@ -102,6 +114,86 @@ class TestCreateDiskOffering(cloudstackTestCase):
                         )
         return
 
+    @attr(hypervisor="kvm")
+    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke"])
+    def test_02_create_sparse_type_disk_offering(self):
+        """Test to create  a sparse type disk offering"""
+
+        # Validate the following:
+        # 1. createDiskOfferings should return valid info for new offering
+        # 2. The Cloud Database contains the valid information
+
+        disk_offering = DiskOffering.create(
+                                        self.apiclient,
+                                        self.services["sparse"]
+                                        )
+        self.cleanup.append(disk_offering)
+
+        self.debug("Created Disk offering with ID: %s" % disk_offering.id)
+
+        list_disk_response = list_disk_offering(
+                                                self.apiclient,
+                                                id=disk_offering.id
+                                                )
+        self.assertEqual(
+                            isinstance(list_disk_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(list_disk_response),
+                            0,
+                            "Check Disk offering is created"
+                        )
+        disk_response = list_disk_response[0]
+
+        self.assertEqual(
+                            disk_response.provisioningtype,
+                            self.services["sparse"]["provisioningtype"],
+                            "Check provisionig type in createServiceOffering"
+                        )
+        return
+
+
+    @attr(hypervisor="kvm")
+    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke"])
+    def test_04_create_fat_type_disk_offering(self):
+        """Test to create  a sparse type disk offering"""
+
+        # Validate the following:
+        # 1. createDiskOfferings should return valid info for new offering
+        # 2. The Cloud Database contains the valid information
+
+        disk_offering = DiskOffering.create(
+                                        self.apiclient,
+                                        self.services["fat"]
+                                        )
+        self.cleanup.append(disk_offering)
+
+        self.debug("Created Disk offering with ID: %s" % disk_offering.id)
+
+        list_disk_response = list_disk_offering(
+                                                self.apiclient,
+                                                id=disk_offering.id
+                                                )
+        self.assertEqual(
+                            isinstance(list_disk_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            len(list_disk_response),
+                            0,
+                            "Check Disk offering is created"
+                        )
+        disk_response = list_disk_response[0]
+
+        self.assertEqual(
+                            disk_response.provisioningtype,
+                            self.services["fat"]["provisioningtype"],
+                            "Check provisionig type in createServiceOffering"
+                        )
+        return
 
 class TestDiskOfferings(cloudstackTestCase):
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11f5bdd7/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index 411ecf1..aed31fb 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -62,6 +62,12 @@ class Services:
                                     "name": "Small",
                                     "disksize": 1
                         },
+                        "sparse_disk_offering": {
+                                    "displaytext": "Sparse",
+                                    "name": "Sparse",
+                                    "provisioningtype": "sparse",
+                                    "disksize": 1
+                        },
                         'resized_disk_offering': {
                                     "displaytext": "Resized",
                                     "name": "Resized",
@@ -102,6 +108,10 @@ class TestCreateVolume(cloudstackTestCase):
                                     cls.api_client,
                                     cls.services["disk_offering"]
                                     )
+        cls.sparse_disk_offering = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["sparse_disk_offering"]
+                                    )
         cls.custom_disk_offering = DiskOffering.create(
                                     cls.api_client,
                                     cls.services["disk_offering"],
@@ -172,6 +182,18 @@ class TestCreateVolume(cloudstackTestCase):
             self.debug("Created a volume with ID: %s" % volume.id)
             self.volumes.append(volume)
 
+        if self.virtual_machine.hypervisor == "KVM":
+            sparse_volume = Volume.create(
+                                        self.apiClient,
+                                        self.services,
+                                        zoneid=self.zone.id,
+                                        account=self.account.name,
+                                        domainid=self.account.domainid,
+                                        diskofferingid=self.sparse_disk_offering.id
+                                        )
+            self.debug("Created a sparse volume: %s" % sparse_volume.id)
+            self.volumes.append(sparse_volume)
+
         volume = Volume.create_custom_disk(
                                     self.apiClient,
                                     self.services,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11f5bdd7/ui/dictionary.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp
index ebe71b6..c2fa55b 100644
--- a/ui/dictionary.jsp
+++ b/ui/dictionary.jsp
@@ -536,6 +536,7 @@ dictionary = {
 'label.disk.read.bytes': '<fmt:message key="label.disk.read.bytes" />',
 'label.disk.read.io': '<fmt:message key="label.disk.read.io" />',
 'label.disk.offering': '<fmt:message key="label.disk.offering" />',
+'label.disk.provisioningtype': '<fmt:message key="label.disk.provisioningtype" />',
 'label.disk.size': '<fmt:message key="label.disk.size" />',
 'label.disk.size.gb': '<fmt:message key="label.disk.size.gb" />',
 'label.disk.total': '<fmt:message key="label.disk.total" />',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11f5bdd7/ui/scripts/configuration.js
----------------------------------------------------------------------
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index ba6bdce..e6503d7 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -95,6 +95,28 @@
                                             });
                                         }
                                     },
+                                    provisioningType: {
+                                        label: 'label.disk.provisioningtype',
+                                        docID: 'helpComputeOfferingProvisioningType',
+                                        select: function(args) {
+                                            var items = [];
+                                            items.push({
+                                                id: 'thin',
+                                                description: 'thin'
+                                            });
+                                            items.push({
+                                                id: 'sparse',
+                                                description: 'sparse'
+                                            });
+                                            items.push({
+                                                id: 'fat',
+                                                description: 'fat'
+                                            });
+                                            args.response.success({
+                                                data: items
+                                            });
+                                        }
+                                    },
                                     isCustomized: {
                                         label: 'label.custom',                          
            
                                         isBoolean: true,
@@ -456,7 +478,8 @@
                                     name: args.data.name,
                                     displaytext: args.data.description,
                                     storageType: args.data.storageType,
-                                    customized: (args.data.isCustomized == "on")        
                           
+                                    provisioningType :args.data.provisioningType,
+                                    customized: (args.data.isCustomized == "on")
                                 };
                                 
                                 //custom fields (begin)
@@ -721,6 +744,9 @@
                                     storagetype: {
                                         label: 'label.storage.type'
                                     },
+                                    provisioningtype: {
+                                        label: 'label.disk.provisioningtype'
+                                    },
                                     cpunumber: {
                                         label: 'label.num.cpu.cores'
                                     },
@@ -937,6 +963,28 @@
                                             });
                                         }
                                     },
+                                    provisioningType: {
+                                        label: 'label.disk.provisioningtype',
+                                        docID: 'helpDiskOfferingProvisioningType',
+                                        select: function(args) {
+                                            var items = [];
+                                            items.push({
+                                                id: 'thin',
+                                                description: 'thin'
+                                            });
+                                            items.push({
+                                                id: 'sparse',
+                                                description: 'sparse'
+                                            });
+                                            items.push({
+                                                id: 'fat',
+                                                description: 'fat'
+                                            });
+                                            args.response.success({
+                                                data: items
+                                            });
+                                        }
+                                    },
                                     cpuNumber: {
                                         label: 'label.num.cpu.cores',
                                         docID: 'helpSystemOfferingCPUCores',
@@ -1064,6 +1112,7 @@
                                     displaytext: args.data.description,
                                     systemvmtype: args.data.systemvmtype,
                                     storageType: args.data.storageType,
+                                    provisioningType: args.data.provisioningType,
                                     cpuNumber: args.data.cpuNumber,
                                     cpuSpeed: args.data.cpuSpeed,
                                     memory: args.data.memory
@@ -1271,6 +1320,9 @@
                                     storagetype: {
                                         label: 'label.storage.type'
                                     },
+                                    provisioningtype: {
+                                        label: 'label.disk.provisioningtype'
+                                    },
                                     cpunumber: {
                                         label: 'label.num.cpu.cores'
                                     },
@@ -1447,6 +1499,28 @@
                                             });
                                         }
                                     },
+                                    provisioningType: {
+                                        label: 'label.disk.provisioningtype',
+                                        docID: 'helpDiskOfferingProvisioningType',
+                                        select: function(args) {
+                                            var items = [];
+                                            items.push({
+                                                id: 'thin',
+                                                description: 'thin'
+                                            });
+                                            items.push({
+                                                id: 'sparse',
+                                                description: 'sparse'
+                                            });
+                                            items.push({
+                                                id: 'fat',
+                                                description: 'fat'
+                                            });
+                                            args.response.success({
+                                                data: items
+                                            });
+                                        }
+                                    },
                                     isCustomized: {
                                         label: 'label.custom.disk.size',
                                         docID: 'helpDiskOfferingCustomDiskSize',
@@ -1671,6 +1745,7 @@
                                     displaytext: args.data.description,
                                     storageType: args.data.storageType,
                                     cacheMode: args.data.cacheMode,
+                                    provisioningType: args.data.provisioningType,
                                     customized: (args.data.isCustomized == "on")
                                 };
 
@@ -1917,6 +1992,9 @@
                                     },
                                     storagetype: {
                                         label: 'label.storage.type'
+                                    },
+                                    provisioningtype: {
+                                        label: 'label.disk.provisioningtype'
                                     }
                                 }],
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11f5bdd7/ui/scripts/docs.js
----------------------------------------------------------------------
diff --git a/ui/scripts/docs.js b/ui/scripts/docs.js
index df4bcf0..8c9f514 100755
--- a/ui/scripts/docs.js
+++ b/ui/scripts/docs.js
@@ -218,6 +218,10 @@ cloudStack.docs = {
         desc: 'Type of disk for the VM. Local storage is attached to the hypervisor host
where the VM is running. Shared storage is accessible via NFS.',
         externalLink: ''
     },
+    helpComputeOfferingProvisioningType: {
+        desc: 'Provisioning type to create a volume. Thin and sparse is lazy allocation.
fat is eager allocation.',
+        externalLink: ''
+    },
     helpComputeOfferingCPUCores: {
         desc: 'The number of cores which should be allocated to a VM with this offering',
         externalLink: ''
@@ -282,6 +286,10 @@ cloudStack.docs = {
         desc: 'A short description of the offering that can be displayed to users',
         externalLink: ''
     },
+    helpDiskOfferingProvisioningType: {
+        desc: 'Provisioning type to create a volume. Thin and sparse is lazy allocation.
fat is eager allocation.',
+        externalLink: ''
+    },
     helpDiskOfferingStorageType: {
         desc: 'Type of disk for the VM. Local is attached to the hypervisor host where the
VM is running. Shared is storage accessible via NFS.',
         externalLink: ''

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11f5bdd7/ui/scripts/storage.js
----------------------------------------------------------------------
diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js
index e69a07e..528a3c5 100644
--- a/ui/scripts/storage.js
+++ b/ui/scripts/storage.js
@@ -1402,6 +1402,9 @@
                                     storagetype: {
                                         label: 'label.storage.type'
                                     },
+                                    provisioningtype: {
+                                        label: 'label.disk.provisioningtype'
+                                    },
                                     hypervisor: {
                                         label: 'label.hypervisor'
                                     },


Mime
View raw message