@@ -177,7 +177,7 @@ public void CreateReservedIPThenWindowsVM()
177
177
Utilities . ExecuteAndLog ( ( ) => { dns = vmPowershellCmdlets . NewAzureDns ( dnsName , DNS_IP ) ; } , "Create a new Azure DNS" ) ;
178
178
Utilities . ExecuteAndLog ( ( ) =>
179
179
{
180
- PersistentVM vm = CreateVMObjectWithDataDiskSubnetAndAvailibilitySet ( vmName , OS . Windows ) ;
180
+ PersistentVM vm = Utilities . CreateVMObjectWithDataDiskSubnetAndAvailibilitySet ( vmName , OS . Windows , username , password , subnet ) ;
181
181
vmPowershellCmdlets . NewAzureVM ( serviceName , new [ ] { vm } , vnet , new [ ] { dns } , location : locationName , reservedIPName : reservedIpName ) ;
182
182
} , "Create a new windows azure vm with reserved ip." ) ;
183
183
VerifyReservedIpInUse ( serviceName , input ) ;
@@ -290,7 +290,7 @@ public void CreateWindowsVMThenAssociateReservedIP()
290
290
Utilities . ExecuteAndLog ( ( ) => { dns = vmPowershellCmdlets . NewAzureDns ( dnsName , DNS_IP ) ; } , "Create a new Azure DNS" ) ;
291
291
Utilities . ExecuteAndLog ( ( ) =>
292
292
{
293
- PersistentVM vm = CreateVMObjectWithDataDiskSubnetAndAvailibilitySet ( vmName , OS . Windows ) ;
293
+ PersistentVM vm = Utilities . CreateVMObjectWithDataDiskSubnetAndAvailibilitySet ( vmName , OS . Windows , username , password , subnet ) ;
294
294
vmPowershellCmdlets . NewAzureVM ( serviceName , new [ ] { vm } , vnet , new [ ] { dns } , location : locationName ) ;
295
295
} , "Create a new windows azure vm without reserved ip." ) ;
296
296
@@ -340,7 +340,7 @@ public void TestAssociateReservedIPToStageSlotIaaSFails()
340
340
Utilities . ExecuteAndLog ( ( ) => { dns = vmPowershellCmdlets . NewAzureDns ( dnsName , DNS_IP ) ; } , "Create a new Azure DNS" ) ;
341
341
Utilities . ExecuteAndLog ( ( ) =>
342
342
{
343
- PersistentVM vm = CreateVMObjectWithDataDiskSubnetAndAvailibilitySet ( vmName , OS . Windows ) ;
343
+ PersistentVM vm = Utilities . CreateVMObjectWithDataDiskSubnetAndAvailibilitySet ( vmName , OS . Windows , username , password , subnet ) ;
344
344
vmPowershellCmdlets . NewAzureVM ( serviceName , new [ ] { vm } , vnet , new [ ] { dns } , location : locationName ) ;
345
345
} , "Create a new windows azure vm without reserved ip." ) ;
346
346
@@ -384,7 +384,7 @@ public void CreateWindowsVMWithReservedIPThenDisassociateReservedIP()
384
384
Utilities . ExecuteAndLog ( ( ) => { dns = vmPowershellCmdlets . NewAzureDns ( dnsName , DNS_IP ) ; } , "Create a new Azure DNS" ) ;
385
385
Utilities . ExecuteAndLog ( ( ) =>
386
386
{
387
- PersistentVM vm = CreateVMObjectWithDataDiskSubnetAndAvailibilitySet ( vmName , OS . Windows ) ;
387
+ PersistentVM vm = Utilities . CreateVMObjectWithDataDiskSubnetAndAvailibilitySet ( vmName , OS . Windows , username , password , subnet ) ;
388
388
vmPowershellCmdlets . NewAzureVM ( serviceName , new [ ] { vm } , vnet , new [ ] { dns } , location : locationName , reservedIPName : reservedIpName ) ;
389
389
} , "Create a new windows azure vm with reserved ip." ) ;
390
390
@@ -431,7 +431,7 @@ public void CreateWindowsVMThenReservedExistingIP()
431
431
Utilities . ExecuteAndLog ( ( ) => { dns = vmPowershellCmdlets . NewAzureDns ( dnsName , DNS_IP ) ; } , "Create a new Azure DNS" ) ;
432
432
Utilities . ExecuteAndLog ( ( ) =>
433
433
{
434
- PersistentVM vm = CreateVMObjectWithDataDiskSubnetAndAvailibilitySet ( vmName , OS . Windows ) ;
434
+ PersistentVM vm = Utilities . CreateVMObjectWithDataDiskSubnetAndAvailibilitySet ( vmName , OS . Windows , username , password , subnet ) ;
435
435
vmPowershellCmdlets . NewAzureVM ( serviceName , new [ ] { vm } , vnet , new [ ] { dns } , location : locationName ) ;
436
436
} , "Create a new windows azure vm without reserved ip." ) ;
437
437
@@ -489,7 +489,7 @@ public void CreateReservedIPThenLinuxVM()
489
489
490
490
Utilities . ExecuteAndLog ( ( ) =>
491
491
{
492
- PersistentVM vm = CreateVMObjectWithDataDiskSubnetAndAvailibilitySet ( vmName , OS . Linux ) ;
492
+ PersistentVM vm = Utilities . CreateVMObjectWithDataDiskSubnetAndAvailibilitySet ( vmName , OS . Linux , username , password , subnet ) ;
493
493
vmPowershellCmdlets . NewAzureVM ( serviceName , new [ ] { vm } , vnet , new [ ] { dns } , affinityGroup : affinityGroup , reservedIPName : reservedIpName ) ;
494
494
} , "" ) ;
495
495
VerifyReservedIpInUse ( serviceName , input ) ;
@@ -649,34 +649,6 @@ private void VerifyReservedIpRemoved(string reservedIpName)
649
649
Utilities . VerifyFailure ( ( ) => vmPowershellCmdlets . GetAzureReservedIP ( reservedIpName ) , ResourceNotFoundException ) ;
650
650
}
651
651
652
- private PersistentVM CreateVMObjectWithDataDiskSubnetAndAvailibilitySet ( string vmName , OS os )
653
- {
654
- string disk1 = "Disk1" ;
655
- int diskSize = 30 ;
656
- string availabilitySetName = Utilities . GetUniqueShortName ( "AvailSet" ) ;
657
- string img = string . Empty ;
658
-
659
- bool isWindowsOs = false ;
660
- if ( os == OS . Windows )
661
- {
662
- img = vmPowershellCmdlets . GetAzureVMImageName ( new [ ] { "Windows" } , false ) ;
663
- isWindowsOs = true ;
664
- }
665
- else
666
- {
667
- img = vmPowershellCmdlets . GetAzureVMImageName ( new [ ] { "Linux" } , false ) ;
668
- isWindowsOs = false ;
669
- }
670
-
671
- PersistentVM vm = Utilities . CreateIaaSVMObject ( vmName , InstanceSize . Small , img , isWindowsOs , username , password ) ;
672
- AddAzureDataDiskConfig azureDataDiskConfigInfo1 = new AddAzureDataDiskConfig ( DiskCreateOption . CreateNew , diskSize , disk1 , 0 , HostCaching . ReadWrite . ToString ( ) ) ;
673
- azureDataDiskConfigInfo1 . Vm = vm ;
674
-
675
- vm = vmPowershellCmdlets . SetAzureSubnet ( vm , new string [ ] { subnet } ) ;
676
- vm = vmPowershellCmdlets . SetAzureAvailabilitySet ( availabilitySetName , vm ) ;
677
- return vm ;
678
- }
679
-
680
652
#endregion Helper Methods
681
653
}
682
654
}
0 commit comments