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
Conversation
pkg/terraform/gather/ovirt/ip.go
Outdated
return "", errors.Errorf("failed to lookup bootstrap managed object reference") | ||
} | ||
|
||
ip, err := findVirtualMachineIP(client, vmid,"192.168.0.0/16") |
There was a problem hiding this comment.
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 ..
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is very similar to what is done for choosing the node-ip: https://github.com/openshift/baremetal-runtimecfg/blob/5ba9497f109f6d3170ecc7f0f879e93090cf8eda/pkg/utils/addresses.go#L160-L165
528ddac
to
72bf1c3
Compare
There was a problem hiding this 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
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 :)
72bf1c3
to
58b7367
Compare
There was a problem hiding this 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
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
66eaf1b
to
2aaf9b3
Compare
/test e2e-ovirt |
1 similar comment
/test e2e-ovirt |
2aaf9b3
to
91cb66a
Compare
@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
In response to this:
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. |
@eslutsky: This pull request references Bugzilla bug 1810438, which is valid. 3 validation(s) were run on this bug
In response to this:
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. |
pkg/terraform/gather/ovirt/ip.go
Outdated
} | ||
|
||
return reportedDeviceSlice, nil | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra line :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pkg/terraform/gather/ovirt/ip.go
Outdated
for _, ip := range ips.Slice() { | ||
ipres := ip.MustAddress() | ||
if ipres != "" { | ||
if checkPortIsOpen(ipres, "22") { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
91cb66a
to
b719f0f
Compare
/lgtm |
/assign @abhinavdahiya @staebler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly just nits.
b719f0f
to
f428896
Compare
92035a3
to
bbb8417
Compare
/lgtm |
/retest |
There was a problem hiding this 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
pkg/terraform/gather/ovirt/ip.go
Outdated
} | ||
} | ||
} | ||
return "", fmt.Errorf("coudlnt find usable bootstrap IP address for vm id: %s", moRefValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
[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 |
assuming that the engine already got the ip from the qemu agent. Signed-off-by: Evgeny Slutsky <eslutsky@redhat.com>
bbb8417
to
0b6e8ff
Compare
@eslutsky: The following test failed, say
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. |
/lgtm |
@eslutsky: All pull requests linked via external trackers have merged: Bugzilla bug 1810438 has been moved to the MODIFIED state. In response to this:
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. |
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