[pve-devel] [PATCH v4 qemu-server] vm_start: check if storages of volumes support correct content-type

Lorenz Stechauner l.stechauner at proxmox.com
Tue Jun 22 14:30:30 CEST 2021


Signed-off-by: Lorenz Stechauner <l.stechauner at proxmox.com>
---
changes to v3:
* dropped already applied patch
* moved check to cfg2cmd (with helper)
* 'images' content-type is not anymore hard-coded

vm state files are not included anymore and efi disks have type 'images' - therefore they should work

 PVE/QemuServer.pm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index fe31741..d8e2d44 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3610,6 +3610,7 @@ sub config_to_command {
 	my ($ds, $drive) = @_;
 
 	if (PVE::Storage::parse_volume_id($drive->{file}, 1)) {
+	    check_volume_storage_type($storecfg, $drive->{file});
 	    push @$vollist, $drive->{file};
 	}
 
@@ -7736,4 +7737,17 @@ sub vm_is_paused {
     return $qmpstatus && $qmpstatus->{status} eq "paused";
 }
 
+sub check_volume_storage_type {
+    my ($storecfg, $vol) = @_;
+
+    my ($storeid, $volname) = PVE::Storage::parse_volume_id($vol);
+    my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
+    my ($vtype) = PVE::Storage::parse_volname($storecfg, $vol);
+
+    die "storage '$storeid' does not support content-type '$vtype'\n"
+	if !$scfg->{content}->{$vtype};
+
+    return 1;
+}
+
 1;
-- 
2.30.2






More information about the pve-devel mailing list