Fix invalidating cache on device-removed event#434
Conversation
With broken cache invalidation, plugging new device in the same port as
an old one returned stale info from cache, which then got rejected when
looking for 'device' instance for an event handler. The end result was
that device-added handler got VirtualDevice() instance, instead of
DeviceInfo() and that made qui-domains widget unhappy:
Failed to handle event: sys-usb, device-added:usb, {'device': sys-usb+4-1:0bda:8179:00E04C0001:uffffff}
Traceback (most recent call last):
File "/usr/lib/python3.13/site-packages/qubesadmin/events/__init__.py", line 278, in handle
kwargs['device'] = plugged
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/qui/devices/device_widget.py", line 262, in device_added
dev = backend.Device(device, self)
File "/usr/lib/python3.13/site-packages/qui/devices/backend.py", line 156, in __init__
for interface in dev.interfaces:
^^^^^^^^^^^^^^
AttributeError: 'VirtualDevice' object has no attribute 'interfaces'
There were several issues:
- using 'elif' made the code never called, as 'device-removed' event is
handled earlier too
- "port" is not the same as "port id" - the former is
backend-name:port-id
- the actual line missed "del"
Fixes: c95a89c "devices: invalidate device cache on device-removed event"
Fixes QubesOS/qubes-issues#10674
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #434 +/- ##
==========================================
+ Coverage 76.13% 76.22% +0.09%
==========================================
Files 53 53
Lines 9299 9309 +10
==========================================
+ Hits 7080 7096 +16
+ Misses 2219 2213 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8fb570a to
ad1779e
Compare
OpenQA test summaryComplete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2026030114-4.3&flavor=pull-requests Test run included the following:
Upload failures
New failures, excluding unstableCompared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2026020304-devel&flavor=update
Failed tests26 failures
Fixed failuresCompared to: https://openqa.qubes-os.org/tests/166096#dependencies 25 fixed
Unstable testsDetailsPerformance TestsPerformance degradation:15 performance degradations
Remaining performance tests:96 tests
|
With broken cache invalidation, plugging new device in the same port as
an old one returned stale info from cache, which then got rejected when
looking for 'device' instance for an event handler. The end result was
that device-added handler got VirtualDevice() instance, instead of
DeviceInfo() and that made qui-domains widget unhappy:
There were several issues:
handled earlier too
backend-name:port-id
Fixes: c95a89c "devices: invalidate device cache on device-removed event"
Fixes QubesOS/qubes-issues#10674