@@ -770,20 +770,16 @@ public boolean restoreBackupVolumeAndAttachToVM(final String backedUpVolumeUuid,
770770 String [] hostPossibleValues = {host .getPrivateIpAddress (), host .getName ()};
771771 String [] datastoresPossibleValues = {datastore .getUuid (), datastore .getName ()};
772772
773- updateVmState (vm , VirtualMachine .Event .RestoringRequested , VirtualMachine .State .Restoring );
774773 Pair <Boolean , String > result = restoreBackedUpVolume (backedUpVolumeUuid , backup , backupProvider , hostPossibleValues , datastoresPossibleValues );
775774
776775 if (BooleanUtils .isFalse (result .first ())) {
777- updateVmState (vm , VirtualMachine .Event .RestoringFailed , VirtualMachine .State .Stopped );
778776 throw new CloudRuntimeException (String .format ("Error restoring volume [%s] of VM [%s] to host [%s] using backup provider [%s] due to: [%s]." ,
779777 backedUpVolumeUuid , vm .getUuid (), host .getUuid (), backupProvider .getName (), result .second ()));
780778 }
781779 if (!attachVolumeToVM (vm .getDataCenterId (), result .second (), vmFromBackup .getBackupVolumeList (),
782780 backedUpVolumeUuid , vm , datastore .getUuid (), backup )) {
783- updateVmState (vm , VirtualMachine .Event .RestoringFailed , VirtualMachine .State .Stopped );
784781 throw new CloudRuntimeException (String .format ("Error attaching volume [%s] to VM [%s]." + backedUpVolumeUuid , vm .getUuid ()));
785782 }
786- updateVmState (vm , VirtualMachine .Event .RestoringSuccess , VirtualMachine .State .Stopped );
787783 return true ;
788784 }
789785
0 commit comments