Shubhendu Tripathi has posted comments on this change.
Change subject: gluster: bll command to start/stop/restart service
......................................................................
Patch Set 3: (11 inline comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ManageGlusterServiceCommand.java
Line 35:
Line 36: protected Guid clusterId;
Line 37: protected Guid serverId;
Line 38: protected ServiceType serviceType;
Line 39: protected String actionType;
May not be required if equality is checked against the keyset of below map
Line 40: protected List<String> errors = new ArrayList<String>();
Line 41:
Line 42: public static final String
MANAGE_GLUSTER_SERVICE_ACTION_TYPE_START = "start";
Line 43: public static final String MANAGE_GLUSTER_SERVICE_ACTION_TYPE_STOP
= "stop";
Line 84:
Line 85: if
(!actionType.equalsIgnoreCase(ManageGlusterServiceCommand.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_START)
||
Line 86:
!actionType.equalsIgnoreCase(ManageGlusterServiceCommand.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_STOP))
{
Line 87: return
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_ACTION_TYPE);
Line 88: }
Yes, will change the code accordingly
Line 89:
Line 90: if (Guid.isNullOrEmpty(clusterId) &&
Guid.isNullOrEmpty(serverId)) {
Line 91: return
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTERID_AND_SERVERID_BOTH_NULL);
Line 92: }
Line 87: return
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_ACTION_TYPE);
Line 88: }
Line 89:
Line 90: if (Guid.isNullOrEmpty(clusterId) &&
Guid.isNullOrEmpty(serverId)) {
Line 91: return
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTERID_AND_SERVERID_BOTH_NULL);
Will add the check
Line 92: }
Line 93:
Line 94: return true;
Line 95: }
Line 99: if (!(Guid.isNullOrEmpty(clusterId))) {
Line 100: performActionForServicesOfCluster();
Line 101: } else if (!(Guid.isNullOrEmpty(serverId))) {
Line 102: performActionForServicesOfServer();
Line 103: }
Will change the order
Line 104: }
Line 105:
Line 106: private void performActionForServicesOfCluster() {
Line 107: List<VDS> servers =
getClusterUtils().getAllUpServers(clusterId);
Line 153: for (GlusterServerService service : serviceList) {
Line 154: if
(service.getServerId().equals(pairResult.getFirst().getId())
Line 155: && pairResult.getFirst().getStatus() !=
VDSStatus.Error) {
Line 156:
service.setStatus((actionType.equalsIgnoreCase(MANAGE_GLUSTER_SERVICE_ACTION_TYPE_START))
? GlusterServiceStatus.RUNNING
Line 157: : GlusterServiceStatus.STOPPED);
Yes, will change accordingly
Line 158: }
Line 159:
Line 160: getGlusterServerServiceDao().update(service);
Line 161: }
Line 247: */
Line 248: class ManageActionDetail {
Line 249: private VdcBllMessages canDoActionMsg;
Line 250: private GlusterServiceStatus status;
Line 251: private VdcBllMessages statusMsg;
Yes, will remove the references
Line 252: private VDSCommandType vdsCmdType;
Line 253: private AuditLogType actionPerformedActionLog;
Line 254: private AuditLogType actionFailedActionLog;
Line 255:
Line 248: class ManageActionDetail {
Line 249: private VdcBllMessages canDoActionMsg;
Line 250: private GlusterServiceStatus status;
Line 251: private VdcBllMessages statusMsg;
Line 252: private VDSCommandType vdsCmdType;
Yes, will remove the same.
Line 253: private AuditLogType actionPerformedActionLog;
Line 254: private AuditLogType actionFailedActionLog;
Line 255:
Line 256: public ManageActionDetail(VdcBllMessages canDoActionMsg,
....................................................
File
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/ManageGlusterServiceCommandTest.java
Line 131:
Line 132: params.setServiceType(ServiceType.SMB);
Line 133: cmd = spy(new ManageGlusterServiceCommand(params));
Line 134: assertFalse(cmd.canDoAction());
Line 135:
Yes, will do the required refactoring for the test cases
Line 136: params.setClusterId(null);
Line 137: params.setServerId(null);
Line 138: assertFalse(cmd.canDoAction());
Line 139: }
Line 157: cmd = spy(new ManageGlusterServiceCommand(new
GlusterServiceParameters(Guid.NewGuid(), Guid.NewGuid(), ServiceType.NFS,
"start")));
Line 158: setUpMockUpForStart();
Line 159: cmd.executeCommand();
Line 160: assertEquals(cmd.getAuditLogTypeValue(),
AuditLogType.GLUSTER_SERVICE_START_FAILED);
Line 161:
Yes, will do the refactoring of the test cases
Line 162: cmd = spy(new ManageGlusterServiceCommand(new
GlusterServiceParameters(Guid.NewGuid(), Guid.NewGuid(), ServiceType.NFS,
"stop")));
Line 163: setUpMockUpForStop();
Line 164: cmd.executeCommand();
Line 165: assertEquals(cmd.getAuditLogTypeValue(),
AuditLogType.GLUSTER_SERVICE_STOP_FAILED);
....................................................
File
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Enums.java
Line 340:
Line 341: String ServiceType___SHD();
Line 342:
Line 343: String GlusterServiceStatus___STARTED();
Line 344:
Will move the changes to LocalizedEnums with proper names
Line 345: String GlusterServiceStatus___STOPPED();
....................................................
File
frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/Enums.properties
Line 148: GlusterVolumeType___STRIPE=Stripe
Line 149: GlusterVolumeType___DISTRIBUTED_STRIPE=Distributed Stripe
Line 150: GlusterStatus___UP=Up
Line 151: GlusterStatus___DOWN=Down
Line 152: GlusterServiceStatus___STARTED=Service started
Will move the changes to LocalizedEnums
Line 153: GlusterServiceStatus___STOPPED=Service stopped
Line 154: TransportType___TCP=TCP
Line 155: TransportType___RDMA=RDMA
Line 156: ServiceType___NFS=NFS
--
To view, visit http://gerrit.ovirt.org/14831
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifcab38866c49c6f5d43e3b33006c428ec9304501
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shubhendu Tripathi <[email protected]>
Gerrit-Reviewer: Eli Mesika <[email protected]>
Gerrit-Reviewer: Kanagaraj M <[email protected]>
Gerrit-Reviewer: Michael Pasternak <[email protected]>
Gerrit-Reviewer: Omer Frenkel <[email protected]>
Gerrit-Reviewer: Sahina Bose <[email protected]>
Gerrit-Reviewer: Shubhendu Tripathi <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches