Skip to content

Commit fc73486

Browse files
committed
Merge pull request #135 from AzCiS/build
[StorSimple] Added Migration Related command lets.
2 parents f42c8f8 + 6883fea commit fc73486

20 files changed

+1340
-678
lines changed

ChangeLog.txt

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,25 @@
7777
* Remove-AzureBatchVMUser
7878
* Get-AzureBatchRDPFile
7979
* Get-AzureBatchVMFileContents
80+
* StorSimple: New StorSimple commands in AzureServiceManagement mode
81+
* Added cmdlets
82+
* Confirm-AzureStorSimpleLegacyVolumeContainerStatus
83+
* Get-AzureStorSimpleLegacyVolumeContainerConfirmStatus
84+
* Get-AzureStorSimpleLegacyVolumeContainerMigrationPlan
85+
* Get-AzureStorSimpleLegacyVolumeContainerStatus
86+
* Import-AzureStorSimpleLegacyApplianceConfig
87+
* Import-AzureStorSimpleLegacyVolumeContainer
88+
* Start-AzureStorSimpleLegacyVolumeContainerMigrationPlan
89+
* New-AzureStorSimpleVirtualDeviceCommand
90+
* Get-AzureStorSimpleJob
91+
* Stop-AzureStorSimpleJob
92+
* Start-AzureStorSimpleBackupCloneJob
93+
* Get-AzureStorSimpleFailoverVolumeContainers
94+
* Start-AzureStorSimpleDeviceFailoverJob
95+
* New-AzureStorSimpleNetworkConfig
96+
* Set-AzureStorSimpleDevice
97+
* Set-AzureStorSimpleVirtualDevice
98+
8099

81100
2015.03.31 version 0.8.16
82101
* Azure Data Factory:
@@ -148,9 +167,9 @@
148167
* Set-AzureRemoteAppWorkspace
149168
* Unpublish-AzureRemoteAppProgram
150169
* Update-AzureRemoteAppCollection
151-
170+
152171
* Storage: new cmdlets
153-
* Get-AzureStorageContainerStoredAccessPolicy
172+
* Get-AzureStorageContainerStoredAccessPolicy
154173
* Get-AzureStorageQueueStoredAccessPolicy
155174
* Get-AzureStorageTableStoredAccessPolicy
156175
* New-AzureStorageContainerStoredAccessPolicy
@@ -194,7 +213,7 @@
194213
* Start-AzureSiteRecoveryCommitFailoverJob
195214
* Start-AzureSiteRecoveryPlannedFailoverJob
196215
* Start-AzureSiteRecoveryTestFailoverJob
197-
216+
198217
* Azure ExpressRoute cmdlet updates
199218
* Fixed bugs in:
200219
* New-AzureDedicatedCircuit
@@ -207,12 +226,12 @@
207226
* Update-AzureDedicatedCircuitBandwidth
208227

209228
* Azure SQL Database: new cmdlets for managing database dynamic data masking policies:
210-
* Get-AzureSqlDatabaseDataMaskingPolicy
211-
* Set-AzureSqlDatabaseDataMaskingPolicy
212-
* New-AzureSqlDatabaseDataMaskingRule
213-
* Get-AzureSqlDatabaseDataMaskingRule
214-
* Set-AzureSqlDatabaseDataMaskingRule
215-
* Remove-AzureSqlDatabaseDataMaskingRule
229+
* Get-AzureSqlDatabaseDataMaskingPolicy
230+
* Set-AzureSqlDatabaseDataMaskingPolicy
231+
* New-AzureSqlDatabaseDataMaskingRule
232+
* Get-AzureSqlDatabaseDataMaskingRule
233+
* Set-AzureSqlDatabaseDataMaskingRule
234+
* Remove-AzureSqlDatabaseDataMaskingRule
216235

