mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-07 11:10:24 +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 {
|
my $createfn = sub {
|
||||||
|
|
||||||
# second test (after locking test is accurate)
|
# test after locking
|
||||||
die "unable to create vm $vmid: config file already exists\n"
|
die "unable to create vm $vmid: config file already exists\n"
|
||||||
if -f $filename;
|
if -f $filename;
|
||||||
|
|
||||||
@ -389,7 +389,7 @@ __PACKAGE__->register_method({
|
|||||||
return $rpcenv->fork_worker('qmcreate', $vmid, $authuser, $realcmd);
|
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({
|
__PACKAGE__->register_method({
|
||||||
|
@ -1332,18 +1332,24 @@ sub check_type {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub lock_config {
|
sub lock_config_full {
|
||||||
my ($vmid, $code, @param) = @_;
|
my ($vmid, $timeout, $code, @param) = @_;
|
||||||
|
|
||||||
my $filename = config_file_lock($vmid);
|
my $filename = config_file_lock($vmid);
|
||||||
|
|
||||||
my $res = lock_file($filename, 10, $code, @param);
|
my $res = lock_file($filename, $timeout, $code, @param);
|
||||||
|
|
||||||
die $@ if $@;
|
die $@ if $@;
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub lock_config {
|
||||||
|
my ($vmid, $code, @param) = @_;
|
||||||
|
|
||||||
|
return lock_config_full($vmid, 10, $code, @param);
|
||||||
|
}
|
||||||
|
|
||||||
sub cfs_config_path {
|
sub cfs_config_path {
|
||||||
my ($vmid, $node) = @_;
|
my ($vmid, $node) = @_;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user