From c7db1e40c41ada5f9b1812944c0cbc24e460ebc3 Mon Sep 17 00:00:00 2001 From: Emmanuel Kasper Date: Wed, 12 Jul 2017 17:53:35 +0200 Subject: [PATCH] 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 --- PVE/CLI/qm.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm index f6fe4a2f..e1921531 100755 --- a/PVE/CLI/qm.pm +++ b/PVE/CLI/qm.pm @@ -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; -- 2.39.5