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

Add support for USB Disks #8159

Merged
merged 2 commits into from Aug 23, 2022
Merged

Add support for USB Disks #8159

merged 2 commits into from Aug 23, 2022

Conversation

acardace
Copy link
Member

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Release note:

Add support for USB disks

@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/L labels Jul 22, 2022
@acardace
Copy link
Member Author

/retest-required

@rmohr
Copy link
Member

rmohr commented Jul 26, 2022

Hey @acardace I am curious, what are the use-cases for usb disks?

@acardace
Copy link
Member Author

acardace commented Aug 3, 2022

Hey @acardace I am curious, what are the use-cases for usb disks?

Hi @rmohr, it's pretty much for completeness since you can construct such a VM with plain libvirt or qemu.

Also, it can be useful for os-level debugging or test purposes.

@acardace
Copy link
Member Author

acardace commented Aug 3, 2022

/retest-required

Copy link
Member

@rmohr rmohr left a comment

Choose a reason for hiding this comment

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

Looks pretty good. Two minor things.

tests/storage/storage.go Show resolved Hide resolved
//In ppc64le usb devices like mouse / keyboard are set by default,
//so we can't disable the controller otherwise we run into the following error:
//"unsupported configuration: USB is disabled for this domain, but USB devices are present in the domain XML"
if !isAMD64(c.Architecture) {
Copy link
Member

Choose a reason for hiding this comment

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

@zhlhahaha I wonder if we thought about this place also for arm.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that'd be interesting, I've left it as it was but this check could be specialized for ppc64le if there's no need for it in other arches different than x86_64.

Copy link
Contributor

@zhlhahaha zhlhahaha Aug 3, 2022

Choose a reason for hiding this comment

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

Usb storage is not supported by the qemu-kvm binary on Arm64, we only support following storage devices.

Storage devices:
name "scsi-block", bus SCSI, desc "SCSI block device passthrough"
name "scsi-cd", bus SCSI, desc "virtual SCSI CD-ROM"
name "scsi-disk", bus SCSI, desc "virtual SCSI disk or CD-ROM (legacy)"
name "scsi-generic", bus SCSI, desc "pass through generic scsi device (/dev/sg*)"
name "scsi-hd", bus SCSI, desc "virtual SCSI disk"
name "vhost-user-fs-device", bus virtio-bus
name "vhost-user-fs-pci", bus PCI
name "virtio-blk-device", bus virtio-bus
name "virtio-blk-pci", bus PCI, alias "virtio-blk"
name "virtio-blk-pci-non-transitional", bus PCI
name "virtio-blk-pci-transitional", bus PCI
name "virtio-scsi-device", bus virtio-bus
name "virtio-scsi-pci", bus PCI, alias "virtio-scsi"
name "virtio-scsi-pci-non-transitional", bus PCI
name "virtio-scsi-pci-transitional", bus PCI

So I think USB Disks may not work on Arm64.

Copy link
Contributor

Choose a reason for hiding this comment

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

There are so many limitation caused by qemu-kvm binary on Arm64, so I think if it is possible to build qemu-kvm in a normal way rather than removing so many devices. @rmohr

Copy link
Contributor

Choose a reason for hiding this comment

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

@zhlhahaha do we need to fail admission of VMIs with USB disks on Arm64 then?

Copy link
Contributor

Choose a reason for hiding this comment

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

@zhlhahaha do we need to fail admission of VMIs with USB disks on Arm64 then?

I think so.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah! I think this PR will do: #7007

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah! I think this PR will do: #7007

Yes

@rmohr
Copy link
Member

rmohr commented Aug 3, 2022

Hey @acardace I am curious, what are the use-cases for usb disks?

Hi @rmohr, it's pretty much for completeness since you can construct such a VM with plain libvirt or qemu.

Also, it can be useful for os-level debugging or test purposes.

Thanks for the details, I was hoping for some more concrete examples where we saw someone blocked or where adding an usb disk upfront helped debugging somehow. Do you know about some cases?

@acardace
Copy link
Member Author

acardace commented Aug 3, 2022

Hey @acardace I am curious, what are the use-cases for usb disks?

Hi @rmohr, it's pretty much for completeness since you can construct such a VM with plain libvirt or qemu.
Also, it can be useful for os-level debugging or test purposes.

Thanks for the details, I was hoping for some more concrete examples where we saw someone blocked or where adding an usb disk upfront helped debugging somehow. Do you know about some cases?

The best example I can think of is debugging a USB device kernel driver or the USB emulation code in qemu.

@rmohr
Copy link
Member

rmohr commented Aug 3, 2022

/lgtm

lgtm for the code.

Not approving yet. Adding @davidvossel and @vladikr to hear their opinion about this, since we don't seem to have an immediate use-case for this.

@rmohr rmohr added the lgtm Indicates that a PR is ready to be merged. label Aug 3, 2022
@rmohr
Copy link
Member

rmohr commented Aug 3, 2022

/cc @davidvossel
/cc @vladikr

@acardace
Copy link
Member Author

acardace commented Aug 3, 2022

/test pull-kubevirt-e2e-k8s-1.22-sig-compute-migrations

tests/migration_test.go Outdated Show resolved Hide resolved
@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 5, 2022
Copy link
Contributor

@jean-edouard jean-edouard left a comment

Choose a reason for hiding this comment

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

Code LGTM, just a couple concerns about ARM and comment wording.
Also, functional tests are failing because of an obsolete helper function.

)

