Skip to content

Conversation

ankitbaluni123
Copy link
Contributor

Description

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Ankit Baluni (from Dev Box) added 4 commits September 8, 2025 15:53
…e parameter

- Added new parameter -Expedite to expedite the operation of a replicating server.
- Updated documentation to include usage examples for the -Expedite parameter.
- Modified existing examples to reflect new project and resource group names.
- Enhanced output formatting in examples to provide clearer information.
- Added tests for the new -Expedite functionality.
- Updated ChangeLog to document the addition of the -Expedite feature.
@Copilot Copilot AI review requested due to automatic review settings September 8, 2025 11:45
Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copy link
Contributor

Thank you for your contribution @ankitbaluni123! We will review the pull request and get back to you soon.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the Get-AzMigrateServerMigrationStatus cmdlet by adding support for the -Expedite parameter, which provides resource utilization analysis and recommendations to accelerate server migration operations. The enhancement adds a new parameter set GetByPrioritiseServer that analyzes shared resources among VMs and provides actionable suggestions for improving migration performance.

Key changes include:

  • Added new parameter set and -Expedite switch parameter
  • Enhanced resource sharing analysis with detailed recommendations
  • Improved output formatting and table generation

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/Migrate/Migrate/help/Get-AzMigrateServerMigrationStatus.md Added documentation for new -Expedite parameter and example usage
src/Migrate/Migrate/ChangeLog.md Added changelog entry for the expedite functionality enhancement
src/Migrate/Migrate.Autorest/test/README.md Minor documentation formatting update (backslash to forward slash)
src/Migrate/Migrate.Autorest/test/Get-AzMigrateServerMigrationStatus.Tests.ps1 Added test stub for new GetByPrioritiseServer parameter set
src/Migrate/Migrate.Autorest/resources/README.md Minor documentation formatting update (backslash to forward slash)
src/Migrate/Migrate.Autorest/examples/Get-AzMigrateServerMigrationStatus.md Added example 4 showing expedite functionality with detailed output
src/Migrate/Migrate.Autorest/docs/Az.Migrate.md Updated module GUID
src/Migrate/Migrate.Autorest/custom/README.md Multiple documentation formatting updates (backslash to forward slash)
src/Migrate/Migrate.Autorest/custom/Get-AzMigrateServerMigrationStatus.ps1 Major implementation changes adding expedite functionality, resource analysis, and recommendations
src/Migrate/Migrate.Autorest/custom/Az.Migrate.custom.psm1 Documentation formatting update (backslash to forward slash)
src/Migrate/Migrate.Autorest/Properties/AssemblyInfo.cs Version number changes


if ($ReplicationMigrationItem.MigrationState -match "MigrationInProgress" -and $ReplicationMigrationItem.migrationProgressPercentage -eq $null) {
return "FinalDeltaReplication Queued"
elseif ($ReplicationMigrationItem.MigrationState -match "InitialSeedingFailed") {
Copy link
Preview

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The state mapping logic should be consistent. Consider using -match for both conditions or -eq for both, rather than mixing comparison operators for similar string matching scenarios.

Suggested change
elseif ($ReplicationMigrationItem.MigrationState -match "InitialSeedingFailed") {
elseif ($ReplicationMigrationItem.MigrationState -eq "InitialSeedingFailed") {

Copilot uses AI. Check for mistakes.

Comment on lines +255 to +259
if ($null -ne $Value) {
return "$Value %"
} else {
return "-"
}
Copy link
Preview

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name Add-Percent is misleading as it doesn't add anything - it formats a value with a percent symbol. Consider renaming to Format-AsPercent or ConvertTo-PercentString for clarity.

Copilot uses AI. Check for mistakes.

}
}

function Add-MBps {
Copy link
Preview

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to Add-Percent, the functions Add-MBps and Add-MB have misleading names as they format rather than add values. Consider renaming to Format-AsMBps and Format-AsMB respectively for better clarity.

Copilot uses AI. Check for mistakes.

}
}

function Add-MB {
Copy link
Preview

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to Add-Percent, the functions Add-MBps and Add-MB have misleading names as they format rather than add values. Consider renaming to Format-AsMBps and Format-AsMB respectively for better clarity.

Copilot uses AI. Check for mistakes.

continue;
}
$replicationState = GetState -State $ReplicationMigrationItem.ProviderSpecificDetail.GatewayOperationDetailState -ReplicationMigrationItem $ReplicationMigrationItem
if ($replicationState -match "Failed" -or $replicationState -match "Completed" -or ($replicationState -notmatch "InProgress" -and $replicationState -notmatch "Queued")) {
Copy link
Preview

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The complex conditional logic for checking replication states could be simplified by defining valid states for expedite operations. Consider creating an array of valid states and using -in or -contains operators for better readability.

Suggested change
if ($replicationState -match "Failed" -or $replicationState -match "Completed" -or ($replicationState -notmatch "InProgress" -and $replicationState -notmatch "Queued")) {
$validExpediteStates = @("Queued", "InProgress")
if (-not ($validExpediteStates -contains $replicationState)) {

Copilot uses AI. Check for mistakes.

if (-not $cols -or $cols.Count -eq 0) { $cols = $existingCols }

# Select columns explicitly and force Format-Table to render all of them (no truncation)
$vmMigrationStatusTable = $vmMigrationStatusTable | Select-Object -Property $cols | Format-Table -Property $cols -AutoSize -Wrap -Force | Out-String -Width 4096
Copy link
Preview

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded width value of 4096 should be defined as a named constant or configuration parameter to improve maintainability and make it easier to adjust if needed.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant