Improve the error message when a VM start fails due to a volume storage not supporting the volume's required content type by prefixing it with the disk handle (e.g. scsi0).
Signed-off-by: Daniel Kral <d.k...@proxmox.com> --- changes since v1: - none except relocation of helper PVE/QemuServer.pm | 17 +++-------------- .../unsupported-storage-content-type.conf | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 2f14bb52..07b7785f 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -3827,7 +3827,9 @@ sub config_to_command { my ($ds, $drive) = @_; if (PVE::Storage::parse_volume_id($drive->{file}, 1)) { - check_volume_storage_type($storecfg, $drive->{file}); + eval { PVE::Storage::assert_volume_type_supported($storecfg, $drive->{file}) }; + die "$ds: $@" if $@; + push @$vollist, $drive->{file}; } @@ -8708,19 +8710,6 @@ sub vm_is_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; -} - sub add_nets_bridge_fdb { my ($conf, $vmid) = @_; diff --git a/test/cfg2cmd/unsupported-storage-content-type.conf b/test/cfg2cmd/unsupported-storage-content-type.conf index e33165a8..e0903eff 100644 --- a/test/cfg2cmd/unsupported-storage-content-type.conf +++ b/test/cfg2cmd/unsupported-storage-content-type.conf @@ -1,3 +1,3 @@ # TEST: Unsupported storage content type in a volume disk -# EXPECT_ERROR: storage 'noimages' does not support content-type 'images' +# EXPECT_ERROR: scsi0: storage 'noimages' does not support content type 'images' scsi0: noimages:8006/vm-8006-disk-0.raw,iothread=1,size=32G -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel