Search in sources :

Example 1 with CpuTune

use of org.ovirt.engine.api.model.CpuTune in project ovirt-engine by oVirt.

the class VmMapper method stringToCpuTune.

/**
 * Maps the stringified CPU-pinning to the API format.
 */
static CpuTune stringToCpuTune(String cpuPinning) {
    if (cpuPinning == null || cpuPinning.equals("")) {
        return null;
    }
    final CpuTune cpuTune = new CpuTune();
    VcpuPins pins = new VcpuPins();
    for (String strCpu : cpuPinning.split("_")) {
        VcpuPin pin = stringToVCpupin(strCpu);
        pins.getVcpuPins().add(pin);
    }
    cpuTune.setVcpuPins(pins);
    return cpuTune;
}
Also used : VcpuPins(org.ovirt.engine.api.model.VcpuPins) CpuTune(org.ovirt.engine.api.model.CpuTune) VcpuPin(org.ovirt.engine.api.model.VcpuPin)

Example 2 with CpuTune

use of org.ovirt.engine.api.model.CpuTune in project ovirt-engine by oVirt.

the class V3CpuTuneInAdapter method adapt.

@Override
public CpuTune adapt(V3CpuTune from) {
    CpuTune to = new CpuTune();
    if (from.isSetVCpuPin()) {
        to.setVcpuPins(new VcpuPins());
        to.getVcpuPins().getVcpuPins().addAll(adaptIn(from.getVCpuPin()));
    }
    return to;
}
Also used : VcpuPins(org.ovirt.engine.api.model.VcpuPins) V3CpuTune(org.ovirt.engine.api.v3.types.V3CpuTune) CpuTune(org.ovirt.engine.api.model.CpuTune)

Example 3 with CpuTune

use of org.ovirt.engine.api.model.CpuTune in project ovirt-engine by oVirt.

the class VmMapperTest method postPopulate.

@Override
protected Vm postPopulate(Vm from) {
    from.setType(MappingTestHelper.shuffle(VmType.class));
    from.setStorageErrorResumeBehaviour(MappingTestHelper.shuffle(VmStorageErrorResumeBehaviour.class));
    from.setOrigin(OriginType.VMWARE.name().toLowerCase());
    from.getDisplay().setType(MappingTestHelper.shuffle(DisplayType.class));
    from.getPayloads().getPayloads().get(0).setType(MappingTestHelper.shuffle(VmDeviceType.class));
    List<BootDevice> devices = from.getOs().getBoot().getDevices().getDevices();
    for (int i = 0; i < devices.size(); i++) {
        devices.set(i, MappingTestHelper.shuffle(BootDevice.class));
    }
    while (from.getCpu().getTopology().getSockets() == 0) {
        from.getCpu().getTopology().setSockets(MappingTestHelper.rand(100));
    }
    while (from.getCpu().getTopology().getCores() == 0) {
        from.getCpu().getTopology().setCores(MappingTestHelper.rand(100));
    }
    CpuTune cpuTune = new CpuTune();
    VcpuPin pin = new VcpuPin();
    pin.setVcpu(33);
    pin.setCpuSet("1-4,6");
    VcpuPins pins = new VcpuPins();
    pins.getVcpuPins().add(pin);
    cpuTune.setVcpuPins(pins);
    from.getCpu().setCpuTune(cpuTune);
    from.setTimeZone(new TimeZone());
    from.getTimeZone().setName("Australia/Darwin");
    // VmPlacement - multiple hosts
    from.setPlacementPolicy(createPlacementPolicy(Guid.EVERYONE, Guid.SYSTEM));
    // Guest Nics configurations
    for (NicConfiguration guestNic : from.getInitialization().getNicConfigurations().getNicConfigurations()) {
        guestNic.setBootProtocol(MappingTestHelper.shuffle(BootProtocol.class, BootProtocol.AUTOCONF));
    }
    from.getDisplay().setType(DisplayType.SPICE);
    from.getSerialNumber().setPolicy(SerialNumberPolicy.CUSTOM);
    from.getDisplay().setFileTransferEnabled(true);
    from.getDisplay().setCopyPasteEnabled(true);
    from.getMigration().setAutoConverge(InheritableBoolean.TRUE);
    from.getMigration().setCompressed(InheritableBoolean.TRUE);
    from.getDisplay().setDisconnectAction(DisplayDisconnectAction.LOCK_SCREEN.toString());
    return from;
}
Also used : DisplayType(org.ovirt.engine.api.model.DisplayType) VmDeviceType(org.ovirt.engine.api.model.VmDeviceType) BootDevice(org.ovirt.engine.api.model.BootDevice) NicConfiguration(org.ovirt.engine.api.model.NicConfiguration) VmStorageErrorResumeBehaviour(org.ovirt.engine.api.model.VmStorageErrorResumeBehaviour) VcpuPin(org.ovirt.engine.api.model.VcpuPin) TimeZone(org.ovirt.engine.api.model.TimeZone) VcpuPins(org.ovirt.engine.api.model.VcpuPins) CpuTune(org.ovirt.engine.api.model.CpuTune) VmType(org.ovirt.engine.api.model.VmType) BootProtocol(org.ovirt.engine.api.model.BootProtocol)

Example 4 with CpuTune

use of org.ovirt.engine.api.model.CpuTune in project ovirt-engine by oVirt.

the class VmMapperTest method stringToCpuTune.

@Test
public void stringToCpuTune() {
    CpuTune cpuTune = VmMapper.stringToCpuTune("0#0");
    assertNotNull(cpuTune);
    assertNotNull(cpuTune.getVcpuPins());
    assertEquals(1, cpuTune.getVcpuPins().getVcpuPins().size());
    assertEquals(0, (int) cpuTune.getVcpuPins().getVcpuPins().get(0).getVcpu());
    assertEquals("0", cpuTune.getVcpuPins().getVcpuPins().get(0).getCpuSet());
}
Also used : CpuTune(org.ovirt.engine.api.model.CpuTune) Test(org.junit.Test)

Aggregations

CpuTune (org.ovirt.engine.api.model.CpuTune)4 VcpuPins (org.ovirt.engine.api.model.VcpuPins)3 VcpuPin (org.ovirt.engine.api.model.VcpuPin)2 Test (org.junit.Test)1 BootDevice (org.ovirt.engine.api.model.BootDevice)1 BootProtocol (org.ovirt.engine.api.model.BootProtocol)1 DisplayType (org.ovirt.engine.api.model.DisplayType)1 NicConfiguration (org.ovirt.engine.api.model.NicConfiguration)1 TimeZone (org.ovirt.engine.api.model.TimeZone)1 VmDeviceType (org.ovirt.engine.api.model.VmDeviceType)1 VmStorageErrorResumeBehaviour (org.ovirt.engine.api.model.VmStorageErrorResumeBehaviour)1 VmType (org.ovirt.engine.api.model.VmType)1 V3CpuTune (org.ovirt.engine.api.v3.types.V3CpuTune)1