mirror of https://github.com/apache/cloudstack.git
Changes to the op_host_planner_reservation schema - removed unnescessray columns
This commit is contained in:
parent
593e43b93b
commit
06d4b7de3b
|
|
@ -844,4 +844,7 @@
|
|||
<bean id="AffinityGroupVMMapDaoImpl" class="org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDaoImpl">
|
||||
</bean>
|
||||
|
||||
<bean id="PlannerHostReservationDaoImpl" class="com.cloud.deploy.dao.PlannerHostReservationDaoImpl">
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
this.resourceType = resourceType;
|
||||
this.deploymentPlanner = planner;
|
||||
}
|
||||
|
||||
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.resourceUsage = resourceUsage;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -104,32 +106,12 @@ public class PlannerHostReservationVO implements InternalIdentity {
|
|||
this.clusterId = new Long(clusterId);
|
||||
}
|
||||
|
||||
public short getResourceType() {
|
||||
return resourceType;
|
||||
public PlannerResourceUsage getResourceUsage() {
|
||||
return resourceUsage;
|
||||
}
|
||||
|
||||
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 void setAccountId(long accountId) {
|
||||
this.accountId = accountId;
|
||||
public void setResourceUsage(PlannerResourceUsage resourceType) {
|
||||
this.resourceUsage = resourceType;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,4 +21,6 @@ import com.cloud.utils.db.GenericDao;
|
|||
|
||||
public interface PlannerHostReservationDao extends GenericDao<PlannerHostReservationVO, Long> {
|
||||
|
||||
PlannerHostReservationVO findByHostId(long hostId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<PlannerHostReservationVO, Long> implements
|
||||
PlannerHostReservationDao {
|
||||
|
||||
private SearchBuilder<PlannerHostReservationVO> _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<PlannerHostReservationVO> sc = _hostIdSearch.create();
|
||||
sc.setParameters("hostId", hostId);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -925,15 +925,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
|
||||
|
|
|
|||
Loading…
Reference in New Issue