Search in sources :

Example 1 with UsbControllerModel

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

the class OsRepositoryImplTest method testNonExistingUsbControllerModel.

@Test
public void testNonExistingUsbControllerModel() {
    final UsbControllerModel model = OsRepositoryImpl.INSTANCE.getOsUsbControllerModel(OsRepositoryImpl.INSTANCE.getOsIdByUniqueName("windows_8"), null, ChipsetType.I440FX);
    assertNull(model);
}
Also used : UsbControllerModel(org.ovirt.engine.core.common.businessentities.UsbControllerModel) Test(org.junit.Test)

Example 2 with UsbControllerModel

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

the class OsRepositoryImplTest method testExistingUsbControllerModelWithNonExistingVersion.

@Test
public void testExistingUsbControllerModelWithNonExistingVersion() {
    final UsbControllerModel model = OsRepositoryImpl.INSTANCE.getOsUsbControllerModel(OsRepositoryImpl.INSTANCE.getOsIdByUniqueName("rhel6"), Version.v4_1, ChipsetType.I440FX);
    assertEquals(UsbControllerModel.NEC_XHCI, model);
}
Also used : UsbControllerModel(org.ovirt.engine.core.common.businessentities.UsbControllerModel) Test(org.junit.Test)

Example 3 with UsbControllerModel

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

the class VmDeviceUtils method updateNormalUsb.

private void updateNormalUsb(VmBase vmBase, ChipsetType chipset) {
    final Collection<VmDevice> usbControllers = getUsbControllers(vmBase.getId());
    final List<VmDevice> unmanagedControllers = usbControllers.stream().filter(d -> !d.isManaged()).collect(Collectors.toList());
    final List<VmDevice> managedUsbControllers = usbControllers.stream().filter(VmDevice::isManaged).collect(Collectors.toList());
    if (unmanagedControllers.size() > 0) {
        acquireUnmanagedUsbController(vmBase, chipset, managedUsbControllers, unmanagedControllers);
        return;
    }
    final UsbControllerModel controllerModel = getUsbControllerModel(vmBase, chipset);
    if ((managedUsbControllers.isEmpty() && controllerModel == null) || (managedUsbControllers.size() == 1 && controllerModel != null && controllerModel.libvirtName.equals(getUsbControllerModelName(managedUsbControllers.get(0))))) {
        return;
    }
    disableNormalUsb(vmBase.getId());
    enableNormalUsb(vmBase, chipset);
}
Also used : UsbPolicy(org.ovirt.engine.core.common.businessentities.UsbPolicy) ClusterDao(org.ovirt.engine.core.dao.ClusterDao) StringUtils(org.apache.commons.lang.StringUtils) VmType(org.ovirt.engine.core.common.businessentities.VmType) VmDeviceUpdate(org.ovirt.engine.core.common.utils.VmDeviceUpdate) VmTemplateDao(org.ovirt.engine.core.dao.VmTemplateDao) OsRepository(org.ovirt.engine.core.common.osinfo.OsRepository) VmStaticDao(org.ovirt.engine.core.dao.VmStaticDao) ChipsetType(org.ovirt.engine.core.common.businessentities.ChipsetType) VmDeviceCommonUtils(org.ovirt.engine.core.common.utils.VmDeviceCommonUtils) Map(java.util.Map) MacPoolPerCluster(org.ovirt.engine.core.bll.network.macpool.MacPoolPerCluster) VmDevice(org.ovirt.engine.core.common.businessentities.VmDevice) VmDeviceDao(org.ovirt.engine.core.dao.VmDeviceDao) VmNic(org.ovirt.engine.core.common.businessentities.network.VmNic) Version(org.ovirt.engine.core.compat.Version) DisplayType(org.ovirt.engine.core.common.businessentities.DisplayType) BaseDisk(org.ovirt.engine.core.common.businessentities.storage.BaseDisk) VmHandler(org.ovirt.engine.core.bll.VmHandler) VmBase(org.ovirt.engine.core.common.businessentities.VmBase) Collection(java.util.Collection) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Set(java.util.Set) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) List(java.util.List) VmRngDevice(org.ovirt.engine.core.common.businessentities.VmRngDevice) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Optional(java.util.Optional) GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) FeatureSupported(org.ovirt.engine.core.common.FeatureSupported) VmDeviceId(org.ovirt.engine.core.common.businessentities.VmDeviceId) VmDeviceType(org.ovirt.engine.core.common.utils.VmDeviceType) ReadMacPool(org.ovirt.engine.core.bll.network.macpool.ReadMacPool) Guid(org.ovirt.engine.core.compat.Guid) UsbControllerModel(org.ovirt.engine.core.common.businessentities.UsbControllerModel) HashMap(java.util.HashMap) Function(java.util.function.Function) Supplier(java.util.function.Supplier) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) ArrayList(java.util.ArrayList) VmDeviceGeneralType(org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType) HashSet(java.util.HashSet) Inject(javax.inject.Inject) VdsProperties(org.ovirt.engine.core.vdsbroker.vdsbroker.VdsProperties) VmStatic(org.ovirt.engine.core.common.businessentities.VmStatic) Config(org.ovirt.engine.core.common.config.Config) CompatibilityVersionUtils(org.ovirt.engine.core.common.utils.CompatibilityVersionUtils) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) VM(org.ovirt.engine.core.common.businessentities.VM) ConsoleTargetType(org.ovirt.engine.core.common.businessentities.ConsoleTargetType) VirtIoRngValidator(org.ovirt.engine.core.bll.validator.VirtIoRngValidator) VmManagementParametersBase(org.ovirt.engine.core.common.action.VmManagementParametersBase) Collections(java.util.Collections) VmInterfaceManager(org.ovirt.engine.core.bll.network.VmInterfaceManager) VmDevice(org.ovirt.engine.core.common.businessentities.VmDevice) UsbControllerModel(org.ovirt.engine.core.common.businessentities.UsbControllerModel)

