Shireesh Anjal has posted comments on this change.
Change subject: engine: Validation added in Import Cluster
......................................................................
Patch Set 4: (2 inline comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterServersForImportQuery.java
Line 87:
getQueryReturnValue().setExceptionString(VdcBllMessages.SERVER_ALREADY_EXISTS_IN_ANOTHER_CLUSTER.name());
Line 88: return;
Line 89: }
Line 90:
Line 91: private boolean areServersPartOfCluster(Set<String> serverNames) {
What you're really checking here is whether any of the given servers exist in
the system. So I don't think "areServersPartOfCluster" is an appropriate name.
How about just "validateServers"? Also, I think the exact name of the server
that already exists needs to be returned as part of the exception string.
Line 92: Iterator<String> it = serverNames.iterator();
Line 93: while (it.hasNext()) {
Line 94: if (getVdsStaticDao().getAllForHost(it.next()).size() > 0
Line 95: ||
getVdsStaticDao().getAllWithIpAddress(it.next()).size() > 0) {
Line 89: }
Line 90:
Line 91: private boolean areServersPartOfCluster(Set<String> serverNames) {
Line 92: Iterator<String> it = serverNames.iterator();
Line 93: while (it.hasNext()) {
Why not use the simpler syntax:
for(String server : serverNames) {
...
}
Line 94: if (getVdsStaticDao().getAllForHost(it.next()).size() > 0
Line 95: ||
getVdsStaticDao().getAllWithIpAddress(it.next()).size() > 0) {
Line 96: return true;
Line 97: }
--
To view, visit http://gerrit.ovirt.org/9784
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I8323f2dcc4f278dfbc01f99ebe18b0f2bd0296ca
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Dhandapani Gopal <[email protected]>
Gerrit-Reviewer: Dhandapani Gopal <[email protected]>
Gerrit-Reviewer: Kanagaraj M <[email protected]>
Gerrit-Reviewer: Omer Frenkel <[email protected]>
Gerrit-Reviewer: Shireesh Anjal <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches