Search in sources :

Example 6 with VcpuPin

use of org.ovirt.engine.api.model.VcpuPin 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)

Aggregations

VcpuPin (org.ovirt.engine.api.model.VcpuPin)6 VcpuPins (org.ovirt.engine.api.model.VcpuPins)3 Test (org.junit.Test)2 CpuTune (org.ovirt.engine.api.model.CpuTune)2 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