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