Skip to content

Commit ba0ae91

Browse files
committed
Update migration deployment cmdlet
1 parent b7e3f62 commit ba0ae91

File tree

5 files changed

+66
-64
lines changed

5 files changed

+66
-64
lines changed

src/ServiceManagement/Common/Commands.ScenarioTest/Resources/ServiceManagement/ServiceManagementTests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ function Test-MigrateAzureDeployment
640640

641641
Get-AzureVM -ServiceName $svcName -Name $vmName
642642

643-
Move-AzureService -PrepareNew -ServiceName $svcName -DeploymentName $svcName;
643+
Move-AzureService -Prepare -ServiceName $svcName -DeploymentName $svcName -CreateNewVirtualNetwork;
644644

645645
$vm = Get-AzureVM -ServiceName $svcName -Name $vmName;
646646

@@ -688,7 +688,7 @@ function Test-MigrationAbortAzureDeployment
688688

689689
Get-AzureVM -ServiceName $svcName -Name $vmName
690690

691-
Move-AzureService -PrepareNew -ServiceName $svcName -DeploymentName $svcName;
691+
Move-AzureService -Prepare -ServiceName $svcName -DeploymentName $svcName -CreateNewVirtualNetwork;
692692

693693
Get-AzureVM -ServiceName $svcName -Name $vmName;
694694

src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Migration/MoveAzureService.cs

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public class MoveAzureServiceCommand : ServiceManagementBaseCmdlet
3030
{
3131
private const string AbortParameterSetName = "AbortMigrationParameterSet";
3232
private const string CommitParameterSetName = "CommitMigrationParameterSet";
33-
private const string PrepareDefaultParameterSetName = "PrepareDefaultMigrationParameterSet";
3433
private const string PrepareNewParameterSetName = "PrepareNewMigrationParameterSet";
3534
private const string PrepareExistingParameterSetName = "PrepareExistingMigrationParameterSet";
3635

@@ -58,34 +57,17 @@ public SwitchParameter Commit
5857
set;
5958
}
6059

61-
[Parameter(
62-
Position = 0,
63-
Mandatory = true,
64-
ParameterSetName = PrepareDefaultParameterSetName,
65-
HelpMessage = "Prepare migration")]
66-
public SwitchParameter PrepareDefault
67-
{
68-
get;
69-
set;
70-
}
71-
7260
[Parameter(
7361
Position = 0,
7462
Mandatory = true,
7563
ParameterSetName = PrepareNewParameterSetName,
7664
HelpMessage = "Prepare migration")]
77-
public SwitchParameter PrepareNew
78-
{
79-
get;
80-
set;
81-
}
82-
8365
[Parameter(
8466
Position = 0,
8567
Mandatory = true,
8668
ParameterSetName = PrepareExistingParameterSetName,
8769
HelpMessage = "Prepare migration")]
88-
public SwitchParameter PrepareExistingDestinationVNet
70+
public SwitchParameter Prepare
8971
{
9072
get;
9173
set;
@@ -114,22 +96,45 @@ public string DeploymentName
11496
set;
11597
}
11698

99+
[Parameter(
100+
Position = 3,
101+
Mandatory = true,
102+
ParameterSetName = PrepareNewParameterSetName,
103+
HelpMessage = "Prepare migration to new virtual network")]
104+
public SwitchParameter CreateNewVirtualNetwork
105+
{
106+
get;
107+
set;
108+
}
109+
117110
[Parameter(
118111
Position = 3,
119112
Mandatory = true,
120113
ParameterSetName = PrepareExistingParameterSetName,
121-
HelpMessage = "Resource group name for migration")]
122-
[ValidateNotNullOrEmpty]
123-
public string ResourceGroupName
114+
HelpMessage = "Prepare migration to existing virtual network")]
115+
public SwitchParameter UseExistingVirtualNetwork
124116
{
125117
get;
126118
set;
127119
}
128120

121+
129122
[Parameter(
130123
Position = 4,
131124
Mandatory = true,
132125
ParameterSetName = PrepareExistingParameterSetName,
126+
HelpMessage = "Resource group name of existing virtual network for migration")]
127+
[ValidateNotNullOrEmpty]
128+
public string VirtualNetworkResourceGroupName
129+
{
130+
get;
131+
set;
132+
}
133+
134+
[Parameter(
135+
Position = 5,
136+
Mandatory = true,
137+
ParameterSetName = PrepareExistingParameterSetName,
133138
HelpMessage = "Virtual network name for migration")]
134139
[ValidateNotNullOrEmpty]
135140
public string VirtualNetworkName
@@ -139,10 +144,10 @@ public string VirtualNetworkName
139144
}
140145

