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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations