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
Reject CD-ROM devices that use the virtio bus #3107
Conversation
/hold Let's think through the side effects of forcing/not-forcing a default bus before merging. On the one hand, creating a default bus other than virtio might be surprising. On the other, existing manifests that didn't specify a bus (that can happen, right?) will be invalid on accident. |
/cc @davidvossel can I get your opinion on this? |
afaik, cdroms are not allowed on he virtio bus anymore: https://www.redhat.com/archives/libvir-list/2019-January/msg01104.html |
/hold cancel Ok, then this PR basically does the right thing. |
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
/lgtm |
@stu-gott perhaps we should just reject |
I don't understand. We do reject virtio requests for CD-ROM with this PR. |
Signed-off-by: Stu Gott <sgott@redhat.com>
Signed-off-by: Stu Gott <sgott@redhat.com>
Refactor to perform bus validation in one location Signed-off-by: Stu Gott <sgott@redhat.com>
After testing I've confirmed that you're correct @vladikr. scsi bus should also be valid. |
|
||
causes := ValidateVirtualMachineInstanceSpec(k8sfield.NewPath("fake"), &vmi.Spec, config) | ||
Expect(len(causes)).To(Equal(1)) | ||
Expect(causes[0].Field).To(Equal("fake.domain.devices.disks[0].cdrom.bus")) |
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.
@stu-gott this test fails. It expects:
fake.domain.devices.disks.domain.devices.disks[0].cdrom.bus
causes = append(causes, metav1.StatusCause{ | ||
Type: metav1.CauseTypeFieldValueInvalid, | ||
Message: fmt.Sprintf("Bus type %s is invalid for CD-ROM device", bus), | ||
Field: field.Child("domain", "devices", "disks").Index(idx).Child("cdrom", "bus").String(), |
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 you just need field.Index(idx).Child("cdrom", "bus").String()
here?
or field.Child("domain", "devices", "disks", "disk").Index(idx).Child("cdrom", "bus").String()
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 actually caused the other error. Thanks for catching that!
Signed-off-by: Stu Gott <sgott@redhat.com>
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vladikr 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 |
/cherry-pick release-0.26 |
@stu-gott: new pull request created: #3145 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. |
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1802001
Special notes for your reviewer:
Release note: