Search in sources :

Example 1 with Vm

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

the class BackendAffinityLabelVmsResource method list.

@Override
public Vms list() {
    Vms vms = new Vms();
    List<Vm> list = vms.getVms();
    Label label = BackendAffinityLabelHelper.getLabel(this, labelId);
    label.getVms().stream().map(BackendAffinityLabelHelper::makeVmLink).forEach(list::add);
    return vms;
}
Also used : Vm(org.ovirt.engine.api.model.Vm) Label(org.ovirt.engine.core.common.businessentities.Label) Vms(org.ovirt.engine.api.model.Vms)

Example 2 with Vm

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

the class BackendVmKatelloErrataResource method addParents.

@Override
protected KatelloErratum addParents(KatelloErratum erratum) {
    Vm vm = new Vm();
    vm.setId(vmId);
    erratum.setVm(vm);
    return super.addParents(erratum);
}
Also used : Vm(org.ovirt.engine.api.model.Vm)

Example 3 with Vm

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

the class CompletenessAssertorTest method testMissingSubFieldAlternatives.

@Test
public void testMissingSubFieldAlternatives() throws Exception {
    Vm vm = new Vm();
    vm.setDescription("incomplete");
    vm.setHost(new Host());
    try {
        CompletenessAssertor.validateParameters(vm, "host.id|name");
        fail("expected WebApplicationException on incomplete model");
    } catch (WebApplicationException wae) {
        verifyIncompleteException(wae, "Vm", "host.id|name");
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) Vm(org.ovirt.engine.api.model.Vm) Host(org.ovirt.engine.api.model.Host) Test(org.junit.Test)

Example 4 with Vm

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

the class CompletenessAssertorTest method testCompleteSubFieldAlternatives.

@Test
public void testCompleteSubFieldAlternatives() throws Exception {
    Vm vm = new Vm();
    vm.setHost(new Host());
    vm.getHost().setName("zog");
    CompletenessAssertor.validateParameters(vm, "host.id|name");
}
Also used : Vm(org.ovirt.engine.api.model.Vm) Host(org.ovirt.engine.api.model.Host) Test(org.junit.Test)

Example 5 with Vm

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

the class CompletenessAssertorTest method testMissingSubField.

@Test
public void testMissingSubField() throws Exception {
    Vm vm = new Vm();
    vm.setDescription("incomplete");
    vm.setHost(new Host());
    try {
        CompletenessAssertor.validateParameters(vm, "host.id");
        fail("expected WebApplicationException on incomplete model");
    } catch (WebApplicationException wae) {
        verifyIncompleteException(wae, "Vm", "host.id");
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) Vm(org.ovirt.engine.api.model.Vm) Host(org.ovirt.engine.api.model.Host) Test(org.junit.Test)

Aggregations

Vm (org.ovirt.engine.api.model.Vm)145 Test (org.junit.Test)80 Response (javax.ws.rs.core.Response)26 Host (org.ovirt.engine.api.model.Host)21 WebApplicationException (javax.ws.rs.WebApplicationException)19 Guid (org.ovirt.engine.core.compat.Guid)15 Template (org.ovirt.engine.api.model.Template)11 Hosts (org.ovirt.engine.api.model.Hosts)10 Action (org.ovirt.engine.api.model.Action)9 VmPlacementPolicy (org.ovirt.engine.api.model.VmPlacementPolicy)9 Vms (org.ovirt.engine.api.model.Vms)8 RunVmOnceParams (org.ovirt.engine.core.common.action.RunVmOnceParams)8 VM (org.ovirt.engine.core.common.businessentities.VM)8 Disk (org.ovirt.engine.api.model.Disk)7 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)7 ArrayList (java.util.ArrayList)6 Nic (org.ovirt.engine.api.model.Nic)6 VmManagementParametersBase (org.ovirt.engine.core.common.action.VmManagementParametersBase)6 Configuration (org.ovirt.engine.api.model.Configuration)5 DiskAttachment (org.ovirt.engine.api.model.DiskAttachment)5