[pve-devel] [PATCH qemu-server 05/31] blockdev: add helpers for attaching and detaching block devices

Fiona Ebner f.ebner at proxmox.com
Mon Jun 30 13:58:16 CEST 2025


Am 30.06.25 um 13:43 schrieb DERUMIER, Alexandre via pve-devel:
> De: "DERUMIER, Alexandre" <alexandre.derumier at groupe-cyllene.com>
> À: pve-devel at lists.proxmox.com <pve-devel at lists.proxmox.com>
> Objet: Re: [pve-devel] [PATCH qemu-server 05/31] blockdev: add helpers
> for attaching and detaching block devices
> Date: 30/06/2025 12:35:22
> 
>> +    # node and also implicit backing children referenced by a qcow2
>> image.
>> +    eval { mon_cmd($vmid, 'blockdev-del', 'node-name' =>
>> "$node_name"); };
>> +    if (my $err = $@) {
>> +        return if $err =~ m/Failed to find node with node-name/; #
>> already gone
> 
>>> does this happen regularly?
> 
>> >From my tests, I have seen different behaviour, depending if the
>>> initial drive was defined in qemu command line  ,   or if it was live
>>> hot-plugged first and hot-unplugged after.
> 
>>> I have also have seen different behaviour with block with defined
>>> node-
>>> name and with autogenerated nodename.
>>>
>>> I don't have retested since a while, so can't confirm 100%, I'll try
>>> to
>>> do some test again today.
> 
> Can't reproduce with simple hotplug/unplug,  or unplug after vm start.
> 
> But, I'm seeing a case, after a driver mirror with zeroinit filter in
> front,  where the whole chain is not autoremoved by device del.
> (including the zero filter).
> And this current code don't seem to remove the file && format blocknode
> too (maybe locked by the zero filter node ?)

The file and format are auto-removed when you remove the zeroinit
filter. What matters is that you remove the node you previously added
explicitly via blockdev-add. Implicitly added child nodes will be
auto-removed.

It doesn't make a difference if there is a zeroinit filter. If you add a
mirror target, you will later need to remove that manually.

So yes, mirror followed by a hotunplug currently leaves left-over nodes.
Will fix that in v2.

> I don't known if we need to keep the zeroinit filter after the drive
> mirror ? (I think it could be removed with a blockdev-reopen) 

We could, but not sure if it's worth it. Can still be done as a
follow-up, but IMHO the rest of the code should work regardless of
whether the child below throttle is a zeroinit filter or the format node.




More information about the pve-devel mailing list