--- Begin Message ---
>>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);
}

--- End Message ---
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to