Hello Alexey Chub, Eli Mesika, I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/7186 to review the following change. Change subject: [WIP] core: Improved version support (#760546) ...................................................................... [WIP] core: Improved version support (#760546) https://bugzilla.redhat.com/760546 The following patch provides the following: a. Elimination of VdsVersion and usage of RpmVersion instead b. Introducing new rpm_version column to vds_dynamic to store VDSM rpm version c. Presenation at UI of Vdsm Version Change-Id: I9931a1aa804d9dc7aec1485ebc29bac45131d0e5 Signed-off-by: Eli Mesika <emes...@redhat.com> Signed-off-by: Alexey Chub <ac...@redhat.com> Signed-off-by: Yair Zaslavsky <yzasl...@redhat.com> --- M backend/manager/dbscripts/create_views.sql A backend/manager/dbscripts/upgrade/03_01_1360_add_vdsm_rpm_version_column.sql M backend/manager/dbscripts/vds_sp.sql M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HandleVdsVersionCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsSelector.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/VdsDynamic.java D backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsVersion.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/VdsDynamicDAODbFacadeImpl.java M backend/manager/modules/dal/src/test/resources/fixtures.xml M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java M frontend/webadmin/modules/gwt-extension/src/main/java/org/ovirt/engine/ui/uioverrides/org/ovirt/engine/core/compat/RpmVersion.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/common/AboutModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/MoveHost.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/renderer/VersionRenderer.java 21 files changed, 167 insertions(+), 261 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/7186/1 diff --git a/backend/manager/dbscripts/create_views.sql b/backend/manager/dbscripts/create_views.sql index 4f2e4fc..5fbf51d 100644 --- a/backend/manager/dbscripts/create_views.sql +++ b/backend/manager/dbscripts/create_views.sql @@ -598,7 +598,7 @@ vds_dynamic.hypervisor_type as hypervisor_type, vds_dynamic.net_config_dirty as net_config_dirty, vds_groups.high_utilization as high_utilization, vds_groups.low_utilization as low_utilization, vds_groups.max_vds_memory_over_commit as max_vds_memory_over_commit, vds_groups.cpu_over_commit_duration_minutes as cpu_over_commit_duration_minutes, storage_pool.id as storage_pool_id, storage_pool.name as storage_pool_name, vds_dynamic.reserved_mem as reserved_mem, - vds_dynamic.guest_overhead as guest_overhead, vds_dynamic.software_version as software_version, vds_dynamic.version_name as version_name, vds_dynamic.build_name as build_name, + vds_dynamic.guest_overhead as guest_overhead, vds_dynamic.rpm_version as rpm_version, vds_dynamic.software_version as software_version, vds_dynamic.version_name as version_name, vds_dynamic.build_name as build_name, vds_dynamic.previous_status as previous_status, vds_statistics.cpu_idle as cpu_idle, vds_statistics.cpu_load as cpu_load, vds_statistics.cpu_sys as cpu_sys, vds_statistics.cpu_user as cpu_user, vds_statistics.usage_mem_percent as usage_mem_percent, vds_statistics.usage_cpu_percent as usage_cpu_percent, vds_statistics.usage_network_percent as usage_network_percent, vds_statistics.mem_available as mem_available, vds_statistics.mem_shared as mem_shared, vds_statistics.swap_free as swap_free, diff --git a/backend/manager/dbscripts/upgrade/03_01_1360_add_vdsm_rpm_version_column.sql b/backend/manager/dbscripts/upgrade/03_01_1360_add_vdsm_rpm_version_column.sql new file mode 100644 index 0000000..b6d9f01 --- /dev/null +++ b/backend/manager/dbscripts/upgrade/03_01_1360_add_vdsm_rpm_version_column.sql @@ -0,0 +1,2 @@ +select fn_db_add_column('vds_dynamic', 'rpm_version', 'varchar(256) default null'); + diff --git a/backend/manager/dbscripts/vds_sp.sql b/backend/manager/dbscripts/vds_sp.sql index f2c1a8e..d263f62 100644 --- a/backend/manager/dbscripts/vds_sp.sql +++ b/backend/manager/dbscripts/vds_sp.sql @@ -149,7 +149,8 @@ v_vms_cores_count INTEGER , v_vm_migrating INTEGER , v_reserved_mem INTEGER , - v_guest_overhead INTEGER , + v_guest_overhead INTEGER , + v_rpm_version VARCHAR(255), v_software_version VARCHAR(40) , v_version_name VARCHAR(40) , v_build_name VARCHAR(40) , @@ -176,8 +177,8 @@ BEGIN BEGIN -INSERT INTO vds_dynamic(cpu_cores, cpu_model, cpu_speed_mh, if_total_speed, kvm_enabled, mem_commited, physical_mem_mb, status, vds_id, vm_active, vm_count, vm_migrating, reserved_mem, guest_overhead, software_version, version_name, build_name, previous_status, cpu_flags, cpu_over_commit_time_stamp, hypervisor_type, vms_cores_count, pending_vcpus_count, pending_vmem_size, cpu_sockets,net_config_dirty, supported_cluster_levels, supported_engines, host_os, kvm_version, spice_version, kernel_version, iscsi_initiator_name, transparent_hugepages_state, anonymous_hugepages,hooks) - VALUES(v_cpu_cores, v_cpu_model, v_cpu_speed_mh, v_if_total_speed, v_kvm_enabled, v_mem_commited, v_physical_mem_mb, v_status, v_vds_id, v_vm_active, v_vm_count, v_vm_migrating, v_reserved_mem, v_guest_overhead, v_software_version, v_version_name, v_build_name, v_previous_status, v_cpu_flags, v_cpu_over_commit_time_stamp, v_hypervisor_type, v_vms_cores_count,v_pending_vcpus_count, v_pending_vmem_size, v_cpu_sockets, v_net_config_dirty, v_supported_cluster_levels, v_supported_engines, v_host_os, v_kvm_version, v_spice_version, v_kernel_version, v_iscsi_initiator_name, v_transparent_hugepages_state, v_anonymous_hugepages,v_hooks); +INSERT INTO vds_dynamic(cpu_cores, cpu_model, cpu_speed_mh, if_total_speed, kvm_enabled, mem_commited, physical_mem_mb, status, vds_id, vm_active, vm_count, vm_migrating, reserved_mem, guest_overhead, rpm_version, software_version, version_name, build_name, previous_status, cpu_flags, cpu_over_commit_time_stamp, hypervisor_type, vms_cores_count, pending_vcpus_count, pending_vmem_size, cpu_sockets,net_config_dirty, supported_cluster_levels, supported_engines, host_os, kvm_version, spice_version, kernel_version, iscsi_initiator_name, transparent_hugepages_state, anonymous_hugepages,hooks) + VALUES(v_cpu_cores, v_cpu_model, v_cpu_speed_mh, v_if_total_speed, v_kvm_enabled, v_mem_commited, v_physical_mem_mb, v_status, v_vds_id, v_vm_active, v_vm_count, v_vm_migrating, v_reserved_mem, v_guest_overhead, v_rpm_version, v_software_version, v_version_name, v_build_name, v_previous_status, v_cpu_flags, v_cpu_over_commit_time_stamp, v_hypervisor_type, v_vms_cores_count,v_pending_vcpus_count, v_pending_vmem_size, v_cpu_sockets, v_net_config_dirty, v_supported_cluster_levels, v_supported_engines, v_host_os, v_kvm_version, v_spice_version, v_kernel_version, v_iscsi_initiator_name, v_transparent_hugepages_state, v_anonymous_hugepages,v_hooks); END; RETURN; @@ -202,7 +203,8 @@ v_vms_cores_count INTEGER , v_vm_migrating INTEGER , v_reserved_mem INTEGER , - v_guest_overhead INTEGER , + v_guest_overhead INTEGER , + v_rpm_version VARCHAR(255), v_software_version VARCHAR(40) , v_version_name VARCHAR(40) , v_build_name VARCHAR(40) , @@ -238,7 +240,7 @@ mem_commited = v_mem_commited,physical_mem_mb = v_physical_mem_mb, status = v_status,vm_active = v_vm_active,vm_count = v_vm_count, vm_migrating = v_vm_migrating,reserved_mem = v_reserved_mem, - guest_overhead = v_guest_overhead,software_version = v_software_version, + guest_overhead = v_guest_overhead,rpm_version = v_rpm_version, software_version = v_software_version, version_name = v_version_name,build_name = v_build_name,previous_status = v_previous_status, cpu_flags = v_cpu_flags,cpu_over_commit_time_stamp = v_cpu_over_commit_time_stamp, hypervisor_type = v_hypervisor_type, diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HandleVdsVersionCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HandleVdsVersionCommand.java index bdc600e..896cbfb 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HandleVdsVersionCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HandleVdsVersionCommand.java @@ -16,6 +16,7 @@ import org.ovirt.engine.core.common.businessentities.VDSStatus; import org.ovirt.engine.core.common.config.Config; import org.ovirt.engine.core.common.config.ConfigValues; +import org.ovirt.engine.core.compat.RpmVersion; import org.ovirt.engine.core.compat.Version; import org.ovirt.engine.core.dal.VdcBllMessages; @@ -50,9 +51,10 @@ Version partialVdcVersion = new Version( new Version(Config.<String> GetValue(ConfigValues.VdcVersion)).toString(2)); // check that vdc support vds OR vds support vdc + RpmVersion vdsVersion = vds.getVersion(); + Version vdsmVersion = new Version(vdsVersion.getMajor(),vdsVersion.getMinor()); boolean vdsmVersionSupported = - Config.<HashSet<Version>> GetValue(ConfigValues.SupportedVDSMVersions).contains(vds.getVersion() - .getPartialVersion()); + Config.<HashSet<Version>> GetValue(ConfigValues.SupportedVDSMVersions).contains(vdsmVersion); if (!vdsmVersionSupported && !StringUtils.isEmpty(vds.getsupported_engines())) { try { vdsmVersionSupported = vds.getSupportedENGINESVersionsSet().contains(partialVdcVersion); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsSelector.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsSelector.java index 8c63f09..6bc0a1c 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsSelector.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsSelector.java @@ -12,12 +12,12 @@ import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VMStatus; import org.ovirt.engine.core.common.businessentities.VdsNetworkInterface; -import org.ovirt.engine.core.common.businessentities.VdsVersion; import org.ovirt.engine.core.common.businessentities.VmNetworkInterface; import org.ovirt.engine.core.common.config.Config; import org.ovirt.engine.core.common.config.ConfigValues; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.compat.NGuid; +import org.ovirt.engine.core.compat.RpmVersion; import org.ovirt.engine.core.dal.VdcBllMessages; import org.ovirt.engine.core.dal.dbbroker.DbFacade; import org.ovirt.engine.core.dao.InterfaceDAO; @@ -175,7 +175,7 @@ /** * save vdsVersion in order to know vds version that was wrong */ - VdsVersion vdsVersion = null; + RpmVersion vdsVersion = null; boolean noVDSs = true; for (VDS curVds : vdss) { if (isMigrate && getVm().getrun_on_vds() != null && getVm().getrun_on_vds().equals(curVds.getId())) { @@ -213,7 +213,7 @@ if (messageToReturn == VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_VERSION && vdsVersion != null) { VmHandler.UpdateVmGuestAgentVersion(getVm()); messages.add("$toolsVersion " + getVm().getPartialVersion()); - messages.add("$serverVersion " + vdsVersion.getPartialVersion()); + messages.add("$serverVersion " + vdsVersion.getRpmName()); } } 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 17f84d7..f355a16 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 @@ -8,6 +8,7 @@ import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.compat.INotifyPropertyChanged; import org.ovirt.engine.core.compat.PropertyChangedEventArgs; +import org.ovirt.engine.core.compat.RpmVersion; import org.ovirt.engine.core.compat.StringHelper; import org.ovirt.engine.core.compat.Version; @@ -209,7 +210,6 @@ this.setmem_shared(mem_shared); this.setsoftware_version(software_version); this.setversion_name(version_name); - this.setbuild_name(build_name); this.setserver_SSL_enabled(server_SSL_enabled); this.vds_group_cpu_nameField = vds_group_cpu_name; this.setcpu_flags(getcpu_flags()); @@ -1118,15 +1118,19 @@ mImagesLastDelay = value; } - public void setVersion(VdsVersion value) { + public void setVersion(RpmVersion value) { mVdsDynamic.setVersion(value); OnPropertyChanged(new PropertyChangedEventArgs("Version")); } - public VdsVersion getVersion() { + public RpmVersion getVersion() { return mVdsDynamic.getVersion(); } + public String getPartialVersion() { + return mVdsDynamic.getVersion().getValue().substring(0, 2); + } + private ServerCpu _cpuName; public ServerCpu getCpuName() { diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java index 003ac1a..d0347fd 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java @@ -14,6 +14,7 @@ import org.hibernate.annotations.TypeDef; import org.ovirt.engine.core.common.businessentities.mapping.GuidType; import org.ovirt.engine.core.compat.Guid; +import org.ovirt.engine.core.compat.RpmVersion; import org.ovirt.engine.core.compat.StringFormat; import org.ovirt.engine.core.compat.StringHelper; import org.ovirt.engine.core.compat.Version; @@ -132,6 +133,7 @@ @Column(name = "hooks") private String hooksStr; + @Column(name = "non_operational_reason") private NonOperationalReason nonOperationalReason = NonOperationalReason.NONE; @@ -139,7 +141,7 @@ private Integer pending_vmem_size; @Transient - private VdsVersion mVdsVersion; + private RpmVersion rpmVersion; @Transient private java.util.HashSet<Version> _supportedClusterVersionsSet; @@ -147,16 +149,16 @@ @Transient private java.util.HashSet<Version> _supportedENGINESVersionsSet; - public void setVersion(VdsVersion value) { - mVdsVersion = value; + public void setVersion(RpmVersion value) { + rpmVersion = value; } - public VdsVersion getVersion() { - return mVdsVersion; + public RpmVersion getVersion() { + return rpmVersion; } public VdsDynamic() { - mVdsVersion = new VdsVersion(); + rpmVersion = new RpmVersion(); mem_commited = 0; reserved_mem = 1024; pending_vcpus_count = 0; @@ -170,7 +172,7 @@ VDSStatus previous_status, String software_version, String version_name, String build_name, Date cpu_over_commit_time_stamp, HypervisorType hypervisor_type, Integer pending_vcpus_count, Integer pending_vmem_sizeField, Boolean net_config_dirty) { - mVdsVersion = new VdsVersion(); + rpmVersion = new RpmVersion(); this.cpu_cores = cpu_cores; this.cpu_model = cpu_model; this.cpu_speed_mh = BigDecimal.valueOf(cpu_speed_mh); @@ -188,7 +190,6 @@ this.previous_status = previous_status; this.setsoftware_version(software_version); this.setversion_name(version_name); - this.setbuild_name(build_name); this.setcpu_over_commit_time_stamp(cpu_over_commit_time_stamp); this.sethypervisor_type(hypervisor_type); this.pending_vcpus_count = pending_vcpus_count; @@ -336,43 +337,19 @@ } public String getsoftware_version() { - if (this.getVersion().getFullVersion() == null) { - return null; - } - return this.getVersion().getFullVersion().toString(); + return this.softwareVersion; } public void setsoftware_version(String value) { this.softwareVersion = value; - if (!StringHelper.isNullOrEmpty(value)) { - String[] vers = value.split("[.]", -1); - this.getVersion().setSoftwareVersion(vers[0]); - if (vers.length > 1) { - this.getVersion().setSoftwareVersion(this.getVersion().getSoftwareVersion() + "." + vers[1]); - } - - if (vers.length > 3) { - this.getVersion().setSoftwareRevision(StringFormat.format("%s.%s", vers[2], vers[3])); - } - } } public String getversion_name() { - return this.getVersion().getVersionName(); + return versionName; } public void setversion_name(String value) { this.versionName = value; - this.getVersion().setVersionName(value); - } - - public String getbuild_name() { - return this.getVersion().getBuildName(); - } - - public void setbuild_name(String value) { - this.buildName = value; - this.getVersion().setBuildName(value); } public String getcpu_flags() { @@ -511,6 +488,14 @@ this.kernel_version = value; } + public String getbuild_name() { + return this.buildName; + } + + public void setbuild_name(String value) { + this.buildName = value; + } + public String getIScsiInitiatorName() { return this.iScsiInitiatorName; } @@ -576,7 +561,7 @@ result = prime * result + ((kernel_version == null) ? 0 : kernel_version.hashCode()); result = prime * result + ((kvm_enabled == null) ? 0 : kvm_enabled.hashCode()); result = prime * result + ((kvm_version == null) ? 0 : kvm_version.hashCode()); - result = prime * result + ((mVdsVersion == null) ? 0 : mVdsVersion.hashCode()); + result = prime * result + ((rpmVersion == null) ? 0 : rpmVersion.hashCode()); result = prime * result + ((mem_commited == null) ? 0 : mem_commited.hashCode()); result = prime * result + ((net_config_dirty == null) ? 0 : net_config_dirty.hashCode()); result = prime * result + ((nonOperationalReason == null) ? 0 : nonOperationalReason.hashCode()); @@ -702,10 +687,10 @@ return false; } else if (!kvm_version.equals(other.kvm_version)) return false; - if (mVdsVersion == null) { - if (other.mVdsVersion != null) + if (rpmVersion == null) { + if (other.rpmVersion != null) return false; - } else if (!mVdsVersion.equals(other.mVdsVersion)) + } else if (!rpmVersion.equals(other.rpmVersion)) return false; if (mem_commited == null) { if (other.mem_commited != null) diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsVersion.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsVersion.java deleted file mode 100644 index 43c0ce4..0000000 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsVersion.java +++ /dev/null @@ -1,114 +0,0 @@ -package org.ovirt.engine.core.common.businessentities; - -import java.io.Serializable; - -import org.ovirt.engine.core.compat.StringFormat; -import org.ovirt.engine.core.compat.Version; - -public class VdsVersion implements Serializable { - private static final long serialVersionUID = -3138828435468456070L; - private String softwareVersion; - private String softwareRevision; - private String buildName; - private String versionName; - private Version mFullVersion; - - public VdsVersion() { - } - - public String getSoftwareVersion() { - return softwareVersion; - } - - public void setSoftwareVersion(String value) { - softwareVersion = value; - } - - public String getSoftwareRevision() { - return softwareRevision; - } - - public void setSoftwareRevision(String value) { - softwareRevision = value; - } - - public String getBuildName() { - return buildName; - } - - public void setBuildName(String value) { - buildName = value; - } - - public String getVersionName() { - return versionName; - } - - public void setVersionName(String value) { - versionName = value; - } - - /** - * Version in .Net style a.b.c.d when: - * <ul> - * <li>a: major version</li> - * <li>b: minor version</li> - * <li>c: major revision</li> - * <li>d: minor revision</li> - * <ul> - * <p> - * Assumption: VDS version in format: x.y where x = major version, y= minor version. There is no major revision - * received from VDS - always 0 - */ - public Version getFullVersion() { - if (mFullVersion == null) { - // defensive code for prevent incorrect versioning - try { - parseFullVersion(); - } catch (RuntimeException e) { - // the error was reported when the property was initially parsed. - } - } - - return mFullVersion; - } - - public void parseFullVersion() { - if (getSoftwareVersion() != null && getSoftwareRevision() != null) { - String stringVersion; - String[] revision = getSoftwareRevision().split("[.]", -1); - - if (revision.length > 1) { - stringVersion = StringFormat.format("%s.%s", getSoftwareVersion(), getSoftwareRevision()); - } else { - stringVersion = StringFormat.format("%s.0.%s", getSoftwareVersion(), getSoftwareRevision()); - } - - mFullVersion = new Version(stringVersion); - } - } - - public Version getPartialVersion() { - return getSoftwareVersion() == null ? null : new Version(getSoftwareVersion()); - } - - @Override - public boolean equals(Object obj) { - if (super.equals(obj)) { - return true; - } - - VdsVersion other = (VdsVersion) ((obj instanceof VdsVersion) ? obj : null); - if (other == null) { - return false; - } - return (getFullVersion() == null && other.getFullVersion() == null) - || (getFullVersion() != null && getFullVersion().equals(other.getFullVersion())); - } - - @Override - public int hashCode() { - return getFullVersion() != null ? getFullVersion().hashCode() : -1; - } - -} 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 b695299..467b4f4 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 @@ -15,6 +15,7 @@ import org.ovirt.engine.core.common.businessentities.VdsTransparentHugePagesState; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.compat.NGuid; +import org.ovirt.engine.core.compat.RpmVersion; import org.ovirt.engine.core.compat.Version; import org.ovirt.engine.core.dal.dbbroker.DbFacadeUtils; import org.springframework.jdbc.core.simple.ParameterizedRowMapper; @@ -214,9 +215,9 @@ entity.setreserved_mem((Integer) rs.getObject("reserved_mem")); entity.setguest_overhead((Integer) rs .getObject("guest_overhead")); + entity.setVersion(new RpmVersion(rs.getString("rpm_version"))); entity.setsoftware_version(rs.getString("software_version")); entity.setversion_name(rs.getString("version_name")); - entity.setbuild_name(rs.getString("build_name")); entity.setprevious_status(VDSStatus.forValue(rs .getInt("previous_status"))); entity.setmem_available(rs.getLong("mem_available")); diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java index 38a5073..0441906 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java @@ -11,6 +11,7 @@ import org.ovirt.engine.core.common.businessentities.VdsDynamic; import org.ovirt.engine.core.common.businessentities.VdsTransparentHugePagesState; import org.ovirt.engine.core.compat.Guid; +import org.ovirt.engine.core.compat.RpmVersion; import org.ovirt.engine.core.dal.dbbroker.DbFacadeUtils; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.simple.ParameterizedRowMapper; @@ -54,6 +55,7 @@ .getObject("guest_overhead")); entity.setsoftware_version(rs.getString("software_version")); entity.setversion_name(rs.getString("version_name")); + entity.setVersion(new RpmVersion(rs.getString("rpm_version"))); entity.setbuild_name(rs.getString("build_name")); entity.setprevious_status(VDSStatus.forValue(rs .getInt("previous_status"))); @@ -108,6 +110,7 @@ .addValue("vm_migrating", vds.getvm_migrating()) .addValue("reserved_mem", vds.getreserved_mem()) .addValue("guest_overhead", vds.getguest_overhead()) + .addValue("rpm_version",vds.getVersion().getRpmName()) .addValue("software_version", vds.getsoftware_version()) .addValue("version_name", vds.getversion_name()) .addValue("build_name", vds.getbuild_name()) @@ -156,6 +159,7 @@ .addValue("vm_migrating", vds.getvm_migrating()) .addValue("reserved_mem", vds.getreserved_mem()) .addValue("guest_overhead", vds.getguest_overhead()) + .addValue("rpm_version",vds.getVersion().getRpmName()) .addValue("software_version", vds.getsoftware_version()) .addValue("version_name", vds.getversion_name()) .addValue("build_name", vds.getbuild_name()) diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml b/backend/manager/modules/dal/src/test/resources/fixtures.xml index 9fcb269..5e21479 100644 --- a/backend/manager/modules/dal/src/test/resources/fixtures.xml +++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml @@ -1198,6 +1198,7 @@ <column>vm_migrating</column> <column>reserved_mem</column> <column>guest_overhead</column> + <column>rpm_version</column> <column>software_version</column> <column>version_name</column> <column>build_name</column> @@ -1236,6 +1237,7 @@ <value>0</value> <value>256</value> <value>65</value> + <value>4.9.6-24.0.el6_3</value> <value>4.9.0.25</value> <value>Snow Man</value> <null /> @@ -1275,6 +1277,7 @@ <value>0</value> <value>256</value> <value>65</value> + <value>4.9.6-24.0.el6_3</value> <value>4.9.0.25</value> <value>Snow Man</value> <null /> diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java index 4c9bcd9..6796a0e 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java @@ -303,6 +303,8 @@ } if (refreshedCapabilities) { + + getDbFacade().getVdsDynamicDAO().update(_vds.getDynamicData()); ResourceManager.getInstance().getEventListener().handleVdsVersion(_vds.getId()); markIsSetNonOperationalExecuted(); } diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java index 46ca4f0..5294e05 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java @@ -29,7 +29,6 @@ import org.ovirt.engine.core.common.businessentities.VdsNetworkInterface; import org.ovirt.engine.core.common.businessentities.VdsNetworkStatistics; import org.ovirt.engine.core.common.businessentities.VdsTransparentHugePagesState; -import org.ovirt.engine.core.common.businessentities.VdsVersion; import org.ovirt.engine.core.common.businessentities.VmDynamic; import org.ovirt.engine.core.common.businessentities.VmExitStatus; import org.ovirt.engine.core.common.businessentities.VmNetworkInterface; @@ -42,6 +41,7 @@ import org.ovirt.engine.core.compat.FormatException; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.compat.LongCompat; +import org.ovirt.engine.core.compat.RpmVersion; import org.ovirt.engine.core.dal.dbbroker.DbFacade; import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector; import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase; @@ -308,7 +308,6 @@ vds.setreserved_mem(AssignIntValue(xmlRpcStruct, VdsProperties.reservedMem)); Integer guestOverhead = AssignIntValue(xmlRpcStruct, VdsProperties.guestOverhead); vds.setguest_overhead(guestOverhead != null ? guestOverhead : 0); - updateVdsStaticVersion(vds, xmlRpcStruct); vds.setcpu_flags(AssignStringValue(xmlRpcStruct, VdsProperties.cpu_flags)); @@ -334,6 +333,10 @@ } private static void UpdatePackagesVersions(VDS vds, XmlRpcStruct xmlRpcStruct) { + + vds.setversion_name(AssignStringValue(xmlRpcStruct, "version_name")); + vds.setsoftware_version(AssignStringValue(xmlRpcStruct, "software_version")); + vds.setbuild_name(AssignStringValue(xmlRpcStruct, "build_name")); if (xmlRpcStruct.contains(VdsProperties.host_os)) { vds.sethost_os(GetPackageVersionFormated( new XmlRpcStruct((Map) xmlRpcStruct.getItem(VdsProperties.host_os)), true)); @@ -355,6 +358,10 @@ } else if (xmlRpcStruct.contains(VdsProperties.packages2)) { Map packages = (Map) xmlRpcStruct.getItem(VdsProperties.packages2); + if (packages.containsKey(VdsProperties.vdsmPackageName)) { + Map vdsm = (Map) packages.get(VdsProperties.vdsmPackageName); + vds.setVersion(getPackageRpmVersion("vdsm",vdsm)); + } if (packages.containsKey(VdsProperties.qemuKvmPackageName)) { Map kvm = (Map) packages.get(VdsProperties.qemuKvmPackageName); vds.setkvm_version(getPackageVersionFormated2(kvm)); @@ -393,6 +400,35 @@ } } return sb.toString(); + } + + private static RpmVersion getPackageRpmVersion(String packageName, Map hostPackage) { + + String packageVersion = (hostPackage.get(VdsProperties.package_version) != null) ? (String) hostPackage + .get(VdsProperties.package_version) : null; + String packageRelease = (hostPackage.get(VdsProperties.package_release) != null) ? (String) hostPackage + .get(VdsProperties.package_release) : null; + + StringBuilder sb = new StringBuilder(); + if (!StringUtils.isEmpty(packageName)) { + sb.append(packageName); + } + boolean hasPackageVersion = StringUtils.isEmpty(packageVersion); + boolean hasPackageRelease = StringUtils.isEmpty(packageRelease); + if (!hasPackageVersion || !hasPackageRelease) { + sb.append("-"); + } + if (!hasPackageVersion) { + sb.append(packageVersion); + } + if (!hasPackageRelease) { + if (sb.length() > 0) { + sb.append(String.format("-%1$s", packageRelease)); + } else { + sb.append(packageRelease); + } + } + return new RpmVersion(sb.toString()); } private static String GetPackageVersionFormated(XmlRpcStruct hostPackage, boolean getName) { @@ -781,24 +817,6 @@ vm.setapp_list(""); } } - } - - private static void updateVdsStaticVersion(VDS vds, XmlRpcStruct xmlRpcStruct) { - VdsVersion version = new VdsVersion(); - version.setVersionName(AssignStringValue(xmlRpcStruct, "version_name")); - version.setSoftwareVersion(AssignStringValue(xmlRpcStruct, "software_version")); - version.setSoftwareRevision(AssignStringValue(xmlRpcStruct, "software_revision")); - version.setBuildName(AssignStringValue(xmlRpcStruct, "build_name")); - try { - version.parseFullVersion(); - } catch (RuntimeException e) { - log.infoFormat("Couldn't parse vds version: {0} , {1} for Host {2}, {3}", - version.getSoftwareVersion(), - version.getSoftwareRevision(), - vds.getId(), - vds.getvds_name()); - } - vds.setVersion(version); } private static VMStatus convertToVmStatus(String statusName) { diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java index b913a00..f661008 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java @@ -86,6 +86,7 @@ public static final String kernelPackageName = "kernel"; public static final String iSCSIInitiatorName = "ISCSIInitiatorName"; public static final String qemuKvmPackageName = "qemu-kvm"; + public static final String vdsmPackageName = "vdsm"; public static final String spiceServerPackageName = "spice-server"; public static final String mem_available = "memAvailable"; diff --git a/frontend/webadmin/modules/gwt-extension/src/main/java/org/ovirt/engine/ui/uioverrides/org/ovirt/engine/core/compat/RpmVersion.java b/frontend/webadmin/modules/gwt-extension/src/main/java/org/ovirt/engine/ui/uioverrides/org/ovirt/engine/core/compat/RpmVersion.java index 40da2b0..9b906de 100644 --- a/frontend/webadmin/modules/gwt-extension/src/main/java/org/ovirt/engine/ui/uioverrides/org/ovirt/engine/core/compat/RpmVersion.java +++ b/frontend/webadmin/modules/gwt-extension/src/main/java/org/ovirt/engine/ui/uioverrides/org/ovirt/engine/core/compat/RpmVersion.java @@ -24,4 +24,8 @@ public String getRpmName() { return this.rpmName; } + + public void setRpmName(String rpmName) { + this.rpmName = rpmName; + } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java index 844824d..057cb88 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java @@ -161,9 +161,8 @@ for (VDS vds : allHosts) { if ((!Linq.IsHostBelongsToAnyOfClusters(clusters, vds)) - && (vds.getstatus() == VDSStatus.Maintenance || vds.getstatus() == VDSStatus.PendingApproval) - && (vds.getVersion().getFullVersion() == null || Extensions.GetFriendlyVersion(vds.getVersion() - .getFullVersion()).compareTo(minimalClusterVersion) >= 0)) + && (vds.getstatus() == VDSStatus.Maintenance || vds.getstatus() == VDSStatus.PendingApproval) + && (vds.getVersion() == null || Extensions.GetFriendlyVersion(vds.getVersion()).compareTo(minimalClusterVersion) >= 0)) { availableHosts.add(vds); } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/common/AboutModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/common/AboutModel.java index ebacb91..a3e1eaf 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/common/AboutModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/common/AboutModel.java @@ -95,7 +95,6 @@ public AboutModel() { - // var licenseProperties = DataProvider.GetLicenseProperties(); // Enterprise = licenseProperties.ContainsKey("EnterpriseProperty") ? licenseProperties["EnterpriseProperty"] : // string.Empty; @@ -187,67 +186,60 @@ // } // } - UICommand tempVar = new UICommand("CopyToClipboard", this); //$NON-NLS-1$ - tempVar.setTitle(ConstantsManager.getInstance().getConstants().copytoClipboardTitle()); - tempVar.setIsAvailable(true); - setCopyToClipboardCommand(tempVar); - this.getCommands().add(getCopyToClipboardCommand()); + UICommand command = new UICommand("CopyToClipboard", this); //$NON-NLS-1$ + command.setTitle(ConstantsManager.getInstance().getConstants().copytoClipboardTitle()); + command.setIsAvailable(true); + setCopyToClipboardCommand(command); + getCommands().add(getCopyToClipboardCommand()); setShowOnlyVersion(true); - AsyncQuery _asyncQuery = new AsyncQuery(); - _asyncQuery.setModel(this); - _asyncQuery.asyncCallback = new INewAsyncCallback() { + + AsyncDataProvider.GetRpmVersionViaPublic(new AsyncQuery(this, new INewAsyncCallback() { @Override - public void OnSuccess(Object model, Object result) - { + public void OnSuccess(Object model, Object returnValue) { + AboutModel aboutModel = (AboutModel) model; - aboutModel.setProductVersion((String) result); + aboutModel.setProductVersion((String) returnValue); } - }; - AsyncDataProvider.GetRpmVersionViaPublic(_asyncQuery); + })); } - private void ShowOnlyVersionChanged() - { - if (!getShowOnlyVersion()) - { - AsyncQuery _asyncQuery = new AsyncQuery(); - _asyncQuery.setModel(this); - _asyncQuery.asyncCallback = new INewAsyncCallback() { + private void ShowOnlyVersionChanged() { + + if (!getShowOnlyVersion()) { + + AsyncDataProvider.GetHostList(new AsyncQuery(this, new INewAsyncCallback() { @Override - public void OnSuccess(Object model, Object result) - { + public void OnSuccess(Object model, Object returnValue) { + AboutModel aboutModel = (AboutModel) model; ArrayList<HostInfo> list = new ArrayList<HostInfo>(); - for (VDS a : (List<VDS>) result) - { - HostInfo tempVar = new HostInfo(); - tempVar.setHostName(a.getvds_name() + ":"); //$NON-NLS-1$ - HostInfo hi = tempVar; - if (!StringHelper.isNullOrEmpty(a.gethost_os())) - { - hi.setOSVersion(ConstantsManager.getInstance().getConstants().osVersionAbout() - + " " + a.gethost_os()); //$NON-NLS-1$ + + for (VDS a : (List<VDS>) returnValue) { + + HostInfo item = new HostInfo(); + item.setHostName(a.getvds_name() + ":"); //$NON-NLS-1$ + + if (!StringHelper.isNullOrEmpty(a.gethost_os())) { + item.setOSVersion(ConstantsManager.getInstance().getConstants().osVersionAbout() + + " " + a.gethost_os()); //$NON-NLS-1$ } - if (a.getVersion().getFullVersion() != null) - { - hi.setVDSMVersion(ConstantsManager.getInstance().getConstants().VDSMVersionAbout() + " " //$NON-NLS-1$ - + Extensions.GetFriendlyVersion(a.getVersion().getFullVersion()) + " " //$NON-NLS-1$ - + a.getVersion().getBuildName()); + if (a.getVersion() != null) { + item.setVDSMVersion(ConstantsManager.getInstance().getConstants().VDSMVersionAbout() + " " //$NON-NLS-1$ + + Extensions.GetFriendlyVersion(a.getVersion()) + " " //$NON-NLS-1$ + + a.getVersion()); } - list.add(hi); + list.add(item); } aboutModel.setHosts(list); } - }; - AsyncDataProvider.GetHostList(_asyncQuery); + })); } } - public void CopyToClipboard() - { + public void CopyToClipboard() { String data = BuildClipboardData(); CopyToClipboard(data); } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java index 7b80d3c..ce134ac 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java @@ -283,17 +283,14 @@ for (VDS vds : allHosts) { if (Linq.IsClusterItemExistInList(clusters, vds.getvds_group_id()) - && (vds.getVersion() == null || vds.getVersion().getFullVersion() == null || Extensions.GetFriendlyVersion(vds.getVersion() - .getFullVersion()) - .compareTo(minimalClusterVersion) >= 0)) + && (vds.getVersion() == null || vds.getVersion() == null || Extensions.GetFriendlyVersion(vds.getVersion()).compareTo(minimalClusterVersion) >= 0)) { hosts.add(vds); } if ((!Linq.IsHostBelongsToAnyOfClusters(clusters, vds)) - && (vds.getstatus() == VDSStatus.Maintenance || vds.getstatus() == VDSStatus.PendingApproval) - && (vds.getVersion().getFullVersion() == null || Extensions.GetFriendlyVersion(vds.getVersion() - .getFullVersion()).compareTo(minimalClusterVersion) >= 0)) + && (vds.getstatus() == VDSStatus.Maintenance || vds.getstatus() == VDSStatus.PendingApproval) + && (vds.getVersion() == null || Extensions.GetFriendlyVersion(vds.getVersion()).compareTo(minimalClusterVersion) >= 0)) { availableHosts.add(vds); } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java index 728c872..b9cb57b 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java @@ -14,7 +14,6 @@ import org.ovirt.engine.core.common.businessentities.VDSStatus; import org.ovirt.engine.core.common.businessentities.VDSType; import org.ovirt.engine.core.common.businessentities.VdsSpmStatus; -import org.ovirt.engine.core.common.businessentities.VdsVersion; import org.ovirt.engine.core.compat.Event; import org.ovirt.engine.core.compat.EventArgs; import org.ovirt.engine.core.compat.EventDefinition; @@ -771,10 +770,10 @@ ); } - private VdsVersion GetHostVersion(Guid hostId) + private RpmVersion GetHostVersion(Guid hostId) { VDS host = DataProvider.GetHostById(hostId); - return host != null ? host.getVersion() : new VdsVersion(); + return host != null ? host.getVersion() : new RpmVersion(); } public void Cancel() @@ -825,7 +824,7 @@ setOS(vds.gethost_os()); setKernelVersion(vds.getkernel_version()); setKvmVersion(vds.getkvm_version()); - setVdsmVersion(vds.getVersion().getFullVersion()); + setVdsmVersion(vds.getVersion()); setSpiceVersion(vds.getspice_version()); setIScsiInitiatorName(vds.getIScsiInitiatorName()); setActiveVms(vds.getvm_active()); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/MoveHost.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/MoveHost.java index 68557e0..8bd4e40 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/MoveHost.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/MoveHost.java @@ -21,7 +21,6 @@ @SuppressWarnings("unused") public class MoveHost extends ListModel { - private ListModel privateCluster; public ListModel getCluster() @@ -66,19 +65,20 @@ { if (getCluster().getSelectedItem() != null) { - AsyncDataProvider.GetHostList(new AsyncQuery(this, - new INewAsyncCallback() { - @Override - public void OnSuccess(Object target, Object returnValue) { - MoveHost moveHost = (MoveHost) target; - ArrayList<VDS> hosts = (ArrayList<VDS>) returnValue; - moveHost.PostGetHostList(hosts); - } - })); + AsyncDataProvider.GetHostList(new AsyncQuery(this, new INewAsyncCallback() { + @Override + public void OnSuccess(Object target, Object returnValue) { + + MoveHost moveHost = (MoveHost) target; + ArrayList<VDS> hosts = (ArrayList<VDS>) returnValue; + moveHost.PostGetHostList(hosts); + } + })); } } private void PostGetHostList(ArrayList<VDS> hosts) { + VDSGroup cluster = (VDSGroup) getCluster().getSelectedItem(); ArrayList<VDSGroup> clusters = (ArrayList<VDSGroup>) getCluster().getItems(); ArrayList<EntityModel> items = new ArrayList<EntityModel>(); @@ -86,9 +86,8 @@ for (VDS vds : hosts) { if (Linq.FirstOrDefault(clusters, new Linq.ClusterPredicate(vds.getvds_group_id())) == null - && (vds.getstatus() == VDSStatus.Maintenance || vds.getstatus() == VDSStatus.PendingApproval) - && (vds.getVersion().getFullVersion() == null || Extensions.GetFriendlyVersion(vds.getVersion() - .getFullVersion()).compareTo(cluster.getcompatibility_version()) >= 0)) + && (vds.getstatus() == VDSStatus.Maintenance || vds.getstatus() == VDSStatus.PendingApproval) + && (vds.getVersion() == null || Extensions.GetFriendlyVersion(vds.getVersion()).compareTo(cluster.getcompatibility_version()) >= 0)) { EntityModel entity = new EntityModel(); entity.setEntity(vds); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/renderer/VersionRenderer.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/renderer/VersionRenderer.java index bf5c6d8..f94f6cf 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/renderer/VersionRenderer.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/renderer/VersionRenderer.java @@ -1,19 +1,25 @@ package org.ovirt.engine.ui.webadmin.widget.renderer; +import com.google.gwt.text.shared.AbstractRenderer; +import org.ovirt.engine.core.compat.RpmVersion; import org.ovirt.engine.core.compat.Version; import org.ovirt.engine.ui.common.widget.renderer.EmptyValueRenderer; import org.ovirt.engine.ui.uicommonweb.Extensions; import org.ovirt.engine.ui.webadmin.gin.ClientGinjectorProvider; -import com.google.gwt.text.shared.AbstractRenderer; - public class VersionRenderer extends AbstractRenderer<Version> { @Override public String render(Version version) { - String formattedVersion = Extensions.GetFriendlyVersion(version).toString(); - return new EmptyValueRenderer<String>( - ClientGinjectorProvider.instance().getApplicationConstants().unAvailablePropertyLabel()).render(formattedVersion); - } + String formattedVersion; + if (version instanceof RpmVersion) { + formattedVersion = ((RpmVersion) version).getRpmName(); + } else { + formattedVersion = Extensions.GetFriendlyVersion(version).toString(); + } + + return new EmptyValueRenderer<String>( + ClientGinjectorProvider.instance().getApplicationConstants().unAvailablePropertyLabel()).render(formattedVersion); + } } -- To view, visit http://gerrit.ovirt.org/7186 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9931a1aa804d9dc7aec1485ebc29bac45131d0e5 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: Alexey Chub <ac...@redhat.com> Gerrit-Reviewer: Eli Mesika <emes...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches