Search in sources :

Example 56 with Vm

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

the class BackendVmResource method update.

@Override
public Vm update(Vm incoming) {
    validateParameters(incoming);
    if (incoming.isSetCluster() && (incoming.getCluster().isSetId() || incoming.getCluster().isSetName())) {
        Guid clusterId = lookupClusterId(incoming);
        if (!clusterId.toString().equals(get().getCluster().getId())) {
            performAction(ActionType.ChangeVMCluster, // TODO: change 'null' to 'incoming.getVmCompa...' when REST support is added
            new ChangeVMClusterParameters(clusterId, guid, null));
        }
    }
    if (!isFiltered()) {
        if (incoming.isSetPlacementPolicy()) {
            parent.validateAndUpdateHostsInPlacementPolicy(incoming.getPlacementPolicy());
        }
    } else {
        incoming.setPlacementPolicy(null);
    }
    QueryType queryType = isNextRunRequested() ? QueryType.GetVmNextRunConfiguration : QueryType.GetVmByVmId;
    Vm vm = performUpdate(incoming, new QueryIdResolver<>(queryType, IdQueryParameters.class), ActionType.UpdateVm, new UpdateParametersProvider());
    if (vm != null) {
        DisplayHelper.adjustDisplayData(this, vm, false);
        removeRestrictedInfo(vm);
    }
    return vm;
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) Vm(org.ovirt.engine.api.model.Vm) ChangeVMClusterParameters(org.ovirt.engine.core.common.action.ChangeVMClusterParameters) Guid(org.ovirt.engine.core.compat.Guid) QueryType(org.ovirt.engine.core.common.queries.QueryType)

Example 57 with Vm

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

the class BackendVmWatchdogsResource method addParents.

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

Example 58 with Vm

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

the class BackendVmNicFilterParameterResource method addParents.

@Override
public NetworkFilterParameter addParents(NetworkFilterParameter parameter) {
    Vm vm = new Vm();
    vm.setId(vmId.toString());
    Nic nic = new Nic();
    nic.setId(nicId.toString());
    nic.setVm(vm);
    parameter.setNic(nic);
    return parameter;
}
Also used : Vm(org.ovirt.engine.api.model.Vm) Nic(org.ovirt.engine.api.model.Nic)

Example 59 with Vm

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

the class BackendVmNicResource method addParents.

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

Example 60 with Vm

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

the class BackendVmNicsResource method addParents.

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

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