mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-06 11:08:34 +00:00
only wait 1 second to aquire lock on vm_create
Waiting is not necessary, and we want to avoid delays in the GUI.
This commit is contained in:
parent
18744ba33f
commit
191435c643
@ -342,7 +342,7 @@ __PACKAGE__->register_method({
|
||||
|
||||
my $createfn = sub {
|
||||
|
||||
# second test (after locking test is accurate)
|
||||
# test after locking
|
||||
die "unable to create vm $vmid: config file already exists\n"
|
||||
if -f $filename;
|
||||
|
||||
@ -389,7 +389,7 @@ __PACKAGE__->register_method({
|
||||
return $rpcenv->fork_worker('qmcreate', $vmid, $authuser, $realcmd);
|
||||
};
|
||||
|
||||
return PVE::QemuServer::lock_config($vmid, $archive ? $restorefn : $createfn);
|
||||
return PVE::QemuServer::lock_config_full($vmid, 1, $archive ? $restorefn : $createfn);
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method({
|
||||
|
@ -1332,18 +1332,24 @@ sub check_type {
|
||||
}
|
||||
}
|
||||
|
||||
sub lock_config {
|
||||
my ($vmid, $code, @param) = @_;
|
||||
sub lock_config_full {
|
||||
my ($vmid, $timeout, $code, @param) = @_;
|
||||
|
||||
my $filename = config_file_lock($vmid);
|
||||
|
||||
my $res = lock_file($filename, 10, $code, @param);
|
||||
my $res = lock_file($filename, $timeout, $code, @param);
|
||||
|
||||
die $@ if $@;
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
sub lock_config {
|
||||
my ($vmid, $code, @param) = @_;
|
||||
|
||||
return lock_config_full($vmid, 10, $code, @param);
|
||||
}
|
||||
|
||||
sub cfs_config_path {
|
||||
my ($vmid, $node) = @_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user