@@ -86,7 +86,7 @@ public BaseRecoveryServicesJobResponse EnableProtection()
86
86
ValidateAzureVMWorkloadType ( item . WorkloadType , policy . WorkloadType ) ;
87
87
ValidateAzureVMModifyProtectionRequest ( itemBase , policy ) ;
88
88
89
- isComputeAzureVM = IsComputeAzureVM ( item . VirtualMachineId ) ;
89
+ isComputeAzureVM = IsComputeAzureVM ( item . VirtualMachineId ) ;
90
90
Dictionary < UriEnums , string > keyValueDict = HelperUtils . ParseUri ( item . Id ) ;
91
91
containerUri = HelperUtils . GetContainerUri ( keyValueDict , item . Id ) ;
92
92
protectedItemUri = HelperUtils . GetProtectedItemUri ( keyValueDict , item . Id ) ;
@@ -184,13 +184,13 @@ public BaseRecoveryServicesJobResponse TriggerBackup()
184
184
AzureRmRecoveryServicesItemBase item = ( AzureRmRecoveryServicesItemBase ) ProviderData . ProviderParameters [ ItemParams . Item ] ;
185
185
DateTime expiryDate = ( DateTime ) ProviderData . ProviderParameters [ ItemParams . ExpiryDate ] ;
186
186
AzureRmRecoveryServicesIaasVmItem iaasVmItem = item as AzureRmRecoveryServicesIaasVmItem ;
187
- return HydraAdapter . TriggerBackup ( IdUtils . GetValueByName ( iaasVmItem . Id , IdUtils . IdNames . ProtectionContainerName ) ,
187
+ return HydraAdapter . TriggerBackup ( IdUtils . GetValueByName ( iaasVmItem . Id , IdUtils . IdNames . ProtectionContainerName ) ,
188
188
IdUtils . GetValueByName ( iaasVmItem . Id , IdUtils . IdNames . ProtectedItemName ) ) ;
189
189
}
190
190
191
191
public BaseRecoveryServicesJobResponse TriggerRestore ( )
192
192
{
193
- AzureRmRecoveryServicesIaasVmRecoveryPoint rp = ProviderData . ProviderParameters [ RestoreBackupItemParams . RecoveryPoint ]
193
+ AzureRmRecoveryServicesIaasVmRecoveryPoint rp = ProviderData . ProviderParameters [ RestoreBackupItemParams . RecoveryPoint ]
194
194
as AzureRmRecoveryServicesIaasVmRecoveryPoint ;
195
195
string storageAccountId = ProviderData . ProviderParameters [ RestoreBackupItemParams . StorageAccountId ] . ToString ( ) ;
196
196
string storageAccountLocation = ProviderData . ProviderParameters [ RestoreBackupItemParams . StorageAccountLocation ] . ToString ( ) ;
@@ -274,7 +274,7 @@ public ProtectionPolicyResponse CreatePolicy()
274
274
CopyScheduleTimeToRetentionTimes ( ( AzureRmRecoveryServicesBackupLongTermRetentionPolicy ) retentionPolicy ,
275
275
( AzureRmRecoveryServicesBackupSimpleSchedulePolicy ) schedulePolicy ) ;
276
276
Logger . Instance . WriteDebug ( "Copy of RetentionTime from with SchedulePolicy to RetentionPolicy is successful" ) ;
277
-
277
+
278
278
// Now validate both RetentionPolicy and SchedulePolicy together
279
279
PolicyHelpers . ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy (
280
280
( AzureRmRecoveryServicesBackupLongTermRetentionPolicy ) retentionPolicy ,
@@ -369,7 +369,7 @@ public ProtectionPolicyResponse ModifyPolicy()
369
369
} ;
370
370
371
371
return HydraAdapter . CreateOrUpdateProtectionPolicy ( policy . Name ,
372
- hydraRequest ) ;
372
+ hydraRequest ) ;
373
373
}
374
374
375
375
public List < AzureRmRecoveryServicesContainerBase > ListProtectionContainers ( )
@@ -438,7 +438,7 @@ public List<AzureRmRecoveryServicesItemBase> ListProtectedItems()
438
438
paginationRequest . SkipToken = skipToken ;
439
439
}
440
440
} while ( skipToken != null ) ;
441
-
441
+
442
442
List < AzureRmRecoveryServicesItemBase > itemModels = ConversionHelpers . GetItemModelList ( protectedItems , container ) ;
443
443
444
444
// 1. Filter by container
@@ -455,6 +455,23 @@ public List<AzureRmRecoveryServicesItemBase> ListProtectedItems()
455
455
{
456
456
return ( ( AzureRmRecoveryServicesIaasVmItem ) itemModel ) . Name == name ;
457
457
} ) . ToList ( ) ;
458
+
459
+ GetProtectedItemQueryParam getItemQueryParams = new GetProtectedItemQueryParam ( ) ;
460
+ getItemQueryParams . Expand = "extendedinfo" ;
461
+
462
+ for ( int i = 0 ; i < itemModels . Count ; i ++ )
463
+ {
464
+ var getResponse = HydraAdapter . GetProtectedItem ( container . Name , itemModels [ i ] . Name , getItemQueryParams ) ;
465
+ AzureRmRecoveryServicesIaasVmItemExtendedInfo extendedInfo = new AzureRmRecoveryServicesIaasVmItemExtendedInfo ( ) ;
466
+ var hydraExtendedInfo = ( ( AzureIaaSVMProtectedItem ) getResponse . Item . Properties ) . ExtendedInfo ;
467
+ if ( hydraExtendedInfo . OldestRecoveryPoint . HasValue )
468
+ {
469
+ extendedInfo . OldestRecoveryPoint = hydraExtendedInfo . OldestRecoveryPoint ;
470
+ }
471
+ extendedInfo . PolicyState = hydraExtendedInfo . PolicyInconsistent . ToString ( ) ;
472
+ extendedInfo . RecoveryPointCount = hydraExtendedInfo . RecoveryPointCount ;
473
+ ( ( AzureRmRecoveryServicesIaasVmItem ) itemModels [ i ] ) . ExtendedInfo = extendedInfo ;
474
+ }
458
475
}
459
476
460
477
// 3. Filter by item's Protection Status
@@ -485,7 +502,7 @@ public List<AzureRmRecoveryServicesItemBase> ListProtectedItems()
485
502
}
486
503
487
504
return itemModels ;
488
- }
505
+ }
489
506
490
507
public AzureRmRecoveryServicesBackupSchedulePolicyBase GetDefaultSchedulePolicyObject ( )
491
508
{
@@ -620,7 +637,7 @@ private void ValidateAzureVMContainerType(Microsoft.Azure.Commands.RecoveryServi
620
637
type . ToString ( ) ) ) ;
621
638
}
622
639
}
623
-
640
+
624
641
private void ValidateAzureVMProtectionPolicy ( AzureRmRecoveryServicesBackupPolicyBase policy )
625
642
{
626
643
if ( policy == null || policy . GetType ( ) != typeof ( AzureRmRecoveryServicesIaasVmPolicy ) )
@@ -681,7 +698,7 @@ private void ValidateAzureVMModifyProtectionRequest(AzureRmRecoveryServicesItemB
681
698
typeof ( AzureRmRecoveryServicesIaasVmItem ) . ToString ( ) ) ) ;
682
699
}
683
700
684
- if ( string . IsNullOrEmpty ( ( ( AzureRmRecoveryServicesIaasVmItem ) itemBase ) . VirtualMachineId ) )
701
+ if ( string . IsNullOrEmpty ( ( ( AzureRmRecoveryServicesIaasVmItem ) itemBase ) . VirtualMachineId ) )
685
702
{
686
703
throw new ArgumentException ( Resources . VirtualMachineIdIsEmptyOrNull ) ;
687
704
}
0 commit comments