Skip to content

Commit

Permalink
fix stop vm when no shutdown command
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxtof committed Oct 1, 2024
1 parent b0d0ef2 commit a53ebf7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions builder/nutanix/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -945,17 +945,13 @@ func (d *NutanixDriver) PowerOff(ctx context.Context, vmUUID string) error {

taskUUID := resp.Status.ExecutionContext.TaskUUID.(string)

// Wait for the VM to be deleted
for i := 0; i < 1200; i++ {
resp, err := conn.V3.GetTask(ctx, taskUUID)
if err != nil || *resp.Status != "SUCCEEDED" {
<-time.After(1 * time.Second)
continue
}
return fmt.Errorf("error while GetTask, %s", err.Error())
// Wait for the VM to be stopped
log.Printf("stopping VM: %s", d.Config.VMName)
err = checkTask(ctx, conn, taskUUID)
if err != nil {
return fmt.Errorf("error while stopping VM: %s", err.Error())
}

log.Printf("PowerOff task: %s", taskUUID)
return nil
}
func (d *NutanixDriver) SaveVMDisk(ctx context.Context, diskUUID string, index int, imageCategories []Category) (*nutanixImage, error) {
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

var (
// Version is the main version number that is being run at the moment.
Version = "0.0.3"
Version = "0.9.3"

// VersionPrerelease is A pre-release marker for the Version. If this is ""
// (empty string) then it means that it is a final release. Otherwise, this
Expand Down

0 comments on commit a53ebf7

Please sign in to comment.