mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	bug 11997: Introduce created and update_time in the op_host_capacity table.
status 11997: resolved fixed
This commit is contained in:
		
							parent
							
								
									9086a39bda
								
							
						
					
					
						commit
						e39498f1e7
					
				
							
								
								
									
										40
									
								
								core/src/com/cloud/capacity/CapacityVO.java
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										40
									
								
								core/src/com/cloud/capacity/CapacityVO.java
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							@ -18,12 +18,18 @@
 | 
			
		||||
 | 
			
		||||
package com.cloud.capacity;
 | 
			
		||||
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
 | 
			
		||||
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 javax.persistence.Temporal;
 | 
			
		||||
import javax.persistence.TemporalType;
 | 
			
		||||
 | 
			
		||||
import com.cloud.utils.db.GenericDao;
 | 
			
		||||
 | 
			
		||||
@Entity
 | 
			
		||||
@Table(name="op_host_capacity")
 | 
			
		||||
@ -55,7 +61,15 @@ public class CapacityVO implements Capacity {
 | 
			
		||||
    private long totalCapacity;
 | 
			
		||||
 | 
			
		||||
    @Column(name="capacity_type")
 | 
			
		||||
    private short capacityType;
 | 
			
		||||
    private short capacityType;
 | 
			
		||||
    
 | 
			
		||||
    @Column(name=GenericDao.CREATED_COLUMN)
 | 
			
		||||
    protected Date created;    
 | 
			
		||||
    
 | 
			
		||||
    @Column(name="update_time", updatable=true, nullable=true)
 | 
			
		||||
    @Temporal(value=TemporalType.TIMESTAMP)
 | 
			
		||||
    protected Date updateTime;
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    public CapacityVO() {}
 | 
			
		||||
 | 
			
		||||
@ -66,7 +80,8 @@ public class CapacityVO implements Capacity {
 | 
			
		||||
        this.clusterId = clusterId;
 | 
			
		||||
        this.usedCapacity = usedCapacity;
 | 
			
		||||
        this.totalCapacity = totalCapacity;
 | 
			
		||||
        this.capacityType = capacityType;
 | 
			
		||||
        this.capacityType = capacityType;
 | 
			
		||||
        this.updateTime = new Date();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@ -111,7 +126,8 @@ public class CapacityVO implements Capacity {
 | 
			
		||||
        return usedCapacity;
 | 
			
		||||
    }
 | 
			
		||||
    public void setUsedCapacity(long usedCapacity) {
 | 
			
		||||
        this.usedCapacity = usedCapacity;
 | 
			
		||||
        this.usedCapacity = usedCapacity;
 | 
			
		||||
        this.setUpdateTime (new Date());
 | 
			
		||||
    }
 | 
			
		||||
    @Override
 | 
			
		||||
    public long getReservedCapacity() {
 | 
			
		||||
@ -119,13 +135,15 @@ public class CapacityVO implements Capacity {
 | 
			
		||||
    }
 | 
			
		||||
    public void setReservedCapacity(long reservedCapacity) {
 | 
			
		||||
        this.reservedCapacity = reservedCapacity;
 | 
			
		||||
        this.setUpdateTime (new Date());
 | 
			
		||||
    }
 | 
			
		||||
    @Override
 | 
			
		||||
    public long getTotalCapacity() {
 | 
			
		||||
        return totalCapacity;
 | 
			
		||||
    }
 | 
			
		||||
    public void setTotalCapacity(long totalCapacity) {
 | 
			
		||||
        this.totalCapacity = totalCapacity;
 | 
			
		||||
        this.totalCapacity = totalCapacity;
 | 
			
		||||
        this.setUpdateTime (new Date());
 | 
			
		||||
    }
 | 
			
		||||
    @Override
 | 
			
		||||
    public short getCapacityType() {
 | 
			
		||||
@ -133,5 +151,17 @@ public class CapacityVO implements Capacity {
 | 
			
		||||
    }
 | 
			
		||||
    public void setCapacityType(short capacityType) {
 | 
			
		||||
        this.capacityType = capacityType;
 | 
			
		||||
    }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public Date getCreated() {
 | 
			
		||||
		return created;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public Date getUpdateTime() {
 | 
			
		||||
		return updateTime;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setUpdateTime(Date updateTime) {
 | 
			
		||||
		this.updateTime = updateTime;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1172,6 +1172,8 @@ CREATE TABLE `cloud`.`op_host_capacity` (
 | 
			
		||||
  `reserved_capacity` bigint signed NOT NULL,
 | 
			
		||||
  `total_capacity` bigint signed NOT NULL,
 | 
			
		||||
  `capacity_type` int(1) unsigned NOT NULL,
 | 
			
		||||
  `update_time` datetime COMMENT 'time the capacity was last updated',
 | 
			
		||||
  `created` datetime COMMENT  'date created',
 | 
			
		||||
  PRIMARY KEY  (`id`),
 | 
			
		||||
  INDEX `i_op_host_capacity__host_type`(`host_id`, `capacity_type`),
 | 
			
		||||
  INDEX `i_op_host_capacity__pod_id`(`pod_id`),
 | 
			
		||||
 | 
			
		||||
@ -225,3 +225,7 @@ CREATE TABLE `cloud`.`vm_template_details` (
 | 
			
		||||
  PRIMARY KEY (`id`),
 | 
			
		||||
  CONSTRAINT `fk_vm_template_details__template_id` FOREIGN KEY `fk_vm_template_details__template_id`(`template_id`) REFERENCES `vm_template`(`id`) ON DELETE CASCADE
 | 
			
		||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 | 
			
		||||
 | 
			
		||||
ALTER TABLE `cloud`.`op_host_capacity` ADD COLUMN `created` datetime;
 | 
			
		||||
ALTER TABLE `cloud`.`op_host_capacity` ADD COLUMN `update_time` datetime;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user