Search in sources :

Example 1 with VdsDynamic

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

the class BaseNetworkImplementationDetailsUtilsTest method setUpBefore.

@Before
public void setUpBefore() throws Exception {
    qosA = createAndMockQos(30, 30, 30);
    qosB = createAndMockQos(60, 60, 60);
    unlimitedHostNetworkQos = createQos(null, null, null);
    VdsStatic vdsStatic = new VdsStatic();
    vdsStatic.setId(VDS_ID);
    vdsStatic.setClusterId(CLUSTER_ID);
    VdsDynamic vdsDynamic = new VdsDynamic();
    cluster = new Cluster();
    cluster.setCompatibilityVersion(Version.v4_2);
    cluster.setId(CLUSTER_ID);
    when(vdsStaticDaoMock.get(eq(VDS_ID))).thenReturn(vdsStatic);
    when(vdsDynamicDaoMock.get(eq(VDS_ID))).thenReturn(vdsDynamic);
    when(clusterDaoMock.get(eq(CLUSTER_ID))).thenReturn(cluster);
    EffectiveHostNetworkQos effectiveHostNetworkQos = new EffectiveHostNetworkQos(hostNetworkQosDaoMock);
    networkImplementationDetailsUtils = new NetworkImplementationDetailsUtils(effectiveHostNetworkQos, networkAttachmentDaoMock, vdsStaticDaoMock, vdsDynamicDaoMock, clusterDaoMock, calculateBaseNic, this.defaultRouteUtil);
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Before(org.junit.Before)

Example 2 with VdsDynamic

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

the class CollectVdsNetworkDataAfterInstallationVDSCommand method persistCollectedData.

@Override
protected void persistCollectedData() {
    super.persistCollectedData();
    VdsDynamicDao vdsDynamicDao = DbFacade.getInstance().getVdsDynamicDao();
    VdsDynamic hostFromDb = vdsDynamicDao.get(getVds().getId());
    hostFromDb.setSupportedClusterLevels(getVds().getDynamicData().getSupportedClusterLevels());
    vdsDynamicDao.update(hostFromDb);
}
Also used : VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) VdsDynamicDao(org.ovirt.engine.core.dao.VdsDynamicDao)

Example 3 with VdsDynamic

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

the class ChangeVDSClusterCommand method getPermissionCheckSubjects.

@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
    List<PermissionSubject> permissionList = new ArrayList<>();
    VdsDynamic vdsDynamic = getVds().getDynamicData();
    // in order to approve a host
    if (vdsDynamic != null && !VDSStatus.PendingApproval.equals(vdsDynamic.getStatus())) {
        permissionList.add(new PermissionSubject(getParameters().getVdsId(), VdcObjectType.VDS, getActionType().getActionGroup()));
    }
    permissionList.add(new PermissionSubject(getParameters().getClusterId(), VdcObjectType.Cluster, getActionType().getActionGroup()));
    List<PermissionSubject> unmodifiableList = Collections.unmodifiableList(permissionList);
    return unmodifiableList;
}
Also used : PermissionSubject(org.ovirt.engine.core.bll.utils.PermissionSubject) VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) ArrayList(java.util.ArrayList)

Example 4 with VdsDynamic

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

the class PersistentHostSetupNetworksCommand method checkForChanges.

private boolean checkForChanges() {
    final VdsDynamic host = vdsDynamicDao.get(getVdsId());
    final Boolean netConfigDirty = host.getNetConfigDirty();
    return Boolean.TRUE.equals(netConfigDirty);
}
Also used : VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic)

Example 5 with VdsDynamic

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

the class HostUpgradeCallback method evaluateMaintenanceHostCommandProgress.

/**
 * Evaluates the host status in regards to maintenance status: The host must move to {@code VDSStatus.Maintenance}
 * in order to proceed with the upgrade process.
 *
 * @param childCmdIds
 *            child command IDs list to search if {@code MaintenanceNumberOfVdss} exists in it
 * @param rootCommand
 *            The root command
 */
private void evaluateMaintenanceHostCommandProgress(List<Guid> childCmdIds, CommandBase<?> rootCommand) {
    UpgradeHostParameters parameters = (UpgradeHostParameters) rootCommand.getParameters();
    VdsDynamic host = DbFacade.getInstance().getVdsDynamicDao().get(parameters.getVdsId());
    switch(host.getStatus()) {
        // Wait till moving to maintenance ends
        case PreparingForMaintenance:
            break;
        // Invoke the upgrade action
        case Maintenance:
            log.info("Host '{}' is on maintenance mode. Proceeding with Upgrade process.", getHostName(parameters.getVdsId()));
            invokeHostUpgrade(rootCommand, parameters);
            break;
        // Any other status implies maintenance action failed, and the callback cannot proceed with the upgrade
        default:
            if (isMaintenanceCommandExecuted(childCmdIds)) {
                log.error("Host '{}' failed to move to maintenance mode. Upgrade process is terminated.", getHostName(parameters.getVdsId()));
                auditLogDirector.log(rootCommand, AuditLogType.VDS_MAINTENANCE_FAILED);
                rootCommand.setCommandStatus(CommandStatus.FAILED);
            }
            break;
    }
}
Also used : UpgradeHostParameters(org.ovirt.engine.core.common.action.hostdeploy.UpgradeHostParameters) VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic)

Aggregations

VdsDynamic (org.ovirt.engine.core.common.businessentities.VdsDynamic)27 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)4 VDS (org.ovirt.engine.core.common.businessentities.VDS)4 Before (org.junit.Before)3 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)3 VdsStatic (org.ovirt.engine.core.common.businessentities.VdsStatic)3 VDSStatus (org.ovirt.engine.core.common.businessentities.VDSStatus)2 OS (org.ovirt.engine.core.utils.OS)2 HashMap (java.util.HashMap)1 PermissionSubject (org.ovirt.engine.core.bll.utils.PermissionSubject)1 StoragePoolValidator (org.ovirt.engine.core.bll.validator.storage.StoragePoolValidator)1 CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)1 MaintenanceVdsParameters (org.ovirt.engine.core.common.action.MaintenanceVdsParameters)1 UpgradeHostParameters (org.ovirt.engine.core.common.action.hostdeploy.UpgradeHostParameters)1 NonOperationalReason (org.ovirt.engine.core.common.businessentities.NonOperationalReason)1 ServerCpu (org.ovirt.engine.core.common.businessentities.ServerCpu)1 VdsTransparentHugePagesState (org.ovirt.engine.core.common.businessentities.VdsTransparentHugePagesState)1 Bond (org.ovirt.engine.core.common.businessentities.network.Bond)1 DnsResolverConfiguration (org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)1