Search in sources :

Example 1 with InstanceTypesService

use of org.ovirt.engine.sdk4.services.InstanceTypesService in project ovirt-engine-sdk-java by oVirt.

the class AddInstanceType method main.

public static void main(String[] args) throws Exception {
    // Create the connection to the server:
    Connection connection = connection().url("https://engine40.example.com/ovirt-engine/api").user("admin@internal").password("redhat123").trustStoreFile("truststore.jks").build();
    // Get the reference to the instance types service:
    InstanceTypesService instanceTypesService = connection.systemService().instanceTypesService();
    // Add the instance type. Note that the size of the memory, the `memory`
    // attribute, is specified in bytes, so to create a instance type with
    // 2 GiB of memory the value should be 2 * 2^30.
    instanceTypesService.add().instanceType(instanceType().name("myinstancetype").description("My instance type").memory(BigInteger.valueOf(2).multiply(BigInteger.valueOf(2).pow(30))).highAvailability(highAvailability().enabled(true)).cpu(cpu().topology(cpuTopology().cores(2).sockets(2)))).send();
    // Close the connection to the server:
    connection.close();
}
Also used : Connection(org.ovirt.engine.sdk4.Connection) InstanceTypesService(org.ovirt.engine.sdk4.services.InstanceTypesService)

Aggregations

Connection (org.ovirt.engine.sdk4.Connection)1 InstanceTypesService (org.ovirt.engine.sdk4.services.InstanceTypesService)1