Skip to content

Commit 2943f57

Browse files
author
dragonfly91
committed
Merge branch 'dev1' into anudeeb-dev1
2 parents f9acf86 + 36e731c commit 2943f57

File tree

8 files changed

+26
-20
lines changed

8 files changed

+26
-20
lines changed

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/ConversionHelpers.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public static AzureRmRecoveryServicesContainerBase GetContainerModel(ProtectionC
3737
{
3838
containerModel = new AzureRmRecoveryServicesIaasVmContainer(protectionContainer);
3939
}
40+
if (protectionContainer.Properties.GetType().IsSubclassOf(typeof(MabProtectionContainer)))
41+
{
42+
containerModel = new AzureRmRecoveryServicesMabContainer(protectionContainer);
43+
}
4044
}
4145

4246
return containerModel;
@@ -93,7 +97,7 @@ public static AzureRmRecoveryServicesPolicyBase GetPolicyModel(ProtectionPolicyR
9397
iaasPolicyModel.BackupManagementType = BackupManagementType.AzureVM;
9498
iaasPolicyModel.RetentionPolicy = PolicyHelpers.GetPSLongTermRetentionPolicy((LongTermRetentionPolicy)
9599
((AzureIaaSVMProtectionPolicy)hydraResponse.Properties).RetentionPolicy);
96-
iaasPolicyModel.SchedulePolicy = PolicyHelpers.GetPSSimpleSchedulePolicyPolicy((SimpleSchedulePolicy)
100+
iaasPolicyModel.SchedulePolicy = PolicyHelpers.GetPSSimpleSchedulePolicy((SimpleSchedulePolicy)
97101
((AzureIaaSVMProtectionPolicy)hydraResponse.Properties).SchedulePolicy);
98102
}
99103
else

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/RecoveryPointConversions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ public static List<AzureRmRecoveryServicesRecoveryPointBase> GetPSAzureRecoveryP
3535
AzureRmRecoveryServicesIaasVmRecoveryPoint rpBase = new AzureRmRecoveryServicesIaasVmRecoveryPoint()
3636
{
3737
BackupManagementType = item.BackupManagementType,
38-
ContainerName = item.ContainerName,
3938
ItemName = item.Name,
39+
ContainerName = item.ContainerName,
4040
ContainerType = item.ContainerType,
4141
RecoveryPointTime = Convert.ToDateTime(recPoint.RecoveryPointTime).ToLocalTime(),
4242
RecoveryPointType = recPoint.RecoveryPointType,
43+
RecoveryPointId = rp.Id,
4344
WorkloadType = item.WorkloadType,
4445
RecoveryPointAdditionalInfo = recPoint.RecoveryPointAdditionalInfo,
4546
};
@@ -67,7 +68,6 @@ public static AzureRmRecoveryServicesRecoveryPointBase GetPSAzureRecoveryPoints(
6768
RecoveryPointTime = Convert.ToDateTime(recPoint.RecoveryPointTime).ToLocalTime(),
6869
RecoveryPointType = recPoint.RecoveryPointType,
6970
RecoveryPointId = rpResponse.RecPoint.Id,
70-
Region = rpResponse.Location,
7171
WorkloadType = item.WorkloadType,
7272
RecoveryPointAdditionalInfo = recPoint.RecoveryPointAdditionalInfo,
7373
};

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/RetentionPolicyConversions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ private static DailyRetentionSchedule GetPSLTRDailySchedule(HydraModels.DailyRet
208208
DailyRetentionSchedule psDaily = new DailyRetentionSchedule();
209209

210210
psDaily.DurationCountInDays = GetRetentionDurationInDays(hydraDaily.RetentionDuration);
211-
psDaily.RetentionTimes = (List<DateTime>)hydraDaily.RetentionTimes;
211+
psDaily.RetentionTimes = ParseDateTimesToUTC(hydraDaily.RetentionTimes);
212212

213213
return psDaily;
214214
}
@@ -223,7 +223,7 @@ private static WeeklyRetentionSchedule GetPSLTRWeeklySchedule(HydraModels.Weekly
223223
WeeklyRetentionSchedule psWeekly = new WeeklyRetentionSchedule();
224224

225225
psWeekly.DurationCountInWeeks = GetRetentionDurationInWeeks(hydraWeekly.RetentionDuration);
226-
psWeekly.RetentionTimes = (List<DateTime>)hydraWeekly.RetentionTimes;
226+
psWeekly.RetentionTimes = ParseDateTimesToUTC(hydraWeekly.RetentionTimes);
227227
psWeekly.DaysOfTheWeek = HelperUtils.GetEnumListFromStringList<DayOfWeek>(hydraWeekly.DaysOfTheWeek);
228228

229229
return psWeekly;
@@ -239,7 +239,7 @@ private static MonthlyRetentionSchedule GetPSLTRMonthlySchedule(HydraModels.Mont
239239
MonthlyRetentionSchedule psMonthly = new MonthlyRetentionSchedule();
240240

241241
psMonthly.DurationCountInMonths = GetRetentionDurationInMonths(hydraMonthly.RetentionDuration);
242-
psMonthly.RetentionTimes = (List<DateTime>)hydraMonthly.RetentionTimes;
242+
psMonthly.RetentionTimes = ParseDateTimesToUTC(hydraMonthly.RetentionTimes);
243243
psMonthly.RetentionScheduleFormatType = (RetentionScheduleFormat)Enum.Parse(typeof(RetentionScheduleFormat),
244244
hydraMonthly.RetentionScheduleFormatType);
245245
psMonthly.RetentionScheduleDaily = GetPSLTRDailyRetentionFormat(hydraMonthly.RetentionScheduleDaily);
@@ -258,7 +258,7 @@ private static YearlyRetentionSchedule GetPSLTRYearlySchedule(HydraModels.Yearly
258258
YearlyRetentionSchedule psYearly = new YearlyRetentionSchedule();
259259

260260
psYearly.DurationCountInYears = GetRetentionDurationInYears(hydraYearly.RetentionDuration);
261-
psYearly.RetentionTimes = (List<DateTime>)hydraYearly.RetentionTimes;
261+
psYearly.RetentionTimes = ParseDateTimesToUTC(hydraYearly.RetentionTimes);
262262
psYearly.RetentionScheduleFormatType = (RetentionScheduleFormat)Enum.Parse(typeof(RetentionScheduleFormat),
263263
hydraYearly.RetentionScheduleFormatType);
264264
psYearly.RetentionScheduleDaily = GetPSLTRDailyRetentionFormat(hydraYearly.RetentionScheduleDaily);

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/SchedulePolicyConversions.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public partial class PolicyHelpers
2626
{
2727
#region HydraToPSObject conversions
2828

29-
public static AzureRmRecoveryServicesSimpleSchedulePolicy GetPSSimpleSchedulePolicyPolicy(
29+
public static AzureRmRecoveryServicesSimpleSchedulePolicy GetPSSimpleSchedulePolicy(
3030
SimpleSchedulePolicy hydraPolicy)
3131
{
3232
if (hydraPolicy == null)
@@ -39,7 +39,7 @@ public static AzureRmRecoveryServicesSimpleSchedulePolicy GetPSSimpleSchedulePol
3939
psPolicy.ScheduleRunDays = HelperUtils.GetEnumListFromStringList<DayOfWeek>(hydraPolicy.ScheduleRunDays);
4040
psPolicy.ScheduleRunFrequency = (ScheduleRunType)Enum.Parse(typeof(ScheduleRunType),
4141
hydraPolicy.ScheduleRunFrequency);
42-
psPolicy.ScheduleRunTimes = (List<DateTime>)hydraPolicy.ScheduleRunTimes;
42+
psPolicy.ScheduleRunTimes = ParseDateTimesToUTC(hydraPolicy.ScheduleRunTimes);
4343

4444
// safe side validation
4545
psPolicy.Validate();
@@ -51,7 +51,7 @@ public static AzureRmRecoveryServicesSimpleSchedulePolicy GetPSSimpleSchedulePol
5151

5252
#region PStoHydraObject conversions
5353

54-
public static List<DateTime> ParseScheduleRunTimesToUTC(List<DateTime> localTimes)
54+
public static List<DateTime> ParseDateTimesToUTC(IList<DateTime> localTimes)
5555
{
5656
if (localTimes == null || localTimes.Count == 0)
5757
{
@@ -64,11 +64,9 @@ public static List<DateTime> ParseScheduleRunTimesToUTC(List<DateTime> localTime
6464
foreach (DateTime localTime in localTimes)
6565
{
6666
temp = localTime;
67-
if (localTime.Kind == DateTimeKind.Local)
67+
if (localTime.Kind != DateTimeKind.Utc)
6868
{
69-
temp = localTime.ToUniversalTime();
70-
temp = new DateTime(temp.Year, temp.Month,
71-
temp.Day, temp.Hour, temp.Minute - (temp.Minute % 30), 0);
69+
temp = localTime.ToUniversalTime();
7270
}
7371
utcTimes.Add(temp);
7472
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/RestoreDiskAPIs.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public BaseRecoveryServicesJobResponse RestoreDisk(AzureRmRecoveryServicesIaasVm
2323
{
2424
string resourceGroupName = BmsAdapter.GetResourceGroupName();
2525
string resourceName = BmsAdapter.GetResourceName();
26+
string location = BmsAdapter.GetResourceLocation();
2627

2728
string containerName = rp.ContainerName;
2829
string protectedItemName = rp.ItemName;
@@ -35,7 +36,7 @@ public BaseRecoveryServicesJobResponse RestoreDisk(AzureRmRecoveryServicesIaasVm
3536
CreateNewCloudService = false,
3637
RecoveryPointId = recoveryPointId,
3738
RecoveryType = RecoveryType.RestoreDisks,
38-
Region = rp.Region,
39+
Region = location,
3940
StorageAccountName = storageAccountId,
4041
SubnetName = string.Empty,
4142
VirtualMachineName = string.Empty,

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/ClientProxyBase.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,10 @@ public string GetResourceGroupName()
6767
{
6868
return PSRecoveryServicesClient.arsVault.ResouceGroupName;
6969
}
70+
71+
public string GetResourceLocation()
72+
{
73+
return PSRecoveryServicesClient.arsVault.Location;
74+
}
7075
}
7176
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmRecoveryPoint.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ public class AzureRmRecoveryServicesIaasVmRecoveryPoint : AzureRmRecoveryService
2828
///
2929
public string RecoveryPointAdditionalInfo { get; set; }
3030

31-
public string Region { get; set; }
32-
3331
public AzureRmRecoveryServicesIaasVmRecoveryPoint()
3432
{
3533

src/ResourceManager/RecoveryServices.Backup/Microsoft.Azure.Commands.RecoveryServices.Backup.format.ps1xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
<TableHeaders>
1111
<TableColumnHeader>
1212
<Label>Name</Label>
13-
<Width>25</Width>
13+
<Width>20</Width>
1414
</TableColumnHeader>
1515
<TableColumnHeader>
1616
<Label>WorkloadType</Label>
1717
<Width>18</Width>
1818
</TableColumnHeader>
1919
<TableColumnHeader>
2020
<Label>BackupManagementType</Label>
21-
<Width>18</Width>
21+
<Width>20</Width>
2222
</TableColumnHeader>
2323
<TableColumnHeader>
2424
<Label>BackupTime</Label>
25-
<Width>30</Width>
25+
<Width>25</Width>
2626
</TableColumnHeader>
2727
<TableColumnHeader>
2828
<Label>DaysOfWeek</Label>

0 commit comments

Comments
 (0)