mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-10-04 21:14:21 +00:00
add lock around update_vm code
This commit is contained in:
parent
afdb31d5f8
commit
5d39a18227
@ -455,6 +455,8 @@ __PACKAGE__->register_method({
|
||||
|
||||
&$resolve_cdrom_alias($param);
|
||||
|
||||
my $updatefn = sub {
|
||||
|
||||
my $conf = PVE::QemuServer::load_config($vmid);
|
||||
|
||||
die "checksum missmatch (file change by other user?)\n"
|
||||
@ -471,8 +473,6 @@ __PACKAGE__->register_method({
|
||||
die "you can't use '-$opt' and '-delete $opt' at the same time\n"
|
||||
if defined($param->{$opt});
|
||||
|
||||
my $unset = {};
|
||||
|
||||
if (!PVE::QemuServer::option_exists($opt)) {
|
||||
raise_param_exc({ delete => "unknown option '$opt'" });
|
||||
}
|
||||
@ -510,12 +510,9 @@ __PACKAGE__->register_method({
|
||||
warn $@ if $@;
|
||||
}
|
||||
|
||||
$unset->{$opt} = 1;
|
||||
PVE::QemuServer::change_config_nolock($vmid, {}, $unset, 1);
|
||||
PVE::QemuServer::change_config_nolock($vmid, {}, { $opt => 1 }, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#add
|
||||
foreach my $opt (keys %$param) {
|
||||
|
||||
@ -573,6 +570,9 @@ __PACKAGE__->register_method({
|
||||
|
||||
PVE::QemuServer::change_config_nolock($vmid, { $opt => $param->{$opt} }, {}, 1);
|
||||
}
|
||||
};
|
||||
|
||||
PVE::QemuServer::lock_config($vmid, $updatefn);
|
||||
|
||||
return undef;
|
||||
}});
|
||||
|
Loading…
Reference in New Issue
Block a user