]> git.proxmox.com Git - qemu-server.git/commitdiff
Fix #1417: make sure the target storage allows disk images before importing
authorEmmanuel Kasper <e.kasper@proxmox.com>
Wed, 12 Jul 2017 15:53:35 +0000 (17:53 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 13 Jul 2017 04:45:58 +0000 (06:45 +0200)
This was fixed in c46366fd494c7dd0cd46bf133146e6f7a98e32a4
for 'qm create', but 'qm importdisk' has the same issue

PVE/CLI/qm.pm

index f6fe4a2fa1d2557dbcc7d7a6bc79d943b17ddd75..e1921531c39420ef25a77d22457e136d678f273e 100755 (executable)
@@ -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;