public DriverTask createVolumeClone(List<VolumeClone> clones){
  LOG.info("Creating volume clone");
  DellSCDriverTask task=new DellSCDriverTask("createVolumeClone");
  StringBuilder errBuffer=new StringBuilder();
  int createCount=0;
  for (  VolumeClone clone : clones) {
    try {
      StorageCenterAPI api=connectionManager.getConnection(clone.getStorageSystemId());
      ScReplay replay=null;
      api.checkAndInitVolume(clone.getParentId());
      if (clone.getSourceType() == SourceType.SNAPSHOT) {
        replay=api.getReplay(clone.getParentId());
      }
 else {
        replay=api.createReplay(clone.getParentId(),5);
      }
      ScVolume scVol=api.createViewVolume(clone.getDisplayName(),replay.instanceId);
      clone.setProvisionedCapacity(SizeUtil.sizeStrToBytes(scVol.configuredSize));
      clone.setAllocatedCapacity(0L);
      clone.setWwn(scVol.deviceId);
      clone.setNativeId(scVol.instanceId);
      clone.setDeviceLabel(scVol.name);
      clone.setAccessStatus(AccessStatus.READ_WRITE);
      clone.setReplicationState(ReplicationState.SYNCHRONIZED);
      createCount++;
    }
 catch (    DellSCDriverException|StorageCenterAPIException dex) {
      String error=String.format("Error creating clone of volume %s: %s",clone.getParentId(),dex);
      errBuffer.append(String.format("%s%n",error));
    }
  }
  task.setMessage(errBuffer.toString());
  if (createCount == clones.size()) {
    task.setStatus(TaskStatus.READY);
  }
 else   if (createCount == 0) {
    task.setStatus(TaskStatus.FAILED);
  }
 else {
    task.setStatus(TaskStatus.PARTIALLY_FAILED);
  }
  return task;
}

public DriverTask createVolumeClone ( List < VolumeClone > clones ) { LOG . info ( "Creating volume clone" ) ; DellSCDriverTask task = new DellSCDriverTask ( "createVolumeClone" ) ; StringBuilder errBuffer = new StringBuilder ( ) ; int createCount = 0 ; for ( VolumeClone clone : clones ) { try { StorageCenterAPI api = connectionManager . getConnection ( clone . getStorageSystemId ( ) ) ; ScReplay replay = null ; api . checkAndInitVolume ( clone . getParentId ( ) ) ; if ( clone . getSourceType ( ) == SourceType . SNAPSHOT ) { replay = api . getReplay ( clone . getParentId ( ) ) ; } else { replay = api . createReplay ( clone . getParentId ( ) , 5 ) ; } ScVolume scVol = api . createViewVolume ( clone . getDisplayName ( ) , replay . instanceId ) ; clone . setProvisionedCapacity ( SizeUtil . sizeStrToBytes ( scVol . configuredSize ) ) ; clone . setAllocatedCapacity ( 0L ) ; clone . setWwn ( scVol . deviceId ) ; clone . setNativeId ( scVol . instanceId ) ; clone . setDeviceLabel ( scVol . name ) ; clone . setAccessStatus ( AccessStatus . READ_WRITE ) ; clone . setReplicationState ( ReplicationState . SYNCHRONIZED ) ; createCount ++ ; } catch ( DellSCDriverException | StorageCenterAPIException dex ) { String error = String . format ( "Error creating clone of volume %s: %s" , clone . getParentId ( ) , dex ) ; errBuffer . append ( String . format ( "%s%n" , error ) ) ; } } task . setMessage ( errBuffer . toString ( ) ) ; if ( createCount == clones . size ( ) ) { task . setStatus ( TaskStatus . READY ) ; } else if ( createCount == 0 ) { task . setStatus ( TaskStatus . FAILED ) ; } else { task . setStatus ( TaskStatus . PARTIALLY_FAILED ) ; } return task ; }
create a clone of a volume .
