private void handleBlockVolumeErrors(DbClient dbClient) { for (VolumeDescriptor volumeDescriptor : VolumeDescriptor.getDescriptors(_volumeDescriptors, VolumeDescriptor.Type.BLOCK_DATA)) { Volume volume = dbClient.queryObject(Volume.class, volumeDescriptor.getVolumeURI()); if (volume != null && (volume.getNativeId() == null || volume.getNativeId().equals(""))) { _log.info("No native id was present on volume {}, marking inactive", volume.getLabel()); dbClient.markForDeletion(volume); } } }
private void handleVplexVolumeErrors(DbClient dbClient) { List<String> finalMessages = new ArrayList<String>(); for (VolumeDescriptor volumeDescriptor : VolumeDescriptor.getDescriptors( _volumeDescriptors, VolumeDescriptor.Type.VPLEX_VIRT_VOLUME)) { Volume volume = dbClient.queryObject(Volume.class, volumeDescriptor.getVolumeURI()); _log.info("Looking at VPLEX virtual volume {}", volume.getLabel()); boolean deactivateVirtualVolume = true; List<String> livingVolumeNames = new ArrayList<String>(); _log.info("Its associated volumes are: " + volume.getAssociatedVolumes()); for (String associatedVolumeUri : volume.getAssociatedVolumes()) { Volume associatedVolume = dbClient.queryObject(Volume.class, URI.create(associatedVolumeUri)); if (associatedVolume != null && !associatedVolume.getInactive()) { _log.warn( "VPLEX virtual volume {} has active associated volume {}", volume.getLabel(), associatedVolume.getLabel()); livingVolumeNames.add(associatedVolume.getLabel()); deactivateVirtualVolume = false; } } if (deactivateVirtualVolume) { _log.info( "VPLEX virtual volume {} has no active associated volumes, marking for deletion", volume.getLabel()); dbClient.markForDeletion(volume); } else { String message = "VPLEX virtual volume " + volume.getLabel() + " will not be marked for deletion " + "because it still has active associated volumes ("; message += Joiner.on(",").join(livingVolumeNames) + ")"; finalMessages.add(message); _log.warn(message); } } if (!finalMessages.isEmpty()) { String finalMessage = Joiner.on("; ").join(finalMessages) + "."; _log.error(finalMessage); } }