vagrant-smartos / vagrant-smartos-zones

Manage SmartOS local zones in Vagrant
MIT License
54 stars 9 forks source link

zone shutdown on vagrant halt #13

Closed tylerflint closed 9 years ago

tylerflint commented 9 years ago

Currently, the halt action chain hangs trying to shut down the vm. Eventually, vagrant reaches a limit and triggers a hard poweroff through the virtualbox api. I assume this is because the shutdown command is executed in the zone and not the global zone.

There are probably multiple ways this can be solved, and also my assumption of the problem may not be completely correct. Either way, we probably want to shut down the zone prior to vm halt. To do this, I assume we'll need to inject a custom action into the halt chain.

We might also want to see what command is being issued to shut down the global zone. I know solaris is a bit tricky with shutdown. We probably need to ensure the command issued will not queue a shutdown after a period of time, but shutdown immediately.

bixu commented 9 years ago

I’m pretty sure it will be save to just do a ‘sudo poweroff’ in the global zone. This should gracefully trigger a shutdown of any non-global zones.

On Oct 8, 2014, at 5:14 PM, Tyler Flint notifications@github.com wrote:

Currently, the halt action chain hangs trying to shut down the vm. Eventually, vagrant reaches a limit and triggers a hard poweroff through the virtualbox api. I assume this is because the shutdown command is executed in the zone and not the global zone.

There are probably multiple ways this can be solved, and also my assumption of the problem may not be completely correct. Either way, we probably want to shut down the zone prior to vm halt. To do this, I assume we'll need to inject a custom action into the halt chain.

We might also want to see what command is being issued to shut down the global zone. I know solaris is a bit tricky with shutdown. We probably need to ensure the command issued will not queue a shutdown after a period of time, but shutdown immediately.

— Reply to this email directly or view it on GitHub https://github.com/vagrant-smartos/vagrant-smartos-zones/issues/13.

sax commented 9 years ago

I've gotten vagrant halt to work before (without zonegate), so I suspect it's what Tyler said.

It should not be too hard to find an action in the VBox halt chain for us to hook onto, and shut down the zone. To make sure we're doing the right thing in the right place, I suggest we use the 'zone stop' code that uses 'vmadm'.

sax commented 9 years ago

I have a fix for this, but won't be able to push it until late tomorrow, based on my current internet situation.

sax commented 9 years ago

I think this is fixed, but could others test this and see if my commits actually solve the problem?

Also, I suspect that there's something going on in the global zone, that takes it so long to stop. Maybe vagrant is issuing a command that takes a long time to be processed? I think the boxes have something going on with the services as well.

bixu commented 9 years ago

Confirmed working.