Skip to content

Commit 838a284

Browse files
Addressed review comments
1 parent 55f907e commit 838a284

File tree

6 files changed

+54
-9
lines changed

6 files changed

+54
-9
lines changed

src/RecoveryServices/RecoveryServices.SiteRecovery/Models/PSFabricDetails.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ public ASRHyperVReplicaAzureSpecificRPIDetails(HyperVReplicaAzureReplicationDeta
869869
public string RecoveryProximityPlacementGroupId { get; set; }
870870

871871
/// <summary>
872-
/// Gets or sets the SQL Server license type to the machine to in the event of a failover.
872+
/// Gets or sets the SQL Server license type of the machine to in the event of a failover.
873873
/// </summary>
874874
public string SqlServerLicenseType { get; set; }
875875

@@ -885,7 +885,7 @@ public ASRHyperVReplicaAzureSpecificRPIDetails(HyperVReplicaAzureReplicationDeta
885885

886886
/// <summary>
887887
/// Gets or sets the tags for the target NICs.
888-
/// </summary>
888+
/// </summary>S
889889
public IDictionary<string, string> RecoveryNicTag { get; set; }
890890
}
891891

@@ -1211,7 +1211,7 @@ public ASRInMageAzureV2SpecificRPIDetails(InMageAzureV2ReplicationDetails detail
12111211
public string RecoveryProximityPlacementGroupId { get; set; }
12121212

12131213
/// <summary>
1214-
/// Gets or sets the SQL Server license type to the machine to in the event of a failover.
1214+
/// Gets or sets the SQL Server license type of the machine to in the event of a failover.
12151215
/// </summary>
12161216
public string SqlServerLicenseType { get; set; }
12171217

src/RecoveryServices/RecoveryServices.SiteRecovery/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/RecoveryServices/RecoveryServices.SiteRecovery/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,4 +513,7 @@ Recommended Action: To cleanup the resources created by Test failover run the Te
513513
<data name="IPConfigNotFoundInVMNic" xml:space="preserve">
514514
<value>IP Config "{0}" not found in VM NIC "{1}".</value>
515515
</data>
516+
<data name="DiskTagCannotBeSet" xml:space="preserve">
517+
<value>Disk Tag "{0}" cannot be set if UseManagedDisk is "{1}".</value>
518+
</data>
516519
</root>

src/RecoveryServices/RecoveryServices.SiteRecovery/ReplicationProtectedItem/NewAzureRmRecoveryServicesAsrReplicationProtectedItem.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,11 @@ public override void ExecuteSiteRecoveryCmdlet()
541541

542542
private void VMwareToAzureReplication(EnableProtectionInput input)
543543
{
544+
var seedManagedDiskTag = this.DiskTag;
545+
if (!string.IsNullOrEmpty(this.RecoveryAzureStorageAccountId))
546+
{
547+
seedManagedDiskTag = null;
548+
}
544549
var providerSettings = new InMageAzureV2EnableProtectionInput
545550
{
546551
ProcessServerId = this.ProcessServer.Id,
@@ -566,7 +571,7 @@ private void VMwareToAzureReplication(EnableProtectionInput input)
566571
SqlServerLicenseType = this.SqlServerLicenseType,
567572
TargetVmTags = this.RecoveryVmTag,
568573
TargetNicTags = this.RecoveryNicTag,
569-
SeedManagedDiskTags = this.DiskTag,
574+
SeedManagedDiskTags = seedManagedDiskTag,
570575
TargetManagedDiskTags = this.DiskTag
571576
};
572577

@@ -667,9 +672,24 @@ private void EnterpriseAndHyperVToAzure(EnableProtectionInput input)
667672
providerSettings.TargetVmSize = this.Size;
668673
providerSettings.SqlServerLicenseType = this.SqlServerLicenseType;
669674
providerSettings.TargetVmTags = this.RecoveryVmTag;
670-
providerSettings.TargetManagedDiskTags = this.DiskTag;
671675
providerSettings.TargetNicTags = this.RecoveryNicTag;
672676

677+
if(this.DiskTag != null || this.DiskTag.Count > 0)
678+
{
679+
if(this.UseManagedDisk == Constants.False)
680+
{
681+
throw new PSArgumentException(
682+
string.Format(
683+
Resources.DiskTagCannotBeSet,
684+
this.DiskTag,
685+
this.UseManagedDisk));
686+
}
687+
else
688+
{
689+
providerSettings.TargetManagedDiskTags = this.DiskTag;
690+
}
691+
}
692+
673693
if (!string.IsNullOrEmpty(this.RecoveryAzureNetworkId))
674694
{
675695
providerSettings.TargetAzureNetworkId = this.RecoveryAzureNetworkId;

src/RecoveryServices/RecoveryServices.SiteRecovery/ReplicationProtectedItem/SetAzureRmRecoveryServicesAsrReplicationProtectedItem.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,19 @@ public override void ExecuteSiteRecoveryCmdlet()
468468
diskTag = providerSpecificDetails.TargetManagedDiskTags;
469469
}
470470

471+
if(useManagedDisk == Constants.False)
472+
{
473+
if(diskTag != null ||
474+
diskTag.Count > 0)
475+
{
476+
throw new PSArgumentException(
477+
string.Format(
478+
Resources.DiskTagCannotBeSet,
479+
diskTag,
480+
useManagedDisk));
481+
}
482+
}
483+
471484
var deploymentType = Utilities.GetValueFromArmId(
472485
providerSpecificDetails.RecoveryAzureStorageAccount,
473486
ARMResourceTypeConstants.Providers);

src/RecoveryServices/RecoveryServices/help/Set-AzRecoveryServicesAsrReplicationProtectedItem.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ Accept wildcard characters: False
185185
```
186186
187187
### -DiskTag
188-
Specify the tags for the disks of the VM.
188+
Specify the tags for the disks of the VM. This is applicable for Vmware to Azure and HyperV to Azure providers.
189189
190190
```yaml
191191
Type: System.Collections.Generic.IDictionary`2[System.String,System.String]
@@ -458,8 +458,8 @@ Accept pipeline input: False
458458
Accept wildcard characters: False
459459
```
460460
461-
### -RecoveryNicTag
462-
Specify the tags for the target NICs of the VM.
461+
### -RecoveryNicTag
462+
Specify the tags for the target NICs of the VM. This is applicable for Vmware to Azure and HyperV to Azure providers.
463463
464464
```yaml
465465
Type: System.Collections.Generic.IDictionary`2[System.String,System.String]
@@ -519,7 +519,7 @@ Accept wildcard characters: False
519519
```
520520
521521
### -RecoveryVmTag
522-
Specify the tags for target VM.
522+
Specify the tags for target VM. This is applicable for Vmware to Azure and HyperV to Azure providers.
523523
524524
```yaml
525525
Type: System.Collections.Generic.IDictionary`2[System.String,System.String]

0 commit comments

Comments
 (0)