Daniel Erez has posted comments on this change.

Change subject: core: added volume types existence validation
......................................................................


Patch Set 1:

(4 comments)

https://gerrit.ovirt.org/#/c/41967/1/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/storage/CinderDisksValidator.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/storage/CinderDisksValidator.java:

Line 92:                         // Specifying a volume type is not mandatory 
as Cinder can auto-select it.
Line 93:                         continue;
Line 94:                     }
Line 95:                     OpenStackVolumeProviderProxy proxy = 
diskProxyMap.get(disk.getId());
Line 96:                     List<CinderVolumeType> volumeTypes = 
proxy.getVolumeTypes();
> Sggestion: I would suggest to use CinderStorageRelatedDisksAndProxy private
on second thought, i'll just validate against a single disk
Line 97:                     boolean volumeTypeExists = 
CollectionUtils.exists(volumeTypes, new Predicate() {
Line 98:                         @Override
Line 99:                         public boolean evaluate(Object o) {
Line 100:                             return ((CinderVolumeType) 
o).getName().equals(disk.getCinderVolumeType());


Line 98:                         @Override
Line 99:                         public boolean evaluate(Object o) {
Line 100:                             return ((CinderVolumeType) 
o).getName().equals(disk.getCinderVolumeType());
Line 101:                         }
Line 102:                     });
> Not sure I got this predicate.
since I need to check equality against the name of the CinderVolumeType
Line 103: 
Line 104:                     if (!volumeTypeExists) {
Line 105:                         return new 
ValidationResult(VdcBllMessages.CINDER_VOLUME_TYPE_NOT_EXISTS,
Line 106:                                 String.format("$cinderVolumeType %s", 
disk.getCinderVolumeType()));


Line 103: 
Line 104:                     if (!volumeTypeExists) {
Line 105:                         return new 
ValidationResult(VdcBllMessages.CINDER_VOLUME_TYPE_NOT_EXISTS,
Line 106:                                 String.format("$cinderVolumeType %s", 
disk.getCinderVolumeType()));
Line 107:                     }
> the for loop here is not relevant since we already break it once an invalid
on second thought, i'll just validate against a single disk
Line 108:                 }
Line 109:                 return ValidationResult.VALID;
Line 110:             }
Line 111:         });


https://gerrit.ovirt.org/#/c/41967/1/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
File 
backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties:

Line 1417: ACTION_TYPE_FAILED_PROVIDER_NOT_SUPPORTED=Cannot ${action} ${type}. 
The current type ${providerType} is not supported.
Line 1418: ACTION_TYPE_FAILED_CINDER=Cannot ${action} ${type}. An error 
occurred on Cinder - '${cinderException}'.
Line 1419: CANNOT_ADD_CINDER_DISK_VOLUME_LIMIT_EXCEEDED=Cannot ${action} 
${type}. Maximum number of volumes allowed (${maxTotalVolumes}) exceeded - 
could not create Cinder disk ${diskAlias}.
Line 1420: CINDER_DISK_ALREADY_REGISTERED=Cannot ${action} ${type}. Cinder disk 
is already registered (${diskAlias}).
Line 1421: CINDER_VOLUME_TYPE_NOT_EXISTS=Cannot ${action} ${type}. Cinder 
volume type '${cinderVolumeType}' does not exist.
> Please mention also the disk alias
can't, since the disk doesn't exist yet at this point..
Line 1422: ERROR_CANNOT_DETACH_CINDER_PROVIDER_WITH_IMAGES=Cannot detach a non 
empty Cinder provider.\n\
Line 1423:         -Please remove all VMs / Templates / Disks and try again.
Line 1424: 
Line 1425: NO_HOST_PROVIDER_FOR_SYSTEM=The engine server is not associated with 
any host provider.


-- 
To view, visit https://gerrit.ovirt.org/41967
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I781ba3667f4f28db3ab79e2e31346154097ea664
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Daniel Erez <de...@redhat.com>
Gerrit-Reviewer: Daniel Erez <de...@redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Maor Lipchuk <mlipc...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to