217236
* Azure Batch: new cmdlets:
218237
* Get-AzureBatchPool
@@ -230,22 +249,22 @@
230249
* Update-AzureDisk
231250
* Set-AzureOSDisk
232251
* Set-AzureDataDisk (DiskName parameter is also added along with ResizedSizeInGB)
233-
234-
* AzureProfile:
252+
253+
* AzureProfile:
235254
* New cmdlets to manage in-memory profiles
236255
* New-AzureProfile: Create a new in-memory Profile
237256
* Select-AzureProfile: Select the profile to be used in the current session
238257
* Added -Profile parameter to every cmdlet - the cmdlet will use the passed-in profile to authenticate with Azure
239-
258+
240259
2015.02.12 version 0.8.14
241260
* StorSimple: New StorSimple commands in AzureServiceManagement mode:
242261
* GetAzureStorSimpleAccessControlRecord
243262
* GetAzureStorSimpleStorageAccountCredential
244263
* RemoveAzureStorSimpleAccessControlRecord
245264
* RemoveAzureStorSimpleStorageAccountCredential
246265
* SetAzureStorSimpleAccessControlRecord
247-
* GetAzureStorSimpleDeviceVolume
248-
* RemoveAzureStorSimpleDeviceVolume
266+
* GetAzureStorSimpleDeviceVolume
267+
* RemoveAzureStorSimpleDeviceVolume
249268
* GetAzureStorSimpleDeviceVolumeContainer
250269
* RemoveAzureStorSimpleDeviceVolumeContainer
251270
* GetAzureStorSimpleDevice
@@ -277,19 +296,19 @@
277296
* ClusterType (update): New value (Spark) can be specified as cluster type
278297
* Add-AzureHDInsightConfigValues cmdlet:
279298
* Spark (new): collection of configuration properties can be passed in to customize the Spark service
280-
299+
281300
* Azure Insights cmdlets in AzureResourceManager Mode:
282301
* Get-AzureCrrelationLogId
283302
* Get-AzureResourceGroupLog
284303
* Get-AzureResourceLog
285304
* Get-AzureResourceProviderLog
286305
* Get-AzureSubscriptionIdLog
287-
306+
288307
* Azure VM cmdlets
289308
* Get-AzureVMDscExtentionStatus: Get the DSC Extension status for a cloud service or VM
290-
309+
291310
* Updates and bug fixes for AzureAutomation and AzureDataFactory cmdlets
292-
311+
293312
2015.01.08 version 0.8.13
294313
* Key Vault Service - new cmdlets in AzureResourceManager mode:
295314
* Keys:
@@ -371,7 +390,7 @@
371390
* Remove-AzureSqlDatabaseServerAuditing
372391
* Use-AzureSqlDatabaseServerAuditingPolicy
373392
* Allow users to define which storage account key (Primary or Secondary) to use when defining audit policy, using the “StorageKeyType” parameter.
374-
393+
375394
2014.10.27 Version 0.8.10
376395
* Azure Data Factory cmdlets in AzureResourceManager mode
377396
* New-AzureDataFactory

src/ServiceManagement/StorSimple/Commands.StorSimple.Test/Commands.StorSimple.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Scheduler.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Scheduler.dll</HintPath>
8181
</Reference>
8282
<Reference Include="Microsoft.WindowsAzure.Management.StorSimple">
83-
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.StorSimple.1.0.3-preview\lib\net40\Microsoft.WindowsAzure.Management.StorSimple.dll</HintPath>
83+
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.StorSimple.1.0.4-preview\lib\net40\Microsoft.WindowsAzure.Management.StorSimple.dll</HintPath>
8484
</Reference>
8585
<Reference Include="Newtonsoft.Json">
8686
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>

