Discard preloaded disposables with outdated props#771
Conversation
27d189e to
87dfa27
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #771 +/- ##
==========================================
- Coverage 70.21% 70.17% -0.05%
==========================================
Files 61 61
Lines 13942 13975 +33
==========================================
+ Hits 9790 9807 +17
- Misses 4152 4168 +16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ff0c3be to
38d6003
Compare
OpenQA test summaryComplete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=202601122238-4.3&flavor=pull-requests Test run included the following: New failures, excluding unstableCompared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2026011214-devel&flavor=update Failed testsNo failures! Fixed failuresCompared to: https://openqa.qubes-os.org/tests/165203#dependencies 4 fixed
Unstable testsDetailsPerformance TestsPerformance degradation:No issues Remaining performance tests:No remaining performance tests |
qubes/vm/dispvm.py
Outdated
| appvm = self.template | ||
| appvm_props = appvm.property_dict() | ||
| props = self.property_dict() | ||
| exclude_props = [ |
There was a problem hiding this comment.
Shouldn't netvm be excluded too, given you added handling for that already? Or is that handling not complete? There are (at least) two cases:
- disposable template uses default netvm, and the global default changes
- disposable template uses non-default netvm (none or not), and user changes this value
If I read the code correctly, currently only the first case is handled by the deferred netvm setting, right?
But if going with discarding preloaded disposables on netvm change too, then maybe deferred netvm change can be removed? At least its use in preloaded disposables code?
There was a problem hiding this comment.
Shouldn't
netvmbe excluded too, given you added handling for that already? Or is that handling not complete?
Handling not complete, examples below.
There are (at least) two cases:
* disposable template uses default netvm, and the global default changes * disposable template uses non-default netvm (none or not), and user changes this valueIf I read the code correctly, currently only the first case is handled by the deferred netvm setting, right?
Right. The current PR would allow handling the second case. Note that deferred netvm handles reestablishing severed link in case the netvm restarts (domain-shutdown in vm.mix.net), while the current PR wouldn't know about it as netvm property would not have changed.
But if going with discarding preloaded disposables on netvm change too, then maybe deferred netvm change can be removed? At least its use in preloaded disposables code?
Here are some cases. It always involves a paused client and severed link. I will consider changes only for vm switch (choosing a different netvm), not for state change (restart):
- preloaded disposable netvm restarts: no property change, handled by deferred netvm
- disposable template netvm changes: property changed, handled by this PR
The deferred netvm PR introduced the feature deferred-netvm-original, which could be placeholders for preloaded disposables to discard early? Now instead of trying to establish netvm link after unpause, it will establish on a new preloaded qube, but without the speed benefits of preloading.
The behavior them will change:
- Changing
default_netvmwill discard if disposable netvm is the default - Change disposable template netvm will restart
- Restarting netvm will refresh
If you update via the Dom0 updater, it will shutdown the template (refreshes preloaded disposables because of outdated volumes, already the case) and maybe restart servicevms that are netvms (discards disposables because of severed link, new). So behavior after update is, no preloaded disposables. There are some ways to solve this, and I'd like to solve tool independent, so it doesn't matter if you use Salt,Ansible or the updater:
- Refresh with a generous delay, so when changing properties, it doesn't try to refresh multiple times in a short amount of time.
There was a problem hiding this comment.
The current discard code is lazily evaluated, only when requesting a disposable, which means it won't have any preload ready. It could also be improved by having a wildcard handler on qubes/vm/mix/dvmtemplate.py:
@qubes.events.handler("property-reset:*")
@qubes.events.handler("property-set:*")Outdated volumes is already handled on domain-shutdown, I guess it makes sense to anticipate discarding earlier, maybe refresh, will see.
There was a problem hiding this comment.
IMO better do it lazily, to better handle several changed properties.
There was a problem hiding this comment.
IMO better do it lazily, to better handle several changed properties.
Outdated volumes is done on template shutdown and lazily if somehow the domain-shutdown was not called yet.
I could add a 10-15s delay till refresh (or even larger delay)? Or not good enough?
There was a problem hiding this comment.
I added some delay and pushed to test the behavior. If the property-(re)\?set code is unwanted, I will just remove one block.
38d6003 to
8f20e52
Compare
8f20e52 to
a5aa00a
Compare
Seems to be enough to check itself against the disposable template |
Yes, for preloaded case should be enough. |
5e11587 to
971b0c8
Compare
If a qube property is changed on the disposable template, it is not replicated to the preloaded disposable, no refresh occurs, which means, if a disposable template has the netvm changed, the preloaded disposable would still remain with the old setting. While changing netvm on the fly is possible after unpause, several other settings requires a restart. Fixes: QubesOS/qubes-issues#10525 For: QubesOS/qubes-issues#1512
971b0c8 to
f03fe7b
Compare
|
PipelineRetryFailed |
|
openQArun TEST=system_tests_dispvm |
When it is stable, it will be added again. For: QubesOS/qubes-issues#1512 For: QubesOS/qubes-issues#10525 For: QubesOS#771
Disposable size is integer and disposable template size is string. For: QubesOS/qubes-issues#1512 For: QubesOS/qubes-issues#10525 Fixes: QubesOS/qubes-issues#10572 For: QubesOS#771
Disposable size is integer and disposable template size is string. For: QubesOS/qubes-issues#1512 For: QubesOS/qubes-issues#10525 Fixes: QubesOS/qubes-issues#10572 For: QubesOS#771
Disposable size is integer and disposable template size is string. For: QubesOS/qubes-issues#1512 For: QubesOS/qubes-issues#10525 Fixes: QubesOS/qubes-issues#10572 For: QubesOS#771
Disposable size is integer and disposable template size is string. For: QubesOS/qubes-issues#1512 For: QubesOS/qubes-issues#10525 Fixes: QubesOS/qubes-issues#10572 For: QubesOS#771
|
Interesting that reading the logs doesn't show it doesn't discard the preloads on all runs, only on the runs that it was supposed to ( Because if it did, it would error out as there are assertions to make sure it received the expected qube from the list: qubes-core-admin/qubes/tests/integ/dispvm.py Line 472 in 756ff94 It is some behavior seem after qubesd restarts. |
The size type on volume_config, depends how the qube is loaded, from disk or from the store. The volumes have a size property, use that instead, but still convert to integer, no cost operation. For: QubesOS/qubes-issues#1512 For: QubesOS/qubes-issues#10525 Fixes: QubesOS/qubes-issues#10572 For: QubesOS#771
Makes it easier to debug, even for volumes, which may have been for different reasons, template shutdown or resize. For: QubesOS/qubes-issues#1512 For: QubesOS/qubes-issues#10525 Fixes: QubesOS/qubes-issues#10572 For: QubesOS#771
The size type on volume_config, depends how the qube is loaded, from disk or from the store. The volumes have a size property, use that instead, but still convert to integer, no cost operation. For: QubesOS/qubes-issues#1512 For: QubesOS/qubes-issues#10525 Fixes: QubesOS/qubes-issues#10572 For: QubesOS#771
Makes it easier to debug, even for volumes, which may have been for different reasons, template shutdown or resize. For: QubesOS/qubes-issues#1512 For: QubesOS/qubes-issues#10525 Fixes: QubesOS/qubes-issues#10572 For: QubesOS#771
The size type on volume_config, depends how the qube is loaded, from disk or from the store. The volumes have a size property, use that instead, but still convert to integer, no cost operation. For: QubesOS/qubes-issues#1512 For: QubesOS/qubes-issues#10525 Fixes: QubesOS/qubes-issues#10572 For: QubesOS#771
Makes it easier to debug, even for volumes, which may have been for different reasons, template shutdown or resize. For: QubesOS/qubes-issues#1512 For: QubesOS/qubes-issues#10525 Fixes: QubesOS/qubes-issues#10572 For: QubesOS#771
Makes it easier to debug, even for volumes, which may have been for different reasons, template shutdown or resize. For: QubesOS/qubes-issues#1512 For: QubesOS/qubes-issues#10525 Fixes: QubesOS/qubes-issues#10572 For: QubesOS#771
The type of size in volume_config depends on whether the qube object has been loaded from xml (str) or created freshly (int). Due to this, in almost all cases preloaded disposables were wrongly discarded. Use the Volume objects in vm.volumes instead. While at it also improve the return value to correctly report why it thinks it's outdated (both for changed private size as well as outdated volumes). For: QubesOS/qubes-issues#1512 For: QubesOS/qubes-issues#10525 Fixes: QubesOS/qubes-issues#10572 For: #771
Makes it easier to debug, even for volumes, which may have been for different reasons, template shutdown or resize. For: QubesOS/qubes-issues#1512 For: QubesOS/qubes-issues#10525 Fixes: QubesOS/qubes-issues#10572 For: #771
If a qube property is changed on the disposable template, it is not replicated to the preloaded disposable, no refresh occurs, which means, if a disposable template has the netvm changed, the preloaded disposable would still remain with the old setting. While changing netvm on the fly is possible after unpause, several other settings requires a restart.
Fixes: QubesOS/qubes-issues#10525
For: QubesOS/qubes-issues#1512
I think checking features is not relevant: QubesOS/qubes-core-admin-client#398 (comment)