]> git.proxmox.com Git - qemu-server.git/commitdiff
only wait 1 second to aquire lock on vm_create
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 27 Mar 2012 06:50:04 +0000 (08:50 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 27 Mar 2012 07:02:50 +0000 (09:02 +0200)
Waiting is not necessary, and we want to avoid delays in the GUI.

PVE/API2/Qemu.pm
PVE/QemuServer.pm

index 789b851a2b25550baa01fb34061b38043c386ff2..4978fb35c6a5983f21c77664c77b2556dae1421b 100644 (file)
@@ -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({
index 314c938281aa5a0f1a25b00cc05c903a62c18c5a..d21069c383f11c182df84b6d43d76a4ca36c11d1 100644 (file)
@@ -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) = @_;