Search in sources :

Example 6 with UsbControllerModel

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

the class OsRepositoryImplTest method testExistingUsbControllerModelWithVersion.

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

Example 7 with UsbControllerModel

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

the class VmDeviceUtils method enableNormalUsb.

private void enableNormalUsb(VmBase vmBase, ChipsetType chipset) {
    final UsbControllerModel controllerModel = getUsbControllerModel(vmBase, chipset);
    if (controllerModel == null) {
        return;
    }
    addManagedDevice(new VmDeviceId(Guid.newGuid(), vmBase.getId()), VmDeviceGeneralType.CONTROLLER, VmDeviceType.USB, createUsbControllerSpecParams(controllerModel.libvirtName, 0), true, false);
}
Also used : UsbControllerModel(org.ovirt.engine.core.common.businessentities.UsbControllerModel) VmDeviceId(org.ovirt.engine.core.common.businessentities.VmDeviceId)

Example 8 with UsbControllerModel

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

the class VmDeviceUtils method acquireUnmanagedUsbController.

/**
 * If there is an existing unmanaged usb controller, it drops all managed ones and acquires it.
 *
 * <p>This can be dropped together with support of USB controllers without specified model. Used till engine 3.6.
 * they may survive as part of long-running VMs and snapshots.</p>
 */
private void acquireUnmanagedUsbController(VmBase vmBase, ChipsetType chipset, List<VmDevice> managedUsbControllers, List<VmDevice> unmanagedControllers) {
    if (unmanagedControllers.size() > 1) {
        throw new IllegalStateException(format("At most one unmanaged USB controller expected for VM=%s(%s), found=%s", vmBase.getName(), vmBase.getId(), unmanagedControllers));
    }
    if (unmanagedControllers.isEmpty()) {
        return;
    }
    UsbControllerModel controllerModel = getUsbControllerModel(vmBase, chipset);
    // should not be here but due to https://bugzilla.redhat.com/1438188 can appear one
    // remove it
    removeVmDevices(managedUsbControllers);
    // has been created on pre 4.0 engine by VDSM, adopt it as ours
    VmDevice device = unmanagedControllers.iterator().next();
    device.setManaged(true);
    device.setPlugged(true);
    device.setReadOnly(false);
    device.setSpecParams(createUsbControllerSpecParams(controllerModel.libvirtName, 0));
    vmDeviceDao.update(device);
}
Also used : VmDevice(org.ovirt.engine.core.common.businessentities.VmDevice) UsbControllerModel(org.ovirt.engine.core.common.businessentities.UsbControllerModel)

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