-
Notifications
You must be signed in to change notification settings - Fork 84
CI: Add a minimal virtual machine startup/teardown test. #1330
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
Conversation
Signed-off-by: Matthew Arnold <marnold@redhat.com>
This is needed on cloud clusters that don't use host virtualization or nested virtualization. Assume it is needed in CI. Signed-off-by: Matthew Arnold <marnold@redhat.com>
Also minor factoring of data volume creation, and add a place for the VM creation test. Signed-off-by: Matthew Arnold <marnold@redhat.com>
This clones the CirrOS data volume and attaches it to a new VM, then cleans everything up once it goes running. Signed-off-by: Matthew Arnold <marnold@redhat.com>
| return health == "healthy" | ||
| } | ||
|
|
||
| // Check if KVM emulation is enabled. |
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.
what is KVM?
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.
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.
KVM here means kernel virtual machine, which is a kernel feature that accelerates virtual machines using the virtualization extensions provided by the CPU. Most cloud clusters do not have direct access to the CPU, and can't use KVM. So this pull request turns on an emulation mode that is much slower, but will work on our CI instances.
I took this out by mistake in a previous commit. Signed-off-by: Matthew Arnold <marnold@redhat.com>
| return false | ||
| } | ||
| if !ok { | ||
| log.Printf("No KVM emulation annotation (%s) listed on HCO!", emulationAnnotation) |
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 return false here?
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.
It will as it will hit line no 248.
| err = v.EnsureEmulation(10 * time.Second) | ||
| Expect(err).To(BeNil()) | ||
|
|
||
| err = v.EnsureDataVolume("openshift-cnv", "cirros-dv", "https://download.cirros-cloud.net/0.6.2/cirros-0.6.2-x86_64-disk.img", "128Mi", 5*time.Minute) |
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 do something like?
//"io/ioutil"
//"net/http"
//"strings"
//"fmt"
func getLatestCirrosImageURL() (string, error) {
cirrosVersionURL := "https://download.cirros-cloud.net/version/released"
resp, err := http.Get(cirrosVersionURL)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}
latestCirrosVersion := strings.TrimSpace(string(body))
imageURL := fmt.Sprintf("https://download.cirros-cloud.net/%s/cirros-%s-x86_64-disk.img", latestCirrosVersion, latestCirrosVersion)
return imageURL, 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.
Sure, do you want to open a pull request to https://github.com/mrnold/oadp-operator/tree/ci-create-vm? Or should I just copy and paste this?
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.
copy-paste is fine
mpryc
left a comment
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.
/lgtm
Feel free to update if you like the idea of getting latest cirros img.
| return nil | ||
| } | ||
|
|
||
| func (v *VirtOperator) ensureVm(namespace, name, source string, timeout time.Duration) error { |
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.
here the logic is right? It will check if VM exists (without checking status), but if it fails, then it will check status
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.
Maybe not, it doesn't look like I thought this through. The existence check is really there to speed up development of the CI test itself, since I don't have it tear down and recreate everything from scratch on every run. The status check polling is for the newly created VM. I can probably take out the existence check, since Kubernetes will complain if the VM is already there when the test tries to create it.
Signed-off-by: Matthew Arnold <marnold@redhat.com>
mateusoliveira43
left a comment
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.
From tests log, it is working as expected 😄
|
/lgtm The only test which we are interested in this PR is around kubevirt-aws, which passes. The code does not have any further comments from my side: $ demystifier https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/openshift_oadp-operator/1330/pull-ci-openshift-oadp-operator-master-4.14-e2e-test-kubevirt-aws/1757841604539846656
INFO[0000] Test Demystifier starts its journey >>> start_demystifier_timestamp=1707998188
INFO[0000] Using log from >>> location="https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/test-platform-results/pr-logs/pull/openshift_oadp-operator/1330/pull-ci-openshift-oadp-operator-master-4.14-e2e-test-kubevirt-aws/1757841604539846656/artifacts/e2e-test-kubevirt-aws/e2e/build-log.txt"
Test Summary Table:
---------------------------------------------------------------------------------------------------
| Test Name | Num Attempts | Num Failed | Average Run Time |
---------------------------------------------------------------------------------------------------
| should verify virt installation | 1 | 0 | 0s |
| should create and boot a virtual machine | 1 | 0 | 1m46.047s |
---------------------------------------------------------------------------------------------------
INFO[0000] Test Demystifier finishes its journey >>> end_demystifier_timestamp=1707998189
|
|
/retest We can override the failing ones, but maybe this time will pass as those are unknown flakes. |
|
/override ci/prow/4.12-e2e-test-azure |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mateusoliveira43, mpryc, mrnold, weshayutin 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 |
|
@kaovilai: Overrode contexts on behalf of kaovilai: ci/prow/4.12-e2e-test-azure, ci/prow/4.13-e2e-test-azure, ci/prow/4.14-e2e-test-azure 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. |
|
/override ci/prow/4.12-e2e-test-azure |
|
@kaovilai: Cannot get commit statuses for PR #1330 in openshift/oadp-operator 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. |
) * Remove unused timeouts. Signed-off-by: Matthew Arnold <marnold@redhat.com> * Add ability to enable KVM emulation. This is needed on cloud clusters that don't use host virtualization or nested virtualization. Assume it is needed in CI. Signed-off-by: Matthew Arnold <marnold@redhat.com> * Clone base data volume before creating a VM. Also minor factoring of data volume creation, and add a place for the VM creation test. Signed-off-by: Matthew Arnold <marnold@redhat.com> * Add a test to start a virtual machine. This clones the CirrOS data volume and attaches it to a new VM, then cleans everything up once it goes running. Signed-off-by: Matthew Arnold <marnold@redhat.com> * Clean up base CirrOS disk before removing HCO. I took this out by mistake in a previous commit. Signed-off-by: Matthew Arnold <marnold@redhat.com> * Address some review comments. Signed-off-by: Matthew Arnold <marnold@redhat.com> --------- Signed-off-by: Matthew Arnold <marnold@redhat.com>
Add a test to create and start a virtual machine.