On Wed, Apr 15, 2026 at 11:48:20AM +0100, Daniel P. Berrangé wrote: > On Thu, Apr 09, 2026 at 08:01:54AM +0200, mr-083 wrote: > > Add a drive_insert HMP command that reconnects a host block device file > > to an existing guest device whose backing store was previously removed > > with drive_del. > > > > After drive_del, the BlockBackend remains attached to the guest device > > but has no BlockDriverState (shown as "[not inserted]" in info block). > > drive_insert opens the specified file, finds the device's BlockBackend > > by iterating all backends and matching the attached device ID, then > > calls blk_insert_bs() to reconnect the backing store. > > > > This complements drive_del for non-removable devices (such as NVMe > > namespaces) where blockdev-change-medium cannot be used. Combined with > > PCIe AER Surprise Down error injection to trigger a controller reset, > > this enables complete NVMe disk hot-swap simulation where the guest > > sees the same device names throughout. > > > > Example usage: > > drive_del drv0 # remove backing store > > drive_insert ns0 disk.qcow2 # reconnect backing > > pcie_aer_inject_error rp0 SDN # trigger controller reset > > > > Signed-off-by: Matthieu Receveur > > --- > > block/monitor/block-hmp-cmds.c | 59 ++++++++++++++++++++++++++++++++++ > > hmp-commands.hx | 18 +++++++++++ > > I see v3 has dropped this new command, but in case you have plans > to re-introduce it.. I suggest splitting this into two separate patch series since two different use cases are being addressed: 1. --device nvme-ns hotplug using NVMe AEN. Allows users to attach and detach storage to the NVMe controller at runtime (without PCI hotplug). 2. PCIe Surprise Down and AER. Allows testing of PCI error recovery in guest drivers. Stefan