Search in sources :

Example 6 with VdsDynamic

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

the class StartVdsCommandTest method mockVdsDynamicDao.

private void mockVdsDynamicDao() {
    VdsDynamic currentVds = new VdsDynamic();
    currentVds.setId(FENCECD_HOST_ID);
    currentVds.setStatus(VDSStatus.Reboot);
    when(vdsDynamicDao.get(FENCECD_HOST_ID)).thenReturn(currentVds);
}
Also used : VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic)

Example 7 with VdsDynamic

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

the class VdsArchitectureHelper method getArchitecture.

/**
 * Gets the architecture type of the given host using its cpu flags, if not found, return the cluster architecture
 * @param host
 *            The host
 * @return
 *            The host architecture type
 */
public ArchitectureType getArchitecture(VdsStatic host) {
    Cluster cluster = clusterDao.get(host.getClusterId());
    VdsDynamic vdsDynamic = vdsDynamicDao.get(host.getId());
    if (vdsDynamic != null) {
        ServerCpu cpu = cpuFlagsManagerHandler.findMaxServerCpuByFlags(vdsDynamic.getCpuFlags(), cluster.getCompatibilityVersion());
        if (cpu != null && cpu.getArchitecture() != null) {
            return cpu.getArchitecture();
        }
    }
    // take architecture from the cluster if it is null on the host level or host is not yet saved in db
    log.info("Failed to get architecture type from host information for host '{}'. Using cluster '{}'" + " architecture value instead.", host.getName(), cluster.getName());
    return cluster.getArchitecture();
}
Also used : VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 8 with VdsDynamic

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

the class ReportedConfigurationsFillerTest method setUp.

@Before
public void setUp() {
    hostId = Guid.newGuid();
    clusterId = Guid.newGuid();
    VdsStatic vdsStatic = new VdsStatic();
    vdsStatic.setId(hostId);
    vdsStatic.setClusterId(clusterId);
    reportedDnsResolverConfiguration = new DnsResolverConfiguration();
    VdsDynamic vdsDynamic = new VdsDynamic();
    vdsDynamic.setId(hostId);
    vdsDynamic.setReportedDnsResolverConfiguration(reportedDnsResolverConfiguration);
    baseNic = createNic("eth0");
    vlanNic = createNic("eth0.1");
    vlanNic.setBaseInterface(baseNic.getName());
    baseNicNetwork = createNetwork("baseNicNetwork");
    vlanNetwork = createNetwork("vlanNicNetwork");
    vlanNetwork.setVlanId(1);
    baseNicNetworkQos = new HostNetworkQos();
    baseNicNetworkQos.setId(baseNicNetwork.getQosId());
    vlanNetworkQos = new HostNetworkQos();
    vlanNetworkQos.setId(vlanNetwork.getQosId());
    when(vdsStaticDao.get(hostId)).thenReturn(vdsStatic);
    when(vdsDynamicDao.get(hostId)).thenReturn(vdsDynamic);
    cluster = new Cluster();
    cluster.setCompatibilityVersion(Version.v4_1);
    when(clusterDao.get(any())).thenReturn(cluster);
}
Also used : HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) EffectiveHostNetworkQos(org.ovirt.engine.core.vdsbroker.EffectiveHostNetworkQos) VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration) Before(org.junit.Before)

Example 9 with VdsDynamic

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

the class HostSetupNetworksValidatorTest method setUp.

@Before
public void setUp() throws Exception {
    host = new VDS();
    host.setId(Guid.newGuid());
    final VdsDynamic vdsDynamic = new VdsDynamic();
    host.setDynamicData(vdsDynamic);
    bond = new Bond();
    bond.setId(Guid.newGuid());
    when(mockNetworkExclusivenessValidatorResolver.resolveNetworkExclusivenessValidator()).thenReturn(mockNetworkExclusivenessValidator);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) Bond(org.ovirt.engine.core.common.businessentities.network.Bond) Before(org.junit.Before)

Example 10 with VdsDynamic

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

the class HostMaintenanceCallback method evaluateMaintenanceHostCommandProgress.

/**
 * Evaluates the host status in regards to maintenance status: The host must move to {@code VDSStatus.Maintenance}
 * in order to stop gluster service
 *
 * @param maintenanceCommand
 *            The root command
 */
private void evaluateMaintenanceHostCommandProgress(MaintenanceVdsCommand<MaintenanceVdsParameters> maintenanceCommand) {
    MaintenanceVdsParameters parameters = maintenanceCommand.getParameters();
    VdsDynamic host = vdsDynamicDao.get(parameters.getVdsId());
    switch(host.getStatus()) {
        // Wait till moving to maintenance ends
        case PreparingForMaintenance:
            break;
        // Stop Gluster processes
        case Maintenance:
            log.info("Host '{}' is on maintenance mode. Stoping all gluster services.", getHostName(parameters.getVdsId()));
            stopGlusterServices(parameters.getVdsId());
            maintenanceCommand.setCommandStatus(CommandStatus.SUCCEEDED);
            break;
        // Any other status implies maintenance action failed, and the callback cannot proceed with stopping gluster's services
        default:
            if (isMaintenanceCommandExecuted(maintenanceCommand)) {
                log.info("Host '{}' failed to move to maintenance mode. Could not stop Gluster services.", getHostName(parameters.getVdsId()));
                maintenanceCommand.setCommandStatus(CommandStatus.FAILED);
            }
            break;
    }
}
Also used : VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) MaintenanceVdsParameters(org.ovirt.engine.core.common.action.MaintenanceVdsParameters)

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