machine-drivers / docker-machine-driver-xhyve

docker-machine/minikube/minishift driver plugin for xhyve/hyperkit (native macOS hypervisor.framework)
https://godoc.org/github.com/machine-drivers/docker-machine-driver-xhyve
BSD 3-Clause "New" or "Revised" License
888 stars 74 forks source link

GetState returns running after host reboot #179

Closed gbraad closed 7 years ago

gbraad commented 7 years ago

What could happen is the following:

  1. Minishift is started and the driver plugin registers a PID in ~/.minishift/machines/minishift/minishift.pid
  2. The host machine is rebooted (like in case of an update)
  3. minishift status uses the recorded PID to get the status
  4. It finds a running process (note: this is not xhyve)
  5. docker-machine wrongly assumes that the machine instance is active
  6. minishift ssh therefore will fail to login

Is there a way to make sure the process that is queried for the state is actually related to xhyve?

Related issue: https://github.com/minishift/minishift/issues/1066#issuecomment-311552029 Code: https://github.com/zchee/docker-machine-driver-xhyve/blob/master/xhyve/xhyve.go#L316

gbraad commented 7 years ago

You can test this by modifying the PID file to an existing process, which is not xhyve related. I have fixed this by looking at the process name.

Now it returns an error when the process does not contain docker-machine

$ minishift status
Error: Unable to find 'xhyve' process by PID: 341