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.gruenbich...@proxmox.com>
Signed-off-by: Fiona Ebner <f.eb...@proxmox.com>
---
 PVE/QemuConfig.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/PVE/QemuConfig.pm b/PVE/QemuConfig.pm
index ffdf9f03..a2156abb 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,17 @@ sub get_derived_property {
     }
 }
 
+sub write_config {
+    my ($class, $vmid, $conf) = @_;
+
+    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

Reply via email to