use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VmMapperTest method testMapSessions.
@Test
public void testMapSessions() {
org.ovirt.engine.core.common.businessentities.VM vm = new org.ovirt.engine.core.common.businessentities.VM();
VmDynamic vmDynamic = new VmDynamic();
vmDynamic.setConsoleCurrentUserName("admin");
vmDynamic.setClientIp("1.1.1.1");
vmDynamic.setGuestCurrentUserName("Ori");
vm.setDynamicData(vmDynamic);
Sessions sessions = VmMapper.map(vm, new Sessions());
assertNotNull(sessions);
assertEquals(2, sessions.getSessions().size());
Session consoleSession = sessions.getSessions().get(0).getUser().getUserName().equals("admin") ? sessions.getSessions().get(0) : sessions.getSessions().get(1);
Session guestSession = sessions.getSessions().get(0).getUser().getUserName().equals("Ori") ? sessions.getSessions().get(0) : sessions.getSessions().get(1);
assertEquals("admin", consoleSession.getUser().getUserName());
assertEquals("1.1.1.1", consoleSession.getIp().getAddress());
assertTrue(consoleSession.isConsoleUser());
assertEquals("Ori", guestSession.getUser().getUserName());
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VmAnalyzer method processUnmanagedVm.
private void processUnmanagedVm() {
VmDynamic vmDynamic = vdsmVm.getVmDynamic();
if (vmDynamic.getStatus() == VMStatus.Down || (vmDynamic.getStatus() == VMStatus.Paused && vmDynamic.getPauseStatus() == VmPauseStatus.EIO)) {
destroyVm();
return;
}
unmanagedVm = true;
vmDynamic.setRunOnVds(vdsManager.getVdsId());
saveDynamic(vmDynamic);
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VmAnalyzerFactory method getVmAnalyzer.
protected VmAnalyzer getVmAnalyzer(Pair<VmDynamic, VdsmVm> monitoredVm) {
// the VM that was reported by vdsm
VdsmVm vdsmVm = monitoredVm.getSecond();
// VM from the database running on the monitored host, might be null
VmDynamic dbVmOnMonitoredHost = monitoredVm.getFirst();
VmDynamic dbVm = dbVmOnMonitoredHost != null ? dbVmOnMonitoredHost : vmDynamicDao.get(vdsmVm.getVmDynamic().getId());
return new VmAnalyzer(dbVm, vdsmVm, updateStatistics, vdsManager, auditLogDirector, resourceManager, vdsDynamicDao, vmNetworkInterfaceDao);
}
use of org.ovirt.engine.core.common.businessentities.VmDynamic in project ovirt-engine by oVirt.
the class VmAnalyzer method proceedWatchdogEvents.
private void proceedWatchdogEvents() {
VmDynamic vmDynamic = vdsmVm.getVmDynamic();
if (isNewWatchdogEvent(vmDynamic, dbVm)) {
AuditLogableBase auditLogable = Injector.injectMembers(new AuditLogableBase());
auditLogable.setVmId(vmDynamic.getId());
auditLogable.addCustomValue("wdaction", vmDynamic.getLastWatchdogAction());
// for the interpretation of vdsm's response see http://docs.python.org/2/library/time.html
auditLogable.addCustomValue("wdevent", new Date(vmDynamic.getLastWatchdogEvent() * 1000).toString());
auditLog(auditLogable, AuditLogType.WATCHDOG_EVENT);
}
}
Aggregations