Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AC8D7CA37 for ; Fri, 26 Jul 2013 20:51:56 +0000 (UTC) Received: (qmail 4984 invoked by uid 500); 26 Jul 2013 20:51:56 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 4966 invoked by uid 500); 26 Jul 2013 20:51:56 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 4959 invoked by uid 99); 26 Jul 2013 20:51:56 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Jul 2013 20:51:56 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 3EBF99A6D; Fri, 26 Jul 2013 20:51:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mchen@apache.org To: commits@cloudstack.apache.org Message-Id: <45d59b96c2d941dfa94d31e5a38c59fe@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/master to 199e861 Date: Fri, 26 Jul 2013 20:51:56 +0000 (UTC) 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 Authored: Fri Jul 26 13:33:19 2013 -0700 Committer: Min Chen 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 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 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 findByPoolId(long poolId, Volume.Type volumeType) { @@ -421,14 +424,14 @@ public class VolumeDaoImpl extends GenericDaoBase 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");