Shubhendu Tripathi has posted comments on this change.

Change subject: restapi: REST apis for SWIFT maintenance
......................................................................


Patch Set 8: (17 inline comments)

Review comments incoporated

....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/GlusterServiceActionType.java
Line 2: 
Line 3: public enum GlusterServiceActionType {
Line 4:     start,
Line 5:     stop,
Line 6:     restart;
Will do the changes accordingly
Line 7: 
Line 8:     public int getValue() {
Line 9:         return this.ordinal();
Line 10:     }


Line 5:     stop,
Line 6:     restart;
Line 7: 
Line 8:     public int getValue() {
Line 9:         return this.ordinal();
Will change the method and use the same when required
Line 10:     }
Line 11: 
Line 12:     public static GlusterServiceActionType valueOf(int value) {
Line 13:         return values()[value];


....................................................
File 
backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
Line 1345:           <xs:element name="os" type="OperatingSystem" minOccurs="0" 
maxOccurs="1"/>
Line 1346:           <xs:element ref="hooks" minOccurs="0"/>
Line 1347:           <xs:element name="libvirt_version" type="Version" 
minOccurs="0" maxOccurs="1"/>
Line 1348: <!--           Optionally  specify the display address of this host 
explicitly -->
Line 1349:           <xs:element ref="services" minOccurs="0"/>
This is added at "host" level to show list of services and not at 
"ActionTesponseGroup" level
Line 1350:           <xs:element ref="display" minOccurs="0"/>
Line 1351:         </xs:sequence>
Line 1352:       </xs:extension>
Line 1353:     </xs:complexContent>


Line 1753:     <xs:complexContent>
Line 1754:       <xs:extension base="BaseResource">
Line 1755:         <xs:sequence>
Line 1756:           <xs:element ref="host" minOccurs="0" />
Line 1757:           <xs:element name="status" type="xs:string" minOccurs="0" />
Will do the changes
Line 1758:           <xs:element name="service_type" type="xs:string" 
minOccurs="0" />
Line 1759:         </xs:sequence>
Line 1760:       </xs:extension>
Line 1761:     </xs:complexContent>


....................................................
File 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendServiceResource.java
Line 25:     }
Line 26: 
Line 27:     @Override
Line 28:     protected Service addParents(Service model) {
Line 29:         model.setId(id);
Will do the changes and test the scenarios
Line 30:         parent.addParents(model);
Line 31:         return model;
Line 32:     }
Line 33: 


Line 32:     }
Line 33: 
Line 34:     @Override
Line 35:     public Service get() {
Line 36:         Services serviceRes = getParent().list();
Dedicated queries are there for getting list of services for a given serverId 
or clusterId. There is not dedicated query for getting an individual service by 
serviceId. Kindly suggest if we need to add one for the same.
Line 37:         if (serviceRes != null) {
Line 38:             for (Service srvc : serviceRes.getServices()) {
Line 39:                 if (srvc.getId().equals(id)) {
Line 40:                     return srvc;


....................................................
File 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendServicesResource.java
Line 42:     }
Line 43: 
Line 44:     public BackendServicesResource(BackendHostResource parent, String 
serverId) {
Line 45:         this(serverId);
Line 46:         this.serverId = serverId;
Will try removing the same
Line 47:         setParent(parent);
Line 48:     }
Line 49: 
Line 50:     public BackendHostResource getParent() {


Line 88:         return model;
Line 89:     }
Line 90: 
Line 91:     private void validateParameters(Action action) {
Line 92:         String srvcTypeParam = action.getServiceType();
No specific reason to have the local variable. Will remove it.
Line 93:         validateParameters(action, "serviceType");
Line 94:         validateEnum(ServiceType.class, srvcTypeParam);
Line 95:     }
Line 96: 


Line 104:     @Override
Line 105:     @POST
Line 106:     @Consumes({ "application/xml", "application/json", 
"application/x-yaml" })
Line 107:     @Actionable
Line 108:     @Path("start")
Will remove them
Line 109:     public Response start(Action action) {
Line 110:         validateParameters(action);
Line 111:         return performServiceAction(action, 
GlusterServiceActionType.start);
Line 112:     }


Line 106:     @Consumes({ "application/xml", "application/json", 
"application/x-yaml" })
Line 107:     @Actionable
Line 108:     @Path("start")
Line 109:     public Response start(Action action) {
Line 110:         validateParameters(action);
Only service_type is mandatory parameter and required validation is present.
Name of action anyway comes as part of URL so removed from rsdl file
Line 111:         return performServiceAction(action, 
GlusterServiceActionType.start);
Line 112:     }
Line 113: 
Line 114:     @Override


Line 114:     @Override
Line 115:     @POST
Line 116:     @Consumes({ "application/xml", "application/json", 
"application/x-yaml" })
Line 117:     @Actionable
Line 118:     @Path("stop")
Will remove them
Line 119:     public Response stop(Action action) {
Line 120:         validateParameters(action);
Line 121:         return performServiceAction(action, 
GlusterServiceActionType.stop);
Line 122:     }


Line 116:     @Consumes({ "application/xml", "application/json", 
"application/x-yaml" })
Line 117:     @Actionable
Line 118:     @Path("stop")
Line 119:     public Response stop(Action action) {
Line 120:         validateParameters(action);
Only service_type is mandatory parameter and required validation is present.
Name of action anyway comes as part of URL so removed from rsdl file
Line 121:         return performServiceAction(action, 
GlusterServiceActionType.stop);
Line 122:     }
Line 123: 
Line 124:     @Override


Line 124:     @Override
Line 125:     @POST
Line 126:     @Consumes({ "application/xml", "application/json", 
"application/x-yaml" })
Line 127:     @Actionable
Line 128:     @Path("restart")
Will remove them
Line 129:     public Response restart(Action action) {
Line 130:         validateParameters(action);
Line 131:         return performServiceAction(action, 
GlusterServiceActionType.restart);
Line 132:     }


Line 126:     @Consumes({ "application/xml", "application/json", 
"application/x-yaml" })
Line 127:     @Actionable
Line 128:     @Path("restart")
Line 129:     public Response restart(Action action) {
Line 130:         validateParameters(action);
Only service_type is mandatory parameter and required validation is present.
Name of action anyway comes as part of URL so removed from rsdl file
Line 131:         return performServiceAction(action, 
GlusterServiceActionType.restart);
Line 132:     }
Line 133: 
Line 134:     @Override


....................................................
File 
backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ServiceMapper.java
Line 23:             service.setName(fromService.getServiceName());
Line 24:         }
Line 25: 
Line 26:         if(fromService.getStatus() != null) {
Line 27:             service.setStatus(fromService.getStatus().name());
Will introduce a new public enum for the same
Line 28:         }
Line 29: 
Line 30:         if(fromService.getServiceType() != null) {
Line 31:             
service.setServiceType(fromService.getServiceType().name());


Line 27:             service.setStatus(fromService.getStatus().name());
Line 28:         }
Line 29: 
Line 30:         if(fromService.getServiceType() != null) {
Line 31:             
service.setServiceType(fromService.getServiceType().name());
Will introduce a new public enum for the same
Line 32:         }
Line 33: 
Line 34:         return service;
Line 35:     }


....................................................
Commit Message
Line 18:  - api/hosts/{id}/services/stop
Line 19:    stops all the services in the said host for a given type
Line 20:  - api/hosts/{id}/services/restart
Line 21:    re-starts all the services in the said host for a given type
Line 22: 
1. Added
2. Done
Line 23: Change-Id: I87cb354e10fed21cbd18b874595b726d3ac018a6


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I87cb354e10fed21cbd18b874595b726d3ac018a6
Gerrit-PatchSet: 8
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shubhendu Tripathi <[email protected]>
Gerrit-Reviewer: Kanagaraj M <[email protected]>
Gerrit-Reviewer: Michael Pasternak <[email protected]>
Gerrit-Reviewer: Sahina Bose <[email protected]>
Gerrit-Reviewer: Shubhendu Tripathi <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to