-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
device manager: externally provided mediated devices should not be removed #9250
Conversation
/cc @cdesiniotis @jean-edouard FYI |
@vladikr: GitHub didn't allow me to request PR reviews from the following users: cdesiniotis. Note that only kubevirt members and repo collaborators can review this PR, and authors cannot review their own PRs. 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. |
8e1d43d
to
4d68512
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.
Thank you for tackling this, and well done finding the offending code!
Since this is a draft I'm not sure it's ready for reviews, but see comment below if applicable.
} | ||
removeUndesiredMDEVs(desiredTypesMap) | ||
|
||
removeUndesiredMDEVs(doNotRemoveTypesMap) |
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 function is hard to read, and this call is particularly confusing (remove(doNotRemove)
).
It's probably worth adding to the comment above to describe what's happening.
4d68512
to
9e05b5d
Compare
9e05b5d
to
2db4b5b
Compare
@vladikr I have not closely reviewed this yet; however, does this also address the scenario where mdevs have been created on the system but are not listed under |
@@ -275,15 +275,31 @@ func (c *DeviceController) RefreshMediatedDeviceTypes() { | |||
}() | |||
} | |||
|
|||
func (c *DeviceController) getExternallyProvidedMdevs() map[string]struct{} { | |||
externalMdevResourcesMap := make(map[string]struct{}) |
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.
you can use sets.NewString
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.
Good point @PiotrProkop
However the rest of the file uses similar make()
call, let's keep it like that for consistency.
Maybe we should address that for the whole file/project in a separate PR?
func (c *DeviceController) getExternallyProvidedMdevs() map[string]struct{} { | ||
externalMdevResourcesMap := make(map[string]struct{}) | ||
hostDevs := c.virtConfig.GetPermittedHostDevices() | ||
if len(hostDevs.MediatedDevices) != 0 { |
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.
you can skip this if
, the for loop will just iterate over empty map and end result will be the same.
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.
Thanks!
// the following will remove all configured types that have not been | ||
// created by an external provider and are not in the desiredTypesMap |
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.
intendation is off
func (c *DeviceController) getExternallyProvidedMdevs() map[string]struct{} { | ||
externalMdevResourcesMap := make(map[string]struct{}) | ||
if hostDevs := c.virtConfig.GetPermittedHostDevices(); hostDevs != nil { | ||
if len(hostDevs.MediatedDevices) != 0 { |
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.
you can skip this if
, the for loop will just won't iterate over hostDevs.MediatedDevices when len == 0
6647d89
to
2872ac5
Compare
/test all |
2872ac5
to
3a2aae9
Compare
/test pull-kubevirt-e2e-kind-1.23.vgpu |
@vladikr: The specified target(s) for
The following commands are available to trigger optional jobs:
Use
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. |
/test pull-kubevirt-e2e-kind-1.23-vgpu |
/test pull-kubevirt-e2e-kind-1.23-vgpu |
1 similar comment
/test pull-kubevirt-e2e-kind-1.23-vgpu |
49dc487
to
d1536f1
Compare
d1536f1
to
cd91f82
Compare
/test pull-kubevirt-e2e-kind-1.23-vgpu |
Signed-off-by: Vladik Romanovsky <vromanso@redhat.com>
Signed-off-by: Vladik Romanovsky <vromanso@redhat.com>
Signed-off-by: Vladik Romanovsky <vromanso@redhat.com>
cd91f82
to
a131632
Compare
/test pull-kubevirt-e2e-kind-1.23-vgpu |
a131632
to
0b9f6e4
Compare
@vladikr: The following tests failed, say
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. |
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.
/approve
[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 |
/lgtm |
@vladikr can you edit the release note please? Thanks |
/retest-required |
/cherrypick release-0.59 |
@acardace: new pull request created: #9343 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. |
/cherrypick release-0.58 |
@acardace: #9250 failed to apply on top of branch "release-0.58":
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. |
Created manual backport at #9690 |
What this PR does / why we need it:
virt-handler is deleting any mediated device that is created on the system even if it explicitly
configured as an externally provided resource.
This PR prevents the deletion of externally configured mediated devices.
Mediated devices handling can be disabled altogether by setting a
DisableMDEVConfiguration
feature gate.In this case, no mediated devices will be created or removed.
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 # rhbz#2169880
Special notes for your reviewer:
Release note: