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

git commit: updated refs/heads/master to 199e861

Updated Branches:
  refs/heads/master 037c6958b -> 199e861a5


CLOUDSTACK-3856:[ZWPS] Template downloaded from ROOT volume is not seen
in the UI because of failure to get hypervisor_type for the ROOT volume
for zone-wide primary storage.


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

Branch: refs/heads/master
Commit: 199e861a51beec0a574309dba227df979b4d65f6
Parents: 037c695
Author: Min Chen <mi...@citrix.com>
Authored: Fri Jul 26 13:33:19 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Fri Jul 26 13:41:58 2013 -0700

----------------------------------------------------------------------
 .../com/cloud/storage/dao/VolumeDaoImpl.java    | 21 +++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/199e861a/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java
index f87cd4e..7696bcc 100755
--- a/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java
+++ b/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java
@@ -67,7 +67,10 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
     ResourceTagDao _tagsDao;
 
     protected static final String SELECT_VM_SQL = "SELECT DISTINCT instance_id from volumes v where v.host_id = ? and v.mirror_state = ?";
-    protected static final String SELECT_HYPERTYPE_FROM_VOLUME = "SELECT c.hypervisor_type from volumes v, storage_pool s, cluster c where v.pool_id = s.id and s.cluster_id = c.id and v.id = ?";
+    // need to account for zone-wide primary storage where storage_pool has
+    // null-value pod and cluster, where hypervisor information is stored in
+    // storage_pool
+    protected static final String SELECT_HYPERTYPE_FROM_VOLUME = "SELECT s.hypervisor, c.hypervisor_type from volumes v, storage_pool s, cluster c where v.pool_id = s.id and s.cluster_id = c.id and v.id = ?";
 
     private static final String ORDER_POOLS_NUMBER_OF_VOLUMES_FOR_ACCOUNT = "SELECT pool.id, SUM(IF(vol.state='Ready' AND vol.account_id = ?, 1, 0)) FROM `cloud`.`storage_pool` pool LEFT JOIN `cloud`.`volumes` vol ON pool.id = vol.pool_id WHERE pool.data_center_id = ? "
             + " AND pool.pod_id = ? AND pool.cluster_id = ? " + " GROUP BY pool.id ORDER BY 2 ASC ";
@@ -109,8 +112,8 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
         sc.setParameters("poolId", poolId);
         sc.setParameters("notDestroyed", Volume.State.Destroy);
         sc.setParameters("vType", Volume.Type.ROOT.toString());
-	    return listBy(sc);
-	}
+        return listBy(sc);
+    }
 
     @Override
     public List<VolumeVO> findByPoolId(long poolId, Volume.Type volumeType) {
@@ -421,14 +424,14 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
             if (dbVol != null) {
                 StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString());
                 str.append(": DB Data={id=").append(dbVol.getId()).append("; state=").append(dbVol.getState())
-                        .append("; updatecount=").append(dbVol.getUpdatedCount()).append(";updatedTime=")
-                        .append(dbVol.getUpdated());
+                .append("; updatecount=").append(dbVol.getUpdatedCount()).append(";updatedTime=")
+                .append(dbVol.getUpdated());
                 str.append(": New Data={id=").append(vo.getId()).append("; state=").append(nextState)
-                        .append("; event=").append(event).append("; updatecount=").append(vo.getUpdatedCount())
-                        .append("; updatedTime=").append(vo.getUpdated());
+                .append("; event=").append(event).append("; updatecount=").append(vo.getUpdatedCount())
+                .append("; updatedTime=").append(vo.getUpdated());
                 str.append(": stale Data={id=").append(vo.getId()).append("; state=").append(currentState)
-                        .append("; event=").append(event).append("; updatecount=").append(oldUpdated)
-                        .append("; updatedTime=").append(oldUpdatedTime);
+                .append("; event=").append(event).append("; updatecount=").append(oldUpdated)
+                .append("; updatedTime=").append(oldUpdatedTime);
             } else {
                 s_logger.debug("Unable to update volume: id=" + vo.getId()
                         + ", as there is no such volume exists in the database anymore");