Eli Mesika has uploaded a new change for review. Change subject: [WIP]core : BE & DAO changes for Multi-Tier fencing ......................................................................
[WIP]core : BE & DAO changes for Multi-Tier fencing this patch includes the changes in BE & DAO for Multi-Tier fencing support Change-Id: I56a7b0d3237029e91e7b0cb4bbff18b64e729d9e Signed-off-by: Eli Mesika <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsHandler.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStaticDAODbFacadeImpl.java 5 files changed, 269 insertions(+), 10 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/59/10259/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsHandler.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsHandler.java index e7c66cd..d77886ea 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsHandler.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsHandler.java @@ -46,6 +46,14 @@ mUpdateVdsStatic.AddPermittedField("pm_options"); mUpdateVdsStatic.AddPermittedField("pm_enabled"); mUpdateVdsStatic.AddPermittedField("PmOptionsMap"); + mUpdateVdsStatic.AddPermittedField("managmentIp"); + mUpdateVdsStatic.AddPermittedField("pmSecondaryIp"); + mUpdateVdsStatic.AddPermittedField("pmSecondaryType"); + mUpdateVdsStatic.AddPermittedField("pmSecondaryUser"); + mUpdateVdsStatic.AddPermittedField("pmSecondaryPassword"); + mUpdateVdsStatic.AddPermittedField("pmSecondaryPort"); + mUpdateVdsStatic.AddPermittedField("pmSecondaryOptions"); + mUpdateVdsStatic.AddPermittedField("pmSecondaryOptionsMap"); mUpdateVdsStatic.AddPermittedField("vdsSpmPriority"); mUpdateVdsStatic.AddPermittedField("otpValidity"); mUpdateVdsStatic.AddFields( diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java index bdd4414..bb77d0e 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java @@ -166,8 +166,9 @@ Integer reserved_mem, Integer guest_overhead, VDSStatus previous_status, String software_version, String version_name, String build_name, Long mem_available, Long mem_shared, boolean server_SSL_enabled, String vds_group_cpu_name, String cpu_name, Boolean net_config_dirty, String pm_type, String pm_user, - String pm_password, Integer pm_port, String pm_options, boolean pm_enabled) // Nullable<System.Int32> - // mem_cached, + String pm_password, Integer pm_port, String pm_options, boolean pm_enabled, String pmSecondaryIp, + String pmSecondaryType, String pmSecondaryUser, String pmSecondaryPassword, Integer pmSecondaryPort, + String pmSecondaryOptions, boolean pmSecondaryConcurrent) { mVdsStatic = new VdsStatic(); mVdsDynamic = new VdsDynamic(); @@ -218,6 +219,12 @@ this.setpm_options(pm_options); this.setpm_type(pm_type); this.setpm_user(pm_user); + this.setPmSecondaryIp(pmSecondaryIp); + this.setPmSecondaryType(pmSecondaryType); + this.setPmSecondaryPort(pmSecondaryPort); + this.setPmSecondaryUser(pmSecondaryUser); + this.setPmSecondaryPassword(pmSecondaryPassword); + this.setPmSecondaryConcurrent(pmSecondaryConcurrent); } public VDS(VdsStatic vdsStatic, VdsDynamic vdsDynamic, VdsStatistics vdsStatistics) { @@ -271,7 +278,14 @@ getpm_password(), getpm_port(), getpm_options(), - getpm_enabled()); + getpm_enabled(), + getPmSecondaryIp(), + getPmSecondaryType(), + getPmSecondaryuser(), + getPmSecondaryPassword(), + getPmSecondaryPort(), + getPmSecondaryOptions(), + isPmSecondaryConcurrent()); vds.setcpu_flags(getcpu_flags()); vds.setVdsSpmPriority(getVdsSpmPriority()); @@ -919,6 +933,13 @@ return mVdsStatic.getPmOptionsMap(); } + public ValueObjectMap getPmSecondaryOptionsMap() { + return mVdsStatic.getPmSecondaryOptionsMap(); + } + + public void setPmSecondaryOptionsMap(ValueObjectMap value) { + mVdsStatic.setPmSecondaryOptionsMap(value); + } public void setPmOptionsMap(ValueObjectMap value) { mVdsStatic.setPmOptionsMap(value); } @@ -929,6 +950,66 @@ public void setpm_enabled(boolean value) { mVdsStatic.setpm_enabled(value); + } + + public String getPmSecondaryIp() { + return mVdsStatic.getPmSecondaryIp(); + } + + public void setPmSecondaryIp(String value) { + mVdsStatic.setPmSecondaryIp(value); + } + + public String getPmSecondaryType() { + return mVdsStatic.getPmSecondaryType(); + } + + public void setPmSecondaryType(String value) { + mVdsStatic.setPmSecondaryType(value); + } + + public String getPmSecondaryuser() { + return mVdsStatic.getPmSecondaryuser(); + } + + public void setPmSecondaryUser(String value) { + mVdsStatic.setPmSecondaryUser(value); + } + + public String getPmSecondaryPassword() { + return mVdsStatic.getPmSecondaryPassword(); + } + + public void setPmSecondaryPassword(String value) { + mVdsStatic.setPmSecondaryPassword(value); + } + + public Integer getPmSecondaryPort() { + return mVdsStatic.getPmSecondaryPort(); + } + + public void setPmSecondaryPort(Integer value) { + mVdsStatic.setPmSecondaryPort(value); + } + + public String getPmSecondaryOptions() { + return mVdsStatic.getPmSecondaryOptions(); + } + + public void setPmSecondaryOptions(String value) { + mVdsStatic.setPmSecondaryOptions(value); + } + + public void setPmSecondaryPort(String value) { + mVdsStatic.setPmSecondaryOptions(value); + } + + public boolean isPmSecondaryConcurrent() { + return mVdsStatic.isPmSecondaryConcurrent(); + } + + public void setPmSecondaryConcurrent(boolean value) { + mVdsStatic.setPmSecondaryConcurrent(value); } public String gethost_os() { @@ -1115,13 +1196,14 @@ "usage_mem_percent", "usage_network_percent", "mem_commited", "vm_count", "vm_active", "host_name", "vds_group_name", - "vds_type", "CpuName", "vds_group_id", "net_config_dirty", "spm_status", "pm_enabled", - "pm_user", - "pm_password", "pm_type", "pm_port", "pm_options", "vms_cores_count", "ksm_state", - "mem_shared", - "Version", "vds_group_compatibility_version", "UniqueId", "TransparentHugePagesState", - "swap_total", - "PmOptionsMap", "swap_free", "mem_shared_percent", "ManagmentIp", + "vds_type", "CpuName", "vds_group_id", "net_config_dirty", "spm_status", + "pm_enabled", "ManagmentIp", "pm_user", "pm_password", "pm_type", "pm_port", "pm_options", + "pmSecondaryConcurrent", "pmSecondaryIp", "pmSecondaryUser", "pmSecondaryPassword", + "pmSecondaryType", + "pmSecondaryPort", "pmSecondaryOptions", "PmOptionsMap", "PmSecondaryOptionsMap", + "mem_shared", "vms_cores_count", "ksm_state", "Version", "vds_group_compatibility_version", + "UniqueId", + "TransparentHugePagesState", "swap_total", "swap_free", "mem_shared_percent", "supported_cluster_levels", "ContainingHooks", "NonOperationalReason", "host_os", "kernel_version", "spice_version", "kvm_version", "libvirt_version", "storage_pool_id", "physical_mem_mb" })); diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java index ba8902b..5430e16 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatic.java @@ -14,6 +14,7 @@ import javax.persistence.Transient; import javax.validation.constraints.Max; import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; @@ -63,6 +64,7 @@ private String name = ""; // GREGM prevents NPE @HostnameOrIp(message = "VALIDATION.VDS.POWER_MGMT.ADDRESS.HOSTNAME_OR_IP", groups = PowerManagementCheck.class) + @NotNull(groups = PowerManagementCheck.class) @Size(max = BusinessEntitiesDefinitions.HOST_IP_SIZE) @Column(name = "ip") private String ip; @@ -73,6 +75,7 @@ @HostnameOrIp(message = "VALIDATION.VDS.HOSTNAME.HOSTNAME_OR_IP", groups = { CreateEntity.class, UpdateEntity.class }) + @NotNull(groups = { CreateEntity.class, UpdateEntity.class }) @Size(max = BusinessEntitiesDefinitions.HOST_HOSTNAME_SIZE) @Column(name = "host_name", length = BusinessEntitiesDefinitions.HOST_HOSTNAME_SIZE) private String hostname; @@ -118,8 +121,38 @@ @Column(name = "pm_enabled") private boolean pmEnabled; + @HostnameOrIp(message = "VALIDATION.VDS.POWER_MGMT.ADDRESS.HOSTNAME_OR_IP", groups = PowerManagementCheck.class) + @Size(max = BusinessEntitiesDefinitions.HOST_IP_SIZE) + @Column(name = "pm_secondary_ip") + private String pmSecondaryIp; + + @Size(max = BusinessEntitiesDefinitions.HOST_PM_TYPE_SIZE) + @Column(name = "pm_secondary_type") + private String pmSecondaryType; + + @Size(max = BusinessEntitiesDefinitions.HOST_PM_USER_SIZE) + @Column(name = "pm_secondary_user") + private String pmSecondaryUser; + + @Size(max = BusinessEntitiesDefinitions.HOST_PM_PASSWD_SIZE) + @Column(name = "pm_secondary_password") + private String pmSecondaryPassword; + + @Column(name = "pm_secondary_port") + private Integer pmSecondaryPort; + + @Size(max = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE) + @Column(name = "pm_secondary_options", length = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE) + private String pmSecondaryOptions; + + @Column(name = "pm_secondary_concurrent") + private boolean pmSecondaryConcurrent; + @Transient private ValueObjectMap pmOptionsMap; + + @Transient + private ValueObjectMap pmSecondaryOptionsMap; @Column(name = "otp_validity") private long otpValidity; @@ -164,6 +197,7 @@ this.serverSslEnabled = server_SSL_enabled; this.setvds_type(vds_type); this.setpm_options(""); + this.setPmSecondaryOptions(""); this.vdsSpmPriority = HOST_DEFAULT_SPM_PRIORITY; } @@ -309,6 +343,72 @@ pmEnabled = value; } + public String getPmSecondaryIp() { + return this.pmSecondaryIp; + } + + public void setPmSecondaryIp(String value) { + this.pmSecondaryIp = value; + } + + public String getPmSecondaryType() { + return pmSecondaryType; + } + + public void setPmSecondaryType(String value) { + pmSecondaryType = value; + } + + public String getPmSecondaryuser() { + return pmSecondaryUser; + } + + public void setPmSecondaryUser(String value) { + pmSecondaryUser = value; + } + + public String getPmSecondaryPassword() { + return pmSecondaryPassword; + } + + public void setPmSecondaryPassword(String value) { + pmSecondaryPassword = value; + } + + public Integer getPmSecondaryPort() { + return pmSecondaryPort; + } + + public void setPmSecondaryPort(Integer value) { + pmSecondaryPort = value; + } + + public String getPmSecondaryOptions() { + return pmSecondaryOptions; + } + + public void setPmSecondaryOptions(String value) { + pmSecondaryOptions = value; + // set pmSecondaryOptionsMap value content to match the given string. + pmSecondaryOptionsMap = PmOptionsStringToMap(value); + } + + public boolean isPmSecondaryConcurrent() { + return pmSecondaryConcurrent; + } + + public void setPmSecondaryConcurrent(boolean value) { + pmSecondaryConcurrent = value; + } + + public ValueObjectMap getPmSecondaryOptionsMap() { + return pmSecondaryOptionsMap; + } + + public void setPmSecondaryOptionsMap(ValueObjectMap value) { + pmSecondaryOptionsMap = value; + } + public long getOtpValidity() { return otpValidity; } @@ -397,6 +497,14 @@ result = prime * result + ((pmPort == null) ? 0 : pmPort.hashCode()); result = prime * result + ((pmType == null) ? 0 : pmType.hashCode()); result = prime * result + ((pmUser == null) ? 0 : pmUser.hashCode()); + result = prime * result + ((pmSecondaryIp == null) ? 0 : ip.hashCode()); + result = prime * result + (pmSecondaryConcurrent ? 1231 : 1237); + result = prime * result + ((pmSecondaryOptions == null) ? 0 : pmOptions.hashCode()); + result = prime * result + ((pmSecondaryOptionsMap == null) ? 0 : pmSecondaryOptionsMap.hashCode()); + result = prime * result + ((pmSecondaryPassword == null) ? 0 : pmSecondaryPassword.hashCode()); + result = prime * result + ((pmSecondaryPort == null) ? 0 : pmSecondaryPort.hashCode()); + result = prime * result + ((pmSecondaryType == null) ? 0 : pmSecondaryType.hashCode()); + result = prime * result + ((pmSecondaryUser == null) ? 0 : pmSecondaryUser.hashCode()); result = prime * result + port; result = prime * result + ((serverSslEnabled == null) ? 0 : serverSslEnabled.hashCode()); result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); @@ -498,6 +606,46 @@ return false; } else if (!sshKeyFingerprint.equals(other.sshKeyFingerprint)) return false; + if (pmSecondaryIp == null) { + if (other.pmSecondaryIp != null) + return false; + } else if (!pmSecondaryIp.equals(other.pmSecondaryIp)) + return false; + if (pmSecondaryConcurrent != other.pmSecondaryConcurrent) + return false; + if (pmSecondaryOptions == null) { + if (other.pmSecondaryOptions != null) + return false; + } else if (!pmSecondaryOptions.equals(other.pmSecondaryOptions)) + return false; + if (pmSecondaryOptionsMap == null) { + if (other.pmSecondaryOptionsMap != null) + return false; + } else if (!pmSecondaryOptionsMap.equals(other.pmSecondaryOptionsMap)) + return false; + if (pmSecondaryPassword == null) { + if (other.pmSecondaryPassword != null) + return false; + } else if (!pmSecondaryPassword.equals(other.pmSecondaryPassword)) + return false; + if (pmSecondaryPort == null) { + if (other.pmSecondaryPort != null) + return false; + } else if (!pmSecondaryPort.equals(other.pmSecondaryPort)) + return false; + if (pmSecondaryType == null) { + if (other.pmSecondaryType != null) + return false; + } else if (!pmSecondaryType.equals(other.pmSecondaryType)) + return false; + if (pmSecondaryUser == null) { + if (other.pmSecondaryUser != null) + return false; + } else if (!pmSecondaryUser.equals(other.pmSecondaryUser)) + return false; + if (port != other.port) + return false; + return true; } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java index c931076..359a8f7 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java @@ -282,6 +282,13 @@ entity.setpm_port((Integer) rs.getObject("pm_port")); entity.setpm_options(rs.getString("pm_options")); entity.setpm_enabled(rs.getBoolean("pm_enabled")); + entity.setPmSecondaryIp((rs.getString("pm_secondary_ip"))); + entity.setPmSecondaryType(rs.getString("pm_secondary_type")); + entity.setPmSecondaryUser(rs.getString("pm_secondary_user")); + entity.setPmSecondaryPassword(DbFacadeUtils.decryptPassword(rs.getString("pm_secondary_password"))); + entity.setPmSecondaryPort((Integer) rs.getObject("pm_secondary_port")); + entity.setPmSecondaryOptions(rs.getString("pm_secondary_options")); + entity.setPmSecondaryConcurrent(rs.getBoolean("pm_secondary_concurrent")); entity.setspm_status(VdsSpmStatus.forValue(rs .getInt("spm_status"))); entity.setswap_free(rs.getLong("swap_free")); diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStaticDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStaticDAODbFacadeImpl.java index 822e097..a6ce0e0 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStaticDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStaticDAODbFacadeImpl.java @@ -92,6 +92,13 @@ .addValue("pm_port", vds.getpm_port()) .addValue("pm_options", vds.getpm_options()) .addValue("pm_enabled", vds.getpm_enabled()) + .addValue("pm_secondary_ip", vds.getPmSecondaryIp()) + .addValue("pm_secondary_type", vds.getPmSecondaryType()) + .addValue("pm_secondary_user", vds.getPmSecondaryuser()) + .addValue("pm_secondary_password", DbFacadeUtils.encryptPassword(vds.getPmSecondaryPassword())) + .addValue("pm_secondary_port", vds.getPmSecondaryPort()) + .addValue("pm_secondary_options", vds.getpm_options()) + .addValue("pm_secondary_concurrent", vds.isPmSecondaryConcurrent()) .addValue("otp_validity", vds.getOtpValidity()) .addValue("vds_spm_priority", vds.getVdsSpmPriority()) .addValue("sshKeyFingerprint", vds.getSSHKeyFingerprint()); @@ -134,6 +141,13 @@ entity.setpm_port((Integer) rs.getObject("pm_port")); entity.setpm_options(rs.getString("pm_options")); entity.setpm_enabled(rs.getBoolean("pm_enabled")); + entity.setPmSecondaryIp((rs.getString("pm_secondary_ip"))); + entity.setPmSecondaryType(rs.getString("pm_secondary_type")); + entity.setPmSecondaryUser(rs.getString("pm_secondary_user")); + entity.setPmSecondaryPassword(DbFacadeUtils.decryptPassword(rs.getString("pm_secondary_password"))); + entity.setPmSecondaryPort((Integer) rs.getObject("pm_secondary_port")); + entity.setPmSecondaryOptions(rs.getString("pm_secondary_options")); + entity.setPmSecondaryConcurrent(rs.getBoolean("pm_secondary_concurrent")); entity.setOtpValidity(rs.getLong("otp_validity")); entity.setSSHKeyFingerprint(rs.getString("sshKeyFingerprint")); -- To view, visit http://gerrit.ovirt.org/10259 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I56a7b0d3237029e91e7b0cb4bbff18b64e729d9e Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
