Integer comparison on qube volume size#775
Conversation
|
openQArun TEST=system_tests_dispvm |
OpenQA test summaryComplete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=202601221354-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 tests7 failures
Fixed failuresCompared to: https://openqa.qubes-os.org/tests/165203#dependencies 6 fixed
Unstable testsDetailsPerformance TestsPerformance degradation:No issues Remaining performance tests:No remaining performance tests |
|
Just would like to note that it also didn't fail openqa last time: #771 (comment), but was broken on real use case, which is sad... it requires some qubesd restart to change the state, which I don't think I can do mid test run. Anyway, new integration tests introduced for the cases that should discard. |
qubes/vm/dispvm.py
Outdated
| self.volume_config["private"]["size"] | ||
| != appvm.volume_config["private"]["size"] | ||
| if int(self.volume_config["private"]["size"]) != int( | ||
| appvm.volume_config["private"]["size"] |
There was a problem hiding this comment.
Is there a reason to use .volume_config at all here? Using .volumes["private"].size would avoid this issue (and should remove the hack in your test).
There was a problem hiding this comment.
- Cause I didn't know...
- Now that I changed to it, unit tests became a bit harder because I wasn't creating the volumes, the storage was being mocked. There are a few dispvm tests doing it, will try to use that.
|
While strictly speaking out of scope of this PR, what is the intended behavior for the next lines? if any(vol for vol in self.volumes.values() if vol.is_outdated()):
# Volume name is irrelevant. We use any() to return fast.
differed["volumes"] = ["root"]
return differedEither only the "root" volume matters, then the iterator is unnecessary, or the return value is (potentially) wrong. |
The iterator stops on the first |
8dee80e to
aee1e29
Compare
|
openQArun TEST=system_tests_dispvm |
I'm fine with returning on the first outdated volume, that also matched the other checks. But then the return value should accurately report which volume is outdated, otherwise things can get very confusing when debugging. Given that we are talking about a DispVM, it's actually a normal case that the private volume of the AppVM template gets outdated without the root volume being outdated. Should be very straight forward to implement: for vol_name, vol in self.volumes.items():
if vol.is_outdated():
differed["volumes"] = [vol_name]
return differed[This should go into a separate PR, just commented here since this jumped my into my eye, while trying to understand the original issue] |
qubes/vm/dispvm.py
Outdated
| self.volume_config["private"]["size"] | ||
| != appvm.volume_config["private"]["size"] | ||
| if int(self.volumes["private"].size) != int( | ||
| appvm.volumes["private"].size |
There was a problem hiding this comment.
No need for int() here. Here we have a proper Volume object, which should always return an int for it's size property.
If the first outdated volume is "private", than the logs can't distinguish between the current check of outdated volume and the prior check of volume size... So if I do your way, I'd prefer returning every volume, which yes, doesn't guarantee that only "private" will appear. And I think it makes sense to include in this PR, if you agree. OpenQA didn't run yet because of temporary build failure. |
aee1e29 to
7f126d3
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #775 +/- ##
==========================================
- Coverage 70.23% 70.17% -0.07%
==========================================
Files 61 61
Lines 13975 13977 +2
==========================================
- Hits 9815 9808 -7
- Misses 4160 4169 +9
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:
|
If this your concern then listing every volume doesn't help. If you resize "private" is will return So if you want to be able to distinguish those cases in the return value you need to use different keys (for example "volumes_size" and "volume_outdated").
As noted above I would have put it into a separate, but fine with me to keep it here if you like. |
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
7f126d3 to
958dcec
Compare
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
958dcec to
71d268f
Compare
|
openQArun TEST=system_tests_dispvm Didn't create a gitlab or openqa pipeline. |
|
openQArun TEST=system_tests_dispvm |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
openQArun TEST=system_tests_dispvm,system_tests_network,system_tests_network_ipv6 |
|
Merged as a7c6042 I updated the commit message to match the current version. Also dropped the "Not needed to return all volumes" comment (only describes what the code does not why. Also why comment the early return here and not in the other cases). (As a nitpick on the commits: For a fix like this I would have put the changed test into a separate commit.) The failures we saw on some openQA are not related to this change as far as I can see. Merged this now to get the fix to users (although it only affected the testing repo). But what I think we want to address in some future change:
|
I normally put tests in the same commit, it allows automatic git bisect using |
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: #771