From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 08/12] backup restore: improve missing drive handling
Date: Tue, 4 Mar 2025 11:44:09 +0100 [thread overview]
Message-ID: <20250304104413.38638-9-f.ebner@proxmox.com> (raw)
In-Reply-To: <20250304104413.38638-1-f.ebner@proxmox.com>
Currently, the configuration line for a drive that is marked for
backup (i.e. 'backup' flag not explicitly set to 0), but missing from
the restore map will be added verbatim to the restored configuration.
As reported in the community forum [0], this can cause issues with a
VM with a configured EFI disk, but not using OVMF BIOS. In such a
case, the EFI disk is not backed up, see the get_backup_volumes()
helper in QemuConfig.pm.
Writing out references to non-existent volumes to the restored config
will lead to issues starting the VM. Write such references as comments
instead, like is already done for volumes explicitly excluded from
backup. But add a warning since this is not expected, and info for the
EFI disk case.
Note that drives using absolute paths are either also backed-up and
will be allocated as new volumes during restore or explicitly marked
as excluded.
Continue preserving configuration lines for CD-ROMs. No CD-ROMs were
included in backups before commit "backup: include owned CD-ROM
volumes" and non-owned CD-ROM and cloud-init drives continue to be
excluded. Skipping owned CD-ROMs that are missing from the backup here
too (and maybe even those owned by another VM?) could be done in the
future, but might be considered a breaking change. Currently, the old
VM ID is also not readily available for such a check.
[0]: https://forum.proxmox.com/threads/160483/
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
PVE/QemuServer.pm | 12 +++++++++++-
test/restore-config-expected/140.conf | 4 ++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 454ee64a..f937b1d7 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6714,6 +6714,7 @@ sub restore_update_config_line {
$res .= "$id: $netstr\n";
} elsif ($line =~ m/^((ide|scsi|virtio|sata|efidisk|tpmstate)\d+):\s*(\S+)\s*$/) {
my $virtdev = $1;
+ my $interface = $2;
my $value = $3;
my $di = parse_drive($virtdev, $value);
if (defined($di->{backup}) && !$di->{backup}) {
@@ -6723,8 +6724,17 @@ sub restore_update_config_line {
$di->{file} = $map->{$virtdev};
$value = print_drive($di);
$res .= "$virtdev: $value\n";
- } else {
+ } elsif (PVE::QemuServer::Drive::drive_is_cdrom($di)) {
+ # TODO PVE 9 - skip owned (either by this or also other VM?) CD-ROMs that are not in
+ # backup (except cloud-init)
$res .= $line;
+ } else {
+ if ($interface eq 'efidisk') {
+ print "$virtdev: not part of the backup - SeaBIOS configured?\n";
+ } else {
+ log_warn("$virtdev: not part of the backup");
+ }
+ $res .= "#$line";
}
} elsif (($line =~ m/^vmgenid: (.*)/)) {
my $vmgenid = $1;
diff --git a/test/restore-config-expected/140.conf b/test/restore-config-expected/140.conf
index af1a4d59..33ba37a7 100644
--- a/test/restore-config-expected/140.conf
+++ b/test/restore-config-expected/140.conf
@@ -2,7 +2,7 @@
bios: seabios
boot: order=scsi0;ide2;net0
cores: 1
-efidisk0: mydir:140/vm-140-disk-0.qcow2,size=128K
+#efidisk0: mydir:140/vm-140-disk-0.qcow2,size=128K
ide2: local:iso/debian-10.6.0-amd64-netinst.iso,media=cdrom
memory: 2048
name: eficloneclone
@@ -10,7 +10,7 @@ net0: virtio=7A:6C:A5:8B:11:93,bridge=vmbr0,firewall=1
numa: 0
ostype: l26
scsi0: target:140/vm-140-disk-0.raw,size=4G
-scsi1: rbdkvm:vm-140-disk-2,size=1G
+#scsi1: rbdkvm:vm-140-disk-2,size=1G
scsihw: virtio-scsi-pci
smbios1: uuid=21a7e7bc-3cd2-4232-a009-a41f4ee992ae
sockets: 1
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-03-04 10:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-04 10:44 [pve-devel] [PATCH-SERIES guest-common/manager/qemu-server/container 00/12] backup/restore: improve missing drive and owned CD-ROM handling Fiona Ebner
2025-03-04 10:44 ` [pve-devel] [PATCH guest-common 01/12] abstract config: make get_backup_volumes() method more flexible Fiona Ebner
2025-03-04 10:44 ` [pve-devel] [PATCH manager 02/12] api: backup: adapt to new get_backup_volumes() signature Fiona Ebner
2025-03-04 10:44 ` [pve-devel] [PATCH qemu-server 03/12] cloudinit: avoid undefined value warning when no searchdomain is defined Fiona Ebner
2025-03-04 10:44 ` [pve-devel] [PATCH qemu-server 04/12] drive: move vm_is_volid_owner() and try_deallocate_drive() helpers to Drive module Fiona Ebner
2025-03-04 10:44 ` [pve-devel] [PATCH qemu-server 05/12] test: restore config: use diff to make failure human-readable Fiona Ebner
2025-03-04 10:44 ` [pve-devel] [PATCH qemu-server 06/12] test: restore config: add config with missing disks Fiona Ebner
2025-03-04 10:44 ` [pve-devel] [PATCH qemu-server 07/12] test: restore config: test behavior for disks with absolute paths Fiona Ebner
2025-03-04 10:44 ` Fiona Ebner [this message]
2025-03-04 10:44 ` [pve-devel] [PATCH qemu-server 09/12] backup: adapt to new get_backup_volumes() signature Fiona Ebner
2025-03-04 10:44 ` [pve-devel] [PATCH qemu-server 10/12] backup: include owned CD-ROM volumes Fiona Ebner
2025-03-04 10:44 ` [pve-devel] [PATCH qemu-server 11/12] destroy vm: add reminder to also remove owned CD-ROMs starting with PVE 9 Fiona Ebner
2025-03-04 10:44 ` [pve-devel] [PATCH container 12/12] backup: adapt to new get_backup_volumes() signature Fiona Ebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250304104413.38638-9-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.