-
-
Notifications
You must be signed in to change notification settings - Fork 215
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
Questions regarding NVMe emulation #1051
Comments
It looks like your QEMU NVME drives are attached directly to the root PCI bridge rather than to a hot-pluggable port on the PCIe bridge. Our layout lines up with what you'd get on a physical system and allow for hotplug and hotremove:
^ physical system with two NVMe drives. |
Is there any way to attach the NVMe drives directly to the root PCI bridge? |
Nope, you'd need to hack your way around it with |
What doesn't really make sense is that presumably whatever is failing to find those virtualized NVME drives is quite capable of finding physical ones which are connected with an identical layout. |
I think the way devices are identified is closely related to the physical layout of Macs, and I wouldn’t be surprised if everything was attached to the root PCI on them. |
It's something I'd prefer not to do as it would cause a different PCIe structure just for this one case, which then has "fun" side-effects such as changing the otherwise mostly predictable naming pattern for network interfaces. It would also prevent hot-remove of those disks when we otherwise have universal support for storage add/remove, so that'd be more exceptions we'd need to keep in mind throughout the code. Overall, while it's not impossible to do, making this an option is likely to make things quite brittle or tricky to test. |
Got it. I tried to do some nasty EFI/ACPI trickeries in the last few days, but to no avail. Still, I really want to see on Incus the disks that my macOS VMs use. I tried to use the generated Incus drive names (and the virtual I guess I’ll attach a second monitor and send a few
|
One option may be to add some more Basically:
The value of which would be a JSON list of QMP commands (command+arguments). In your case, you'd likely want |
I’ll look into it. I have not yet looked at that part of the codebase, so that might take me quite some time; I’ll try to come up with something in a couple of weeks. A few questions (tell me if you’d prefer me to open another issue to discuss this):
|
I'd probably just fail startup if any of the command fails, returning the error back to the user.
I was thinking of the easy way to do this, basically as our devices/configuration is consistent across startup, you should be able to predict what the name or index is going to be and just use that in your Though having a This is usually not something we'd be very keen on for security reasons as such a script could be used to do some very nasty things through QMP and could also cause Incus' memory and CPU usage to get out of control, but as it would be a |
Sure, but if I add a device later, I’d also need to edit the configuration key (I’d like to put the key in a profile and forget about it). I’ll see what I can do by first implementing non-scriptlet solutions, then look at scriptlets. |
I think I’m almost there. Is there any reason to prefer, as you suggested, (i) a JSON list of QMP commands vs. (ii) a list of JSON QMP commands? raw.qemu.qmp.early: command vs. raw.qemu.qmp.early:
- command be a bad idea? |
Well, the catch is that all our config keys are stored as strings (configs are always map[string]string in Incus),so your second option would lead to a type error when trying to set it. |
Okay, I’ll do a PR this week. Meanwhile, a little update on my painful and ugly journey. I tried everything I could to add my drives with QMP, but every attempt has been met with raw.qemu.qmp.pre-start: |-
[
{
"execute": "blockdev-add",
"arguments": {
"driver": "raw",
"node-name": "fdset0",
"file": {
"driver": "file",
"filename": "/dev/fdset/0"
}
}
},
{
"execute": "qom-set",
"arguments": {
"path": "/machine/peripheral/blk0",
"property": "drive",
"value": "fdset0"
}
}
] Not that I don’t like black magic, but isn’t there a cleaner way of dynamically patching a drive? |
Haha, welcome to the QMP hell :) It's one of those APIs that has grown very organically with no clear design or consistency... |
I think now’s the time to close the issue, as #1115 fixes part of it. |
Required information
Issue description
I’m looking into NVMe emulation and have found out that using
io.bus: nvme
creates a PCI device on which a PCI device representing the virtual NVMe is linked. Is there a way to directly connect the NVMe devices to the root PCI?On the following image,
nvme{0,1}n1
are devices manually created with the QEMU command line (something like-drive id=foo,if=none,file=/tmp/foo.img,format=qcow2 -device nvme,serial=deadbeef,drive=foo
), andnvme{2,3}n1
are created with Incus options.I’m trying to build macOS VMs and NVMe disks declared with Incus are not recognized, while QEMU ones are, so I’m guessing I need the NVMe devices to be linked to the root PCI to be recognized (I may be wrong on that though…).
Any clue?
The text was updated successfully, but these errors were encountered: