-
Notifications
You must be signed in to change notification settings - Fork 478
Extend 'VmConfig' with 'preserved_fds' #5373
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
Merged
rbradford
merged 10 commits into
cloud-hypervisor:main
from
likebreath:0414/vmconfig_preserved_fds
Apr 17, 2023
Merged
Extend 'VmConfig' with 'preserved_fds' #5373
rbradford
merged 10 commits into
cloud-hypervisor:main
from
likebreath:0414/vmconfig_preserved_fds
Apr 17, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e972e7a to
2f755c0
Compare
…/dev/null" This reverts commit 46066d6. Signed-off-by: Bo Chen <chen.bo@intel.com>
…()'" This reverts commit 0567def. Signed-off-by: Bo Chen <chen.bo@intel.com>
This reverts commit 0110fb4. Signed-off-by: Bo Chen <chen.bo@intel.com>
This reverts commit b144275. Signed-off-by: Bo Chen <chen.bo@intel.com>
This reverts commit ea4a95c. Signed-off-by: Bo Chen <chen.bo@intel.com>
2f755c0 to
8c558f1
Compare
rbradford
reviewed
Apr 16, 2023
| // VmConfig instance, such as FDs for creating TAP devices. | ||
| // Perserved FDs will stay open as long as the holding VmConfig instance is | ||
| // valid, and will be closed when the holding VmConfig instance is destroyed. | ||
| pub preserved_fds: Option<Vec<i32>>, |
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.
Cool, but I think this should be #[serde(skip)] I don't think this makes any sense to serialise/deserialise
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 catch. Updated.
Preserved FDs are the ones that share the same life-time as its holding VmConfig instance, such as FDs for creating TAP devices. Preserved FDs will stay open as long as the holding VmConfig instance is valid, and will be closed when the holding VmConfig instance is destroyed. Signed-off-by: Bo Chen <chen.bo@intel.com>
The custom 'clone' duplicates 'preserved_fds' so that the validation logic can be safely carried out on the clone of the VmConfig. The custom 'drop' ensures 'preserved_fds' are safely closed when the holding VmConfig instance is destroyed. Signed-off-by: Bo Chen <chen.bo@intel.com>
Signed-off-by: Bo Chen <chen.bo@intel.com>
In this way, valid FDs for TAP devices will be closed when the holding VmConfig instance is destroyed. Signed-off-by: Bo Chen <chen.bo@intel.com>
In this way, we can cover the scenario where a VM with hotplugged net device using FDs can work properly with reboot. Signed-off-by: Bo Chen <chen.bo@intel.com>
8c558f1 to
d2df3ef
Compare
rbradford
approved these changes
Apr 17, 2023
rbradford
approved these changes
Apr 17, 2023
This was referenced Apr 18, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Preserved FDs are the ones that share the same life-time as its holding
VmConfig instance, such as FDs for creating TAP devices.
Preserved FDs will stay open as long as the holding VmConfig instance is
valid, and will be closed when the holding VmConfig instance is destroyed.