Skip to content

devices: allow bridge devclass assignment#474

Open
fepitre wants to merge 1 commit into
QubesOS:mainfrom
fepitre:allow-bridge-device-assignment
Open

devices: allow bridge devclass assignment#474
fepitre wants to merge 1 commit into
QubesOS:mainfrom
fepitre:allow-bridge-device-assignment

Conversation

@fepitre

@fepitre fepitre commented Jun 27, 2026

Copy link
Copy Markdown
Member

Few reformats

Comment thread qubesadmin/devices.py
"""
if (
assignment.devclass not in ("pci", "testclass", "block")
assignment.devclass not in self._vm.app.list_deviceclass()

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.

This doesn't make any sense. It guards which devclasses are allowed as "required", and here you replace it basically with "any". In that case, simply remove this check (and the one below too, as with the change is similarly useless).

But then, ensure at the backend side it's really checked that for example "usb" are not allowed as "required"

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.

Is there not one that's supposed to exclude tests classes?

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.

In all the cases, the spelling is a hell in the new devices API, similar to discussions on Matrix.

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.

@marmarek are you ok to introduce a flag in device class to notify that it is "required" type class?

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 don't think we have a place to add meta-data of a device class as a whole. But maybe, a device could have a property with list of supported assignment modes? @piotrbartman what do you think?

@fepitre fepitre Jun 28, 2026

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'm going into the way of exposing via admin.DeviceClass.List pci+required. It extends the protocol and allows client to know without relying only on back. Especially, it allows to stop hardcoding values. So each device class will have this parameter easily retrieved on call for list of classes.

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'm going into the way of exposing via admin.DeviceClass.List .

That's not a good idea, because it breaks existing clients as they will interpret it whole as a device class (once dom0 is updated, all users, including sys-gui etc will break). This could be solved by adding extra info only if some specific argument is given, like admin.DeviceClass.List+details. But more importantly, it isn't a long term solution, if any other property would be needed, you still don't have a way to send it.

And then, both on the backend and frontend side we need a mechanism to pass this info. On the backend, it could be a class property of relevant DeviceInfo subclass maybe? On the frontend side, some function to return list of classes with extra metadata?

Anyway, I would like to hear @piotrbartman opinion first. Because setting it on individual devices possibly would be more flexible. Or maybe there is some other option I didn't think of.

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.

Is there not one that's supposed to exclude tests classes?

Only this classes are allowed as "required"

But maybe, a device could have a property with list of supported assignment modes? @piotrbartman what do you think?

We definitely have to keep info from this table somewhere "in the code", available from API. It could be per device.
image

And then, both on the backend and frontend side we need a mechanism to pass this info. On the backend, it could be a class property of relevant DeviceInfo subclass maybe? On the frontend side, some function to return list of classes with extra metadata?

at first glance it seems okay, but I need to think it over

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.

The problem is supporting other classes of devices that are not in the codebase => bridges and maybe some other kind too.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants