Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaqiluo committed Jul 26, 2024
1 parent d82f559 commit 05caa37
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions libmachine/libmachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,12 @@ func (api *Client) Create(h *host.Host) error {
log.Info("Creating machine...")

if err := api.performCreate(h); err != nil {
// it is possible that the VM is instantiated but fails to bootstrap,
// save the machine to the store, so the VM and associated resources can be found and destroyed later
if err := api.Save(h); err != nil {
log.Warnf("Error saving host to store after creation fails: %s", err)
if h.Driver.DriverName() == "vmwarevsphere" {
// it is possible that the VM is instantiated but fails to bootstrap,
// save the machine to the store, so the VM and associated resources can be found and destroyed later
if err := api.Save(h); err != nil {
log.Warnf("Error saving host to store after creation fails: %s", err)
}
}
return fmt.Errorf("Error creating machine: %s", err)
}
Expand Down

0 comments on commit 05caa37

Please sign in to comment.