Adding `cloud`.`op_host_planner_reservation` schema, VO and DAO classes

This commit is contained in:
Prachi Damle 2013-04-22 14:16:02 -07:00
parent 93277e8647
commit 593e43b93b
4 changed files with 208 additions and 0 deletions

View File

@ -0,0 +1,135 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.deploy;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.cloudstack.api.InternalIdentity;
@Entity
@Table(name = "op_host_planner_reservation")
public class PlannerHostReservationVO implements InternalIdentity {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name="host_id")
private Long hostId;
@Column(name="data_center_id")
private Long dataCenterId;
@Column(name="pod_id")
private Long podId;
@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;
public PlannerHostReservationVO() {
}
public PlannerHostReservationVO(Long hostId, Long dataCenterId, Long podId, Long clusterId, short resourceType,
String planner) {
this.hostId = hostId;
this.dataCenterId = dataCenterId;
this.podId = podId;
this.clusterId = clusterId;
this.resourceType = resourceType;
this.deploymentPlanner = planner;
}
@Override
public long getId() {
return id;
}
public Long getHostId() {
return hostId;
}
public void setHostId(Long hostId) {
this.hostId = hostId;
}
public Long getDataCenterId() {
return dataCenterId;
}
public void setDataCenterId(Long dataCenterId) {
this.dataCenterId = dataCenterId;
}
public Long getPodId() {
return podId;
}
public void setPodId(long podId) {
this.podId = new Long(podId);
}
public Long getClusterId() {
return clusterId;
}
public void setClusterId(long clusterId) {
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 void setAccountId(long accountId) {
this.accountId = accountId;
}
}

View File

@ -0,0 +1,24 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.deploy.dao;
import com.cloud.deploy.PlannerHostReservationVO;
import com.cloud.utils.db.GenericDao;
public interface PlannerHostReservationDao extends GenericDao<PlannerHostReservationVO, Long> {
}

View File

@ -0,0 +1,27 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.deploy.dao;
import javax.ejb.Local;
import com.cloud.deploy.PlannerHostReservationVO;
import com.cloud.utils.db.GenericDaoBase;
@Local(value = { PlannerHostReservationDao.class })
public class PlannerHostReservationDaoImpl extends GenericDaoBase<PlannerHostReservationVO, Long> implements
PlannerHostReservationDao {
}

View File

@ -918,6 +918,28 @@ CREATE TABLE `cloud`.`network_asa1000v_map` (
ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `eip_associate_public_ip` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if public IP is associated with user VM creation by default when EIP service is enabled.' AFTER `elastic_ip_service`;
CREATE TABLE `cloud`.`op_host_planner_reservation` (
`id` bigint unsigned NOT NULL auto_increment,
`data_center_id` bigint unsigned NOT NULL,
`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)',
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
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Re-enable foreign key checking, at the end of the upgrade path
SET foreign_key_checks = 1;