By("Starting the VirtualMachineInstance")
vmi = runVMIAndExpectLaunch(vmi, 240)
Copy link
Contributor

Choose a reason for hiding this comment

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

@acardace this function doesn't exist anymore, which is why the tests fail

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks, didn't rebase against master in my local workspace :)


//usb controller is turned on, only when user specify input device with usb bus,
//otherwise it is turned off
//In ppc64le usb devices like mouse / keyboard are set by default,
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment seems to assume that the only USB devices are input devices, which is not true anymore.
It's also hard to read, probably worth reworking...

Copy link
Member Author

Choose a reason for hiding this comment

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

I just removed the first 2 lines, thanks for noticing that.

Signed-off-by: Antonio Cardace <acardace@redhat.com>
@jean-edouard
Copy link
Contributor

With this patch volumes can be attached to a VMI
as USB mass storage devices.

adjust existing Disk tests and add a new
e2e one specific to USB disks.

Signed-off-by: Antonio Cardace <acardace@redhat.com>
@acardace
Copy link
Member Author

/retest

Copy link
Contributor

@jean-edouard jean-edouard left a comment

Choose a reason for hiding this comment

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

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jean-edouard

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 Aug 22, 2022
@acardace acardace requested review from rmohr and removed request for kbidarkar, davidvossel and alicefr August 22, 2022 13:53
@acardace
Copy link
Member Author

@rmohr can you take another look? I just had to rebase pretty much.

@rmohr
Copy link
Member

rmohr commented Aug 22, 2022

Seems like no objections to adding usb disk support.

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 22, 2022
@rmohr
Copy link
Member

rmohr commented Aug 22, 2022

@rmohr can you take another look? I just had to rebase pretty much.

Will probably compete with #7007. Let's see who wins the race :)

@acardace
Copy link
Member Author

/retest

@kubevirt-bot
Copy link
Contributor

kubevirt-bot commented Aug 22, 2022

@acardace: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubevirt-fossa 2579ebd link false /test pull-kubevirt-fossa

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.

@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@kubevirt-bot kubevirt-bot merged commit 3fe3b04 into kubevirt:main Aug 23, 2022
@acardace
Copy link
Member Author

@rmohr can you take another look? I just had to rebase pretty much.

Will probably compete with #7007. Let's see who wins the race :)

Thank you for taking a look, btw won :)

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/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants