Skip to content
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

fix vm declaration #20

Merged
merged 1 commit into from
Jul 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions builder/nutanix/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (d *NutanixDriver) CreateRequest(vm VmConfig) (*v3.VMIntentInput, error) {
if disk.SourceImageUUID != "" {
image, err = findImageByUUID(conn, disk.SourceImageUUID)
if err != nil {
return nil, fmt.Errorf("error while findImageByUUID, Error %s" , err.Error())
return nil, fmt.Errorf("error while findImageByUUID, Error %s", err.Error())
}
} else if disk.SourceImageName != "" {
image, err = findImageByName(conn, disk.SourceImageName)
Expand Down Expand Up @@ -373,13 +373,13 @@ func (d *NutanixDriver) Create(req *v3.VMIntentInput) (*nutanixInstance, error)

log.Printf("waiting for vm (%s) to create: %s", uuid, taskUUID)

vm := &v3.VMIntentResponse{}
var vm *v3.VMIntentResponse
for {
vm, err = conn.V3.GetVM(uuid)
if err == nil {
if *vm.Status.State == "COMPLETE" {
log.Printf("vm created successfully: " + *vm.Status.State)
break
break
} else if *vm.Status.State == "ERROR" {
var errTxt string
for i := 0; i < len(vm.Status.MessageList); i++ {
Expand Down Expand Up @@ -411,7 +411,7 @@ func (d *NutanixDriver) Create(req *v3.VMIntentInput) (*nutanixInstance, error)
log.Printf("VM (%s) configured with ip address %s", uuid, IPAddress)
return &nutanixInstance{nutanix: *vm}, err
}
return nil, fmt.Errorf("not able to get ip address for vm (%s)",uuid)
return nil, fmt.Errorf("not able to get ip address for vm (%s)", uuid)
}

func (d *NutanixDriver) Delete(vmUUID string) error {
Expand Down