Merge pull request #512 from hoshposh/vbox-shutdown-issue
builder/virtualbox: sleep after shutdown before export to avoid session locks
This commit is contained in:
commit
b1e1c44f74
|
@ -4,7 +4,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mitchellh/multistep"
|
"github.com/mitchellh/multistep"
|
||||||
"github.com/mitchellh/packer/packer"
|
"github.com/mitchellh/packer/packer"
|
||||||
|
"log"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This step cleans up forwarded ports and exports the VM to an OVF.
|
// This step cleans up forwarded ports and exports the VM to an OVF.
|
||||||
|
@ -21,6 +23,10 @@ func (s *stepExport) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packer.Ui)
|
||||||
vmName := state.Get("vmName").(string)
|
vmName := state.Get("vmName").(string)
|
||||||
|
|
||||||
|
// Wait a second to ensure VM is really shutdown.
|
||||||
|
log.Println("1 second timeout to ensure VM is really shutdown")
|
||||||
|
time.Sleep(1 * time.Second)
|
||||||
|
|
||||||
// Clear out the Packer-created forwarding rule
|
// Clear out the Packer-created forwarding rule
|
||||||
ui.Say("Preparing to export machine...")
|
ui.Say("Preparing to export machine...")
|
||||||
ui.Message(fmt.Sprintf("Deleting forwarded port mapping for SSH (host port %d)", state.Get("sshHostPort")))
|
ui.Message(fmt.Sprintf("Deleting forwarded port mapping for SSH (host port %d)", state.Get("sshHostPort")))
|
||||||
|
|
Loading…
Reference in New Issue