src/ServiceManagement/StorSimple/Commands.StorSimple.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
1313
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
1414
<package id="Microsoft.WindowsAzure.Management.Scheduler" version="6.0.0" targetFramework="net45" />
15-
<package id="Microsoft.WindowsAzure.Management.StorSimple" version="1.0.3-preview" targetFramework="net45" />
15+
<package id="Microsoft.WindowsAzure.Management.StorSimple" version="1.0.4-preview" targetFramework="net45" />
1616
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
1717
<package id="xunit" version="1.9.2" targetFramework="net45" />
1818
</packages>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.WindowsAzure.Commands.StorSimple.Properties;
16+
using Microsoft.WindowsAzure.Management.StorSimple;
17+
using Microsoft.WindowsAzure.Management.StorSimple.Models;
18+
using System;
19+
using System.Collections.Generic;
20+
using System.Linq;
21+
using System.Management.Automation;
22+
using System.Text;
23+
24+
namespace Microsoft.WindowsAzure.Commands.StorSimple.Cmdlets
25+
{
26+
[Cmdlet(VerbsLifecycle.Confirm, "AzureStorSimpleLegacyVolumeContainerStatus")]
27+
public class ConfirmAzureStorSimpleLegacyVolumeContainerStatus : StorSimpleCmdletBase
28+
{
29+
[Parameter(Mandatory = true, Position = 0, HelpMessage = StorSimpleCmdletHelpMessage.MigrationConfigId)]
30+
[ValidateNotNullOrEmpty]
31+
public string LegacyConfigId { get; set; }
32+
33+
[Parameter(Mandatory = true, Position = 1, HelpMessage = StorSimpleCmdletHelpMessage.MigrationOperation)]
34+
[ValidateSet("Commit", "Rollback", IgnoreCase = true)]
35+
public string MigrationOperation { get; set; }
36+
37+
[Parameter(Mandatory = false, Position = 2,
38+
HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
39+
public string[] LegacyContainerNames { get; set; }
40+
41+
public override void ExecuteCmdlet()
42+
{
43+
try
44+
{
45+
var confirmMigrationRequest = new MigrationConfirmStatusRequest();
46+
confirmMigrationRequest.Operation =
47+
(MigrationOperation) Enum.Parse(typeof (MigrationOperation), MigrationOperation, true);
48+
confirmMigrationRequest.DataContainerNameList = (null != LegacyContainerNames)
49+
? new List<string>(LegacyContainerNames.ToList().Distinct(StringComparer.InvariantCultureIgnoreCase))
50+
: new List<string>();
51+
var status = StorSimpleClient.ConfirmLegacyVolumeContainerStatus(LegacyConfigId, confirmMigrationRequest);
52+
MigrationCommonModelFormatter opFormatter = new MigrationCommonModelFormatter();
53+
WriteObject(opFormatter.GetResultMessage(Resources.ConfirmMigrationSuccessMessage, status));
54+
}
55+
catch (Exception except)
56+
{
57+
this.HandleException(except);
58+
}
59+
}
60+
}
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.WindowsAzure.Management.StorSimple;
16+
using System;
17+
using System.Linq;
18+
using System.Management.Automation;
19+
20+
namespace Microsoft.WindowsAzure.Commands.StorSimple.Cmdlets
21+
{
22+
[Cmdlet(VerbsCommon.Get, "AzureStorSimpleLegacyVolumeContainerConfirmStatus")]
23+
public class GetAzureStorSimpleLegacyVolumeContainerConfirmStatus : StorSimpleCmdletBase
24+
{
25+
[Parameter(Mandatory = true, Position = 0, HelpMessage = StorSimpleCmdletHelpMessage.MigrationConfigId)]
26+
[ValidateNotNullOrEmpty]
27+
public string LegacyConfigId { get; set; }
28+
29+
[Parameter(Mandatory = false, Position = 1,
30+
HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
31+
public string[] LegacyContainerNames { get; set; }
32+
33+
public override void ExecuteCmdlet()
34+
{
35+
try
36+
{
37+
StorSimpleClient.UpdateMigrationConfirmStatusSync(LegacyConfigId);
38+
var confirmStatus = StorSimpleClient.GetMigrationConfirmStatus(LegacyConfigId);
39+
if (0 < confirmStatus.ContainerConfirmStatus.Count)
40+
{
41+
if (null != LegacyContainerNames)
42+
{
43+
var legacyContainerNameList = LegacyContainerNames.ToList();
44+
confirmStatus.ContainerConfirmStatus = confirmStatus.ContainerConfirmStatus.ToList().FindAll(
45+
status =>
46+
legacyContainerNameList.Contains(status.CloudConfigurationName,
47+
StringComparer.InvariantCultureIgnoreCase));
48+
}
49+
}
50+
51+
var confirmStatusMsg = new ConfirmMigrationStatusMsg(LegacyConfigId, confirmStatus);
52+
WriteObject(confirmStatusMsg);
53+
}
54+
catch (Exception except)
55+
{
56+
this.HandleException(except);
57+
}
58+
}
59+
}
60+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.WindowsAzure.Commands.StorSimple.Properties;
16+
using Microsoft.WindowsAzure.Management.StorSimple;
17+
using Microsoft.WindowsAzure.Management.StorSimple.Models;
18+
using System;
19+
using System.Linq;
20+
using System.Management.Automation;
21+
22+
namespace Microsoft.WindowsAzure.Commands.StorSimple.Cmdlets
23+
{
24+
[Cmdlet(VerbsCommon.Get, "AzureStorSimpleLegacyVolumeContainerMigrationPlan"), OutputType(typeof(MigrationConfig), typeof(MigrationPlanMsg))]
25+
public class GetAzureStorSimpleLegacyVolumeContainerMigrationPlan : StorSimpleCmdletBase
26+
{
27+
[Parameter(Mandatory = false, Position = 0, HelpMessage = StorSimpleCmdletHelpMessage.MigrationConfigId)]
28+
[ValidateNotNullOrEmpty]
29+
public string LegacyConfigId { get; set; }
30+
31+
[Parameter(Mandatory = false, Position = 1,
32+
HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
33+
public string[] LegacyContainerNames { get; set; }
34+
35+
public override void ExecuteCmdlet()
36+
{
37+
try
38+
{
39+
if (string.IsNullOrEmpty(LegacyConfigId))
40+
{
41+
var migrationPlanList = StorSimpleClient.GetAllMigrationPlan();
42+
if (migrationPlanList.MigrationPlans.Count == 0)
43+
{
44+
WriteWarning(Resources.MigrationPlanNoConfigs);
45+
}
46+
else
47+
{
48+
foreach (var migrationPlan in migrationPlanList.MigrationPlans)
49+
{
50+
var migrationPlanConfig = new MigrationConfig(migrationPlan);
51+
WriteObject(migrationPlanConfig);
52+
}
53+
}
54+
}
55+
else
56+
{
57+
StorSimpleClient.UpdateMigrationPlanSync(LegacyConfigId);
58+
var migrationPlanList = StorSimpleClient.GetMigrationPlan(LegacyConfigId);
59+
if (0 >= migrationPlanList.MigrationPlans.Count)
60+
{
61+
throw new ArgumentException(Resources.MigrationPlanNotFound);
62+
}
63+
else
64+
{
65+
MigrationPlan migrationPlan = migrationPlanList.MigrationPlans.First();
66+
if (null != LegacyContainerNames)
67+
{
68+
var legacyContainerNamesList = LegacyContainerNames.ToList();
69+
migrationPlan.MigrationPlanInfo =
70+
migrationPlan.MigrationPlanInfo.ToList().FindAll(
71+
plan =>
72+
legacyContainerNamesList.Contains(plan.DataContainerName,
73+
StringComparer.InvariantCultureIgnoreCase));
74+
}
75+
76+
var migrationPlanMsg = new MigrationPlanMsg(migrationPlan);
77+
WriteObject(migrationPlanMsg);
78+
}
79+
}
80+
}
81+
catch (Exception except)
82+
{
83+
this.HandleException(except);
84+
}
85+
}
86+
}
87+
}

0 commit comments

Comments
 (0)