Search in sources :

Example 6 with RpmVersion

use of org.ovirt.engine.core.compat.RpmVersion in project ovirt-engine by oVirt.

the class HostMapperTest method testLibvirtVersion.

@Test
public void testLibvirtVersion() {
    VDS vds = new VDS();
    vds.setId(Guid.Empty);
    vds.setLibvirtVersion(new RpmVersion("libvirt-0.9.10-21.el6_3.4", "libvirt-", true));
    Host host = HostMapper.map(vds, (Host) null);
    assertNotNull(host.getLibvirtVersion());
    assertEquals(Long.valueOf(0), Long.valueOf(host.getLibvirtVersion().getMajor()));
    assertEquals(Long.valueOf(9), Long.valueOf(host.getLibvirtVersion().getMinor()));
    assertEquals(Long.valueOf(0), Long.valueOf(host.getLibvirtVersion().getRevision()));
    assertEquals(Long.valueOf(10), Long.valueOf(host.getLibvirtVersion().getBuild()));
    assertEquals("libvirt-0.9.10-21.el6_3.4", host.getLibvirtVersion().getFullVersion());
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) Host(org.ovirt.engine.api.model.Host) RpmVersion(org.ovirt.engine.core.compat.RpmVersion) Test(org.junit.Test)

Example 7 with RpmVersion

use of org.ovirt.engine.core.compat.RpmVersion in project ovirt-engine by oVirt.

the class HostMapperTest method testVersion.

@Test
public void testVersion() {
    VDS vds = new VDS();
    vds.setId(Guid.Empty);
    vds.setVersion(new RpmVersion("vdsm-4.10.0-10.fc17", "vdsm-", true));
    Host host = HostMapper.map(vds, (Host) null);
    assertNotNull(host.getVersion());
    assertEquals(Long.valueOf(4), Long.valueOf(host.getVersion().getMajor()));
    assertEquals(Long.valueOf(10), Long.valueOf(host.getVersion().getMinor()));
    assertEquals(Long.valueOf(0), Long.valueOf(host.getVersion().getRevision()));
    assertEquals(Long.valueOf(0), Long.valueOf(host.getVersion().getBuild()));
    assertEquals("vdsm-4.10.0-10.fc17", host.getVersion().getFullVersion());
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) Host(org.ovirt.engine.api.model.Host) RpmVersion(org.ovirt.engine.core.compat.RpmVersion) Test(org.junit.Test)

Example 8 with RpmVersion

use of org.ovirt.engine.core.compat.RpmVersion in project ovirt-engine by oVirt.

the class UpgradeOvirtNodeInternalCommand method isISOCompatible.

private boolean isISOCompatible(File iso, RpmVersion ovirtHostOsVersion) {
    boolean ret = false;
    log.debug("Check if ISO compatible: '{}'", iso);
    for (OVirtNodeInfo.Entry info : OVirtNodeInfo.getInstance().get()) {
        if (info.path.equals(iso.getParentFile())) {
            try {
                Matcher matcher = info.isoPattern.matcher(iso.getCanonicalFile().getName());
                if (matcher.find()) {
                    String rpmLike = matcher.group(1).replaceAll("-", ".");
                    log.debug("ISO version: '{}' '{}' '{}'", iso, rpmLike, ovirtHostOsVersion);
                    RpmVersion isoVersion = new RpmVersion(rpmLike, "", true);
                    if (VdsHandler.isIsoVersionCompatibleForUpgrade(ovirtHostOsVersion, isoVersion)) {
                        log.debug("ISO compatible '{}'", iso);
                        ret = true;
                        break;
                    }
                }
            } catch (IOException e) {
                log.error("Cannot get canonical path to '{}': {}", iso.getName(), e.getMessage());
                log.debug("Exception", e);
            }
        }
    }
    return ret;
}
Also used : Matcher(java.util.regex.Matcher) IOException(java.io.IOException) RpmVersion(org.ovirt.engine.core.compat.RpmVersion)

