package com.bocloud.cmp.model.hmc;

/**
 * HMC系统内存配置
 *
 * @author sxp
 * @since May 22, 2018
 */
@Deprecated
public class HmcSystemMemoryConfigModel {
    private Long id;
    private Long serverId;
    private Long currentAvailableSystemMemory;
    private Long memoryUsedByHypervisor;
    private Long configurableSystemMemory;
    private Long installedSystemMemory;
    private Long memoryRegionSize;
    private Long currentAvailableHugePages;
    private Long configurableHugePages;
    private Long hugePageSize;
    private Long maximumHugePages;
    private Long requestedHugePages;
    private Long totalBarrierSynchronizationRegisterArrays;
    private Long barrierSynchronizationRegisterArraySize;
    private Long availableBarrierSynchronizationRegisterArrays;
    private String activeMemorySharingCapable;
    private Long assignedSystemMemory;
    private Double currentAvailableSystemMemoryGB;
    private Double memoryUsedByHypervisorGB;
    private Double configurableSystemMemoryGB;
    private Double installedSystemMemoryGB;
    private Double memoryRegionSizeGB;
    private Double assignedSystemMemoryGB;

    public HmcSystemMemoryConfigModel() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getServerId() {
        return serverId;
    }

    public void setServerId(Long serverId) {
        this.serverId = serverId;
    }

    public Long getCurrentAvailableSystemMemory() {
        return currentAvailableSystemMemory;
    }

    public void setCurrentAvailableSystemMemory(Long currentAvailableSystemMemory) {
        this.currentAvailableSystemMemory = currentAvailableSystemMemory;
    }

    public Long getMemoryUsedByHypervisor() {
        return memoryUsedByHypervisor;
    }

    public void setMemoryUsedByHypervisor(Long memoryUsedByHypervisor) {
        this.memoryUsedByHypervisor = memoryUsedByHypervisor;
    }

    public Long getConfigurableSystemMemory() {
        return configurableSystemMemory;
    }

    public void setConfigurableSystemMemory(Long configurableSystemMemory) {
        this.configurableSystemMemory = configurableSystemMemory;
    }

    public Long getInstalledSystemMemory() {
        return installedSystemMemory;
    }

    public void setInstalledSystemMemory(Long installedSystemMemory) {
        this.installedSystemMemory = installedSystemMemory;
    }

    public Long getMemoryRegionSize() {
        return memoryRegionSize;
    }

    public void setMemoryRegionSize(Long memoryRegionSize) {
        this.memoryRegionSize = memoryRegionSize;
    }

    public Long getCurrentAvailableHugePages() {
        return currentAvailableHugePages;
    }

    public void setCurrentAvailableHugePages(Long currentAvailableHugePages) {
        this.currentAvailableHugePages = currentAvailableHugePages;
    }

    public Long getConfigurableHugePages() {
        return configurableHugePages;
    }

    public void setConfigurableHugePages(Long configurableHugePages) {
        this.configurableHugePages = configurableHugePages;
    }

    public Long getHugePageSize() {
        return hugePageSize;
    }

    public void setHugePageSize(Long hugePageSize) {
        this.hugePageSize = hugePageSize;
    }

    public Long getMaximumHugePages() {
        return maximumHugePages;
    }

    public void setMaximumHugePages(Long maximumHugePages) {
        this.maximumHugePages = maximumHugePages;
    }

    public Long getRequestedHugePages() {
        return requestedHugePages;
    }

    public void setRequestedHugePages(Long requestedHugePages) {
        this.requestedHugePages = requestedHugePages;
    }

    public Long getTotalBarrierSynchronizationRegisterArrays() {
        return totalBarrierSynchronizationRegisterArrays;
    }

    public void setTotalBarrierSynchronizationRegisterArrays(Long totalBarrierSynchronizationRegisterArrays) {
        this.totalBarrierSynchronizationRegisterArrays = totalBarrierSynchronizationRegisterArrays;
    }

    public Long getBarrierSynchronizationRegisterArraySize() {
        return barrierSynchronizationRegisterArraySize;
    }

    public void setBarrierSynchronizationRegisterArraySize(Long barrierSynchronizationRegisterArraySize) {
        this.barrierSynchronizationRegisterArraySize = barrierSynchronizationRegisterArraySize;
    }

