Skip to content

Return UnknownDevice for assignments where device is unknown#400

Open
marmarta wants to merge 1 commit intoQubesOS:mainfrom
marmarta:bugfix10409
Open

Return UnknownDevice for assignments where device is unknown#400
marmarta wants to merge 1 commit intoQubesOS:mainfrom
marmarta:bugfix10409

Conversation

@marmarta
Copy link
Copy Markdown
Member

@marmarta marmarta commented Dec 8, 2025

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 8, 2025

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.66%. Comparing base (38c79ef) to head (b95d322).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
qubesadmin/device_protocol.py 0.00% 1 Missing ⚠️
qubesadmin/tools/qvm_device.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #400   +/-   ##
=======================================
  Coverage   76.65%   76.66%           
=======================================
  Files          53       53           
  Lines        9407     9411    +4     
=======================================
+ Hits         7211     7215    +4     
  Misses       2196     2196           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

marmarta added a commit to marmarta/qubes-manager that referenced this pull request Dec 9, 2025
Fix tests so that now they will fail if there is a bad reaction
to an unknown PCI device. Clean-up handling unknown PCI
devices by settigs.

requires QubesOS/qubes-core-admin-client#400
fixes QubesOS/qubes-issues#10409
Comment thread qubesadmin/device_protocol.py Outdated
raise ProtocolError("No devices matches to assignment")
return UnknownDevice(port=self.port,
device_id=self.device_id,
attachment=self)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, check carefully places where this attribute is used (in global config, VM settings, widgets, ansible etc). The behavior change may be unexpected in some, especially since the old behavior was explicitly documented in the docstring.

Then, update docstring.

And finally, I don't think attachment attribute should be set. Its docstring says "VM to which device is attached (frontend domain)", which cannot be true for not present device.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're implying this is a bad idea? I think it makes sense not to raise a ProtocolError if we have an UnknownDevice for those purposes, but I can try to think about tacking this problem in another way.