Example 9 with RpmVersion

use of org.ovirt.engine.core.compat.RpmVersion in project ovirt-engine by oVirt.

the class HostInstallPopupView method initEditors.

void initEditors() {
    isoEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<RpmVersion>() {

        @Override
        public String renderNullSafe(RpmVersion version) {
            // Format string to contain major.minor version only.
            return version.getRpmName();
        }
    });
    // $NON-NLS-1$
    rbPassword = new RadioButton("1");
    // $NON-NLS-1$
    rbPublicKey = new RadioButton("1");
    publicKeyEditor = new StringEntityModelTextAreaLabelEditor();
    activateHostAfterInstallEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    overrideIpTablesEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
}
Also used : StringEntityModelTextAreaLabelEditor(org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextAreaLabelEditor) NullSafeRenderer(org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer) RadioButton(com.google.gwt.user.client.ui.RadioButton) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor) RpmVersion(org.ovirt.engine.core.compat.RpmVersion)

Example 10 with RpmVersion

use of org.ovirt.engine.core.compat.RpmVersion in project ovirt-engine by oVirt.

the class HandleVdsVersionCommand method executeCommand.

@Override
protected void executeCommand() {
    VDS vds = getVds();
    Cluster cluster = getCluster();
    boolean isEngineSupportedByVdsm = false;
    // partialVdcVersion will hold the engine's version (minor and major parts),
    // this will be compared to vdsm supported engines to see if vdsm can be added
    // to cluster
    Version partialVdcVersion = new Version(new Version(Config.getValue(ConfigValues.VdcVersion)).toString(2));
    RpmVersion vdsVersion = vds.getVersion();
    Version vdsmVersion = new Version(vdsVersion.getMajor(), vdsVersion.getMinor());
    if (!StringUtils.isEmpty(vds.getSupportedEngines())) {
        isEngineSupportedByVdsm = vds.getSupportedENGINESVersionsSet().contains(partialVdcVersion);
    }
    // and cluster supports the specific vdsm version. which is sufficient
    if (!isEngineSupportedByVdsm && !Config.<HashSet<Version>>getValue(ConfigValues.SupportedVDSMVersions).contains(vdsmVersion)) {
        reportNonOperationReason(NonOperationalReason.VERSION_INCOMPATIBLE_WITH_CLUSTER, Config.<HashSet<Version>>getValue(ConfigValues.SupportedVDSMVersions).toString(), vdsmVersion.toString());
    } else if (!VersionSupport.checkClusterVersionSupported(cluster.getCompatibilityVersion(), vds)) {
        reportNonOperationReason(NonOperationalReason.CLUSTER_VERSION_INCOMPATIBLE_WITH_CLUSTER, cluster.getCompatibilityVersion().toString(), vds.getSupportedClusterLevels());
    } else {
        checkClusterAdditionalFeaturesSupported(cluster, vds);
    }
    setSucceeded(true);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) RpmVersion(org.ovirt.engine.core.compat.RpmVersion) Version(org.ovirt.engine.core.compat.Version) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) RpmVersion(org.ovirt.engine.core.compat.RpmVersion) HashSet(java.util.HashSet)

Aggregations

RpmVersion (org.ovirt.engine.core.compat.RpmVersion)10 VDS (org.ovirt.engine.core.common.businessentities.VDS)4 File (java.io.File)2 Matcher (java.util.regex.Matcher)2 Test (org.junit.Test)2 Host (org.ovirt.engine.api.model.Host)2 Version (org.ovirt.engine.core.compat.Version)2 RadioButton (com.google.gwt.user.client.ui.RadioButton)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 HostUpgradeManagerResult (org.ovirt.engine.core.common.HostUpgradeManagerResult)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1 AuditLogable (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)1 AuditLogableImpl (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)1 EntityModelCheckBoxEditor (org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor)1 StringEntityModelTextAreaLabelEditor (org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextAreaLabelEditor)1 NullSafeRenderer (org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer)1