[pve-devel] [PATCH v2 qemu-server 3/3] restore: remove efidisk from config if not backed up

Stefan Reiter s.reiter at proxmox.com
Thu Jul 8 13:46:02 CEST 2021


If it doesn't exist, there's no need to keep it around at all. Such a
backup might easily be created if an efidisk is configured with BIOS
set to anything but 'OVMF'.

Unbreaks live-restore for such cases too.

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---

v1->v2:
* Actually remove efidisk from config, not just from launched version for
  live-restore - first, this allows one to restart the VM after the live-restore
  is done without errors, and second this way it also applies for normal
  restores (no reason to keep an efidisk configured that doesn't exist).
  After testing both I think I like this approach better, but feel free to keep
  the v1 version too...

 PVE/QemuServer.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 4082e69..9af0ad3 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6044,7 +6044,7 @@ my $restore_allocate_devices = sub {
 };
 
 sub restore_update_config_line {
-    my ($cookie, $map, $line, $unique) = @_;
+    my ($cookie, $map, $line, $unique, $rpcenv) = @_;
 
     return '' if $line =~ m/^\#qmdump\#/;
     return '' if $line =~ m/^\#vzdump\#/;
@@ -6088,6 +6088,11 @@ sub restore_update_config_line {
 	    $di->{file} = $map->{$virtdev};
 	    $value = print_drive($di);
 	    $res .= "$virtdev: $value\n";
+	} elsif ($line =~ m/^efidisk0/) {
+	    # ignore efidisk, this can happen when backing up a SeaBIOS VM with
+	    # an efidisk configured
+	    $rpcenv->warn("efidisk in config, but not backed up - removing from config")
+		if $rpcenv;
 	} else {
 	    $res .= $line;
 	}
@@ -6428,6 +6433,7 @@ sub restore_proxmox_backup_archive {
 		$map,
 		$line,
 		$options->{unique},
+		$rpcenv,
 	    );
 	}
 
-- 
2.30.2






More information about the pve-devel mailing list