[pve-devel] [PATCH qemu-server 01/13] blockdev: cmdline: add blockdev syntax support

DERUMIER, Alexandre alexandre.derumier at groupe-cyllene.com
Wed Jun 11 16:02:27 CEST 2025


> >
> >>
> >I still unsure how to handle same volume multiple time (if we really
> >want it). I was thinking to use the deviceid in the name
> >(virtio0,..),
> >but it don't work when you unplug/replug to a deviceid.

>>Why wouldn't it work?

Ah sorry, I forgot that we delete the blocknode on unplug.

so it should work indeed


> Maybe some kind of slot number like fabian have suggested, but I
> think
> it'll need  some kind of lookup.
> 
> or maybe, if we want same volume multiple volume, we just keep
> autogenerated qemu blockdev for this specific case, as anyway, we
> can't
> do snapshot, unplug, or other dynamic features.

>>My proposal is:
>>
>>my sub get_node_name {
>>    my ($type, $drive_id, $volid, $snap) = @_;
>>
>>    my $info = "drive=$drive_id,";
>>    $info .= "snap=$snap," if defined($snap);
>>    $info .= "volid=$volid";
>>
>>    my $encoded = substr(Digest::SHA::sha256_hex($info), 0, 30);
>>
>>    my $prefix = "";
>>    if ($type eq 'fmt') {
>>       $prefix = 'f';
>>    } elsif ($type eq 'file') {
>>       $prefix = 'e';
>>    } else {
>>       die "unknown node type '$type'";
>>    }
>>    # node-name must start with an alphabetical character
>>    return "${prefix}${encoded}";
>>}

Ok !

I'm going to test it like this

(I'll be busy with proxmox training tomorrow && friday, so I'll rework
on it next week)





More information about the pve-devel mailing list