Hi Thomas,
On Tue, May 18, 2021 at 3:29 PM Thomas Parrott <thomas.parr...@canonical.com> wrote: > > Due to QEMU moving towards a QMP configuration mechanism and away from config > file support, the LXD team are currently in the process of migrating to using > QMP to add devices to VMs (so that we can support the use of QEMU 6.0). > > Currently we are using the `-S` flag to freeze CPU at startup, then using QMP > to add NIC devices via the `device_add` command, and then using the `cont` > command to start the VM guest. > > However we have found that it is apparently not possible to add a > pcie-root-port device via QMP. > > Initially we tried using something like: > > device_add > {"id":"qemu_pcie5","driver":"pcie-root-port","bus":"pcie.0","addr":"1.5","chassis":5,"multifunction":"on"} > > Which was a straight conversion from the current config file we use. > > However this gave the error: > > Error: Bus 'pcie.0' does not support hotplugging > > Then I found the `--preconfig` flag which sounded interesting, so we removed > the use of `-daemonize` which prevents the use of --preconfig` and then tried > adding the pcie-root-port devices in the preconfig stage. > > But this resulted in the error: > > The command 'device_add' isn't permitted in 'preconfig' state > > So we wondered is this a bug, or if not, what is the correct way to be adding > pcie-root-ports going forward? The pcie-root-ports cannot be hot-plugged, you will need to pre-allocate enough pcie-root-ports for your needs. PCI(e) devices can be hot-plugged into the pre-allocated pcie-root-ports. Thanks, Marcel > > Thanks > Tom Parrott > >