[pve-devel] [RFC storage 1/3] plugin: add method to get qemu blockdevice options for volume
Fiona Ebner
f.ebner at proxmox.com
Fri May 23 11:53:14 CEST 2025
Am 23.05.25 um 11:34 schrieb DERUMIER, Alexandre:
>>> I intentionally do not handle CD-ROMs, qemu-server should be
>>> concerned
>>> with doing that. There is a comment about this ;)
>
> I mean, could it better to have something like this ? :
>
>
> sub qemu_blockdev_options {
> my ($cfg, $volid, $snapname) = @_;
>
> my ($storeid, $volname) = parse_volume_id($volid, 1);
>
> if($storeid) {
> my $scfg = storage_config($cfg, $storeid);
>
> my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
> my ($vtype) = $plugin->parse_volname($volname);
>
> die "cannot use volume of type '$vtype' as a QEMU
> blockdevice\n"
> if $vtype ne 'images' && $vtype ne 'iso' && $vtype ne
> 'import';
>
> die "QEMU blockdevice - 'snapname' argument is not supported
> for vtype '$vtype'"
> if $snapname && $vtype ne 'images';
> } elsif ($volid =~ m|^/|) {
> my $st = File::stat::stat($volid);
> my $driver = (S_ISCHR($st->mode) || S_ISBLK($st->mode)) ?
> 'host_device' : 'file';
> return { driver => $driver, filename => $volid };
> }
>
> return $plugin->qemu_blockdev_options($scfg, $storeid, $volname,
> $snapname);
> }
Yes, it would be possible, and it is a close call. But I briefly chatted
with Fabian off-list and we think it's better to do this in qemu-server,
together with the CD-ROM handling. Since the whole use-case is related
to a QEMU-specific interface already.
More information about the pve-devel
mailing list