static void validateAll ( Map < String , String > targetProperties , String appName , String instanceName ) throws TargetException { // Basic checks validate ( targetProperties ) ; // Storage checks Set < String > mountPoints = new HashSet <> ( ) ; Set < String > volumeNames = new HashSet <> ( ) ; for ( String s : findStorageIds ( targetProperties ) ) { // Unit tests should guarantee there is a default value for the "mount point". String mountPoint = findStorageProperty ( targetProperties , s , VOLUME_MOUNT_POINT_PREFIX ) ; if ( mountPoints . contains ( mountPoint ) ) throw new TargetException ( "Mount point '" + mountPoint + "' is already used by another volume for this VM." ) ; mountPoints . add ( mountPoint ) ; // Same thing for the volume name String volumeName = findStorageProperty ( targetProperties , s , VOLUME_NAME_PREFIX ) ; volumeName = expandVolumeName ( volumeName , appName , instanceName ) ; if ( volumeNames . contains ( volumeName ) ) throw new TargetException ( "Volume name '" + volumeName + "' is already used by another volume for this VM." ) ; volumeNames . add ( volumeName ) ; // Validate volume size String volumesize = findStorageProperty ( targetProperties , s , VOLUME_SIZE_GB_PREFIX ) ; try { Integer . valueOf ( volumesize ) ; } catch ( NumberFormatException e ) { throw new TargetException ( "The volume size must be a valid integer." , e ) ; } } }
Validates the target properties including storage ones .