@@ -805,12 +805,12 @@ public void copyAsync(DataObject srcData, DataObject dstData, AsyncCompletionCal
805805 private Answer createVolumeSnapshot (StorageSubSystemCommand cmd , Long size , SpConnectionDesc conn ,
806806 String volName , TemplateObjectTO dstTO ) {
807807 Answer answer ;
808- SpApiResponse resp2 = StorPoolUtil .volumeSnapshot (volName , dstTO .getUuid (), null , "template" , null , conn );
809- if (resp2 .getError () != null ) {
810- answer = new Answer (cmd , false , String .format ("Could not snapshot volume. Error: %s" , resp2 .getError ()));
808+ SpApiResponse resp = StorPoolUtil .volumeSnapshot (volName , dstTO .getUuid (), null , "template" , null , conn );
809+ if (resp .getError () != null ) {
810+ answer = new Answer (cmd , false , String .format ("Could not snapshot volume. Error: %s" , resp .getError ()));
811811 } else {
812812 dstTO .setPath (StorPoolUtil .devPath (
813- StorPoolUtil .getSnapshotNameFromResponse (resp2 , false , StorPoolUtil .GLOBAL_ID )));
813+ StorPoolUtil .getSnapshotNameFromResponse (resp , false , StorPoolUtil .GLOBAL_ID )));
814814 dstTO .setSize (size );
815815 answer = new CopyCmdAnswer (dstTO );
816816 }
@@ -824,16 +824,16 @@ private Answer createVolumeFromSnapshot(DataObject srcData, DataObject dstData,
824824 VolumeObjectTO dstTO = (VolumeObjectTO ) dstData .getTO ();
825825 dstTO .setSize (size );
826826 dstTO .setPath (StorPoolUtil .devPath (name ));
827- StorageSubSystemCommand cmd1 = new StorPoolDownloadTemplateCommand (srcData .getTO (), dstTO , StorPoolHelper .getTimeout (StorPoolHelper .PrimaryStorageDownloadWait , configDao ), VirtualMachineManager .ExecuteInSequence .value (), "volume" );
827+ StorageSubSystemCommand cmd = new StorPoolDownloadTemplateCommand (srcData .getTO (), dstTO , StorPoolHelper .getTimeout (StorPoolHelper .PrimaryStorageDownloadWait , configDao ), VirtualMachineManager .ExecuteInSequence .value (), "volume" );
828828
829829 EndPoint ep = selector .select (srcData , dstData );
830830 if (ep == null ) {
831- answer = new Answer (cmd1 , false , "\" No remote endpoint to send command, check if host or ssvm is down?\" " );
831+ answer = new Answer (cmd , false , "\" No remote endpoint to send command, check if host or ssvm is down?\" " );
832832 } else {
833- answer = ep .sendMessage (cmd1 );
833+ answer = ep .sendMessage (cmd );
834834 }
835835 if (answer == null || !answer .getResult ()) {
836- answer = new Answer (cmd1 , false , answer != null ? answer .getDetails () : "Unknown error while downloading template. Null answer returned." );
836+ answer = new Answer (cmd , false , answer != null ? answer .getDetails () : "Unknown error while downloading template. Null answer returned." );
837837 }
838838 return answer ;
839839 }
0 commit comments