[pve-devel] [PATCH qemu-server] Fix #1417: verify is the target storage allows disk images before important

Emmanuel Kasper e.kasper at proxmox.com
Wed Jul 12 16:25:47 CEST 2017


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 f6fe4a2..e192153 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.11.0





More information about the pve-devel mailing list