-
Notifications
You must be signed in to change notification settings - Fork 723
[daemon] trigger on_restart for a running VM after daemon boot #4007
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
Conversation
8b170e9
to
096cb66
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4007 +/- ##
==========================================
+ Coverage 89.52% 89.55% +0.03%
==========================================
Files 260 260
Lines 14749 14757 +8
==========================================
+ Hits 13204 13216 +12
+ Misses 1545 1541 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b8909d3
to
e9f9a95
Compare
Hey @xmkg, is this still valid and is it ready for review? |
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.
Looking good! Just a couple questions and a nitpick.
The MP #4010 has to be merged before this one. |
Hi @xmkg |
The scenario in which this is needed is a daemon crash, where things are not nicely being wrapped up as they would in a graceful exit. The current implementation of the "on_restart" function initializes the daemon-side resources needed by a VM to function properly, e.g., a mount's daemon-side counterpart, as in SSHFS. So, assume that we have an SSHFS-mounted VM in a running state, and the daemon crashes. When the daemon is restarted, the spec's state would be The patch fixes that by triggering the on_restart function for the vm.state == running and vm.state == starting. These two states won't require a vm->start() call, so it's being handled separately. |
Thanks for the explanation. The code change does help in this corner case. Actually, this particular corner case further reminded us the necessity of the encapsulated vm which is the refactor we really need to do. |
We also need to do a rebase before we can start the merge. |
on_restart re-initializes some daemon-side resources needed for the VM functionality, such as non-backend mounts like sshfs. this patch ensures that on_restart is executed for the VM's that are already running, or starting. Closes: #4005 Signed-off-by: Mustafa Kemal Gilor <mustafa.gilor@canonical.com>
- Added unit tests for the on_restart() trigger logic - Added unit test for the spec.deleted state set block Signed-off-by: Mustafa Kemal Gilor <mustafa.gilor@canonical.com>
e9f9a95
to
9d182f6
Compare
Signed-off-by: Mustafa Kemal Gilor <mustafa.gilor@canonical.com>
Signed-off-by: Mustafa Kemal Gilor <mustafa.gilor@canonical.com>
Signed-off-by: Mustafa Kemal Gilor <mustafa.gilor@canonical.com>
Done, should be good to go. |
on_restart re-initializes some daemon-side resources needed for the VM functionality, such as non-backend mounts like sshfs. this patch ensures that on_restart is executed for the VM's that are already running, or starting.
Closes: #4005
MULTI-1908