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 D8908106D4 for ; Wed, 24 Apr 2013 22:42:51 +0000 (UTC) Received: (qmail 67999 invoked by uid 500); 24 Apr 2013 22:42:51 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 67977 invoked by uid 500); 24 Apr 2013 22:42:51 -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 67960 invoked by uid 99); 24 Apr 2013 22:42:51 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Apr 2013 22:42:51 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 4E2B38807BA; Wed, 24 Apr 2013 22:42:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: prachidamle@apache.org To: commits@cloudstack.apache.org Date: Wed, 24 Apr 2013 22:42:51 -0000 Message-Id: <57180a83b0354c108e6eff23b4a5821e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: updated refs/heads/planner_reserve to 1959377 Updated Branches: refs/heads/planner_reserve a3aa28929 -> 1959377d3 Changes to the op_host_planner_reservation schema - removed unnescessray columns Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/526c0cc6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/526c0cc6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/526c0cc6 Branch: refs/heads/planner_reserve Commit: 526c0cc6d5e7c6a6e513f61595e00f884bfedc1d Parents: a3aa289 Author: Prachi Damle Authored: Wed Apr 24 15:39:24 2013 -0700 Committer: Prachi Damle Committed: Wed Apr 24 15:39:24 2013 -0700 ---------------------------------------------------------------------- client/tomcatconf/applicationContext.xml.in | 3 + .../com/cloud/deploy/PlannerHostReservationVO.java | 60 +++++---------- .../deploy/dao/PlannerHostReservationDao.java | 2 + .../deploy/dao/PlannerHostReservationDaoImpl.java | 23 ++++++ setup/db/db/schema-410to420.sql | 7 +-- 5 files changed, 50 insertions(+), 45 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526c0cc6/client/tomcatconf/applicationContext.xml.in ---------------------------------------------------------------------- diff --git a/client/tomcatconf/applicationContext.xml.in b/client/tomcatconf/applicationContext.xml.in index 48c1ba9..a341f33 100644 --- a/client/tomcatconf/applicationContext.xml.in +++ b/client/tomcatconf/applicationContext.xml.in @@ -844,4 +844,7 @@ + + + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526c0cc6/server/src/com/cloud/deploy/PlannerHostReservationVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/deploy/PlannerHostReservationVO.java b/server/src/com/cloud/deploy/PlannerHostReservationVO.java index 47e1457..cf5f031 100644 --- a/server/src/com/cloud/deploy/PlannerHostReservationVO.java +++ b/server/src/com/cloud/deploy/PlannerHostReservationVO.java @@ -19,12 +19,16 @@ package com.cloud.deploy; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.deploy.DeploymentPlanner.PlannerResourceUsage; + @Entity @Table(name = "op_host_planner_reservation") public class PlannerHostReservationVO implements InternalIdentity { @@ -45,29 +49,27 @@ public class PlannerHostReservationVO implements InternalIdentity { @Column(name="cluster_id") private Long clusterId; - @Column(name = "resource_type") - private short resourceType; - - @Column(name = "domain_id") - private long domainId; - - @Column(name = "account_id") - private long accountId; - - @Column(name = "deployment_planner") - private String deploymentPlanner; + @Column(name = "resource_usage") + @Enumerated(EnumType.STRING) + private PlannerResourceUsage resourceUsage; public PlannerHostReservationVO() { } - public PlannerHostReservationVO(Long hostId, Long dataCenterId, Long podId, Long clusterId, short resourceType, - String planner) { + public PlannerHostReservationVO(Long hostId, Long dataCenterId, Long podId, Long clusterId) { + this.hostId = hostId; + this.dataCenterId = dataCenterId; + this.podId = podId; + this.clusterId = clusterId; + } + + public PlannerHostReservationVO(Long hostId, Long dataCenterId, Long podId, Long clusterId, + PlannerResourceUsage resourceUsage) { this.hostId = hostId; this.dataCenterId = dataCenterId; this.podId = podId; this.clusterId = clusterId; - this.resourceType = resourceType; - this.deploymentPlanner = planner; + this.resourceUsage = resourceUsage; } @Override @@ -104,32 +106,12 @@ public class PlannerHostReservationVO implements InternalIdentity { this.clusterId = new Long(clusterId); } - public short getResourceType() { - return resourceType; - } - - public void setResourceType(short resourceType) { - this.resourceType = resourceType; - } - - public String getDeploymentPlanner() { - return deploymentPlanner; - } - - public long getDomainId() { - return domainId; - } - - public void setDomainId(long domainId) { - this.domainId = domainId; - } - - public long getAccountId() { - return accountId; + public PlannerResourceUsage getResourceUsage() { + return resourceUsage; } - public void setAccountId(long accountId) { - this.accountId = accountId; + public void setResourceUsage(PlannerResourceUsage resourceType) { + this.resourceUsage = resourceType; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526c0cc6/server/src/com/cloud/deploy/dao/PlannerHostReservationDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/deploy/dao/PlannerHostReservationDao.java b/server/src/com/cloud/deploy/dao/PlannerHostReservationDao.java index 112af95..71e235d 100644 --- a/server/src/com/cloud/deploy/dao/PlannerHostReservationDao.java +++ b/server/src/com/cloud/deploy/dao/PlannerHostReservationDao.java @@ -21,4 +21,6 @@ import com.cloud.utils.db.GenericDao; public interface PlannerHostReservationDao extends GenericDao { + PlannerHostReservationVO findByHostId(long hostId); + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526c0cc6/server/src/com/cloud/deploy/dao/PlannerHostReservationDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/deploy/dao/PlannerHostReservationDaoImpl.java b/server/src/com/cloud/deploy/dao/PlannerHostReservationDaoImpl.java index ccda44b..7b12067 100644 --- a/server/src/com/cloud/deploy/dao/PlannerHostReservationDaoImpl.java +++ b/server/src/com/cloud/deploy/dao/PlannerHostReservationDaoImpl.java @@ -16,12 +16,35 @@ // under the License. package com.cloud.deploy.dao; +import javax.annotation.PostConstruct; import javax.ejb.Local; import com.cloud.deploy.PlannerHostReservationVO; import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; @Local(value = { PlannerHostReservationDao.class }) public class PlannerHostReservationDaoImpl extends GenericDaoBase implements PlannerHostReservationDao { + private SearchBuilder _hostIdSearch; + + public PlannerHostReservationDaoImpl() { + + } + + @PostConstruct + protected void init() { + _hostIdSearch = createSearchBuilder(); + _hostIdSearch.and("hostId", _hostIdSearch.entity().getHostId(), SearchCriteria.Op.EQ); + _hostIdSearch.done(); + } + + @Override + public PlannerHostReservationVO findByHostId(long hostId) { + SearchCriteria sc = _hostIdSearch.create(); + sc.setParameters("hostId", hostId); + return findOneBy(sc); + } + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/526c0cc6/setup/db/db/schema-410to420.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql index d63bdf1..4350b65 100644 --- a/setup/db/db/schema-410to420.sql +++ b/setup/db/db/schema-410to420.sql @@ -725,15 +725,10 @@ CREATE TABLE `cloud`.`op_host_planner_reservation` ( `pod_id` bigint unsigned, `cluster_id` bigint unsigned, `host_id` bigint unsigned, - `account_id` bigint unsigned, - `domain_id` bigint unsigned, - `deployment_planner` varchar(255) COMMENT 'Name of the Planner', - `resource_type` int(1) unsigned NOT NULL COMMENT 'shared(0) Vs dedicated(1)', + `resource_usage` varchar(255) COMMENT 'Shared(between planners) Vs Dedicated (exclusive usage to a planner)', PRIMARY KEY (`id`), INDEX `i_op_host_planner_reservation__host_type`(`host_id`, `resource_type`), CONSTRAINT `fk_planner_reservation__host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_planner_reservation__account_id` FOREIGN KEY `fk_resource_count__account_id`(`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_planner_reservation__domain_id` FOREIGN KEY `fk_resource_count__domain_id`(`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, CONSTRAINT `fk_planner_reservation__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `cloud`.`data_center`(`id`) ON DELETE CASCADE, CONSTRAINT `fk_planner_reservation__pod_id` FOREIGN KEY (`pod_id`) REFERENCES `cloud`.`host_pod_ref`(`id`) ON DELETE CASCADE, CONSTRAINT `fk_planner_reservation__cluster_id` FOREIGN KEY (`cluster_id`) REFERENCES `cloud`.`cluster`(`id`) ON DELETE CASCADE