Ori Liel has posted comments on this change.
Change subject: restapi: Allow copying template disks to another storage domain
#851099
......................................................................
Patch Set 1: (4 inline comments)
....................................................
File
backend/manager/modules/restapi/interface/common/jaxrs/src/main/java/org/ovirt/engine/api/common/util/LinkHelper.java
Line 194: map = new ParentToCollectionMap(DataCenterResource.class,
DataCentersResource.class);
Line 195: TYPES.put(DataCenter.class, map);
Line 196:
Line 197: map = new ParentToCollectionMap(TemplateDiskResource.class,
TemplateDisksResource.class, Template.class);
Line 198: TYPES.put(Disk.class, map);
The two lines above (197, 198) should be removed. The second line:
(198) TYPES.put(Disk.class, map);
is repeated five lines later:
(203) TYPES.put(Disk.class, map);
and the second call completely overrides the value for Disk.class in the map
(map behavior).
So what is done in lines 197, 198 as if never happened, and they can (and
should) be removed.
Line 199:
Line 200: map = new ParentToCollectionMap(DiskResource.class,
DisksResource.class);
Line 201: map.add(VmDiskResource.class, VmDisksResource.class,
VM.class);
Line 202: map.add(TemplateDiskResource.class,
TemplateDisksResource.class, Template.class);
....................................................
File
backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata_v-3.1.yaml
Line 2115: urlparams: {}
Line 2116: headers:
Line 2117: Content-Type: {value: application/xml|json, required: true}
Line 2118: Correlation-Id: {value: 'any string', required: false}
Line 2119: Filter: {value: true|false, required: false}
Need to add
api/templates/{template:id}/disks/{disk:id}|rel=get
Line 2120: - name: /api/templates/{template:id}/nics|rel=get
Line 2121: request:
Line 2122: body:
Line 2123: parameterType: null
....................................................
File
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendActionableResource.java
Line 162:
Line 163: protected Guid lookupStorageDomainIdByName(String name) {
Line 164: return getEntity(storage_domains.class,
SearchType.StorageDomain, "Storage: name=" + name).getId();
Line 165: }
Line 166: }
I don't think it's the right place for this code.
AbstractBackendActionableResource is for generic flows and utility methods that
deal with actions. If bits of code that serve specific actions were moved up
here just to prevent code duplication, it would quickly become a mess.
What I think we need to do is house such reusable methods in a utility object,
which will be referenced from AbstractBackendActionableResource.
....................................................
File
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendTemplateDiskResource.java
Line 16:
Line 17: protected BackendTemplateDisksResource collection;
Line 18:
Line 19: public BackendTemplateDiskResource(Class<Disk> modelType,
Line 20:
Class<org.ovirt.engine.core.common.businessentities.Disk> entityType,
No need to require model and entity types in the constructor, this is static
information which you know at compile time
Line 21: Guid guid,
Line 22: BackendTemplateDisksResource
collection,
Line 23: String... subCollections) {
Line 24: super(modelType, entityType, guid, collection, subCollections);
--
To view, visit http://gerrit.ovirt.org/8428
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic629b331e4753b24ef02612ff50cb6a4457cfd58
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Michael Pasternak <[email protected]>
Gerrit-Reviewer: Ori Liel <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches