-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stable-id: use description as an alias for persistent device #388
Conversation
Codecov Report
@@ Coverage Diff @@
## master #388 +/- ##
==========================================
- Coverage 65.89% 65.86% -0.03%
==========================================
Files 53 53
Lines 9926 9935 +9
==========================================
+ Hits 6541 6544 +3
- Misses 3385 3391 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid it isn't going to work. At the qubes.xml load time (qubesd service start), the backend domain most likely is not started yet, which means the description is not yet available.
The alias resolution needs to happen later - when the description (if using that as an alias) is already available. I think a better place would be when backend announces the device (device-list-change:...
event, although it is quite clumsy - QubesOS/qubes-issues#4626) and maybe on domain start?
Another issue is ident uniqueness - this change basically overrides ident
value. But the ident
is still used in quite a lot of places, at the very least as a part of the key in qubes.devices.PersistentCollection
. This means, you cannot connect two different devices with the same ident - which normally makes sense. But with this change, you potentially would do that. For example sys-usb:sda with alias "ABC" and sys-usb:sda with alias "DEF" - if both devices are present, then aliases should resolve to actual (unique) devices. But if one is missing, it will stay at sys-usb:sda
, which may conflict with the other one - either failing the VM load, or loosing info about one of those devices.
I think a proper solution at the qubesd API would be an "alias" attribute as an alternative to ident, not an extra property, and changed consistently across the code base. Including safeguards like treating unresolved aliases as UnknownDevice
(as it is done for unresolved ident), preventing setting both "ident" and "alias", detecting duplicated aliases etc.
But I'm not sure how that should influence admin API - perhaps it could stay the way it is (an "alias" option)?
vm = self.app.domains[node.get('backend-domain')] | ||
ident = node.get('id') | ||
if 'alias' in options: | ||
vm.events_enabled = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bad idea - initially events are disabled, because events handler can assume VM object being fully initialized - which isn't the case here yet.
OK, Now I see why this issue stalled for so long. |
Yes, something like this can work, I think. One thing is detecting whether two devices aren't in fact the same device. Consider one device attached as In fact, it may be a good idea to expose the same device multiple times using various identifiers (device name, UUID, something else) and explicitly mark them as aliases for the same device (see above). The UI will need to be aware of that (displaying all of them may be confusing), but on the other hand, it will give some more flexibility. IMO the part "this device is in fact an alias for another device" is worth a property in the base And some related rambling: Another thing is UUID stability. It is normally is retrieved from filesystem on the block device, so if you re-format it, the UUID will change. This could still work, but you need to be sure to not detach device in such case automatically (or not pretend it's not attached). Likely loading UUID only at the device initial discovery time and not update it later will work. It shouldn't be a problem, but I want to mention it explicitly. One minor issue is UX one - long device identifiers will make both CLI and GUI quite ugly. I'm not sure what's the best option here, but also IMO it doesn't invalidate your proposed change. Also, note the qrexec argument length limit (relevant if you do qvm-block from non-dom0 mgmt vm) is quite short in Qubes 4.0. But this isn't an issue in Qubes 4.1 anymore. |
QubesOS/qubes-issues/issues/2272