Search in sources :

Example 26 with VmDynamic

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

the class VmMapperTest method testGuestFQDN.

@Test
public void testGuestFQDN() {
    org.ovirt.engine.core.common.businessentities.VM vm = new org.ovirt.engine.core.common.businessentities.VM();
    VmDynamic vmDynamic = new VmDynamic();
    vmDynamic.setStatus(VMStatus.Up);
    vmDynamic.setFqdn("localhost.localdomain");
    vm.setDynamicData(vmDynamic);
    Vm map = VmMapper.map(vm, (Vm) null);
    assertNotNull(map.getFqdn());
    assertEquals("localhost.localdomain", map.getFqdn());
}
Also used : VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic) Vm(org.ovirt.engine.api.model.Vm) Test(org.junit.Test)

Example 27 with VmDynamic

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

the class VmMapperTest method testGuestOs.

@Test
public void testGuestOs() {
    org.ovirt.engine.core.common.businessentities.VM vm = new org.ovirt.engine.core.common.businessentities.VM();
    VmDynamic vmDynamic = new VmDynamic();
    vmDynamic.setStatus(VMStatus.Up);
    vmDynamic.setGuestOsType(OsType.Linux);
    vmDynamic.setGuestOsCodename("Santiago");
    vmDynamic.setGuestOsDistribution("Red Hat Enterprise Linux Server");
    vmDynamic.setGuestOsVersion("6.5");
    vmDynamic.setGuestOsArch(ArchitectureType.x86_64);
    vmDynamic.setGuestOsKernelVersion("2.6.32-431.el6.x86_64");
    vm.setDynamicData(vmDynamic);
    Vm map = VmMapper.map(vm, (Vm) null);
    assertNotNull(map.getGuestOperatingSystem());
    assertEquals("Linux", map.getGuestOperatingSystem().getFamily());
    assertEquals("Santiago", map.getGuestOperatingSystem().getCodename());
    assertEquals("Red Hat Enterprise Linux Server", map.getGuestOperatingSystem().getDistribution());
    assertEquals("6.5", map.getGuestOperatingSystem().getVersion().getFullVersion());
    assertNotNull(map.getGuestOperatingSystem().getVersion().getMajor());
    assertEquals(6, (long) map.getGuestOperatingSystem().getVersion().getMajor());
    assertNotNull(map.getGuestOperatingSystem().getVersion().getMinor());
    assertEquals(5, (long) map.getGuestOperatingSystem().getVersion().getMinor());
    assertNull(map.getGuestOperatingSystem().getVersion().getBuild());
    assertNull(map.getGuestOperatingSystem().getVersion().getRevision());
    assertEquals("x86_64", map.getGuestOperatingSystem().getArchitecture());
    assertEquals("2.6.32-431.el6.x86_64", map.getGuestOperatingSystem().getKernel().getVersion().getFullVersion());
    assertEquals(2, (long) map.getGuestOperatingSystem().getKernel().getVersion().getMajor());
    assertEquals(6, (long) map.getGuestOperatingSystem().getKernel().getVersion().getMinor());
    assertEquals(32, (long) map.getGuestOperatingSystem().getKernel().getVersion().getBuild());
    assertEquals(431, (long) map.getGuestOperatingSystem().getKernel().getVersion().getRevision());
}
Also used : VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic) Vm(org.ovirt.engine.api.model.Vm) Test(org.junit.Test)

Example 28 with VmDynamic

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

the class VmDaoTest method createHostedEngineVm.

private void createHostedEngineVm(Guid id) {
    VmStatic vmStatic = new VmStatic();
    vmStatic.setId(id);
    vmStatic.setClusterId(FixturesTool.CLUSTER_RHEL6_ISCSI);
    vmStatic.setName("HostedEngine");
    vmStatic.setOrigin(OriginType.HOSTED_ENGINE);
    vmStatic.setCpuProfileId(FixturesTool.CPU_PROFILE_1);
    getDbFacade().getVmStaticDao().save(vmStatic);
    VmDynamic vmDynamic = new VmDynamic();
    vmDynamic.setId(id);
    getDbFacade().getVmDynamicDao().save(vmDynamic);
    VmStatistics vmStatistics = new VmStatistics();
    vmStatistics.setId(id);
    getDbFacade().getVmStatisticsDao().save(vmStatistics);
}
Also used : VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic) VmStatistics(org.ovirt.engine.core.common.businessentities.VmStatistics) VmStatic(org.ovirt.engine.core.common.businessentities.VmStatic)

Example 29 with VmDynamic

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

the class VmDynamicDaoTest method testUpdateConsoleUserWithOptimisticLockingFailure.

/**
 * Make sure that saving a new console user id and console user name to a virtual machine
 * that already as a previous console user fails and returns {@code false}.
 */
@Test
public void testUpdateConsoleUserWithOptimisticLockingFailure() throws Exception {
    VmDynamic vmWithoutConsoleUser = dao.get(FixturesTool.VM_RHEL5_POOL_57);
    vmWithoutConsoleUser.setConsoleUserId(new Guid("9bf7c640-b620-456f-a550-0348f366544b"));
    boolean result = dao.updateConsoleUserWithOptimisticLocking(vmWithoutConsoleUser);
    assertFalse(result);
}
Also used : VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test)

Example 30 with VmDynamic

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

the class VmDynamicDaoTest method testClearMigratingToVds.

@Test
public void testClearMigratingToVds() throws Exception {
    VmDynamic vmDynamic = dao.get(FixturesTool.VM_RHEL5_POOL_51);
    assertNotNull("migrating_to_vds field should not be null before we clear it", vmDynamic.getMigratingToVds());
    dao.clearMigratingToVds(FixturesTool.VM_RHEL5_POOL_51);
    vmDynamic = dao.get(FixturesTool.VM_RHEL5_POOL_51);
    assertNull("migrating_to_vds field should be null after we clear it", vmDynamic.getMigratingToVds());
}
Also used : VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic) Test(org.junit.Test)

Aggregations

VmDynamic (org.ovirt.engine.core.common.businessentities.VmDynamic)54 Test (org.junit.Test)13 Guid (org.ovirt.engine.core.compat.Guid)12 VmStatic (org.ovirt.engine.core.common.businessentities.VmStatic)8 VM (org.ovirt.engine.core.common.businessentities.VM)7 VmStatistics (org.ovirt.engine.core.common.businessentities.VmStatistics)6 Vm (org.ovirt.engine.api.model.Vm)4 Date (java.util.Date)3 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)3 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Collectors (java.util.stream.Collectors)2 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)2 VdsmVm (org.ovirt.engine.core.vdsbroker.monitoring.VdsmVm)2 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 Set (java.util.Set)1