    public Long getAvailableBarrierSynchronizationRegisterArrays() {
        return availableBarrierSynchronizationRegisterArrays;
    }

    public void setAvailableBarrierSynchronizationRegisterArrays(Long availableBarrierSynchronizationRegisterArrays) {
        this.availableBarrierSynchronizationRegisterArrays = availableBarrierSynchronizationRegisterArrays;
    }

    public Long getAssignedSystemMemory() {
        return assignedSystemMemory;
    }

    public void setAssignedSystemMemory(Long assignedSystemMemory) {
        this.assignedSystemMemory = assignedSystemMemory;
    }

    public Double getCurrentAvailableSystemMemoryGB() {
        return currentAvailableSystemMemoryGB;
    }

    public void setCurrentAvailableSystemMemoryGB(Double currentAvailableSystemMemoryGB) {
        this.currentAvailableSystemMemoryGB = currentAvailableSystemMemoryGB;
    }

    public Double getMemoryUsedByHypervisorGB() {
        return memoryUsedByHypervisorGB;
    }

    public void setMemoryUsedByHypervisorGB(Double memoryUsedByHypervisorGB) {
        this.memoryUsedByHypervisorGB = memoryUsedByHypervisorGB;
    }

    public Double getConfigurableSystemMemoryGB() {
        return configurableSystemMemoryGB;
    }

    public void setConfigurableSystemMemoryGB(Double configurableSystemMemoryGB) {
        this.configurableSystemMemoryGB = configurableSystemMemoryGB;
    }

    public Double getInstalledSystemMemoryGB() {
        return installedSystemMemoryGB;
    }

    public void setInstalledSystemMemoryGB(Double installedSystemMemoryGB) {
        this.installedSystemMemoryGB = installedSystemMemoryGB;
    }

    public Double getMemoryRegionSizeGB() {
        return memoryRegionSizeGB;
    }

    public void setMemoryRegionSizeGB(Double memoryRegionSizeGB) {
        this.memoryRegionSizeGB = memoryRegionSizeGB;
    }

    public String getActiveMemorySharingCapable() {
        return activeMemorySharingCapable;
    }

    public void setActiveMemorySharingCapable(String activeMemorySharingCapable) {
        this.activeMemorySharingCapable = activeMemorySharingCapable;
    }

    public Double getAssignedSystemMemoryGB() {
        return assignedSystemMemoryGB;
    }

    public void setAssignedSystemMemoryGB(Double assignedSystemMemoryGB) {
        this.assignedSystemMemoryGB = assignedSystemMemoryGB;
    }

    public void calculateAssignedSystemMemory() {
        if (currentAvailableSystemMemory == null || configurableSystemMemory == null
            || memoryUsedByHypervisor == null) {
            return;
        }
        // 可配置的 - 可用的 - 保留的
        long assigned = configurableSystemMemory - currentAvailableSystemMemory - memoryUsedByHypervisor;
        assignedSystemMemory = assigned;
    }

    /**
     * 计算出GB为后缀的变量的值
     *
     * @author sxp
     * @since May 23, 2018
     */
    public void calculateMemoryGB() {
        if (currentAvailableSystemMemory != null) {
            currentAvailableSystemMemoryGB = Math.round(currentAvailableSystemMemory / 1024D * 100) / 100D;
        }
        if (memoryUsedByHypervisor != null) {
            memoryUsedByHypervisorGB = Math.round(memoryUsedByHypervisor / 1024D * 100) / 100D;
        }
        if (configurableSystemMemory != null) {
            configurableSystemMemoryGB = Math.round(configurableSystemMemory / 1024D * 100) / 100D;
        }
        if (installedSystemMemory != null) {
            installedSystemMemoryGB = Math.round(installedSystemMemory / 1024D * 100) / 100D;
        }
        if (memoryRegionSize != null) {
            memoryRegionSizeGB = Math.round(memoryRegionSize / 1024D * 100) / 100D;
        }
        if (currentAvailableSystemMemoryGB == null || configurableSystemMemoryGB == null
            || memoryUsedByHypervisorGB == null) {
            return;
        }
        // 可配置的 - 可用的 - 保留的
        double assigned = configurableSystemMemoryGB - currentAvailableSystemMemoryGB - memoryUsedByHypervisorGB;
        assignedSystemMemoryGB = Math.round(assigned * 100) / 100D;
    }
}
