Skip to content

Commit 4443730

Browse files
committed
BUG: 1346915, Vault Creation fails first time - Add tracking to the creation
1 parent 89c5aa1 commit 4443730

File tree

7 files changed

+20
-7
lines changed

7 files changed

+20
-7
lines changed

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesNetworkMappingClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public JobResponse NewAzureSiteRecoveryNetworkMapping(
255255
createNetworkMappingInput.RecoveryNetworkId = recoveryNetworkId;
256256

257257
NetworkMappingInput networkMappingInput = new NetworkMappingInput();
258-
networkMappingInput.TargetNetworkType = TargetNetworkType.Server.ToString();
258+
networkMappingInput.NetworkTargetType = TargetNetworkType.Server.ToString();
259259
networkMappingInput.CreateNetworkMappingInput =
260260
DataContractUtils.Serialize<CreateNetworkMappingInput>(createNetworkMappingInput);
261261
return this.GetSiteRecoveryClient()
@@ -285,7 +285,7 @@ public JobResponse NewAzureSiteRecoveryAzureNetworkMapping(
285285
createAzureNetworkMappingInput.AzureVMNetworkId = recoveryNetworkId;
286286

287287
NetworkMappingInput networkMappingInput = new NetworkMappingInput();
288-
networkMappingInput.TargetNetworkType = TargetNetworkType.Azure.ToString();
288+
networkMappingInput.NetworkTargetType = TargetNetworkType.Azure.ToString();
289289
networkMappingInput.CreateNetworkMappingInput =
290290
DataContractUtils.Serialize<CreateAzureNetworkMappingInput>(createAzureNetworkMappingInput);
291291
return this.GetSiteRecoveryClient()

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesVaultClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public partial class PSRecoveryServicesClient
2929
/// <param name="vaultName">name of the vault</param>
3030
/// <param name="vaultCreateInput">vault creation input object</param>
3131
/// <returns>creation response object.</returns>
32-
public VaultCreateResponse CreateVault(string cloudServiceName, string vaultName, VaultCreateArgs vaultCreateInput)
32+
public RecoveryServicesOperationStatusResponse CreateVault(string cloudServiceName, string vaultName, VaultCreateArgs vaultCreateInput)
3333
{
3434
return this.GetRecoveryServicesClient.Vaults.Create(cloudServiceName, vaultName, vaultCreateInput);
3535
}

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Properties/Resources.Designer.cs

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

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,7 @@ ClientRequestId: {3}</value>
203203
<data name="VaultCredentialGenerationUnSupported" xml:space="preserve">
204204
<value>Cannot generate vault credentials for this vault. Download it from the Azure Portal.</value>
205205
</data>
206+
<data name="VaultCreationSuccessMessage" xml:space="preserve">
207+
<value>Vault has been created</value>
208+
</data>
206209
</root>

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/CreateAzureSiteRecoveryVault.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414

1515
using System;
1616
using System.Management.Automation;
17+
using System.Net;
18+
using Microsoft.Azure.Commands.RecoveryServices.Properties;
1719
using Microsoft.Azure.Commands.RecoveryServices.SiteRecovery;
18-
using Microsoft.Azure.Portal.RecoveryServices.Models.Common;
1920
using Microsoft.WindowsAzure.Management.RecoveryServices.Models;
2021

2122
namespace Microsoft.Azure.Commands.RecoveryServices
@@ -75,11 +76,11 @@ public override void ExecuteCmdlet()
7576
SchemaVersion = Constants.RpSchemaVersion
7677
};
7778

78-
VaultCreateResponse response = RecoveryServicesClient.CreateVault(cloudServiceName, this.Name, vaultCreateArgs);
79+
RecoveryServicesOperationStatusResponse response = RecoveryServicesClient.CreateVault(cloudServiceName, this.Name, vaultCreateArgs);
7980

8081
VaultOperationOutput output = new VaultOperationOutput()
8182
{
82-
OperationTrackingId = response.RequestId
83+
response = response.StatusCode == HttpStatusCode.OK ? Resources.VaultCreationSuccessMessage : response.StatusCode.ToString()
8384
};
8485

8586
this.WriteObject(output, true);

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/lib/PSObjects.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ public VaultOperationOutput()
10381038
/// <summary>
10391039
/// Gets or sets the operation tracking id of the operation performed.
10401040
/// </summary>
1041-
public string OperationTrackingId { get; set; }
1041+
public string response { get; set; }
10421042

10431043
#endregion
10441044
}

0 commit comments

Comments
 (0)