Skip to content

Commit 6ee3562

Browse files
author
dragonfly91
committed
Merge branch 'dev1' into anudeeb-dev1
2 parents fdf90ae + 326ebb9 commit 6ee3562

File tree

15 files changed

+62
-50
lines changed

15 files changed

+62
-50
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ public static List<AzureRmRecoveryServicesRecoveryPointBase> GetPSAzureRecoveryP
4848
RecoveryPointType = recPoint.RecoveryPointType,
4949
RecoveryPointId = rp.Id,
5050
WorkloadType = item.WorkloadType,
51-
RecoveryPointAdditionalInfo = recPoint.RecoveryPointAdditionalInfo,
51+
RecoveryPointAdditionalInfo = recPoint.RecoveryPointAdditionalInfo,
52+
SourceVMStorageType = recPoint.SourceVMStorageType,
5253
};
5354
result.Add(rpBase);
5455
}

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

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

31+
public string SourceVMStorageType { get; set; }
32+
3133
public AzureRmRecoveryServicesIaasVmRecoveryPoint()
3234
{
3335

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/BaseObjects.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ public AzureRmRecoveryServicesContainerContext(ContainerType containerType, stri
5454

5555
public class AzureRmRecoveryServicesBackupEngineContext : AzureRmRecoveryServicesBackupManagementContext
5656
{
57-
public BackupEngineType BackupEngineType { get; set; }
57+
public string BackupEngineType { get; set; }
5858

5959
public AzureRmRecoveryServicesBackupEngineContext() { }
6060

61-
public AzureRmRecoveryServicesBackupEngineContext(BackupEngineType backupEngineType, string backupManagementType)
61+
public AzureRmRecoveryServicesBackupEngineContext(string backupEngineType, string backupManagementType)
6262
: base(backupManagementType)
6363
{
6464
BackupEngineType = backupEngineType;
@@ -88,7 +88,7 @@ public class AzureRmRecoveryServicesBackupEngineBase : AzureRmRecoveryServicesBa
8888
public string Name { get; set; }
8989

9090
public AzureRmRecoveryServicesBackupEngineBase(BackupEngineResource backupEngine)
91-
: base(ConversionUtils.GetPsBackupEngineType(((BackupEngineBase)backupEngine.Properties).BackupEngineType),
91+
: base(((BackupEngineBase)backupEngine.Properties).BackupEngineType,
9292
((BackupEngineBase)backupEngine.Properties).BackupManagementType)
9393
{
9494
Name = backupEngine.Name;

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/Enums.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,19 @@ public enum ContainerType
2727
Windows
2828
}
2929

30-
public enum BackupEngineType
31-
{
32-
Invalid = 0,
33-
34-
DpmEngine,
35-
36-
DpmVenusEngine
37-
}
38-
3930
public enum BackupManagementType
4031
{
4132
AzureVM = 1,
4233
MARS,
4334
SCDPM
4435
}
4536

37+
public enum BackupEngineType
38+
{
39+
DpmBackupEngine = 1,
40+
AzureBackupServerEngine
41+
}
42+
4643
public enum WorkloadType
4744
{
4845
AzureVM = 1,

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/Utils.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,6 @@ public static ContainerType GetPsContainerType(string containerType)
150150
}
151151
}
152152

153-
public static BackupEngineType GetPsBackupEngineType(string backupEngineType)
154-
{
155-
BackupEngineType type = 0;
156-
Enum.TryParse(backupEngineType, out type);
157-
return type;
158-
}
159-
160153
public static WorkloadType GetPsWorkloadType(string workloadType)
161154
{
162155
if (workloadType == Microsoft.Azure.Management.RecoveryServices.Backup.Models.WorkloadType.VM)

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Properties/Resources.Designer.cs

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Properties/Resources.resx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,4 +407,13 @@ Please contact Microsoft for further assistant.</value>
407407
<data name="JobFromNotProvided" xml:space="preserve">
408408
<value>Please provide From filter along with To filter.</value>
409409
</data>
410+
<data name="RestoreOperation" xml:space="preserve">
411+
<value>Restore Azure Backup Item Operation</value>
412+
</data>
413+
<data name="UnsupportedAzureRmBackupManagementServerException" xml:space="preserve">
414+
<value>Please provide AzureRmBackupManagementServer of BackupEngineType as DpmEngine or DpmVenusEngine and provide BackupManagementType as SCDPM. Provided AzureRmBackupManagementServer has BackupEngineType {0} and backupManagementType {1} which is not valid.</value>
415+
</data>
416+
<data name="UnsupportedContainerException" xml:space="preserve">
417+
<value>Please provide Container of containerType as Windows and backupManagementType as MARS. Provided Container has containerType {0} and backupManagementType {1} which is invalid.</value>
418+
</data>
410419
</root>

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Test/ScenarioTests/IaasVm/PolicyTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function Test-PolicyScenario
2828
$schedulePolicy = Get-AzureRmRecoveryServicesSchedulePolicyObject -WorkloadType "AzureVM"
2929
$retPolicy = Get-AzureRmRecoveryServicesBackupRetentionPolicyObject -WorkloadType "AzureVM"
3030

31-
$temp = Get-AzureRmRecoveryServicesProtectionPolicy -Name "pwtest1"
31+
$temp = Get-AzureRmRecoveryServicesBackupProtectionPolicy -Name "pwtest1"
3232
Set-AzureRmRecoveryServicesBackupProtectionPolicy -RetentionPolicy $retPolicy -SchedulePolicy $schedulePolicy -Policy $temp
3333

3434
#cleanup
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
2727
/// <summary>
2828
/// Get list of containers
2929
/// </summary>
30-
[Cmdlet(VerbsCommon.Get, "AzureRmBackupManagementServer"), OutputType(typeof(AzureRmRecoveryServicesContainerBase))]
31-
public class GetAzureRmBackupManagementServer : RecoveryServicesBackupCmdletBase
30+
[Cmdlet(VerbsCommon.Get, "AzureRmRecoveryServicesBackupManagementServer"), OutputType(typeof(AzureRmRecoveryServicesContainerBase))]
31+
public class GetAzureRmRecoveryServicesBackupManagementServer : RecoveryServicesBackupCmdletBase
3232
{
3333
[Parameter(Mandatory = false, HelpMessage = ParamHelpMsg.Container.Name)]
3434
[ValidateNotNullOrEmpty]

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup/Cmdlets/Container/UnregisterAzureRmBackupManagementServer.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models;
1616
using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ProviderModel;
1717
using Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers;
18+
using Microsoft.Azure.Commands.RecoveryServices.Backup.Properties;
1819
using System;
1920
using System.Collections.Generic;
2021
using System.Linq;
@@ -37,10 +38,10 @@ public override void ExecuteCmdlet()
3738
{
3839
base.ExecuteCmdlet();
3940

40-
if ((AzureRmBackupManagementServer.BackupEngineType != BackupEngineType.DpmEngine && AzureRmBackupManagementServer.BackupEngineType != BackupEngineType.DpmVenusEngine)||
41+
if ((AzureRmBackupManagementServer.BackupEngineType != BackupEngineType.DpmBackupEngine.ToString() && AzureRmBackupManagementServer.BackupEngineType != BackupEngineType.AzureBackupServerEngine.ToString())||
4142
AzureRmBackupManagementServer.BackupManagementType != BackupManagementType.SCDPM)
4243
{
43-
throw new ArgumentException(String.Format("Please provide AzureRmBackupManagementServer of BackupEngineType as DpmEngine or DpmVenusEngine and provide BackupManagementType as SCDPM. Provided AzureRmBackupManagementServer has BackupEngineType {0} and backupManagementType {1} which is not valid.", AzureRmBackupManagementServer.BackupEngineType, AzureRmBackupManagementServer.BackupManagementType));
44+
throw new ArgumentException(String.Format(Resources.UnsupportedAzureRmBackupManagementServerException, AzureRmBackupManagementServer.BackupEngineType, AzureRmBackupManagementServer.BackupManagementType));
4445
}
4546

4647
string azureRmBackupManagementServer = AzureRmBackupManagementServer.Name;

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup/Cmdlets/Container/UnregisterAzureRmRecoveryServicesBackupContainer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models;
1616
using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ProviderModel;
1717
using Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers;
18+
using Microsoft.Azure.Commands.RecoveryServices.Backup.Properties;
1819
using System;
1920
using System.Collections.Generic;
2021
using System.Linq;
@@ -42,7 +43,7 @@ public override void ExecuteCmdlet()
4243

4344
if (Container.ContainerType != ContainerType.Windows || Container.BackupManagementType != BackupManagementType.MARS)
4445
{
45-
throw new ArgumentException(String.Format("Please provide Container of containerType as Windows and backupManagementType as MARS. Provided Container has containerType {0} and backupManagementType {1} which is invalid.", Container.ContainerType, Container.BackupManagementType));
46+
throw new ArgumentException(String.Format(Resources.UnsupportedContainerException, Container.ContainerType, Container.BackupManagementType));
4647
}
4748
AzureRmRecoveryServicesMabContainer mabContainer = Container as AzureRmRecoveryServicesMabContainer;
4849
string containerName = mabContainer.FriendlyName;

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup/Cmdlets/ProtectionPolicy/GetAzureRmRecoveryServicesBackupRetentionPolicyObject.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
2626
[Cmdlet(VerbsCommon.Get, "AzureRmRecoveryServicesBackupRetentionPolicyObject"), OutputType(typeof(AzureRmRecoveryServicesBackupRetentionPolicyBase))]
2727
public class GetAzureRmRecoveryServicesBackupRetentionPolicyObject : RecoveryServicesBackupCmdletBase
2828
{
29-
[Parameter(Mandatory = true, HelpMessage = "Temp Help message. Need to update it")]
29+
[Parameter(Mandatory = true, HelpMessage = ParamHelpMsg.Common.WorkloadType)]
3030
[ValidateNotNullOrEmpty]
3131
public WorkloadType WorkloadType { get; set; }
3232

33-
[Parameter(Mandatory = false, HelpMessage = "Temp Help message. Need to update it")]
33+
[Parameter(Mandatory = false, HelpMessage = ParamHelpMsg.Common.BackupManagementType)]
3434
[ValidateNotNullOrEmpty]
3535
public BackupManagementType? BackupManagementType { get; set; }
3636

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup/Cmdlets/ProtectionPolicy/GetAzureRmRecoveryServicesSchedulePolicyObject.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
2626
[Cmdlet(VerbsCommon.Get, "AzureRmRecoveryServicesSchedulePolicyObject"), OutputType(typeof(AzureRmRecoveryServicesBackupSchedulePolicyBase))]
2727
public class GetAzureRmRecoveryServicesSchedulePolicyObject : RecoveryServicesBackupCmdletBase
2828
{
29-
[Parameter(Mandatory = true, HelpMessage = "Temp Help message. Need to update it")]
29+
[Parameter(Mandatory = true, HelpMessage = ParamHelpMsg.Common.WorkloadType)]
3030
[ValidateNotNullOrEmpty]
3131
public WorkloadType WorkloadType { get; set; }
3232

33-
[Parameter(Mandatory = false, HelpMessage = "Temp Help message. Need to update it")]
33+
[Parameter(Mandatory = false, HelpMessage = ParamHelpMsg.Common.BackupManagementType)]
3434
[ValidateNotNullOrEmpty]
3535
public BackupManagementType? BackupManagementType { get; set; }
3636

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup/Cmdlets/Restore/RestoreAzureRMRecoveryServicesBackupItem.cs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,8 @@ public override void ExecuteCmdlet()
7777
string storageAccountlocation = resource.Resource.Location;
7878
string storageAccountType = resource.Resource.Type;
7979

80-
//GetStorageResource(StorageAccountName, out storageAccountId, out storageAccountlocation, out storageAccountType);
81-
8280
WriteDebug(String.Format("StorageId = {0}", storageAccountId));
8381

84-
storageAccountId = StorageAccountName; //TBD: once service will migrate to storageID we will remove this line;
85-
8682
PsBackupProviderManager providerManager = new PsBackupProviderManager(new Dictionary<System.Enum, object>()
8783
{
8884
{RestoreBackupItemParams.RecoveryPoint, RecoveryPoint},
@@ -95,22 +91,7 @@ public override void ExecuteCmdlet()
9591
var jobResponse = psBackupProvider.TriggerRestore();
9692

9793
WriteDebug(String.Format("Restore submitted"));
98-
var response = HydraAdapter.GetProtectedItemOperationStatusByURL(jobResponse.AzureAsyncOperation);
99-
while (response.OperationStatus.Status == "InProgress")
100-
{
101-
WriteDebug(String.Format("Restore inProgress"));
102-
response = HydraAdapter.GetProtectedItemOperationStatusByURL(jobResponse.AzureAsyncOperation);
103-
TestMockSupport.Delay(TimeSpan.FromSeconds(5));
104-
}
105-
106-
if (response.OperationStatus.Status == "Completed")
107-
{
108-
// TBD -- Hydra change to add jobId in OperationStatusExtendedInfo
109-
WriteDebug(String.Format("Restore Completed"));
110-
string jobId = ""; //response.OperationStatus.Properties.jobId;
111-
var job = HydraAdapter.GetJob(jobId);
112-
//WriteObject(ConversionHelpers.GetJobModel(job));
113-
}
94+
HandleCreatedJob(jobResponse, Resources.RestoreOperation);
11495
});
11596
}
11697

0 commit comments

Comments
 (0)