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

Reject CD-ROM devices that use the virtio bus #3107

Merged
merged 4 commits into from Mar 12, 2020

Conversation

stu-gott
Copy link
Member

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1802001

Special notes for your reviewer:

Release note:

Default bus for CD-ROM devices is now sata.

@stu-gott stu-gott requested a review from rmohr February 26, 2020 23:00
@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. size/M labels Feb 26, 2020
@stu-gott
Copy link
Member Author

/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.

@kubevirt-bot kubevirt-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 26, 2020
@stu-gott
Copy link
Member Author

stu-gott commented Mar 5, 2020

/cc @davidvossel can I get your opinion on this?

@vladikr
Copy link
Member

vladikr commented Mar 5, 2020

afaik, cdroms are not allowed on he virtio bus anymore: https://www.redhat.com/archives/libvir-list/2019-January/msg01104.html

@stu-gott
Copy link
Member Author

stu-gott commented Mar 5, 2020

/hold cancel

Ok, then this PR basically does the right thing.

@kubevirt-bot kubevirt-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 5, 2020
Copy link
Member

@vladikr vladikr left a comment

Choose a reason for hiding this comment

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

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 7, 2020
@petrkotas
Copy link
Contributor

/lgtm

@vladikr
Copy link
Member

vladikr commented Mar 9, 2020

@stu-gott perhaps we should just reject virtio, I think cd-roms are allowed on SCSI or ide(not q35) ?

@stu-gott
Copy link
Member Author

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>
@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 10, 2020
@stu-gott stu-gott changed the title Reject CD-ROM devices that use a bus other than sata. Reject CD-ROM devices that use the virtio bus Mar 10, 2020
@stu-gott
Copy link
Member Author

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"))
Copy link
Member

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(),
Copy link
Member

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()

Copy link
Member Author

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>
@vladikr
Copy link
Member

vladikr commented Mar 11, 2020

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 11, 2020
@vladikr
Copy link
Member

vladikr commented Mar 12, 2020

/approve

@kubevirt-bot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 12, 2020
@kubevirt-bot kubevirt-bot merged commit ef9cd19 into kubevirt:master Mar 12, 2020
@stu-gott
Copy link
Member Author

/cherry-pick release-0.26

@kubevirt-bot
Copy link
Contributor

@stu-gott: new pull request created: #3145

In response to this:

/cherry-pick release-0.26

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. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants