Search in sources :

Example 26 with HostDevice

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

the class HostDeviceDaoTest method updateNetworkDevice.

@Test
public void updateNetworkDevice() {
    HostDevice before = getNetworkDevice();
    before.setNetworkInterfaceName(before.getNetworkInterfaceName() + "new");
    before.setDriver("updated driver");
    dao.update(before);
    HostDevice after = dao.get(before.getId());
    assertNotNull(after);
    assertEquals(before, after);
}
Also used : HostDevice(org.ovirt.engine.core.common.businessentities.HostDevice) Test(org.junit.Test)

Example 27 with HostDevice

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

the class HostDeviceDaoTest method cleanDownVmsTest.

@Test
public void cleanDownVmsTest() {
    HostDevice device = getNetworkDevice();
    HostDeviceId deviceId = device.getId();
    // Setting an id of VM with VMStatus.Down
    Guid vmId = FixturesTool.VM_WITH_NO_ATTACHED_DISKS;
    dao.setVmIdOnHostDevice(deviceId, vmId);
    device = dao.get(deviceId);
    assertNotNull(device);
    assertEquals(vmId, device.getVmId());
    dao.cleanDownVms();
    device = dao.get(deviceId);
    assertNull(device.getVmId());
}
Also used : HostDevice(org.ovirt.engine.core.common.businessentities.HostDevice) Guid(org.ovirt.engine.core.compat.Guid) HostDeviceId(org.ovirt.engine.core.common.businessentities.HostDeviceId) Test(org.junit.Test)

Example 28 with HostDevice

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

the class NetworkDeviceHelperImplTest method slaveDeviceNonNetworkFree.

@Test
public void slaveDeviceNonNetworkFree() {
    freeVfCommon(0, 0, 0, 0, 0, 1);
    HostDevice hostDevice = getSingleMockedNonFreeDevice();
    assertFalse(networkDeviceHelper.isDeviceNetworkFree(hostDevice));
}
Also used : HostDevice(org.ovirt.engine.core.common.businessentities.HostDevice) Test(org.junit.Test)

Example 29 with HostDevice

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

the class NetworkDeviceHelperImplTest method noNicDeviceNonNetworkFree.

@Test
public void noNicDeviceNonNetworkFree() {
    freeVfCommon(0, 0, 1, 0, 0, 0);
    HostDevice hostDevice = getSingleMockedNonFreeDevice();
    assertFalse(networkDeviceHelper.isDeviceNetworkFree(hostDevice));
}
Also used : HostDevice(org.ovirt.engine.core.common.businessentities.HostDevice) Test(org.junit.Test)

Example 30 with HostDevice

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

the class NetworkDeviceHelperImplTest method isNonNetworkDeviceNetworkFree.

@Test
public void isNonNetworkDeviceNetworkFree() {
    HostDevice device = new HostDevice();
    device.setHostId(HOST_ID);
    device.setDeviceName(PCI_DEVICE_NAME_2);
    assertTrue(networkDeviceHelper.isDeviceNetworkFree(device));
}
Also used : HostDevice(org.ovirt.engine.core.common.businessentities.HostDevice) Test(org.junit.Test)

Aggregations

HostDevice (org.ovirt.engine.core.common.businessentities.HostDevice)46 Test (org.junit.Test)17 ArrayList (java.util.ArrayList)16 Guid (org.ovirt.engine.core.compat.Guid)14 Map (java.util.Map)11 List (java.util.List)10 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)10 HashMap (java.util.HashMap)9 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)9 Collectors (java.util.stream.Collectors)8 HostNicVfsConfig (org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig)7 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)7 HostDeviceDao (org.ovirt.engine.core.dao.HostDeviceDao)7 Arrays (java.util.Arrays)6 Collections (java.util.Collections)6 Objects (java.util.Objects)6 Inject (javax.inject.Inject)6 StringUtils (org.apache.commons.lang.StringUtils)6 VmDeviceGeneralType (org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType)6 VmDeviceDao (org.ovirt.engine.core.dao.VmDeviceDao)6