Martin Peřina has posted comments on this change.

Change subject: core: Use VdsValidator in canDoAction of ActivateVds
......................................................................


Patch Set 1: (5 inline comments)

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsValidator.java
Line 19:      * @param vds
Line 20:      *            specified VDS
Line 21:      */
Line 22:     public VdsValidator(VDS vds) {
Line 23:         this.vds = vds;
Isn't it better to have not null validation on 1 place instead of checking it 
in each method?
Line 24:     }
Line 25: 
Line 26:     /**
Line 27:      * Determines if the VDS status is legal for execute fencing on 
host (either SSH Soft Fencing or real one)


Line 28:      *
Line 29:      * @return {@code true}, if fencing should be executed, otherwise 
{@code false}
Line 30:      */
Line 31:     public boolean shouldVdsBeFenced() {
Line 32:         boolean result = false;
If you want to remove not null validation from constructor, it should be added 
here
Line 33: 
Line 34:         switch (vds.getStatus()) {
Line 35:         case Down:
Line 36:         case InstallFailed:


Line 47:         return result;
Line 48:     }
Line 49: 
Line 50:     public ValidationResult exist() {
Line 51:         if (vds == null) {
Maybe exists() would be better name ...
Line 52:             return new 
ValidationResult(VdcBllMessages.VDS_DOES_NOT_EXIST);
Line 53:         }
Line 54:         return ValidationResult.VALID;
Line 55:     }


Line 53:         }
Line 54:         return ValidationResult.VALID;
Line 55:     }
Line 56: 
Line 57:     public ValidationResult validStatusForActivation() {
Maybe validateStatusForActivation() would be a better name ...
Line 58:         if (vds.getStatus().equals(VDSStatus.Up)) {
Line 59:             return new ValidationResult(VdcBllMessages.VDS_ALREADY_UP);
Line 60:         }
Line 61:         return ValidationResult.VALID;


Line 54:         return ValidationResult.VALID;
Line 55:     }
Line 56: 
Line 57:     public ValidationResult validStatusForActivation() {
Line 58:         if (vds.getStatus().equals(VDSStatus.Up)) {
If you want to remove not null validation from constructor, it should be added 
here
Line 59:             return new ValidationResult(VdcBllMessages.VDS_ALREADY_UP);
Line 60:         }
Line 61:         return ValidationResult.VALID;
Line 62:     }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie9a887de27757cd8ff89c8d68eb916be68d327fd
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: Martin Peřina <[email protected]>
Gerrit-Reviewer: Ravi Nori <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[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