public static Volume rollbackVolume(URI volumeURI,DbClient dbClient){
  Volume volume=dbClient.queryObject(Volume.class,volumeURI);
  if (volume != null && !volume.getInactive()) {
    _log.info(String.format("Rollback volume [%s]...",volume.getLabel()));
    if (volume.getProvisionedCapacity() == null || volume.getProvisionedCapacity() == 0) {
      dbClient.markForDeletion(volume);
    }
 else {
      String rollbackLabel="-ROLLBACK-" + Math.random();
      volume.setLabel(volume.getLabel() + rollbackLabel);
      dbClient.updateObject(volume);
    }
    if (RPHelper.isVPlexVolume(volume,dbClient) && (null != volume.getAssociatedVolumes())) {
      for (      String associatedVolId : volume.getAssociatedVolumes()) {
        Volume associatedVolume=dbClient.queryObject(Volume.class,URI.create(associatedVolId));
        if (associatedVolume != null && !associatedVolume.getInactive()) {
          _log.info(String.format("Rollback volume [%s]...",associatedVolume.getLabel()));
          if (associatedVolume.getProvisionedCapacity() == null || associatedVolume.getProvisionedCapacity() == 0) {
            dbClient.markForDeletion(associatedVolume);
          }
 else {
            associatedVolume.setLabel(volume.getLabel() + "-ROLLBACK-" + Math.random());
            dbClient.updateObject(associatedVolume);
          }
        }
      }
    }
  }
  return volume;
}

public static Volume rollbackVolume ( URI volumeURI , DbClient dbClient ) { Volume volume = dbClient . queryObject ( Volume . class , volumeURI ) ; if ( volume != null && ! volume . getInactive ( ) ) { _log . info ( String . format ( "Rollback volume [%s]..." , volume . getLabel ( ) ) ) ; if ( volume . getProvisionedCapacity ( ) == null || volume . getProvisionedCapacity ( ) == 0 ) { dbClient . markForDeletion ( volume ) ; } else { String rollbackLabel = "-ROLLBACK-" + Math . random ( ) ; volume . setLabel ( volume . getLabel ( ) + rollbackLabel ) ; dbClient . updateObject ( volume ) ; } if ( RPHelper . isVPlexVolume ( volume , dbClient ) && ( null != volume . getAssociatedVolumes ( ) ) ) { for ( String associatedVolId : volume . getAssociatedVolumes ( ) ) { Volume associatedVolume = dbClient . queryObject ( Volume . class , URI . create ( associatedVolId ) ) ; if ( associatedVolume != null && ! associatedVolume . getInactive ( ) ) { _log . info ( String . format ( "Rollback volume [%s]..." , associatedVolume . getLabel ( ) ) ) ; if ( associatedVolume . getProvisionedCapacity ( ) == null || associatedVolume . getProvisionedCapacity ( ) == 0 ) { dbClient . markForDeletion ( associatedVolume ) ; } else { associatedVolume . setLabel ( volume . getLabel ( ) + "-ROLLBACK-" + Math . random ( ) ) ; dbClient . updateObject ( associatedVolume ) ; } } } } } return volume ; }
cassandra level rollback of a volume . we set the volume to inactive and rename the volume to indicate that rollback has occured . we do this so as to not prevent subsequent use of the same volume name in the case of rollback / error .
