From 35171ddb0d1ae016cfc6b2c2ddfa99992089aded Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabian=20Gr=C3=BCnbichler?= Date: Tue, 2 Jun 2020 10:46:27 +0200 Subject: [PATCH] fix #2774: add early check for non-managed volumes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit when checking whether a to-be-added drive's and the VM's replication status are matching. otherwise, we end up in a failing generic 'parse_volume_id' with no mention of the actual reason. adding 'replicate=0' to the new drive string fixes the underlying issue with and without this patch, so this is just a cosmetic/usability improvement. Signed-off-by: Fabian Grünbichler --- PVE/API2/Qemu.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 5e6fd42..974ee3b 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -1095,6 +1095,9 @@ my $update_vm_api = sub { return if PVE::QemuServer::drive_is_cdrom($drive); my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, 1); + die "cannot add non-managed/pass-through volume to a replicated VM\n" + if !defined($storeid); + return if defined($volname) && $volname eq 'cloudinit'; my $format; -- 2.39.2