Example 4 with UsbControllerModel

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

the class OsRepositoryImplTest method testExistingUsbControllerModelWithoutVersion.

@Test
public void testExistingUsbControllerModelWithoutVersion() {
    final UsbControllerModel model = OsRepositoryImpl.INSTANCE.getOsUsbControllerModel(OsRepositoryImpl.INSTANCE.getOsIdByUniqueName("rhel7"), null, ChipsetType.I440FX);
    assertEquals(UsbControllerModel.NEC_XHCI, model);
}
Also used : UsbControllerModel(org.ovirt.engine.core.common.businessentities.UsbControllerModel) Test(org.junit.Test)

Example 5 with UsbControllerModel

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

the class OsRepositoryImplTest method testExistingUsbControllerModelWithChipset.

@Test
public void testExistingUsbControllerModelWithChipset() {
    final UsbControllerModel model = OsRepositoryImpl.INSTANCE.getOsUsbControllerModel(OsRepositoryImpl.INSTANCE.getOsIdByUniqueName("rhel7"), null, ChipsetType.Q35);
    assertEquals(UsbControllerModel.QEMU_XHCI, model);
}
Also used : UsbControllerModel(org.ovirt.engine.core.common.businessentities.UsbControllerModel) Test(org.junit.Test)

Aggregations

UsbControllerModel (org.ovirt.engine.core.common.businessentities.UsbControllerModel)8 Test (org.junit.Test)5 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)2 VmDeviceId (org.ovirt.engine.core.common.businessentities.VmDeviceId)2 String.format (java.lang.String.format)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 Function (java.util.function.Function)1 Supplier (java.util.function.Supplier)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1 StringUtils (org.apache.commons.lang.StringUtils)1 VmHandler (org.ovirt.engine.core.bll.VmHandler)1