Repository: cloudstack
Updated Branches:
  refs/heads/master 2f832fddf -> 2ed22b3ba


CLOUDSTACK-5641: Local disk usage on host don't show up in the admin's webui. 
Correcting the view to include capacity type 9 which is local storage. Also 
changing the response to just pick the used bytes coming in through the view 
which now stands corrected.
Verified that the dashboard and storage pool view works fine.


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

Branch: refs/heads/master
Commit: 2ed22b3ba7e67ad96bd741635eec75b9192275cb
Parents: 2f832fd
Author: Nitin Mehta <[email protected]>
Authored: Thu Jul 24 17:16:30 2014 -0700
Committer: Nitin Mehta <[email protected]>
Committed: Thu Jul 24 17:16:30 2014 -0700

----------------------------------------------------------------------
 .../api/query/dao/StoragePoolJoinDaoImpl.java   |  5 +-
 setup/db/db/schema-440to450.sql                 | 55 ++++++++++++++++++++
 2 files changed, 56 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ed22b3b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java 
b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
index 1d89b19..ff04c5b 100644
--- a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
@@ -29,9 +29,7 @@ import 
org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 
 import com.cloud.api.ApiDBUtils;
 import com.cloud.api.query.vo.StoragePoolJoinVO;
-import com.cloud.capacity.Capacity;
 import com.cloud.capacity.CapacityManager;
-import com.cloud.storage.ScopeType;
 import com.cloud.storage.StoragePool;
 import com.cloud.storage.StorageStats;
 import com.cloud.utils.StringUtils;
@@ -152,8 +150,7 @@ public class StoragePoolJoinDaoImpl extends 
GenericDaoBase<StoragePoolJoinVO, Lo
             poolResponse.setHypervisor(pool.getHypervisor().toString());
         }
 
-        short capacityType = pool.getScope() == ScopeType.HOST ? 
Capacity.CAPACITY_TYPE_LOCAL_STORAGE : Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED;
-        long allocatedSize = ApiDBUtils.getStorageCapacitybyPool(pool.getId(), 
capacityType);
+        long allocatedSize = pool.getUsedCapacity();
         poolResponse.setDiskSizeTotal(pool.getCapacityBytes());
         poolResponse.setDiskSizeAllocated(allocatedSize);
         poolResponse.setCapacityIops(pool.getCapacityIops());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ed22b3b/setup/db/db/schema-440to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-440to450.sql b/setup/db/db/schema-440to450.sql
index d727f21..98317a7 100644
--- a/setup/db/db/schema-440to450.sql
+++ b/setup/db/db/schema-440to450.sql
@@ -274,3 +274,58 @@ UPDATE `cloud`.`user` SET `cloud`.`user`.domain_id=(SELECT 
`cloud`.`account`.dom
 ALTER TABLE `cloud`.`user` ADD UNIQUE KEY `username_domain_id` 
(`username`,`domain_id`);
 
 ALTER TABLE `cloud`.`volumes` CHANGE COLUMN `iso_id` `iso_id` bigint(20) 
unsigned COMMENT 'The id of the iso from which the volume was created';
+
+DROP VIEW IF EXISTS `cloud`.`storage_pool_view`;
+CREATE VIEW `cloud`.`storage_pool_view` AS
+    select
+        storage_pool.id,
+        storage_pool.uuid,
+        storage_pool.name,
+        storage_pool.status,
+        storage_pool.path,
+        storage_pool.pool_type,
+        storage_pool.host_address,
+        storage_pool.created,
+        storage_pool.removed,
+        storage_pool.capacity_bytes,
+        storage_pool.capacity_iops,
+        storage_pool.scope,
+        storage_pool.hypervisor,
+        storage_pool.storage_provider_name,
+        cluster.id cluster_id,
+        cluster.uuid cluster_uuid,
+        cluster.name cluster_name,
+        cluster.cluster_type,
+        data_center.id data_center_id,
+        data_center.uuid data_center_uuid,
+        data_center.name data_center_name,
+        data_center.networktype data_center_type,
+        host_pod_ref.id pod_id,
+        host_pod_ref.uuid pod_uuid,
+        host_pod_ref.name pod_name,
+        storage_pool_details.name tag,
+        op_host_capacity.used_capacity disk_used_capacity,
+        op_host_capacity.reserved_capacity disk_reserved_capacity,
+        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`.`storage_pool`
+            left join
+        `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id
+            left join
+        `cloud`.`data_center` ON storage_pool.data_center_id = data_center.id
+            left join
+        `cloud`.`host_pod_ref` ON storage_pool.pod_id = host_pod_ref.id
+            left join
+        `cloud`.`storage_pool_details` ON storage_pool_details.pool_id = 
storage_pool.id
+            and storage_pool_details.value = 'true'
+            left join
+        `cloud`.`op_host_capacity` ON storage_pool.id = 
op_host_capacity.host_id
+            and op_host_capacity.capacity_type in (3,9)
+            left join
+        `cloud`.`async_job` ON async_job.instance_id = storage_pool.id
+            and async_job.instance_type = 'StoragePool'
+            and async_job.job_status = 0;
+

Reply via email to