static void fireUsageEvent(final Volume volume, final EventActionInfo<VolumeAction> actionInfo) { try { ListenerRegistry.getInstance() .fireEvent( VolumeEvent.with( actionInfo, volume.getNaturalId(), volume.getDisplayName(), volume.getSize(), volume.getOwner(), volume.getPartition())); } catch (final Throwable e) { LOG.error( "Error creating/inserting reporting event " + (actionInfo == null ? "null" : actionInfo.getAction().toString()) + " for volume " + (volume == null ? "null" : volume.getDisplayName()), e); } }
public static void annihilateStorageVolume(Volume volume) { volume.setState(State.ANNIHILATING); fireUsageEvent(volume, VolumeEvent.forVolumeDelete()); }