From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 qemu-server 2/3] config: introduce a flag to prevent writing the configuration
Date: Fri, 24 Jan 2025 11:53:50 +0100 [thread overview]
Message-ID: <20250124105351.43428-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20250124105351.43428-1-f.ebner@proxmox.com>
To be used in the context of template backup, where a minimized
temporary configuration is created to start the VM in 'prelaunch'
mode. Issue a warning, so that code paths where this happens will be
noted and can be evaluated and adapted.
Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
Changes in v2:
* add comment about decoupling config data and metadata
PVE/QemuConfig.pm | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/PVE/QemuConfig.pm b/PVE/QemuConfig.pm
index ffdf9f03..51e027b4 100644
--- a/PVE/QemuConfig.pm
+++ b/PVE/QemuConfig.pm
@@ -13,6 +13,7 @@ use PVE::QemuServer::Monitor qw(mon_cmd);
use PVE::QemuServer;
use PVE::QemuServer::Machine;
use PVE::QemuServer::Memory qw(get_current_memory);
+use PVE::RESTEnvironment qw(log_warn);
use PVE::Storage;
use PVE::Tools;
use PVE::Format qw(render_bytes render_duration);
@@ -561,6 +562,19 @@ sub get_derived_property {
}
}
+sub write_config {
+ my ($class, $vmid, $conf) = @_;
+
+ # FIXME avoid this mixing of actual config data and metadata - for example, could make the
+ # configuration a blessed object with appropriate methods.
+ if ($conf->{'no-write-config'}) {
+ log_warn("refusing to write temporary configuration with 'no-write-config' flag");
+ return;
+ }
+
+ return $class->SUPER::write_config($vmid, $conf);
+}
+
# END implemented abstract methods from PVE::AbstractConfig
sub has_cloudinit {
--
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-01-24 10:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-24 10:53 [pve-devel] [PATCH-SERIES v2 qemu-server 0/3] fix #6007: fix PBS template backup for certain configurations Fiona Ebner
2025-01-24 10:53 ` [pve-devel] [PATCH v2 qemu-server 1/3] backup: also restore VM power state for early failures Fiona Ebner
2025-01-24 10:53 ` Fiona Ebner [this message]
2025-01-24 10:53 ` [pve-devel] [PATCH v2 qemu-server 3/3] fix #6007: template backup: use minimized configuration for handling the full vm start 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=20250124105351.43428-3-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox