config: revamp NoWrite interface

instead of blessing a passed-in config and returning it, explicitly only bless
without returning to make it more obvious to callers that this affects the
argument.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2025-02-18 13:56:58 +01:00
parent 3d32c4e588
commit 275a6f477c
2 changed files with 4 additions and 4 deletions

View File

@ -7,12 +7,10 @@ use PVE::RESTEnvironment qw(log_warn);
use base qw(PVE::QemuConfig);
sub new {
sub mark_config {
my ($class, $conf) = @_;
bless($conf, $class);
return $conf;
}
sub write_config {

View File

@ -3398,7 +3398,6 @@ sub config_to_command {
bios => $conf->{bios}, # so efidisk gets included if it exists
name => $conf->{name}, # so it's correct in the process list
};
$newconf = PVE::QemuConfig::NoWrite->new($newconf);
# copy all disks over
for my $device (PVE::QemuServer::Drive::valid_drive_names()) {
@ -3407,6 +3406,9 @@ sub config_to_command {
# remaining configs stay default
# mark config to prevent writing it out
PVE::QemuConfig::NoWrite->mark_config($newconf);
$conf = $newconf;
}