Skip to content

hyperv: If there is no VM , minikube delete should be able to proceed #4459

Closed
@blueelvis

Description

@blueelvis

minikube delete should be able to delete the .minikube folder even if the Hyper-V VM does not exist. For some reason if the Hyper V VM Creation fails, the directory is created but then the minikube delete starts failing. Now, deleting the .minikube directory is the only option as minikube start will also not run.

Maybe add a -force flag to the delete command?

The exact command to reproduce the issue:

  1. .\minikube start --vm-driver "hyperv" --hyperv-virtual-switch "Default Switch" --memory 10 -v 9999 (This will fail stating "'minikube' failed to modify device 'Memory'. (Virtual machine ID 3B02F3CF-034C-4E0A-8972-9567905AF923)
    Invalid startup memory amount assigned for 'minikube'. The minimum amount of memory you can assign to this virtual machine is '32' MB.")
  2. minikube delete -v 9999
    The full output of the command that failed:
PS C:\utilities> .\minikube delete -v 9999
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Hyper-V\Get-VM minikube ).state
[stdout =====>] :
[stderr =====>] : Hyper-V\Get-VM : Hyper-V was unable to find a virtual machine with name "minikube".
At line:1 char:3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM


* Deleting "minikube" from hyperv ...
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Hyper-V\Get-VM minikube ).state
[stdout =====>] :
[stderr =====>] : Hyper-V\Get-VM : Hyper-V was unable to find a virtual machine with name "minikube".
At line:1 char:3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM


[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\Remove-VM minikube -Force
[stdout =====>] :
[stderr =====>] : Hyper-V\Remove-VM : Hyper-V was unable to find a virtual machine with name "minikube".
At line:1 char:1
+ Hyper-V\Remove-VM minikube -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [Remove-VM], VirtualizationException
    + FullyQualifiedErrorId : ObjectNotFound,Microsoft.HyperV.PowerShell.Commands.RemoveVM



X Failed to delete cluster: exit status 1

* Sorry that minikube crashed. If this was unexpected, we would love to hear from you:
  - https://github.com/kubernetes/minikube/issues/new
PS C:\utilities>

The output of the minikube logs command:

PS C:\utilities> .\minikube.exe logs

X command runner: getting ssh client for bootstrapper: Error creating new ssh host from driver: Error getting ssh host name for driver: Host is not running

* Sorry that minikube crashed. If this was unexpected, we would love to hear from you:
  - https://github.com/kubernetes/minikube/issues/new

The operating system version:
Windows 10 Enterprise

Metadata

Metadata

Assignees

Labels

co/hypervHyperV related issueshelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions