Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
Os Upgrade Feature (#411)
Browse files Browse the repository at this point in the history
* os upgradation feature

* remove logs and refactoring

* changing parameter placing for os upgrade

* removed resource naming changes

* resolve comments
  • Loading branch information
shivamverma-ms authored Aug 29, 2023
1 parent a536ea1 commit 7ad02ab
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,28 @@ Function ProcessItemImpl($processor, $csvItem, $reportItem) {
return
}

$osUpgradeVersion = $csvItem.OS_UPGRADE_VERSION

#start the migration
if ([string]::IsNullOrEmpty($TurnOff_SrcServer) -or ($TurnOff_SrcServer -eq 'N') -or ($TurnOff_SrcServer -eq 'No')){
#we are defaulting to this if Turn off Source Server is not mentioned
$MigrateJob = Start-AzMigrateServerMigration -InputObject $ReplicatingServermachine
if([string]::IsNullOrEmpty($osUpgradeVersion)){
$processor.Logger.LogTrace("OS_UPGRADE_VERSION is not mentioned for: '$($sourceMachineName)'")
$reportItem.AdditionalInformation = "OS_VERSION_UPGRADE is not mentioned for: '$($sourceMachineName)'"
$MigrateJob = Start-AzMigrateServerMigration -InputObject $ReplicatingServermachine
} else{
$MigrateJob = Start-AzMigrateServerMigration -InputObject $ReplicatingServermachine -OsUpgradeVersion $osUpgradeVersion
}
}
else {
$MigrateJob = Start-AzMigrateServerMigration -InputObject $ReplicatingServermachine -TurnOffSourceServer
if([string]::IsNullOrEmpty($osUpgradeVersion)){
$processor.Logger.LogTrace("OS_UPGRADE_VERSION is not mentioned for: '$($sourceMachineName)'")
$reportItem.AdditionalInformation = "OS_VERSION_UPGRADE is not mentioned for: '$($sourceMachineName)'"
$MigrateJob = Start-AzMigrateServerMigration -InputObject $ReplicatingServermachine -TurnOffSourceServer
}
else {
$MigrateJob = Start-AzMigrateServerMigration -InputObject $ReplicatingServermachine -TurnOffSourceServer -OsUpgradeVersion $osUpgradeVersion
}
}

if (-not $MigrateJob){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,17 @@ Function ProcessItemImpl($processor, $csvItem, $reportItem) {
}
#End Code for Target Subscription

$TestMigrationJob = Start-AzMigrateTestMigration -InputObject $ReplicatingServermachine -TestNetworkID $Target_VNet.Id
$osUpgradeVersion = $csvItem.OS_UPGRADE_VERSION

if([string]::IsNullOrEmpty($osUpgradeVersion)){
$processor.Logger.LogTrace("OS_UPGRADE_VERSION is not mentioned for: '$($sourceMachineName)'")
$reportItem.AdditionalInformation = "OS_VERSION_UPGRADE is not mentioned for: '$($sourceMachineName)'"
$TestMigrationJob = Start-AzMigrateTestMigration -InputObject $ReplicatingServermachine -TestNetworkID $Target_VNet.Id
}
else{
$TestMigrationJob = Start-AzMigrateTestMigration -InputObject $ReplicatingServermachine -TestNetworkID $Target_VNet.Id -OsUpgradeVersion $osUpgradeVersion
}

if (-not $TestMigrationJob){
$processor.Logger.LogError("Test Migration Job couldn't be initiated for the specified machine: '$($sourceMachineName)'")
$reportItem.AdditionalInformation = "Test Migration Job couldn't be initiated for the specified machine: '$($sourceMachineName)'"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
AZMIGRATEPROJECT_SUBSCRIPTION_ID,AZMIGRATEPROJECT_RESOURCE_GROUP_NAME,AZMIGRATEPROJECT_NAME,SOURCE_MACHINE_NAME,AZMIGRATEASSESSMENT_NAME,AZMIGRATE_APPLIANCE_NAME,OS_UPGRADE_VERSION,AZMIGRATEGROUP_NAME,SQL_SERVER_LICENSE_TYPE,TAG_KEY,TAG_VALUE,VM_TAG_KEY,VM_TAG_VALUE,DISK_TAG_KEY,DISK_TAG_VALUE,NIC_TAG_KEY,NIC_TAG_VALUE,TARGET_SUBSCRIPTION_ID,TARGET_RESOURCE_GROUP_NAME,TARGET_VNET_NAME,TARGET_SUBNET_NAME,TARGET_MACHINE_NAME,TARGET_MACHINE_SIZE,LICENSE_TYPE,OS_DISK_ID,DATA_DISK1_ID,DATA_DISK2_ID,TARGET_DISKTYPE,AVAILABILITYZONE_NUMBER,AVAILABILITYSET_NAME,TURNOFF_SOURCESERVER,TESTMIGRATE_VNET_NAME,UPDATED_TAG_KEY,UPDATED_TAG_VALUE,UPDATED_TAG_OPERATION,UPDATED_VMTAG_KEY,UPDATED_VMTAG_VALUE,UPDATED_VMTAG_OPERATION,UPDATED_DISKTAG_KEY,UPDATED_DISKTAG_VALUE,UPDATED_DISKTAG_OPERATION,UPDATED_NICTAG_KEY,UPDATED_NICTAG_VALUE,UPDATED_NICTAG_OPERATION,UPDATED_TARGET_RESOURCE_GROUP_NAME,UPDATED_TARGET_VNET_NAME,UPDATED_TARGET_MACHINE_NAME,UPDATED_TARGET_DISK_NAME,UPDATED_TARGET_OS_DISK_NAME,UPDATED_TARGET_DATA_DISK1_NAME,UPDATED_TARGET_DATA_DISK2_NAME,UPDATED_TARGET_MACHINE_SIZE,UPDATED_AVAILABILITYZONE_NUMBER,UPDATED_AVAILABILITYSET_NAME,UPDATED_NIC1_ID,UPDATED_TARGET_NIC1_NAME,UPDATED_TARGET_NIC1_SELECTIONTYPE,UPDATED_TARGET_NIC1_SUBNET_NAME,UPDATED_TARGET_NIC1_IP,UPDATED_NIC2_ID,UPDATED_TARGET_NIC2_NAME,UPDATED_TARGET_NIC2_SELECTIONTYPE,UPDATED_TARGET_NIC2_SUBNET_NAME,UPDATED_TARGET_NIC2_IP,OK_TO_UPDATE,OK_TO_MIGRATE,OK_TO_USE_ASSESSMENT,OK_TO_TESTMIGRATE,OK_TO_RETRIEVE_REPLICATIONSTATUS,OK_TO_CLEANUP,OK_TO_TESTMIGRATE_CLEANUP
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx,srcrg-ecy,ECYPROJ,test-ubun22-server-bios-lvm,,sv-app-2,Microsoft Windows Server 2022 (64-bit),srcrg-ecy,PAYG,,,"vm-tag-1,vm-tag-2","vm-tag-val-1,vm-tag-val-2","d1,d2","d1-val,d2-val",n1,n1-val,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx,sv-target-ecy-rg,vnet-ecy,default,testvm-1,,NoLicenseType,,,,,,,Y,vnet-ecy,,,,"up-vm-1,up-vm-2","up-vm-value-1,up-vm-value-2",Replace,disk-1,disk-1-tag,Merge,,,,,,testvm-sv-1,,,,,,,,,nic-name-updated,,,,,,,,,Y,Y,Y,Y,Y,Y,Y
AZMIGRATEPROJECT_SUBSCRIPTION_ID,AZMIGRATEPROJECT_RESOURCE_GROUP_NAME,AZMIGRATEPROJECT_NAME,AZMIGRATE_APPLIANCE_NAME,SOURCE_MACHINE_NAME,OS_UPGRADE_VERSION,AZMIGRATEASSESSMENT_NAME,AZMIGRATEGROUP_NAME,SQL_SERVER_LICENSE_TYPE,TAG_KEY,TAG_VALUE,VM_TAG_KEY,VM_TAG_VALUE,DISK_TAG_KEY,DISK_TAG_VALUE,NIC_TAG_KEY,NIC_TAG_VALUE,TEST_NETWORK_ID,TARGET_SUBSCRIPTION_ID,TARGET_RESOURCE_GROUP_NAME,TARGET_VNET_NAME,TARGET_SUBNET_NAME,TARGET_MACHINE_NAME,TARGET_MACHINE_SIZE,LICENSE_TYPE,OS_DISK_ID,DATA_DISK1_ID,DATA_DISK2_ID,TARGET_DISKTYPE,AVAILABILITYZONE_NUMBER,AVAILABILITYSET_NAME,TURNOFF_SOURCESERVER,TESTMIGRATE_VNET_NAME,UPDATED_TAG_KEY,UPDATED_TAG_VALUE,UPDATED_TAG_OPERATION,UPDATED_VMTAG_KEY,UPDATED_VMTAG_VALUE,UPDATED_VMTAG_OPERATION,UPDATED_DISKTAG_KEY,UPDATED_DISKTAG_VALUE,UPDATED_DISKTAG_OPERATION,UPDATED_NICTAG_KEY,UPDATED_NICTAG_VALUE,UPDATED_NICTAG_OPERATION,UPDATED_TARGET_RESOURCE_GROUP_NAME,UPDATED_TARGET_VNET_NAME,UPDATED_TARGET_MACHINE_NAME,UPDATED_TARGET_DISK_NAME,UPDATED_TARGET_OS_DISK_NAME,UPDATED_TARGET_DATA_DISK1_NAME,UPDATED_TARGET_DATA_DISK2_NAME,UPDATED_TARGET_MACHINE_SIZE,UPDATED_AVAILABILITYZONE_NUMBER,UPDATED_AVAILABILITYSET_NAME,UPDATED_NIC1_ID,UPDATED_TARGET_NIC1_NAME,UPDATED_TARGET_NIC1_SELECTIONTYPE,UPDATED_TARGET_NIC1_SUBNET_NAME,UPDATED_TARGET_NIC1_IP,UPDATED_TARGET_NIC1_TEST_IP,UPDATED_TARGET_NIC1_TEST_SUBNET_NAME,UPDATED_NIC2_ID,UPDATED_TARGET_NIC2_NAME,UPDATED_TARGET_NIC2_SELECTIONTYPE,UPDATED_TARGET_NIC2_SUBNET_NAME,UPDATED_TARGET_NIC2_IP,UPDATED_TARGET_NIC2_TEST_IP,UPDATED_TARGET_NIC2_TEST_SUBNET_NAME,OK_TO_UPDATE,OK_TO_MIGRATE,OK_TO_USE_ASSESSMENT,OK_TO_TESTMIGRATE,OK_TO_RETRIEVE_REPLICATIONSTATUS,OK_TO_CLEANUP,OK_TO_TESTMIGRATE_CLEANUP
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,srcrg-ecy,ECYPROJ,ecyapp,testvm-cvm3,Microsoft Windows Server 2022 (64-bit),,srcrg-ecy,PAYG,,,"vm-tag-1,vm-tag-2","vm-tag-val-1,vm-tag-val-2","d1,d2","d1-val,d2-val",n1,n1-val,,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,sv-target-ecy-rg,vnet-name,default,testvm-1,,NoLicenseType,,,,,,,Y,vnet-ecy,,,,"up-vm-1,up-vm-2","up-vm-value-1,up-vm-value-2",Replace,disk-1,disk-1-tag,Merge,,,,,,testvm-sv-1,,,,,,,,,nic-name-updated,,,,,AzureBastionSubnet,,,,,,,,Y,Y,Y,Y,Y,Y,Y

0 comments on commit 7ad02ab

Please sign in to comment.