Michael Pasternak has posted comments on this change.

Change subject: core, restapi: add GetVmOvfConfigurationQuery
......................................................................


Patch Set 10: Code-Review-1

(6 comments)

....................................................
File 
backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
Line 665:       signatures: []
Line 666:     urlparams:
Line 667:       max: {context: matrix, type: 'xs:int', value: 'max results', 
required: false}
Line 668:     headers:
Line 669:           All-Content: {value: true|false, required: false}
the offset (amount of leading spaces) is wrong, should be as in other "headers" 
params
Line 670: - name: /api/vms/{vm:id}/snapshots/{snapshot:id}|rel=get
Line 671:   request:
Line 672:     body:
Line 673:       parameterType: null


Line 673:       parameterType: null
Line 674:       signatures: []
Line 675:     urlparams: {}
Line 676:     headers:
Line 677:           All-Content: {value: true|false, required: false}
the offset (amount of leading spaces) is wrong, should be as in other "headers" 
params
Line 678: - name: /api/vms/{vm:id}/snapshots/{snapshot:id}|rel=delete
Line 679:   request:
Line 680:     body:
Line 681:       parameterType: null


....................................................
File 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendCollectionResource.java
Line 254:     }
Line 255: 
Line 256:     protected R doPopulate(R model, Q entity) {
Line 257:         return model;
Line 258:     }
this is incorrect you should not override abstract method in abstract class 
unless you provide real functionality to the sub-classes, while this is not 
true for the AbstractBackendCollectionResource as it cannot provide extra 
content resolution for sub-classes by itself,

this why we force all sub-classes to implement it doPopulate()


....................................................
File 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendSnapshotsResource.java
Line 70:     protected Snapshots 
mapCollection(List<org.ovirt.engine.core.common.businessentities.Snapshot> 
entities) {
Line 71:         Snapshots snapshots = new Snapshots();
Line 72:         for (org.ovirt.engine.core.common.businessentities.Snapshot 
entity : entities) {
Line 73:             Snapshot snapshot = map(entity, null);
Line 74:             snapshot = addLinks(snapshot);
add links should be the last in chain as you may add inner resources that need 
href to be created
Line 75:             snapshot = addVmConfiguration(entity, snapshot);
Line 76:             snapshot = populate(snapshot, entity);
Line 77:             snapshots.getSnapshots().add(snapshot);
Line 78:         }


Line 127:     }
Line 128: 
Line 129:     @Override
Line 130:     protected Snapshot doPopulate(Snapshot model, 
org.ovirt.engine.core.common.businessentities.Snapshot entity) {
Line 131:         if (isPopulate()) {
you never call doPopulate() directly, but AbstractBackendResource.populate(), 
and it triggers doPopulate(), so "isPopulate()" is redundant.

about  AbstractBackendCollectionResource.mapEntity(), it should call 
doPopulate() with extra content by-design (we avoid doing this in collections 
only cause it may become resource consuming task, while in context of single 
resource we provide all info), and all-content header in rsdl resource URI is 
for future use, i.e to disable it i.e all-content:false

but all this is not related to this context as you not using mapEntity() here
Line 132:             VdcQueryReturnValue queryReturnValue =
Line 133:                     
runQuery(VdcQueryType.GetVmOvfConfigurationBySnapshot,
Line 134:                             new 
IdQueryParameters(Guid.createGuidFromString(model.getId())));
Line 135: 


Line 135: 
Line 136:             if (queryReturnValue.getSucceeded() && 
queryReturnValue.getReturnValue() != null) {
Line 137:                 return 
SnapshotMapper.mapSnapshotConfiguration((String) 
queryReturnValue.getReturnValue(),
Line 138:                         ConfigurationType.OVF,
Line 139:                         model);
i would take it out to dedicated method as in future we may add more of these.
Line 140:             }
Line 141:         }
Line 142: 
Line 143:         return model;


-- 
To view, visit http://gerrit.ovirt.org/16176
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I46340c4461b57a4c314fb50ca9c19ac5fd08a451
Gerrit-PatchSet: 10
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liron Ar <lara...@redhat.com>
Gerrit-Reviewer: Alissa Bonas <abo...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Deepak C Shetty <deepa...@linux.vnet.ibm.com>
Gerrit-Reviewer: Liron Ar <lara...@redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipc...@redhat.com>
Gerrit-Reviewer: Michael Pasternak <mpast...@redhat.com>
Gerrit-Reviewer: Sergey Gotliv <sgot...@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

Reply via email to