Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add memory validation for Hyper-V #17242

Closed
paulomorgado opened this issue Sep 13, 2023 · 2 comments · Fixed by #17325
Closed

Add memory validation for Hyper-V #17242

paulomorgado opened this issue Sep 13, 2023 · 2 comments · Fixed by #17325
Assignees
Labels
co/hyperv HyperV related issues kind/improvement Categorizes issue or PR as related to improving upon a current feature. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.

Comments

@paulomorgado
Copy link

What Happened?

I0913 15:19:28.925045   14776 main.go:141] libmachine: Creating VHD
I0913 15:19:28.925045   14776 main.go:141] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\New-VHD -Path 'C:\Users\***\.minikube\machines\hyperv3\fixed.vhd' -SizeBytes 10MB -Fixed
/ I0913 15:19:30.246678   14776 main.go:141] libmachine: [stdout =====>] :

ComputerName            : DESKTOP-001
Path                    : C:\Users\***\.minikube\machines\hyperv3\fixed.vhd
VhdFormat               : VHD
VhdType                 : Fixed
FileSize                : 10486272
Size                    : 10485760
MinimumSize             :
LogicalSectorSize       : 512
PhysicalSectorSize      : 512
BlockSize               : 0
ParentPath              :
DiskIdentifier          : 77350D06-FAC8-48F8-9461-70FAB8679688
FragmentationPercentage : 0
Alignment               : 1
Attached                : False
DiskNumber              :
IsPMEMCompatible        : False
AddressAbstractionType  : None
Number                  :




I0913 15:19:30.246678   14776 main.go:141] libmachine: [stderr =====>] :
I0913 15:19:30.246678   14776 main.go:141] libmachine: Writing magic tar header
I0913 15:19:30.246678   14776 main.go:141] libmachine: Writing SSH key tar header
I0913 15:19:30.249541   14776 main.go:141] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\Convert-VHD -Path 'C:\Users\***\.minikube\machines\hyperv3\fixed.vhd' -DestinationPath 'C:\Users\***\.minikube\machines\hyperv3\disk.vhd' -VHDType Dynamic -DeleteSource
/ I0913 15:19:31.567001   14776 main.go:141] libmachine: [stdout =====>] :
I0913 15:19:31.567001   14776 main.go:141] libmachine: [stderr =====>] :
I0913 15:19:31.567001   14776 main.go:141] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\Resize-VHD -Path 'C:\Users\***\.minikube\machines\hyperv3\disk.vhd' -SizeBytes 20000MB
| I0913 15:19:32.344893   14776 main.go:141] libmachine: [stdout =====>] :
I0913 15:19:32.344893   14776 main.go:141] libmachine: [stderr =====>] :
I0913 15:19:32.344893   14776 main.go:141] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\New-VM hyperv3 -Path 'C:\Users\***\.minikube\machines\hyperv3' -SwitchName 'Default Switch' -MemoryStartupBytes 5433MB
- I0913 15:19:33.891458   14776 main.go:141] libmachine: [stdout =====>] :
E0913 15:19:33.891458   14776 main.go:137] libmachine: [stderr =====>] : Hyper-V\New-VM : Failed to modify device 'Memory'.
Invalid memory value assigned for 'hyperv3'. Memory values must be properly aligned.
'hyperv3' failed to modify device 'Memory'. (Virtual machine ID 4B2BACA9-07E1-4859-AC6A-C59877E69929)
Invalid memory value assigned for 'hyperv3'. The memory value assigned ('5433' MB) is not properly aligned. Try again with a memory value that is properly aligned. (Virtual machine ID
4B2BACA9-07E1-4859-AC6A-C59877E69929)
At line:1 char:1
+ Hyper-V\New-VM hyperv3 -Path 'C:\Users\***\.minikube\machines\hyper ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.NewVM


I0913 15:19:33.891458   14776 client.go:171] LocalClient.Create took 6.8436245s
/ I0913 15:19:35.904253   14776 start.go:128] duration metric: createHost completed in 8.8574466s
I0913 15:19:35.904253   14776 start.go:83] releasing machines lock for "hyperv3", held for 8.8579564s
W0913 15:19:35.904761   14776 start.go:672] error starting host: creating host: create: creating: exit status 1
I0913 15:19:35.905371   14776 main.go:141] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Hyper-V\Get-VM hyperv3 ).state
\ I0913 15:19:36.203011   14776 main.go:141] libmachine: [stdout =====>] :
E0913 15:19:36.203011   14776 main.go:137] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V was unable to find a virtual machine with name "hyperv3".
At line:1 char:3
+ ( Hyper-V\Get-VM hyperv3 ).state
+   ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (hyperv3:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM


W0913 15:19:36.203011   14776 start.go:677] delete host: Docker machine "hyperv3" does not exist. Use "docker-machine ls" to list machines. Use "docker-machine create" to add a new one.
| W0913 15:19:36.203011   14776 out.go:239] 🤦  StartHost failed, but will try again: creating host: create: creating: exit status 1

🤦  StartHost failed, but will try again: creating host: create: creating: exit status 1
I0913 15:19:36.203011   14776 start.go:687] Will try again in 5 seconds ...
I0913 15:19:41.216176   14776 start.go:365] acquiring machines lock for hyperv3: {Name:mk68e3356386865e9925ab46b683eaa50638bdfd Clock:{} Delay:500ms Timeout:13m0s Cancel:<nil>}
I0913 15:19:41.216686   14776 start.go:369] acquired machines lock for "hyperv3" in 0s
I0913 15:19:41.216686   14776 start.go:96] Skipping create...Using existing machine configuration
I0913 15:19:41.216686   14776 fix.go:54] fixHost starting:
I0913 15:19:41.217229   14776 main.go:141] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Hyper-V\Get-VM hyperv3 ).state
I0913 15:19:41.496924   14776 main.go:141] libmachine: [stdout =====>] :
E0913 15:19:41.496924   14776 main.go:137] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V was unable to find a virtual machine with name "hyperv3".
At line:1 char:3
+ ( Hyper-V\Get-VM hyperv3 ).state
+   ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (hyperv3:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

Succeeds for 2 nodes, but also fails for 4 nodes.

Attach the log file

Cannot get the logs with minikube logs --file=log.txt because the VM is never created.

Operating System

Windows

Driver

Hyper-V

@paulomorgado
Copy link
Author

Using --memory 6g solved the issue.

@spowelljr
Copy link
Member

Glad you were able to resolve your issue, Hyper-V only accepts even values of memory, we should do better validation of this to prevent this in the future.

@spowelljr spowelljr changed the title Unable to create VM when creating a profile with 3 nodes Add memory validation for Hyper-V Sep 29, 2023
@spowelljr spowelljr self-assigned this Sep 29, 2023
@spowelljr spowelljr added co/hyperv HyperV related issues priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. kind/improvement Categorizes issue or PR as related to improving upon a current feature. labels Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/hyperv HyperV related issues kind/improvement Categorizes issue or PR as related to improving upon a current feature. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants