|
12 | 12 | // limitations under the License.
|
13 | 13 | // ----------------------------------------------------------------------------------
|
14 | 14 |
|
15 |
| -using System; |
16 |
| -using System.Collections.Generic; |
17 |
| -using System.Linq; |
18 |
| -using System.Management.Automation; |
19 | 15 | using AutoMapper;
|
| 16 | +using Hyak.Common; |
20 | 17 | using Microsoft.Azure.Common.Authentication.Models;
|
21 | 18 | using Microsoft.WindowsAzure.Commands.ServiceManagement.Helpers;
|
| 19 | +using Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.PersistentVMs; |
22 | 20 | using Microsoft.WindowsAzure.Commands.ServiceManagement.Properties;
|
23 | 21 | using Microsoft.WindowsAzure.Commands.Utilities.Common;
|
24 | 22 | using Microsoft.WindowsAzure.Management.Compute;
|
25 | 23 | using Microsoft.WindowsAzure.Management.Compute.Models;
|
26 | 24 | using Microsoft.WindowsAzure.Storage;
|
27 |
| -using Hyak.Common; |
| 25 | +using System; |
| 26 | +using System.Collections.Generic; |
| 27 | +using System.Linq; |
| 28 | +using System.Management.Automation; |
28 | 29 |
|
29 | 30 | namespace Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS
|
30 | 31 | {
|
@@ -71,23 +72,14 @@ internal void ExecuteCommandNewSM()
|
71 | 72 | throw new ArgumentException(Resources.CurrentStorageAccountIsNotAccessible);
|
72 | 73 | }
|
73 | 74 |
|
74 |
| - DateTime dateTimeCreated = DateTime.Now; |
75 | 75 | string diskPartName = VM.RoleName;
|
76 |
| - |
77 | 76 | if (datadisk.DiskLabel != null)
|
78 | 77 | {
|
79 | 78 | diskPartName += "-" + datadisk.DiskLabel;
|
80 | 79 | }
|
81 | 80 |
|
82 |
| - string vhdname = string.Format("{0}-{1}-{2}-{3}-{4}-{5}.vhd", ServiceName, diskPartName, dateTimeCreated.Year, dateTimeCreated.Month, dateTimeCreated.Day, dateTimeCreated.Millisecond); |
83 |
| - string blobEndpoint = currentStorage.BlobEndpoint.AbsoluteUri; |
84 |
| - |
85 |
| - if (blobEndpoint.EndsWith("/") == false) |
86 |
| - { |
87 |
| - blobEndpoint += "/"; |
88 |
| - } |
89 |
| - |
90 |
| - datadisk.MediaLink = new Uri(blobEndpoint + "vhds/" + vhdname); |
| 81 | + var mediaLinkFactory = new MediaLinkFactory(currentStorage, this.ServiceName, diskPartName); |
| 82 | + datadisk.MediaLink = mediaLinkFactory.Create(); |
91 | 83 | }
|
92 | 84 |
|
93 | 85 | if (VM.DataVirtualHardDisks.Count > 1)
|
|
0 commit comments