Skip to content

Commit df74141

Browse files
minhsuanleeSam Lee
andauthored
Enhance Az.Migrate to prep for service release (#28020)
Co-authored-by: Sam Lee <[email protected]>
1 parent 0d27106 commit df74141

20 files changed

+444
-258
lines changed

src/Migrate/Migrate.Autorest/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
2121
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
2222
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - Migrate")]
23-
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.7.0")]
24-
[assembly: System.Reflection.AssemblyVersionAttribute("2.7.0")]
23+
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.8.0")]
24+
[assembly: System.Reflection.AssemblyVersionAttribute("2.8.0")]
2525
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
2626
[assembly: System.CLSCompliantAttribute(false)]
27-
28-
29-

src/Migrate/Migrate.Autorest/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ input-file:
5454
- $(repo)/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2024-01-01/service.json
5555
- $(repo)/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/stable/2024-09-01/recoveryservicesdatareplication.json
5656

57-
module-version: 3.0.10
57+
module-version: 3.0.12
5858
title: Migrate
5959
subject-prefix: 'Migrate'
6060

@@ -123,6 +123,9 @@ directive:
123123
- JobModelCustomProperties
124124
- TaskModel
125125
- TaskModelCustomProperties
126+
- FabricAgentModelProperties
127+
- FabricAgentModelCustomProperties
128+
- VaultModelProperties
126129
# Remove variants not in scope
127130
- from: Microsoft.RecoveryServices/stable/2024-01-01/service.json
128131
where:

src/Migrate/Migrate.Autorest/custom/AzLocalDiskInput.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ public AzLocalDiskInput(
1212
long diskSizeGB,
1313
string diskFileFormat,
1414
bool isOsDisk,
15-
long? diskPhysicalSectorSize,
16-
string storageContainerId)
15+
long? diskPhysicalSectorSize)
1716
{
1817
DiskId = diskId;
1918
IsDynamic = isDynamic;
@@ -25,11 +24,6 @@ public AzLocalDiskInput(
2524
(diskPhysicalSectorSize == 512 || diskPhysicalSectorSize == 4096)
2625
? diskPhysicalSectorSize
2726
: null;
28-
29-
StorageContainerId =
30-
string.IsNullOrWhiteSpace(storageContainerId)
31-
? null
32-
: storageContainerId;
3327
}
3428

3529
/// <summary>Gets or sets the type of the virtual hard disk, vhd or vhdx.</summary>
@@ -52,8 +46,5 @@ public AzLocalDiskInput(
5246

5347
/// <summary>Gets or sets a value indicating whether disk is os disk.</summary>
5448
public bool IsOSDisk { get; set; }
55-
56-
/// <summary>Gets or sets the target storage account ARM Id.</summary>
57-
public string StorageContainerId { get; set; }
5849
}
5950
}

src/Migrate/Migrate.Autorest/custom/Get-AzMigrateLocalJob.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The Get-AzMigrateLocalJob cmdlet retrieves the status of an Azure Migrate job.
2222
https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratelocaljob
2323
#>
2424
function Get-AzMigrateLocalJob {
25-
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PreviewMessageAttribute("This cmdlet is using a preview API version and is subject to breaking change in a future release.")]
25+
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PreviewMessageAttribute("This cmdlet is based on a preview API version and may experience breaking changes in future releases.")]
2626
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.IJobModel])]
2727
[CmdletBinding(DefaultParameterSetName = 'ListByName', PositionalBinding = $false)]
2828
param(

src/Migrate/Migrate.Autorest/custom/Get-AzMigrateLocalServerReplication.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The Get-AzMigrateLocalServerReplication cmdlet retrieves the object for the repl
2222
https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratelocalserverreplication
2323
#>
2424
function Get-AzMigrateLocalServerReplication {
25-
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PreviewMessageAttribute("This cmdlet is using a preview API version and is subject to breaking change in a future release.")]
25+
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PreviewMessageAttribute("This cmdlet is based on a preview API version and may experience breaking changes in future releases.")]
2626
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901.IProtectedItemModel])]
2727
[CmdletBinding(DefaultParameterSetName = 'ListByName', PositionalBinding = $false)]
2828
param(

src/Migrate/Migrate.Autorest/custom/Helper/AzLocalCommonSettings.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ $AzLocalInstanceTypes = @{
55

66
# Fabric instances
77
$FabricInstanceTypes = @{
8-
HyperVInstance = "HyperVMigrate";
9-
VMwareInstance = "VMwareMigrate";
8+
HyperVInstance = "HyperVMigrate";
9+
VMwareInstance = "VMwareMigrate";
1010
AzLocalInstance = "AzStackHCI";
1111
}
1212

@@ -101,6 +101,12 @@ $VMwareToolsStatus = @{
101101
NotInstalled = "NotInstalled";
102102
}
103103

104+
$OsType = @{
105+
LinuxGuest = "linuxguest";
106+
WindowsGuest = "windowsguest";
107+
OtherGuestFamily = "otherguestfamily";
108+
}
109+
104110
$VmReplicationValidationMessage = "Replication could not be initiated. Please ensure the necessary changes are made, and allow up to 30 minutes before re-trying."
105111
$VmReplicationValidationMessages = @{
106112
VmPoweredOff = "The VM is currently powered off. $VmReplicationValidationMessage";

src/Migrate/Migrate.Autorest/custom/Helper/CommonHelper.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,14 @@ function ValidateReplication {
277277
throw $VmReplicationValidationMessages.AlreadyInReplication
278278
}
279279

280+
# Check the VM power status
280281
if ($Machine.PowerStatus -eq $PowerStatus.OffVMware -or $Machine.PowerStatus -eq $PowerStatus.OffHyperV) {
281282
throw $VmReplicationValidationMessages.VmPoweredOff
282283
}
283284

284285
if ($MigrationType -eq $AzLocalInstanceTypes.HyperVToAzLocal) {
285-
if (-not $Machine.OperatingSystemDetailOSType -or $Machine.OperatingSystemDetailOSType -eq "") {
286+
if ([string]::IsNullOrEmpty($Machine.OperatingSystemDetailOSType) -or
287+
($Machine.OperatingSystemDetailOSType -eq $OsType.OtherGuestFamily -and [string]::IsNullOrEmpty($Machine.GuestOSDetailOsname))) {
286288
throw $VmReplicationValidationMessages.OsTypeNotFound
287289
}
288290

@@ -292,6 +294,7 @@ function ValidateReplication {
292294
}
293295

294296
if ($MigrationType -eq $AzLocalInstanceTypes.VMwareToAzLocal) {
297+
# Once VMware tools are installed, OS type should be available.
295298
if ($Machine.VMwareToolsStatus -eq $VMwareToolsStatus.NotRunning) {
296299
throw $VmReplicationValidationMessages.VmWareToolsNotRunning
297300
}

0 commit comments

Comments
 (0)