]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
add queue_crm_commands_nolock
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 22 Dec 2015 08:47:30 +0000 (09:47 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 22 Dec 2015 08:47:30 +0000 (09:47 +0100)
src/PVE/HA/Sim/Hardware.pm

index 5a0d014231f1252ffcd639613b8dfb5332b22042..adccf2533873aa53c5243880d9144d5b21416385 100644 (file)
@@ -142,20 +142,26 @@ sub change_service_location {
     $self->write_service_config($conf);
 }
 
-sub queue_crm_commands {
+sub queue_crm_commands_nolock {
     my ($self, $cmd) = @_;
 
     chomp $cmd;
 
-    my $code = sub {
-       my $data = '';
-       my $filename = "$self->{statusdir}/crm_commands";
-       if (-f $filename) {
-           $data = PVE::Tools::file_get_contents($filename);
-       }
-       $data .= "$cmd\n";
-       PVE::Tools::file_set_contents($filename, $data);
-    };
+    my $data = '';
+    my $filename = "$self->{statusdir}/crm_commands";
+    if (-f $filename) {
+       $data = PVE::Tools::file_get_contents($filename);
+    }
+    $data .= "$cmd\n";
+    PVE::Tools::file_set_contents($filename, $data);
+
+    return undef;
+}
+
+sub queue_crm_commands {
+    my ($self, $cmd) = @_;
+
+    my $code = sub { $self->queue_crm_commands_nolock($cmd); };
  
     $self->global_lock($code);