[pve-devel] [PATCH qemu-server v2 07/15] fix #5284: cli: importovf: assert content type support for target storage

Daniel Kral d.kral at proxmox.com
Tue Feb 11 17:08:06 CET 2025


Asserts whether the target storage supports storing VM images before
importing a OVF manifest as a VM to the target storage.

Without the check in place, a VM volume can be imported to a storage,
which does not support VM images, but won't be able to start since any
attached volume must be stored on a supported storage.

Signed-off-by: Daniel Kral <d.kral at proxmox.com>
---
changes since v1:
- new! (was fixed without special notice in rfc, now it's more obvious)

 PVE/CLI/qm.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
index 4214a7ca..58167050 100755
--- a/PVE/CLI/qm.pm
+++ b/PVE/CLI/qm.pm
@@ -756,7 +756,9 @@ __PACKAGE__->register_method ({
 
 	die "$ovf_file: non-existent or non-regular file\n" if (! -f $ovf_file);
 	my $storecfg = PVE::Storage::config();
-	PVE::Storage::storage_check_enabled($storecfg, $storeid);
+	my $scfg = PVE::Storage::storage_check_enabled($storecfg, $storeid);
+	raise_param_exc({ storage => "storage '$storeid' does not support vm images" })
+	   if !$scfg->{content}->{images};
 
 	my $parsed = PVE::GuestImport::OVF::parse_ovf($ovf_file);
 
-- 
2.39.5





More information about the pve-devel mailing list