use of org.ovirt.engine.api.model.Nic in project ovirt-engine by oVirt.
the class BackendVmNicsResourceTest method doTestBadAddNic.
private void doTestBadAddNic(boolean valid, boolean success, String detail) throws Exception {
setUriInfo(setUpActionExpectations(ActionType.AddVmInterface, AddVmInterfaceParameters.class, new String[] { "VmId" }, new Object[] { VM_ID }, valid, success));
Nic model = getModel(0);
try {
collection.add(model);
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
verifyFault(wae, detail);
}
}
use of org.ovirt.engine.api.model.Nic in project ovirt-engine by oVirt.
the class BackendInstanceTypeNicsResource method list.
public Nics list() {
Nics nics = new Nics();
List<VmNetworkInterface> entities = getBackendCollection(QueryType.GetTemplateInterfacesByTemplateId, new IdQueryParameters(instanceTypeId));
for (VmNetworkInterface entity : entities) {
Nic nic = populate(map(entity), entity);
nics.getNics().add(addLinks(nic));
}
return nics;
}
use of org.ovirt.engine.api.model.Nic in project ovirt-engine by oVirt.
the class V3VmNicsServer method add.
@POST
@Consumes({ "application/xml", "application/json" })
public Response add(V3NIC v3Nic) {
// Convert the NIC to the V4 format:
Nic v4Nic = adaptIn(v3Nic);
// Populate the VNIC profile (note that this can't be done in the adapter because in order to determine the
// candidate VNIC profiles we need to know the identifier of the VM, and that isn't possible in the adapter):
setVnicProfile(vmId, v3Nic, v4Nic);
// VNIC profile, as the V4 server will detect/report/handle the issue better than we can do here):
try {
return adaptResponse(getDelegate().add(v4Nic));
} catch (WebApplicationException exception) {
throw adaptException(exception);
}
}
Aggregations