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

Bug 1810438: oVirt: Add missing piece for gathering bootstrap IP info #4524

Merged
merged 1 commit into from Jan 26, 2021

Conversation

eslutsky
Copy link
Contributor

@eslutsky eslutsky commented Jan 7, 2021

during gather-bootstrap logs need to be gathered from the bootstrap node using ssh,
oVirt engine collects node IP information using the qemu-agent,
we are using oVirt SDK to retrieve this information and choose the correct IP which allows ssh connection.

Signed-off-by: Evgeny Slutsky eslutsky@redhat.com

@eslutsky eslutsky changed the title oVirt: Add missing piece for gathering bootsrap IP info WIP: oVirt: Add missing piece for gathering bootstrap IP info Jan 7, 2021
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 7, 2021
return "", errors.Errorf("failed to lookup bootstrap managed object reference")
}

ip, err := findVirtualMachineIP(client, vmid,"192.168.0.0/16")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is temp for testing , we need to decide about it ..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can examine the api_vip from the config and prefer the choose the bootstrap address in the same network.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eslutsky eslutsky force-pushed the bootstrap_ip branch 5 times, most recently from 528ddac to 72bf1c3 Compare January 11, 2021 14:12
Copy link
Contributor

@dougsland dougsland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but I have some suggestions.

pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
}
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, from line 44 until 73 deserve to be a helper function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would do 44-58 getreportedDevices(...) and leave the rest in the main function "findVirtualMachineIP"

pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
br, err := terraform.LookupResource(tfs, "module.bootstrap", "ovirt_vm", "bootstrap")

if err != nil {
return "", errors.Wrap(err, "failed to lookup bootstrap")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have more details about the vm? Like vmname or vmID? The same apply to the messages bellow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this stage we dont have the vmID

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think bootstrap is bootstrap, remember that it will only be called if the bootstrap phase of the install failed :)

Copy link
Contributor

@Gal-Zaidman Gal-Zaidman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good

pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
}
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would do 44-58 getreportedDevices(...) and leave the rest in the main function "findVirtualMachineIP"

br, err := terraform.LookupResource(tfs, "module.bootstrap", "ovirt_vm", "bootstrap")

if err != nil {
return "", errors.Wrap(err, "failed to lookup bootstrap")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think bootstrap is bootstrap, remember that it will only be called if the bootstrap phase of the install failed :)


func findVirtualMachineIP(c *ovirtsdk4.Connection,moRefValue string) (string, error) {

vmsService := c.SystemService().VmsService()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think tou can do it in one shot with:
vmResp , err := c.SystemService().VmsService().VmService(moRefValue).Get().Send()
if err != nil {
return "",fmt.Errorf("Failed to find VM, by id %v, reason: %v\n",moRefValue, err)
}
VM := vmResp.MustVm()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@eslutsky eslutsky force-pushed the bootstrap_ip branch 3 times, most recently from 66eaf1b to 2aaf9b3 Compare January 18, 2021 19:57
@Gal-Zaidman
Copy link
Contributor

/test e2e-ovirt

1 similar comment
@Gal-Zaidman
Copy link
Contributor

/test e2e-ovirt

@eslutsky eslutsky changed the title WIP: oVirt: Add missing piece for gathering bootstrap IP info Bug 1810438: oVirt: Add missing piece for gathering bootstrap IP info Jan 19, 2021
@openshift-ci-robot openshift-ci-robot added bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jan 19, 2021
@openshift-ci-robot
Copy link
Contributor

@eslutsky: This pull request references Bugzilla bug 1810438, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1810438: oVirt: Add missing piece for gathering bootstrap IP info

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Jan 19, 2021
@openshift-ci-robot
Copy link
Contributor

@eslutsky: This pull request references Bugzilla bug 1810438, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1810438: oVirt: Add missing piece for gathering bootstrap IP info

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

}

return reportedDeviceSlice, nil

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra line :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

for _, ip := range ips.Slice() {
ipres := ip.MustAddress()
if ipres != "" {
if checkPortIsOpen(ipres, "22") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use a const var?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}
defer client.Close()

br, err := terraform.LookupResource(tfs, "module.bootstrap", "ovirt_vm", "bootstrap")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not look for the bootstrap VM in ovirt without terraform? less deps == less problems :)

You can use the same logic as https://github.com/openshift/cluster-api-provider-ovirt/blob/master/pkg/cloud/ovirt/clients/machineservice.go#L275-L291

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think since we operate here externally to the cluster using the id is more reliable, plus it's similar to what other vendors are doing [1].

[1]

moid, found, err := unstructured.NestedString(br.Instances[0].Attributes, "moid")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@Gal-Zaidman
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 20, 2021
@Gal-Zaidman
Copy link
Contributor

/assign @abhinavdahiya @staebler

Copy link
Contributor

@staebler staebler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just nits.

pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
pkg/terraform/gather/ovirt/ip.go Outdated Show resolved Hide resolved
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 24, 2021
@eslutsky eslutsky force-pushed the bootstrap_ip branch 3 times, most recently from 92035a3 to bbb8417 Compare January 25, 2021 08:22
@Gal-Zaidman
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 25, 2021
@eslutsky
Copy link
Contributor Author

/retest

Copy link
Contributor

@staebler staebler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One typo. Otherwise it looks good.
/lgtm cancel
/approve

}
}
}
return "", fmt.Errorf("coudlnt find usable bootstrap IP address for vm id: %s", moRefValue)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return "", fmt.Errorf("coudlnt find usable bootstrap IP address for vm id: %s", moRefValue)
return "", fmt.Errorf("could not find usable bootstrap IP address for vm id: %s", moRefValue)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 25, 2021
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: staebler

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 25, 2021
assuming that the engine already got the ip from the  qemu agent.

Signed-off-by: Evgeny Slutsky <eslutsky@redhat.com>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 26, 2021

@eslutsky: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-aws-workers-rhel7 0b6e8ff link /test e2e-aws-workers-rhel7

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@Gal-Zaidman
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 26, 2021
@openshift-merge-robot openshift-merge-robot merged commit 96de17b into openshift:master Jan 26, 2021
@openshift-ci-robot
Copy link
Contributor

@eslutsky: All pull requests linked via external trackers have merged:

Bugzilla bug 1810438 has been moved to the MODIFIED state.

In response to this:

Bug 1810438: oVirt: Add missing piece for gathering bootstrap IP info

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants