Allon Mureinik has posted comments on this change. Change subject: core: Added validation on managed custom mount option ......................................................................
Patch Set 2: Code-Review-1 (3 comments) http://gerrit.ovirt.org/#/c/32372/2/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectStorageToVdsCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectStorageToVdsCommand.java: Line 109: Line 110: return true; Line 111: } Line 112: Line 113: private static final List<String> NFS_MANAGED_OPTIONS = Arrays.asList("timeout", "retrans", "vfs_type", "protocol_version", "nfsvers", "vers"); missing: minorversion, addr, clientaddr Line 114: private static final List<String> POSIX_MANAGED_OPTIONS = Arrays.asList("vfs_type"); Line 115: Line 116: private ValidationResult validateMountOptions() { Line 117: String mountOptions = getConnection().getMountOptions(); Line 110: return true; Line 111: } Line 112: Line 113: private static final List<String> NFS_MANAGED_OPTIONS = Arrays.asList("timeout", "retrans", "vfs_type", "protocol_version", "nfsvers", "vers"); Line 114: private static final List<String> POSIX_MANAGED_OPTIONS = Arrays.asList("vfs_type"); missing: addr, clientaddr Line 115: Line 116: private ValidationResult validateMountOptions() { Line 117: String mountOptions = getConnection().getMountOptions(); Line 118: if (StringUtils.isBlank(mountOptions)) { Line 124: Map<String, String> optionsMap = XmlRpcStringUtils.string2Map(mountOptions); Line 125: Set<String> optionsKeys = new HashSet<>(); Line 126: for (String optionName : optionsMap.keySet()) { Line 127: optionsKeys.add(optionName.toLowerCase()); Line 128: } Consider using a TreeSet with the String.CASE_INSENSITIVE_ORDER as the comparator - it'll save you this block of code. Line 129: Line 130: optionsKeys.retainAll(disallowedOptions); Line 131: if (!optionsKeys.isEmpty()) { Line 132: addCanDoActionMessageVariable("invalidOptions", StringUtils.join(optionsKeys, ", ")); -- To view, visit http://gerrit.ovirt.org/32372 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icc5a74379de55aa81194298be634f689efd331d5 Gerrit-PatchSet: 2 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Tal Nisan <tni...@redhat.com> Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches