Search in sources :

Example 51 with Vm

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

the class BackendVmCdromResource method addParents.

@Override
public Cdrom addParents(Cdrom entity) {
    Vm vm = new Vm();
    vm.setId(vmId.toString());
    entity.setVm(vm);
    return entity;
}
Also used : Vm(org.ovirt.engine.api.model.Vm)

Example 52 with Vm

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

the class BackendVmCdromsResource method addParents.

@Override
public Cdrom addParents(Cdrom entity) {
    Vm vm = new Vm();
    vm.setId(vmId.toString());
    entity.setVm(vm);
    return entity;
}
Also used : Vm(org.ovirt.engine.api.model.Vm)

Example 53 with Vm

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

the class BackendVmDisksResource method addLinks.

@Override
protected Disk addLinks(Disk model, String... subCollectionMembersToExclude) {
    Snapshot snapshotInfo = model.getSnapshot();
    model.setSnapshot(null);
    super.addLinks(model, subCollectionMembersToExclude);
    if (snapshotInfo != null) {
        org.ovirt.engine.core.common.businessentities.Snapshot snapshot = getEntity(org.ovirt.engine.core.common.businessentities.Snapshot.class, QueryType.GetSnapshotBySnapshotId, new IdQueryParameters(asGuid(snapshotInfo.getId())), snapshotInfo.getId());
        Vm vm = new Vm();
        vm.setId(snapshot.getVmId().toString());
        snapshotInfo.setVm(vm);
        model.setSnapshot(snapshotInfo);
        LinkHelper.addLinks(snapshotInfo, null, false);
        model.setSnapshot(snapshotInfo);
    }
    return model;
}
Also used : Snapshot(org.ovirt.engine.api.model.Snapshot) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) Vm(org.ovirt.engine.api.model.Vm)

Example 54 with Vm

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

the class BackendVmGraphicsConsolesResource method addParents.

@Override
protected GraphicsConsole addParents(GraphicsConsole model) {
    model.setVm(new Vm());
    model.getVm().setId(guid.toString());
    return model;
}
Also used : Vm(org.ovirt.engine.api.model.Vm)

Example 55 with Vm

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

the class BackendVmResource method createRunVmOnceParams.

private RunVmOnceParams createRunVmOnceParams(Vm vm, boolean volatileRun) {
    VM entity = getEntity(entityType, QueryType.GetVmByVmId, new IdQueryParameters(guid), id, true);
    RunVmOnceParams params = map(vm, map(map(entity, new Vm()), new RunVmOnceParams(guid)));
    if (vm.isSetPlacementPolicy()) {
        Set<Guid> hostsGuidsSet = parent.validateAndUpdateHostsInPlacementPolicy(vm.getPlacementPolicy());
        if (hostsGuidsSet.size() > 0) {
            // take the arbitrary first host for run destination
            params.setDestinationVdsId(hostsGuidsSet.iterator().next());
        }
    }
    if (vm.isSetInitialization()) {
        if (vm.getInitialization().isSetCloudInit()) {
            params.setInitializationType(InitializationType.CloudInit);
        }
        params.setVmInit(InitializationMapper.map(vm.getInitialization(), entity.getVmInit()));
    }
    params.setVolatileRun(volatileRun);
    return params;
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) RunVmOnceParams(org.ovirt.engine.core.common.action.RunVmOnceParams) VM(org.ovirt.engine.core.common.businessentities.VM) Vm(org.ovirt.engine.api.model.Vm) Guid(org.ovirt.engine.core.compat.Guid)

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