141146
[Parameter(
142-
Position = 5,
147+
Position = 6,
143148
Mandatory = true,
144149
ParameterSetName = PrepareExistingParameterSetName,
145-
HelpMessage = "Subnet Name for migration")]
150+
HelpMessage = "Subnet name for migration")]
146151
[ValidateNotNullOrEmpty]
147152
public string SubnetName
148153
{
@@ -170,11 +175,7 @@ protected override void OnProcessRecord()
170175
}
171176
else
172177
{
173-
if (this.PrepareDefault.IsPresent)
174-
{
175-
DestinationVNetType = DestinationVirtualNetwork.Default;
176-
}
177-
else if (this.PrepareNew.IsPresent)
178+
if (this.CreateNewVirtualNetwork.IsPresent)
178179
{
179180
DestinationVNetType = DestinationVirtualNetwork.New;
180181
}
@@ -187,7 +188,7 @@ protected override void OnProcessRecord()
187188
? new PrepareDeploymentMigrationParameters
188189
{
189190
DestinationVirtualNetwork = this.DestinationVNetType,
190-
ResourceGroupName = this.ResourceGroupName,
191+
ResourceGroupName = this.VirtualNetworkResourceGroupName,
191192
SubNetName = this.SubnetName,
192193
VirtualNetworkName = this.VirtualNetworkName
193194
}

src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Migration/MoveAzureVirtualNetwork.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
using Microsoft.WindowsAzure.Management.Compute.Models;
2222
using Microsoft.WindowsAzure.Management.Network;
2323

24-
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices
24+
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.Network
2525
{
2626
/// <summary>
2727
/// Migrate ASM virtual network to ARM

src/ServiceManagement/Compute/Commands.ServiceManagement/Migration/MoveAzureService.cs

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public class MoveAzureServiceCommand : ServiceManagementBaseCmdlet
3030
{
3131
private const string AbortParameterSetName = "AbortMigrationParameterSet";
3232
private const string CommitParameterSetName = "CommitMigrationParameterSet";
33-
private const string PrepareDefaultParameterSetName = "PrepareDefaultMigrationParameterSet";
3433
private const string PrepareNewParameterSetName = "PrepareNewMigrationParameterSet";
3534
private const string PrepareExistingParameterSetName = "PrepareExistingMigrationParameterSet";
3635

@@ -58,34 +57,17 @@ public SwitchParameter Commit
5857
set;
5958
}
6059

61-
[Parameter(
62-
Position = 0,
63-
Mandatory = true,
64-
ParameterSetName = PrepareDefaultParameterSetName,
65-
HelpMessage = "Prepare migration")]
66-
public SwitchParameter PrepareDefault
67-
{
68-
get;
69-
set;
70-
}
71-
7260
[Parameter(
7361
Position = 0,
7462
Mandatory = true,
7563
ParameterSetName = PrepareNewParameterSetName,
7664
HelpMessage = "Prepare migration")]
77-
public SwitchParameter PrepareNew
78-
{
79-
get;
80-
set;
81-
}
82-
8365
[Parameter(
8466
Position = 0,
8567
Mandatory = true,
8668
ParameterSetName = PrepareExistingParameterSetName,
8769
HelpMessage = "Prepare migration")]
88-
public SwitchParameter PrepareExistingDestinationVNet
70+
public SwitchParameter Prepare
8971
{
9072
get;
9173
set;
@@ -114,22 +96,45 @@ public string DeploymentName
11496
set;
11597
}
11698

99+
[Parameter(
100+
Position = 3,
101+
Mandatory = true,
102+
ParameterSetName = PrepareNewParameterSetName,
103+
HelpMessage = "Prepare migration to new virtual network")]
104+
public SwitchParameter CreateNewVirtualNetwork
105+
{
106+
get;
107+
set;
108+
}
109+
117110
[Parameter(
118111
Position = 3,
119112
Mandatory = true,
120113
ParameterSetName = PrepareExistingParameterSetName,
121-
HelpMessage = "Resource group name for migration")]
122-
[ValidateNotNullOrEmpty]
123-
public string ResourceGroupName
114+
HelpMessage = "Prepare migration to existing virtual network")]
115+
public SwitchParameter UseExistingVirtualNetwork
124116
{
125117
get;
126118
set;
127119
}
128120

121+
129122
[Parameter(
130123
Position = 4,
131124
Mandatory = true,
132125
ParameterSetName = PrepareExistingParameterSetName,
126+
HelpMessage = "Resource group name of existing virtual network for migration")]
127+
[ValidateNotNullOrEmpty]
128+
public string VirtualNetworkResourceGroupName
129+
{
130+
get;
131+
set;
132+
}
133+
134+
[Parameter(
135+
Position = 5,
136+
Mandatory = true,
137+
ParameterSetName = PrepareExistingParameterSetName,
133138
HelpMessage = "Virtual network name for migration")]
134139
[ValidateNotNullOrEmpty]
135140
public string VirtualNetworkName
@@ -139,10 +144,10 @@ public string VirtualNetworkName
139144
}
140145

141146
[Parameter(
142-
Position = 5,
147+
Position = 6,
143148
Mandatory = true,
144149
ParameterSetName = PrepareExistingParameterSetName,
145-
HelpMessage = "Subnet Name for migration")]
150+
HelpMessage = "Subnet name for migration")]
146151
[ValidateNotNullOrEmpty]
147152
public string SubnetName
148153
{
@@ -170,11 +175,7 @@ protected override void OnProcessRecord()
170175
}
171176
else
172177
{
173-
if (this.PrepareDefault.IsPresent)
174-
{
175-
DestinationVNetType = DestinationVirtualNetwork.Default;
176-
}
177-
else if (this.PrepareNew.IsPresent)
178+
if (this.CreateNewVirtualNetwork.IsPresent)
178179
{
179180
DestinationVNetType = DestinationVirtualNetwork.New;
180181
}
@@ -187,7 +188,7 @@ protected override void OnProcessRecord()
187188
? new PrepareDeploymentMigrationParameters
188189
{
189190
DestinationVirtualNetwork = this.DestinationVNetType,
190-
ResourceGroupName = this.ResourceGroupName,
191+
ResourceGroupName = this.VirtualNetworkResourceGroupName,
191192
SubNetName = this.SubnetName,
192193
VirtualNetworkName = this.VirtualNetworkName
193194
}

src/ServiceManagement/Compute/Commands.ServiceManagement/Migration/MoveAzureVirtualNetwork.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
using Microsoft.WindowsAzure.Management.Compute.Models;
2222
using Microsoft.WindowsAzure.Management.Network;
2323

24-
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices
24+
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.Network
2525
{
2626
/// <summary>
2727
/// Migrate ASM virtual network to ARM

0 commit comments

Comments
 (0)