5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-02-18 17:57:43 +03:00

Fix #1417: make sure the target storage allows disk images before importing

This was fixed in c46366fd494c7dd0cd46bf133146e6f7a98e32a4
for 'qm create', but 'qm importdisk' has the same issue
This commit is contained in:
Emmanuel Kasper 2017-07-12 17:53:35 +02:00 committed by Dietmar Maurer
parent c83ad58681
commit c7db1e40c4

View File

@ -420,9 +420,15 @@ __PACKAGE__->register_method ({
my $vm_conf = PVE::QemuConfig->load_config($vmid);
PVE::QemuConfig->check_lock($vm_conf);
die "$source: non-existent or non-regular file\n" if (! -f $source);
my $storecfg = PVE::Storage::config();
PVE::Storage::storage_check_enabled($storecfg, $storeid);
my $target_storage_config =
PVE::Storage::storage_config($storecfg, $storeid);
die "storage $storeid does not support vm images\n"
if !$target_storage_config->{content}->{images};
PVE::QemuServer::ImportDisk::do_import($source, $vmid, $storeid, { format => $format });
return undef;