Search in sources :

Example 1 with VDSStatus

use of org.ovirt.engine.core.common.businessentities.VDSStatus in project ovirt-engine by oVirt.

the class StopVdsCommand method setStatus.

@Override
protected void setStatus() {
    VDSStatus newStatus = VDSStatus.Down;
    if (getParameters().getParentCommand() == ActionType.RestartVds) {
        // In case the stop was issued as a result of VDS command , we
        // cannot set the VDS to down -
        // According to bug fix #605215 it can be that backend will crash
        // during restart, and upon restart, all down VDS are not
        // monitored. Instead, we will set the status to rebooting
        newStatus = VDSStatus.Reboot;
    }
    setStatus(newStatus);
}
Also used : VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus)

Example 2 with VDSStatus

use of org.ovirt.engine.core.common.businessentities.VDSStatus in project ovirt-engine by oVirt.

the class HostStatusCell method render.

@Override
public void render(Context context, VDS vds, SafeHtmlBuilder sb, String id) {
    // Nothing to render if no host is provided:
    if (vds == null) {
        return;
    }
    // Find the image corresponding to the status of the host:
    VDSStatus status = vds.getStatus();
    ImageResource statusImage;
    switch(status) {
        case Unassigned:
        case NonResponsive:
        case InstallFailed:
        case Connecting:
        case Down:
            statusImage = resources.downImage();
            break;
        case PreparingForMaintenance:
            statusImage = resources.prepareImage();
            break;
        case Maintenance:
            statusImage = resources.maintenanceImage();
            break;
        case Up:
            statusImage = resources.upImage();
            break;
        case Error:
            statusImage = resources.errorImage();
            break;
        case Installing:
            statusImage = resources.hostInstallingImage();
            break;
        case Reboot:
            statusImage = resources.waitImage();
            break;
        case NonOperational:
            statusImage = resources.nonOperationalImage();
            break;
        case PendingApproval:
        case InstallingOS:
            statusImage = resources.unconfiguredImage();
            break;
        case Initializing:
            statusImage = resources.waitImage();
            break;
        case Kdumping:
            statusImage = resources.waitImage();
            break;
        default:
            statusImage = resources.downImage();
    }
    // Find the image corresponding to the alert:
    ImageResource alertImage = resources.alertImage();
    // Generate the HTML for the images:
    SafeHtml statusImageHtml = AbstractImagePrototype.create(statusImage).getSafeHtml();
    SafeHtml alertImageHtml = AbstractImagePrototype.create(alertImage).getSafeHtml();
    // Generate the HTML for the cell, wrapped inside <div> element:
    // $NON-NLS-1$ //$NON-NLS-2$
    sb.appendHtmlConstant("<div id=\"" + id + "\" style=\"text-align: center;\">");
    // Append status image:
    sb.append(statusImageHtml);
    // - host reinstall is required
    if (hasPMAlert(vds) || hasNetconfigDirty(vds) || hasGlusterAlert(vds) || vds.getStaticData().isReinstallRequired() || hasDefaultRouteAlert(vds)) {
        sb.append(alertImageHtml);
    }
    // $NON-NLS-1$
    sb.appendHtmlConstant("</div>");
}
Also used : VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) ImageResource(com.google.gwt.resources.client.ImageResource) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml)

Example 3 with VDSStatus

use of org.ovirt.engine.core.common.businessentities.VDSStatus in project ovirt-engine by oVirt.

the class FenceProxyLocatorTest method findProxyHostExcludesUnreachableHosts.

/**
 * Checks if the locator excludes specified host as a proxy host, because it's unreachable by network. And because
 * specified host is the only existing host, no proxy is selected.
 *
 * Special case when host has NonOperational status and reason NETWORK_UNREACHABLE is tested in different test case!
 */
@Test
public void findProxyHostExcludesUnreachableHosts() {
    FenceProxyLocator locator = setupLocator();
    for (VDSStatus status : VDSStatus.values()) {
        mockExistingHosts(createHost(status));
        assertEquals(shouldHostBeUnreachable(status), locator.findProxyHost(false) == null);
    }
}
Also used : VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) Test(org.junit.Test)

Example 4 with VDSStatus

use of org.ovirt.engine.core.common.businessentities.VDSStatus in project ovirt-engine by oVirt.

the class HostValidator method hostStatusLegalForSetupNetworks.

private ValidationResult hostStatusLegalForSetupNetworks() {
    VDSStatus hostStatus = host.getStatus();
    boolean hostStatusLegalForSetupNetworks = LEGAL_STATUSES.contains(hostStatus) || hostStatus == VDSStatus.Installing && internalExecution;
    if (!hostStatusLegalForSetupNetworks) {
        logger.error("Unable to setup network: operation can only be done when Host status is one of: {};" + " current status is {}", LEGAL_STATUSES_STR, hostStatus);
        return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VDS_STATUS_ILLEGAL, ReplacementUtils.replaceWith(VAR_HOST_STATUS, LEGAL_STATUSES, ",", LEGAL_STATUSES.size()));
    }
    return ValidationResult.VALID;
}
Also used : VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) ValidationResult(org.ovirt.engine.core.bll.ValidationResult)

Example 5 with VDSStatus

use of org.ovirt.engine.core.common.businessentities.VDSStatus in project ovirt-engine by oVirt.

the class UpgradeHostCommand method executeCommand.

@Override
protected void executeCommand() {
    VDSStatus statusBeforeUpgrade = getVds().getStatus();
    if (statusBeforeUpgrade != VDSStatus.Maintenance) {
        commandCoordinatorUtil.executeAsyncCommand(ActionType.MaintenanceNumberOfVdss, createMaintenanceParams(), cloneContext());
    }
    setSucceeded(true);
}
Also used : VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus)

Aggregations

VDSStatus (org.ovirt.engine.core.common.businessentities.VDSStatus)11 VDS (org.ovirt.engine.core.common.businessentities.VDS)3 ImageResource (com.google.gwt.resources.client.ImageResource)1 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 Field (java.lang.reflect.Field)1 PostConstruct (javax.annotation.PostConstruct)1 Test (org.junit.Test)1 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)1 FenceVdsActionParameters (org.ovirt.engine.core.common.action.FenceVdsActionParameters)1 MaintenanceNumberOfVdssParameters (org.ovirt.engine.core.common.action.MaintenanceNumberOfVdssParameters)1 VdsActionParameters (org.ovirt.engine.core.common.action.VdsActionParameters)1 VdsPowerDownParameters (org.ovirt.engine.core.common.action.VdsPowerDownParameters)1 EditableVdsField (org.ovirt.engine.core.common.businessentities.EditableVdsField)1 NonOperationalReason (org.ovirt.engine.core.common.businessentities.NonOperationalReason)1 VdsDynamic (org.ovirt.engine.core.common.businessentities.VdsDynamic)1 VdsStatic (org.ovirt.engine.core.common.businessentities.VdsStatic)1 FenceOperationResult (org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult)1 EngineException (org.ovirt.engine.core.common.errors.EngineException)1 Guid (org.ovirt.engine.core.compat.Guid)1 AuditLogable (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)1