@@ -31,7 +31,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ProviderModel
31
31
{
32
32
public class IaasVmPsBackupProvider : IPsBackupProvider
33
33
{
34
- private const int defaultOperationStatusRetryTimeInMilliSec = 5 * 1000 ; // 10 sec
34
+ private const int defaultOperationStatusRetryTimeInMilliSec = 5 * 1000 ; // 5 sec
35
35
private const string separator = ";" ;
36
36
private const string computeAzureVMVersion = "Compute" ;
37
37
private const string classicComputeAzureVMVersion = "ClassicCompute" ;
@@ -713,15 +713,17 @@ private AzureIaaSVMProtectableItem GetAzureVMProtectableObject(string azureVMNam
713
713
if ( isDiscoveryNeed == true )
714
714
{
715
715
// Container is not discovered. Throw exception
716
- string errMsg = String . Format ( Resources . DiscoveryFailure , azureVMName , azureVMRGName , isComputeAzureVM ) ;
716
+ string vmversion = ( isComputeAzureVM ) ? computeAzureVMVersion : classicComputeAzureVMVersion ;
717
+ string errMsg = String . Format ( Resources . DiscoveryFailure , azureVMName , azureVMRGName , vmversion ) ;
717
718
Logger . Instance . WriteDebug ( errMsg ) ;
718
719
Logger . Instance . ThrowTerminatingError ( new ErrorRecord ( new Exception ( Resources . AzureVMNotFound ) , string . Empty , ErrorCategory . InvalidArgument , null ) ) ;
719
720
}
720
721
}
721
722
if ( protectableObject == null )
722
723
{
723
724
// Container is not discovered. Throw exception
724
- string errMsg = String . Format ( Resources . DiscoveryFailure , azureVMName , azureVMRGName , isComputeAzureVM ) ;
725
+ string vmversion = ( isComputeAzureVM ) ? computeAzureVMVersion : classicComputeAzureVMVersion ;
726
+ string errMsg = String . Format ( Resources . DiscoveryFailure , azureVMName , azureVMRGName , vmversion ) ;
725
727
Logger . Instance . WriteDebug ( errMsg ) ;
726
728
Logger . Instance . ThrowTerminatingError ( new ErrorRecord ( new Exception ( Resources . AzureVMNotFound ) , string . Empty , ErrorCategory . InvalidArgument , null ) ) ;
727
729
}
@@ -790,9 +792,8 @@ private void RefreshContainer()
790
792
}
791
793
}
792
794
793
- private bool WaitForDiscoveryToComplete ( string locationUri , out bool isDiscoverySuccessful , out string errorMessage )
795
+ private void WaitForDiscoveryToComplete ( string locationUri , out bool isDiscoverySuccessful , out string errorMessage )
794
796
{
795
- bool isRetryNeeded = false ;
796
797
var status = TrackRefreshContainerOperation ( locationUri ) ;
797
798
errorMessage = String . Empty ;
798
799
@@ -801,12 +802,9 @@ private bool WaitForDiscoveryToComplete(string locationUri, out bool isDiscovery
801
802
if ( status != HttpStatusCode . NoContent )
802
803
{
803
804
isDiscoverySuccessful = false ;
804
- errorMessage = String . Format ( Resources . DiscoveryFailureErrorMessage , status ) ;
805
- Logger . Instance . WriteDebug ( String . Format ( Resources . DiscoveryFailureErrorCode , status ) ) ;
806
- // No need to try as service is handling retryable errors
807
- isRetryNeeded = false ;
805
+ errorMessage = String . Format ( Resources . DiscoveryFailureErrorCode , status ) ;
806
+ Logger . Instance . WriteDebug ( errorMessage ) ;
808
807
}
809
- return isRetryNeeded ;
810
808
}
811
809
812
810
private HttpStatusCode TrackRefreshContainerOperation ( string operationResultLink , int checkFrequency = defaultOperationStatusRetryTimeInMilliSec )
0 commit comments