use of org.ovirt.engine.core.common.businessentities.VdsStatic in project ovirt-engine by oVirt.
the class HostMapper method map.
@Mapping(from = PowerManagement.class, to = VdsStatic.class)
public static VdsStatic map(PowerManagement model, VdsStatic template) {
VdsStatic entity = template != null ? template : new VdsStatic();
if (model.isSetEnabled()) {
entity.setPmEnabled(model.isEnabled());
}
if (model.isSetAutomaticPmEnabled()) {
entity.setDisablePowerManagementPolicy(!model.isAutomaticPmEnabled());
}
if (model.isSetPmProxies()) {
List<FenceProxySourceType> fenceProxySources = model.getPmProxies().getPmProxies().stream().map(pmProxy -> FenceProxySourceType.forValue(pmProxy.getType().toString())).collect(toCollection(LinkedList::new));
entity.setFenceProxySources(fenceProxySources);
}
if (model.isSetKdumpDetection()) {
entity.setPmKdumpDetection(model.isKdumpDetection());
}
return entity;
}
use of org.ovirt.engine.core.common.businessentities.VdsStatic in project ovirt-engine by oVirt.
the class InstallVdsInternalCommand method markCurrentCmdlineAsStored.
private void markCurrentCmdlineAsStored() {
final VdsStatic vdsStatic = getVds().getStaticData();
vdsStaticDao.updateLastStoredKernelCmdline(vdsStatic.getId(), vdsStatic.getCurrentKernelCmdline());
}
use of org.ovirt.engine.core.common.businessentities.VdsStatic in project ovirt-engine by oVirt.
the class GeorepEventSubscriber method processEvent.
@Override
public void processEvent(GlusterEvent event) {
if (event == null) {
log.debug("No event to process!");
return;
}
GlusterServer glusterServer = glusterServerDao.getByGlusterServerUuid(Guid.createGuidFromString(event.getNodeId()));
if (glusterServer == null) {
log.debug("Could not determine gluster server from event '{}'", event);
return;
}
VdsStatic host = vdsStaticDao.get(glusterServer.getId());
if (host == null) {
log.debug("No host corresponding to gluster server in '{}'", event);
return;
}
if (event.getEvent().equalsIgnoreCase(EVENT_GEOREP_CHECKPOINT_COMPLETED)) {
GlusterVolumeEntity masterVol = glusterVolumeDao.getByName(host.getClusterId(), (String) event.getMessage().get(MASTER_VOLUME));
if (masterVol == null) {
log.debug("Could not determine master volume from event '{}'", event);
return;
}
GlusterGeoRepSession session = geoRepDao.getGeoRepSession(masterVol.getId(), (String) event.getMessage().get(SLAVE_HOST), (String) event.getMessage().get(SLAVE_VOLUME));
// hence forcing sync for now.
if (session != null) {
log.debug("received event for session '{}'", session.getSessionKey());
}
geoRepSyncJob.refreshGeoRepDataForVolume(masterVol);
}
}
use of org.ovirt.engine.core.common.businessentities.VdsStatic in project ovirt-engine by oVirt.
the class EntityDaoImplTest method testGetEntityNameByIdAndTypeForHost.
@Test
public void testGetEntityNameByIdAndTypeForHost() {
VdsStatic vds = vdsStaticDao.get(FixturesTool.VDS_RHEL6_NFS_SPM);
assertNotNull(vds);
String name = vds.getName();
assertEquals(name, underTest.getEntityNameByIdAndType(FixturesTool.VDS_RHEL6_NFS_SPM, VdcObjectType.VDS));
}
use of org.ovirt.engine.core.common.businessentities.VdsStatic in project ovirt-engine by oVirt.
the class GetVdsCertificateSubjectByVmIdQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
// Initially we set the command as failed:
QueryReturnValue queryReturnValue = getQueryReturnValue();
queryReturnValue.setSucceeded(false);
// Check if the virtual machine is running on a host, and if does then retrieve the host and copy the subject
// of the certificate to the value returned by the query:
Guid vmId = getParameters().getId();
if (vmId != null) {
VmDynamic vm = vmDynamicDao.get(vmId);
if (vm != null) {
Guid vdsId = vm.getRunOnVds();
if (vdsId != null) {
VdsStatic vds = vdsStaticDao.get(vdsId);
queryReturnValue.setSucceeded(true);
queryReturnValue.setReturnValue(CertificateSubjectHelper.getCertificateSubject(vds.getHostName()));
}
}
}
}
Aggregations