Changeset 1577 for honeyclient

Show
Ignore:
Timestamp:
05/12/08 15:13:29 (7 months ago)
Author:
kindlund
Message:

Disabled multi-threaded snapshotting, since performing this as a subthread didn't work well.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/trunk/lib/HoneyClient/Manager/VM.pm

    r1547 r1577  
    43894389    unregisterVM($class, %args); 
    43904390 
    4391  
    4392     # Since this may take awhile, we perform the remaining operations in a child thread. 
    4393     my $thread = async { 
    4394  
    4395         # Register a kill signal handler. 
    4396         # This handler is designed to kill this thread upon overall module 
    4397         # destruction.  This handler should never be used for normal program 
    4398         # operations, since it will NOT release any locks/semaphores properly. 
    4399         local $SIG{USR1} = sub { threads->exit(); }; 
    4400  
    4401         $maxThreadSemaphore->down(); 
    4402         threads->yield(); 
    4403              
     4391    # Perform the snapshot operation... 
     4392    # XXX: Do this synchronously instead of asynchronously, since we've had problems running 
     4393    # this code in multi-threaded environments. 
     4394#    # Since this may take awhile, we perform the remaining operations in a child thread. 
     4395#    my $thread = async { 
     4396
     4397#        # Register a kill signal handler. 
     4398#        # This handler is designed to kill this thread upon overall module 
     4399#        # destruction.  This handler should never be used for normal program 
     4400#        # operations, since it will NOT release any locks/semaphores properly. 
     4401#        local $SIG{USR1} = sub { threads->exit(); }; 
     4402
     4403#        $maxThreadSemaphore->down(); 
     4404#        threads->yield(); 
     4405#             
    44044406        # Obtain the VM's lock. 
    44054407        my $vmSemaphore = _getVMlock($class, $args{'config'}); 
    4406          
    4407         local $SIG{INT} = sub {  
    4408             my $LOG = get_logger(); 
    4409             $LOG->warn("Asynchronous snapshot of ($vmDir) interrupted!"); 
    4410             # Release any acquired locks. 
    4411             $vmSemaphore->up(); 
    4412             $maxThreadSemaphore->up(); 
    4413             threads->exit(); 
    4414         }; 
    4415  
    4416         # Trap all faults that may occur from these asynchronous operations. 
    4417         # None of the VmPerl objects are thread-safe, so in order to perform the following 
    4418         # commands, we must do callbacks to the main thread over SOAP. 
    4419         # Yes, this is annoying and ugly. 
    4420         eval { 
    4421  
     4408#         
     4409#        local $SIG{INT} = sub {  
     4410#            my $LOG = get_logger(); 
     4411#            $LOG->warn("Asynchronous snapshot of ($vmDir) interrupted!"); 
     4412#            # Release any acquired locks. 
     4413#            $vmSemaphore->up(); 
     4414#            $maxThreadSemaphore->up(); 
     4415#            threads->exit(); 
     4416#        }; 
     4417
     4418#        # Trap all faults that may occur from these asynchronous operations. 
     4419#        # None of the VmPerl objects are thread-safe, so in order to perform the following 
     4420#        # commands, we must do callbacks to the main thread over SOAP. 
     4421#        # Yes, this is annoying and ugly. 
     4422#        eval { 
     4423
    44224424            # Lock the VM. 
    44234425            $vmSemaphore->down(); 
     
    44544456         
    44554457            # Now, reregister the VM... 
    4456             _callback($class, "registerVM", %args); 
     4458#            _callback($class, "registerVM", %args); 
     4459            registerVM($class, %args); 
    44574460 
    44584461            # Turn the VM back on, if it was on previously... 
    44594462            if ($powerState == VM_EXECUTION_STATE_ON) { 
    4460                 _callback($class, "startVM", %args); 
     4463#                _callback($class, "startVM", %args); 
     4464                startVM($class, %args); 
    44614465            } 
    4462         }; 
    4463  
    4464         # For any faults that did occur from the previous operations, be sure 
    4465         # to report them back via the fault queue. 
    4466         if ($@) { 
    4467             _queueFault($@); 
    4468         } 
    4469         $maxThreadSemaphore->up(); 
    4470         threads->exit(); 
    4471     }; 
     4466#        }; 
     4467
     4468#        # For any faults that did occur from the previous operations, be sure 
     4469#        # to report them back via the fault queue. 
     4470#        if ($@) { 
     4471#            _queueFault($@); 
     4472#        } 
     4473#        $maxThreadSemaphore->up(); 
     4474#        threads->exit(); 
     4475#    }; 
    44724476 
    44734477    return ($args{'snapshot_file'});