Moti Asayag has posted comments on this change. Change subject: restapi,engine: Support network name in update nic ......................................................................
Patch Set 2: (7 comments) .................................................... File backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplateNicsResource.java Line 42: VmNetworkInterface nic = map(incoming, entity); Line 43: return new AddVmTemplateInterfaceParameters(parentId, Line 44: nic, Line 45: incoming.isSetNetwork() ? (incoming.getNetwork().isSetName() ? nic.getNetworkName() : "") : null, Line 46: incoming.isSetPortMirroring() ? nic.isPortMirroring() : false); i haven't performed any change that requires updating the rsdl_metadata.yaml. The api is already updated (the method which gets the network name and port mirroring was already declared as deprecated). Line 47: } Line 48: } Line 49: Line 50: @Override Line 52: VmNetworkInterface iface = setNetwork(nic, entity); Line 53: return new AddVmTemplateInterfaceParameters(parentId, Line 54: iface, Line 55: nic.isSetNetwork() ? iface.getNetworkName() : null, Line 56: nic.isSetPortMirroring() ? iface.isPortMirroring() : false); same as above. Line 57: } Line 58: Line 59: @Override Line 60: protected VdcActionParametersBase getRemoveParameters(String id) { Line 86: if (net != null) { Line 87: ni.setNetworkName(net.getName()); Line 88: } Line 89: } else { Line 90: ni.setNetworkName(""); We need an indication that the network was unset using the <network_name> property. If the parameter networkName is passed to the engine as null, there is no option for the engine to figure out which api was used (either vnicProfileId or networkName). Having "" for networkName indicates the user passes <network /> which stands for the network being unset, using the old api. Line 91: } Line 92: } Line 93: return ni; Line 94: } .................................................... File backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmNicsResource.java Line 56: VmNetworkInterface nic = map(incoming, entity); Line 57: return new AddVmInterfaceParameters(parentId, Line 58: nic, Line 59: incoming.isSetNetwork() ? (incoming.getNetwork().isSetName() ? nic.getNetworkName() : "") : null, Line 60: incoming.isSetPortMirroring() ? nic.isPortMirroring() : false); i haven't performed any change that requires updating the rsdl_metadata.yaml. The api is already updated (the method which gets the network name and port mirroring was already declared as deprecated). Line 61: } Line 62: } Line 63: Line 64: @Override Line 176: protected VdcActionParametersBase getAddParameters(VmNetworkInterface entity, NIC nic) { Line 177: return new AddVmInterfaceParameters(parentId, Line 178: setNetwork(nic, entity), Line 179: nic.isSetNetwork() ? entity.getNetworkName() : null, Line 180: nic.isSetPortMirroring() ? entity.isPortMirroring() : false); same Line 181: } Line 182: Line 183: @Override Line 184: protected VdcActionParametersBase getRemoveParameters(String id) { Line 207: if (net != null) { Line 208: ni.setNetworkName(net.getName()); Line 209: } Line 210: } else { Line 211: ni.setNetworkName(""); see the same explanation as in BackendTemplateNicsResource.java Line 212: } Line 213: } Line 214: return ni; Line 215: } .................................................... File backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/NicMapper.java Line 56: if (model.isSetVnicProfile()) { Line 57: if (model.getVnicProfile().isSetId()) { Line 58: entity.setVnicProfileId(GuidUtils.asGuid(model.getVnicProfile().getId())); Line 59: } else { Line 60: entity.setVnicProfileId(null); no, in case of update the previous vnic profile id value is passed here. We needed the ability to unset the vnic profile id (unlinking the nic from a network). This is done by providing <vnic_profile /> element in the request by the user. Line 61: } Line 62: } Line 63: Line 64: return entity; -- To view, visit http://gerrit.ovirt.org/19755 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1f5c96daf64f6e14cc76bfb12daf89618f656b3d Gerrit-PatchSet: 2 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Moti Asayag <masa...@redhat.com> Gerrit-Reviewer: Michael Pasternak <mpast...@redhat.com> Gerrit-Reviewer: Mike Kolesnik <mkole...@redhat.com> Gerrit-Reviewer: Moti Asayag <masa...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches