[pve-devel] [PATCH v3 qemu-server 08/11] blockdev: convert drive_mirror to blockdev_mirror

DERUMIER, Alexandre alexandre.derumier at groupe-cyllene.com
Wed Jan 15 14:01:49 CET 2025


> Fiona Ebner <f.ebner at proxmox.com> hat am 15.01.2025 11:06 CET
> geschrieben:
> 
>  
> Am 15.01.25 um 10:51 schrieb Fabian Grünbichler:
> > 
> > basically what we have is the following situation:
> > 
> > - we have some input data (volid+snapname)
> > - we have a key derived from the input data (block node name)
> > - we have a value (block node)
> > - we need to be be able to map back the block node (name) to the
> > input data
> 
> Oh, we need to map back too? But that can be done via filename in the
> block node, or not?

>>but that filename is the result of PVE::Storage::path which is not
>>stable, so we can't compare that?

>>for snapshot operations, we need to find out "which block node is the
>>one for the snapshot volume". we can't rely on the filename in the
>>block graph for that, because how we map from volid+snapname to that
>>filename might have changed on our end since that bock node was set
>>up. 

The "filename" attribute never change in an existing file-nodename.
(It's impossible to update this attribute).

but we can replace/reopen the file-nodename by another file-nodename as
child of the fmt-nodename.


and to respond to my previous mail, for live rename, I have done tests,
I can reopen the throttle-filter with a new fmt+file nodes couple with
the new filename.

so a hash of (fmt|file)-hash(volid+snapname) should be enough.



workflow for snapshot create:

1)

throttlefilter(drive-scsi0---->fmt-(hash(local:vm-disk-0)--->file
(hash(local:vm-disk-0)---->filename=/path/to/vm-disk-0.qcow2

take a snap1

2) a)  create an hardlink &&  add a new fmt|file couple 

throttlefilter(drive-scsi0---->fmt-(hash(local:vm-disk-0)--->file-
(hash(local:vm-disk-0)---->filename=/path/to/vm-disk-0.qcow2

fmt-(hash(local:vm-disk-0-snap1)--->file (hash(local:vm-disk-0-snap1)--
-->filename=/path/to/vm-disk-0-snap1.qcow2


b) swap the fmt node with blockdev-reopen && delete old fmt node

throttlefilter(drive-scsi0---->fmt-(hash(local:vm-disk-0-snap1)---
>file- (hash(local:vm-disk-0-snap1)---->filename=/path/to/vm-disk-0-
snap1.qcow2

c) create a new current fmt-node with snap1 as backing fmt-node with
blockdev-snapshot


throttlefilter(drive-scsi0---->fmt-(hash(local:vm-disk-0)--->file-
(hash(local:vm-disk-0)---->filename=/path/to/vm-disk-0.qcow2
                               |
                               |-> fmt-(hash(local:vm-disk-0-snap1)---
>file-(hash(local:vm-disk-0-snap1)---->filename=/path/to/vm-disk-0-
snap1.qcow2









More information about the pve-devel mailing list