use of org.ovirt.engine.api.model.Action in project ovirt-engine by oVirt.
the class BackendVmResourceTest method testStartWithBootMenu.
@Test
public void testStartWithBootMenu() throws Exception {
setUpWindowsGetEntityExpectations(1, false);
setUriInfo(setUpActionExpectations(ActionType.RunVmOnce, RunVmOnceParams.class, new String[] { "VmId", "BootMenuEnabled" }, new Object[] { GUIDS[0], true }));
Action action = new Action();
action.setVm(new Vm());
action.getVm().setBios(new Bios());
action.getVm().getBios().setBootMenu(new BootMenu());
action.getVm().getBios().getBootMenu().setEnabled(true);
verifyActionResponse(resource.start(action));
}
use of org.ovirt.engine.api.model.Action in project ovirt-engine by oVirt.
the class BackendVmResourceTest method testStartWithCdRomAndFloppy.
@Test
public void testStartWithCdRomAndFloppy() throws Exception {
setUpWindowsGetEntityExpectations(1, false);
setUriInfo(setUpActionExpectations(ActionType.RunVmOnce, RunVmOnceParams.class, new String[] { "VmId", "DiskPath", "FloppyPath" }, new Object[] { GUIDS[0], ISO_ID, FLOPPY_ID }));
Action action = new Action();
action.setVm(new Vm());
action.getVm().setCdroms(new Cdroms());
action.getVm().getCdroms().getCdroms().add(new Cdrom());
action.getVm().getCdroms().getCdroms().get(0).setFile(new File());
action.getVm().getCdroms().getCdroms().get(0).getFile().setId(ISO_ID);
action.getVm().setFloppies(new Floppies());
action.getVm().getFloppies().getFloppies().add(new Floppy());
action.getVm().getFloppies().getFloppies().get(0).setFile(new File());
action.getVm().getFloppies().getFloppies().get(0).getFile().setId(FLOPPY_ID);
verifyActionResponse(resource.start(action));
}
use of org.ovirt.engine.api.model.Action in project ovirt-engine by oVirt.
the class BackendVmResourceTest method testStartWithHost.
protected void testStartWithHost(Host host, Guid hostId) throws Exception {
setUpWindowsGetEntityExpectations(1, false);
setUriInfo(setUpActionExpectations(ActionType.RunVmOnce, RunVmOnceParams.class, new String[] { "VmId", "DestinationVdsId" }, new Object[] { GUIDS[0], hostId }));
Action action = new Action();
action.setVm(new Vm());
VmPlacementPolicy placementPolicy = new VmPlacementPolicy();
placementPolicy.setHosts(new Hosts());
placementPolicy.getHosts().getHosts().add(host);
action.getVm().setPlacementPolicy(placementPolicy);
verifyActionResponse(resource.start(action));
}
use of org.ovirt.engine.api.model.Action in project ovirt-engine by oVirt.
the class BackendVmResourceTest method testStartWithPauseAndStateless.
@Test
public void testStartWithPauseAndStateless() throws Exception {
setUpWindowsGetEntityExpectations(1, false);
setUriInfo(setUpActionExpectations(ActionType.RunVmOnce, RunVmOnceParams.class, new String[] { "VmId", "RunAndPause", "RunAsStateless" }, new Object[] { GUIDS[0], true, Boolean.TRUE }));
Action action = new Action();
action.setPause(true);
action.setVm(new Vm());
action.getVm().setStateless(true);
verifyActionResponse(resource.start(action));
}
use of org.ovirt.engine.api.model.Action in project ovirt-engine by oVirt.
the class ActionMapper method map.
@Mapping(from = List.class, to = Action.class)
public static Action map(List<AsyncTaskStatus> entity, Action template) {
Action model = template != null ? template : new Action();
CreationStatus asyncStatus = null;
for (AsyncTaskStatus task : entity) {
asyncStatus = AsyncTaskMapper.map(task, asyncStatus);
}
model.setStatus(asyncStatus.value());
if (asyncStatus == CreationStatus.FAILED) {
model.setFault(new Fault());
for (AsyncTaskStatus task : entity) {
if (task.getException() != null) {
model.getFault().setDetail(task.getException().toString());
break;
}
}
}
return model;
}
Aggregations