qemu-server/PVE/QemuConfig/NoWrite.pm
Fiona Ebner 1afbefb2d0 config: add special class that prevents writing the configuration
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.

Since the code currently doesn't use blessed config objects, special
dispatching is needed to potentially defer to the new child class in
the write_config() method.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-02-18 15:06:04 +01:00

26 lines
354 B
Perl

package PVE::QemuConfig::NoWrite;
use strict;
use warnings;
use PVE::RESTEnvironment qw(log_warn);
use base qw(PVE::QemuConfig);
sub new {
my ($class, $conf) = @_;
bless($conf, $class);
return $conf;
}
sub write_config {
my ($class, $vmid, $conf) = @_;
log_warn("refusing to write temporary configuration");
return;
}
1;