(and about the attachment attribute, it is incorrect to set here self, yes, but this is a property of a DeviceAssignment that knows its frontend domain, shouldn't we set it?)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the change makes sense in general. But since it's behavior change, it needs at least checking if other places don't rely on the old behavior. For example attach_device in qubesadmin/tools/qvm_device.py seems to rely on this exception. I'm sure there are other places too (maybe also in other repositories...)

(and about the attachment attribute, it is incorrect to set here self, yes, but this is a property of a DeviceAssignment that knows its frontend domain, shouldn't we set it?)

"attachment" is about where the device is attached (like, currently connected), not assigned (potentially attached, automatically or not, may be even multiple assignments for the same device)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and note this file is also copied to core-admin, so check if that side doesn't rely on this exception too.

@marmarta
Copy link
Copy Markdown
Member Author

marmarta commented Apr 8, 2026

I tried to find uses of this in other modules, didn't find reliance on the exception outside of core-admin (QubesOS/qubes-core-admin#799) and core-admin-client.

@marmarta
Copy link
Copy Markdown
Member Author

marmarta commented Apr 9, 2026

I'm not sure here; the tests failed when I did a change to react to this change in qvm_detach, but I'm not sure if it's not because the tests do not take into account the concurrent change in core-admin?

@qubesos-bot
Copy link
Copy Markdown

qubesos-bot commented May 4, 2026

OpenQA test summary

Complete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2026050404-devel&flavor=pull-requests

Test run included the following:

New failures, excluding unstable

Compared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2026032404-devel&flavor=update

  • system_tests_whonix

    • whonixcheck: wait_serial (wait serial expected)
      # wait_serial expected: qr/09xlb-\d+-/...
  • system_tests_basic_vm_qrexec_gui

    • TC_20_NonAudio_fedora-43-xfce: test_500_gui_agent_env_sync (failure)
      AssertionError: unexpected QUBES_ENV_TEST value from systemd user m...
  • system_tests_pvgrub_salt_storage

    • TC_41_HVMGrub_debian-13-xfce: test_000_standalone_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_debian-13-xfce: test_001_standalone_vm_dracut (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_fedora-43-xfce: test_000_standalone_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_fedora-43-xfce: test_010_template_based_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

  • system_tests_basic_vm_qrexec_gui_zfs

    • TC_20_NonAudio_fedora-43-xfce-pool: test_500_gui_agent_env_sync (failure)
      AssertionError: unexpected QUBES_ENV_TEST value from systemd user m...
  • system_tests_basic_vm_qrexec_gui_btrfs

    • TC_20_NonAudio_fedora-43-xfce-pool: test_500_gui_agent_env_sync (failure)
      AssertionError: unexpected QUBES_ENV_TEST value from systemd user m...
  • system_tests_basic_vm_qrexec_gui_ext4

    • TC_20_NonAudio_fedora-43-xfce-pool: test_500_gui_agent_env_sync (failure)
      AssertionError: unexpected QUBES_ENV_TEST value from systemd user m...
  • system_tests_basic_vm_qrexec_gui_xfs

    • TC_20_NonAudio_fedora-43-xfce-pool: test_500_gui_agent_env_sync (failure)
      AssertionError: unexpected QUBES_ENV_TEST value from systemd user m...

Failed tests

14 failures
  • system_tests_whonix

    • whonixcheck: fail (unknown)
      Whonixcheck for sys-whonix failed...

    • whonixcheck: Failed (test died)
      # Test died: systemcheck failed at qubesos/tests/whonixcheck.pm lin...

    • whonixcheck: wait_serial (wait serial expected)
      # wait_serial expected: qr/09xlb-\d+-/...

  • system_tests_basic_vm_qrexec_gui

    • TC_20_NonAudio_fedora-43-xfce: test_500_gui_agent_env_sync (failure)
      AssertionError: unexpected QUBES_ENV_TEST value from systemd user m...
  • system_tests_pvgrub_salt_storage

    • TC_41_HVMGrub_debian-13-xfce: test_000_standalone_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_debian-13-xfce: test_001_standalone_vm_dracut (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_debian-13-xfce: test_010_template_based_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_debian-13-xfce: test_011_template_based_vm_dracut (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_fedora-43-xfce: test_000_standalone_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_fedora-43-xfce: test_010_template_based_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

  • system_tests_basic_vm_qrexec_gui_zfs

    • TC_20_NonAudio_fedora-43-xfce-pool: test_500_gui_agent_env_sync (failure)
      AssertionError: unexpected QUBES_ENV_TEST value from systemd user m...
  • system_tests_basic_vm_qrexec_gui_btrfs

    • TC_20_NonAudio_fedora-43-xfce-pool: test_500_gui_agent_env_sync (failure)
      AssertionError: unexpected QUBES_ENV_TEST value from systemd user m...
  • system_tests_basic_vm_qrexec_gui_ext4

    • TC_20_NonAudio_fedora-43-xfce-pool: test_500_gui_agent_env_sync (failure)
      AssertionError: unexpected QUBES_ENV_TEST value from systemd user m...
  • system_tests_basic_vm_qrexec_gui_xfs

    • TC_20_NonAudio_fedora-43-xfce-pool: test_500_gui_agent_env_sync (failure)
      AssertionError: unexpected QUBES_ENV_TEST value from systemd user m...

Fixed failures

Compared to: https://openqa.qubes-os.org/tests/170766#dependencies

30 fixed
  • system_tests_network

    • system_tests: Fail (unknown)
      Tests qubes.tests.integ.network failed (exit code 1), details repor...

    • system_tests: Failed (test died)
      # Test died: Some tests failed at qubesos/tests/system_tests.pm lin...

    • VmNetworking_debian-13-xfce: test_203_fake_ip_inter_vm_allow (failure)
      ^... AssertionError: 1 != 0

  • system_tests_pvgrub_salt_storage

    • TC_41_HVMGrub_fedora-42-xfce: test_000_standalone_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_fedora-42-xfce: test_010_template_based_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

  • system_tests_extra

    • system_tests: Fail (unknown)
      Tests qubes.tests.extra failed (exit code 1), details reported sepa...

    • system_tests: Failed (test died)
      # Test died: Some tests failed at qubesos/tests/system_tests.pm lin...

    • TC_01_InputProxyExclude_debian-13-xfce: test_000_qemu_tablet (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

  • system_tests_gui_interactive

    • collect_logs: wait_serial (wait serial expected)
      # wait_serial expected: qr/Dhelp-\d+-/...

    • collect_logs: Failed (test died + timed out)
      # Test died: command 'curl --form upload=@journalctl.log --form upn...

  • system_tests_network_ipv6

    • system_tests: Fail (unknown)
      Tests qubes.tests.integ.network_ipv6 failed (exit code 1), details ...

    • system_tests: Failed (test died)
      # Test died: Some tests failed at qubesos/tests/system_tests.pm lin...

    • VmIPv6Networking_fedora-42-xfce: test_113_reattach_after_provider_kill (failure)
      ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^... AssertionError: 1 != 0

  • system_tests_network_updates

    • system_tests: Fail (unknown)
      Tests qubes.tests.integ.dom0_update failed (exit code 1), details r...

    • system_tests: Failed (test died)
      # Test died: Some tests failed at qubesos/tests/system_tests.pm lin...

    • TC_00_Dom0Upgrade_whonix-gateway-18: test_020_install_wrong_sign (error)
      subprocess.CalledProcessError: Command 'timeout=120; while ! tor-ci...

    • TC_11_QvmTemplateMgmtVM_debian-13-xfce: test_000_template_list (failure)
      qvm-template: error: No matching templates to list

    • TC_11_QvmTemplateMgmtVM_debian-13-xfce: test_010_template_install (failure)
      qvm-template: error: Template 'debian-12-minimal' not found.

    • TC_11_QvmTemplateMgmtVM_fedora-42-xfce: test_000_template_list (failure)
      qvm-template: error: No matching templates to list

    • TC_11_QvmTemplateMgmtVM_fedora-42-xfce: test_010_template_install (failure)
      qvm-template: error: Template 'debian-12-minimal' not found.

    • TC_11_QvmTemplateMgmtVM_whonix-gateway-18: test_000_template_list (failure)
      qvm-template: error: No matching templates to list

    • TC_11_QvmTemplateMgmtVM_whonix-gateway-18: test_010_template_install (failure)
      qvm-template: error: Template 'debian-12-minimal' not found.

  • system_tests_kde_gui_interactive

    • collect_logs: wait_serial (wait serial expected)
      # wait_serial expected: qr/bMse8-\d+-/...

    • collect_logs: Failed (test died + timed out)
      # Test died: command 'curl --form upload=@journalctl.log --form upn...

  • system_tests_guivm_vnc_gui_interactive

    • collect_logs: wait_serial (wait serial expected)
      # wait_serial expected: qr/C_fDy-\d+-/...

    • collect_logs: Failed (test died + timed out)
      # Test died: command 'curl --form upload=@journalctl.log --form upn...

  • system_tests_audio

    • system_tests: Fail (unknown)
      Tests qubes.tests.integ.audio failed (exit code 1), details reporte...

    • system_tests: Failed (test died)
      # Test died: Some tests failed at qubesos/tests/system_tests.pm lin...

    • TC_20_AudioVM_Pulse_whonix-workstation-18: test_225_audio_rec_unmuted_hvm (failure)
      AssertionError: too short audio, expected 10s, got 7.59433106575963...

    • TC_20_AudioVM_PipeWire_debian-13-xfce: test_251_audio_playback_audiovm_pipewire_late_start (failure)
      AssertionError: pacat for test-inst-vm1 (xid 48) running(False) in ...

Unstable tests

Details

Performance Tests

Performance degradation:

No issues

Remaining performance tests:

No remaining performance tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants