use of org.ovirt.engine.api.model.VmPlacementPolicy in project ovirt-engine by oVirt.
the class BackendVmResourceTest method testUpdateVmPolicyHostsIds.
@Test
public void testUpdateVmPolicyHostsIds() throws Exception {
setUpUdpateVm();
setUriInfo(setUpActionExpectations(ActionType.UpdateVm, VmManagementParametersBase.class, new String[] {}, new Object[] {}, true, true));
Vm model = getModel(0);
model.setPlacementPolicy(new VmPlacementPolicy());
Hosts hosts = new Hosts();
for (int i = 0; i < GUIDS.length; i++) {
Host newHost = new Host();
newHost.setId(GUIDS[i].toString());
hosts.getHosts().add(newHost);
}
model.getPlacementPolicy().setHosts(hosts);
verifyModel(resource.update(model), 0);
}
use of org.ovirt.engine.api.model.VmPlacementPolicy 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));
}
Aggregations