Skip to content

Commit cc267b4

Browse files
committed
removed Enable-HyperV from provisioning steps
because HyperV being enabled prevents NSXT team from being able to use resulting stemcells [#173045518](https://www.pivotaltracker.com/story/show/173045518) As a platform operator I should be able to use Windows stemcells with Hyper-V disabled
1 parent 89c2823 commit cc267b4

File tree

4 files changed

+1
-66
lines changed

4 files changed

+1
-66
lines changed

stemcell-automation/AutomationHelpers.Tests.ps1

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -125,43 +125,6 @@ Describe "InstallCFFeatures" {
125125
}
126126
}
127127

128-
Describe "Enable-HyperV" {
129-
It "executes the Enable-Hyper-V powershell cmdlet when the os version is 2019" {
130-
Mock Enable-Hyper-V { }
131-
Mock Write-Log { }
132-
$osVersion2019 = "10.0.17763.2761"
133-
Mock Get-OSVersionString { $osVersion2019 }
134-
135-
{ Enable-HyperV } | Should -Not -Throw
136-
137-
Assert-MockCalled Enable-Hyper-V -Times 1 -Scope It
138-
Assert-MockCalled Write-Log -Times 1 -Scope It -ParameterFilter { $Message -eq "Successfully enabled HyperV" }
139-
}
140-
141-
It "does not execute the Enable-Hyper-V powershell cmdlet when the os version is not 2019" {
142-
Mock Enable-Hyper-V { }
143-
Mock Write-Log { }
144-
$osVersion1803 = "10.0.17134.2761"
145-
Mock Get-OSVersionString { $osVersion1803 }
146-
147-
{ Enable-HyperV } | Should -Not -Throw
148-
149-
Assert-MockCalled Enable-Hyper-V -Times 0 -Scope It
150-
Assert-MockCalled Write-Log -Times 1 -Scope It -ParameterFilter { $Message -eq "Did not enable HyperV because OS Version is not 2019" }
151-
}
152-
153-
It "fails gracefully when enabling Hyper-V" {
154-
Mock Enable-Hyper-V { throw "unable to comply" }
155-
Mock Write-Log { }
156-
$osVersion2019 = "10.0.17763.2761"
157-
Mock Get-OSVersionString { $osVersion2019 }
158-
159-
{ Enable-HyperV } | Should -Throw "unable to comply"
160-
161-
Assert-MockCalled Write-Log -Times 1 -Scope It -ParameterFilter { $Message -eq "unable to comply" }
162-
Assert-MockCalled Write-Log -Times 1 -Scope It -ParameterFilter { $Message -eq "Failed to enable HyperV. See 'c:\provision\log.log' for more info." }
163-
}
164-
}
165128

166129
Describe "InstallCFCell" {
167130
It "executes the Protect-CFCell powershell cmdlet" {

stemcell-automation/AutomationHelpers.ps1

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,6 @@ function InstallCFFeatures
7171
}
7272
}
7373

74-
function Enable-HyperV
75-
{
76-
try
77-
{
78-
$osVersion2019Regex = "10\.0\.17763\..+"
79-
$osVersion = Get-OSVersionString
80-
if ($osVersion -match $osVersion2019Regex) {
81-
Enable-Hyper-V
82-
Write-Log "Successfully enabled HyperV"
83-
}
84-
else {
85-
Write-Log "Did not enable HyperV because OS Version is not 2019"
86-
}
87-
88-
}
89-
catch [Exception]
90-
{
91-
Write-Log $_.Exception.Message
92-
Write-Log "Failed to enable HyperV. See 'c:\provision\log.log' for more info."
93-
throw $_.Exception
94-
}
95-
}
9674

9775
function InstallCFCell
9876
{

stemcell-automation/ProvisionVM.Tests.ps1

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Describe "ProvisionVM" {
1212
Mock Enable-SSHD { $provisionerCalls.Add("Enable-SSHD") }
1313
Mock Install-SecurityPoliciesAndRegistries { $provisionerCalls.Add("Install-SecurityPoliciesAndRegistries") }
1414
Mock Extract-LGPO { $provisionerCalls.Add("Extract-LGPO") }
15-
Mock Enable-HyperV { $provisionerCalls.Add("Enable-HyperV") }
1615
Mock Install-WUCerts { $provisionerCalls.Add("Install-WUCerts") }
1716
Mock Create-VersionFile { $provisionerCalls.Add("Create-VersionFile") }
1817

@@ -36,11 +35,6 @@ Describe "ProvisionVM" {
3635

3736
Assert-MockCalled -CommandName InstallCFFeatures
3837
}
39-
It "enables Hyper-V when possible" {
40-
ProvisionVM
41-
42-
Assert-MockCalled -CommandName Enable-HyperV
43-
}
4438

4539
It "copy PSModules is the first provisioner called" {
4640
ProvisionVM

stemcell-automation/ProvisionVM.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function ProvisionVM() {
1313
Install-SecurityPoliciesAndRegistries
1414
Enable-SSHD
1515
InstallCFFeatures
16-
Enable-HyperV
16+
1717
try
1818
{
1919
Install-WUCerts

0 commit comments

Comments
 (0)