From 4c27b18c083baea20b976422367d0c836542befb Mon Sep 17 00:00:00 2001 From: Stefan Reiter Date: Wed, 21 Oct 2020 11:00:25 +0200 Subject: [PATCH] bootorder: don't print empty 'order=' property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specifying 'boot: order=' was intended to be used for an empty bootorder (i.e. no boot devices), but as it turns out our format parser doesn't like empty '-list' properties if they are nested in a subformat. Fixing this in JSONSchema sounds like a risky move, so instead just write 'boot: ' (without 'order=') to indicate an empty bootorder. The rest of the code handles it just fine, as this was valid before too. Incidentally also fixes a bug where you couldn't create a new VM without any disks if no explicit 'boot' property was specified (i.e. a simple 'qm create 100' without any parameters would fail). Reported-by: Dominic Jäger Signed-off-by: Stefan Reiter --- PVE/QemuServer.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 5cf72885..20e284cc 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -1148,6 +1148,7 @@ sub verify_bootdev { sub print_bootorder { my ($devs) = @_; + return "" if !@$devs; my $data = { order => join(';', @$devs) }; return PVE::JSONSchema::print_property_string($data, $boot_fmt); }