[pve-devel] [PATCH qemu-server 02/14] blockdev: cmdline: convert drive to blockdev syntax
Fabian Grünbichler
f.gruenbichler at proxmox.com
Wed May 7 10:41:05 CEST 2025
> Fiona Ebner <f.ebner at proxmox.com> hat am 06.05.2025 14:57 CEST geschrieben:
> > +
> > + ($storeid) = PVE::Storage::parse_volume_id($volid, 1);
> > + my $vtype = $storeid ? (PVE::Storage::parse_volname($storecfg, $drive->{file}))[0] : undef;
> > + die "$driveid: explicit media parameter is required for iso images\n"
> > + if !defined($drive->{media}) && defined($vtype) && $vtype eq 'iso';
> > +
> > + if (drive_is_cdrom($drive)) {
> > + $path = get_iso_path($storecfg, $volid);
> > + } elsif ($storeid) {
> > + $path = PVE::Storage::path($storecfg, $volid, $snap);
> > + $scfg = PVE::Storage::storage_config($storecfg, $storeid);
> > + }
> > + }
> > +
> > + if ($path =~ m/^rbd:(\S+)$/) {
> > +
> > + my $rbd_options = $1;
> > + $blockdev->{driver} = 'rbd';
> > +
> > + #map options to key=value pair (if not key is provided, this is the image)
> > + #options are seprated with : but we need to exclude \: used for ipv6 address
> > + my $options = {
> > + map {
> > + s/\\:/:/g; /^(.*?)=(.*)/ ? ($1=>$2) : (image=>$_)
> > + } $rbd_options =~ /(?:\\:|\[[^\]]*\]|[^:\\])+/g
> > + };
>
> Maybe we should add a new method to the storage plugin API to give us a
> hash with the necessary QEMU blockdev options? Because right now, we
> construct an implicit QEMU-path just to deconstruct it again, which is
> not nice at all. We can implement that for all our plugins and, for
> backwards-compatibility handling with third-party plugins, the default
> implementation in Plugin.pm could have the code you put here.
something like that sounds okay to me..
> Just not sure if the RBD plugin should put the generated ceph config in
> /run/qemu-server/${storeid}.ceph.conf then, or use some kind of
> /run/pve-storage path?
the latter seems like a better fit if the storage plugin generates the
file..
> CC @Fabian, opinions?
do we need both? or could a per-volume config file also replace the hash?
More information about the pve-devel
mailing list