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);
}
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();
}
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);
}
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);
}
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;
}
}
Aggregations