-
Notifications
You must be signed in to change notification settings - Fork 68
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
Running exec in start callback always fails as VM isn't ready #9
Comments
Hi @chiefy ,
The How do you define "booted"? On a linux machine, runlevel 3? What about Windows Server? How does vboxmanage know? What about other operating systems, or systems that might not have guest-utils installed. You can test it yourself with the Virtualbox GUI open, and running the commandline My workaround Even checking the The most reliable way I've found to ensure that your virtual machine is actually completely operational before doing something with it is to actually ping a real service on your virtual machine and check the response. In one of my deployments, I needed to make sure that a node API was running, so I just asked the API if it was alive. You could probably modify your callback to start a |
@michaelsanford dude - thanks for such a great explanation. I was going to look at what Vagrant does, but that totally makes sense. Thank so much for the reply! |
My pleasure, @chiefy ! Your question is surely to be asked by others, so I felt it ought to be thoroughly addressed. Your question even prompted me to start writing a little article on node + vm management patterns. I've been working extensively with node and virtualbox recently, so found a lot of interesting pitfalls and workarounds. I hope to test and merge a big update soon — 2bf68fc. |
I am having an issue, and I know the reason why it's happening, but I am unsure if there is a way to solve it.
When I issue a
virtualbox.start(vm_name, cb)
the callback is getting executed before the VM has fully booted. When I try to execute a command in said VM, it fails as it is not ready for commands. I've "solved" this issue by adding asetTimeout
but it feels very hacky. Is there any way to long-poll the VM and query if it's actually ready to accept commands?Thanks!
The text was updated successfully, but these errors were encountered: