6f4ee4d daemon: graceful pid handling

Authored and Committed by teigland 12 years ago
    daemon: graceful pid handling
    
    Add the "killpath" api to set a program/script for
    "killing" a pid/connection, where killing could
    be anything that either causes the pid to exit,
    or causes the pid to be put into a safe state and
    releases its leases, e.g. pausing a vm.
    
    Add a helper process to fork/exec the killpaths.
    
    If pids need to be killed, a configured killpath will
    first be run instead of kill(SIGTERM).  If the pid
    has not exited or had its leases released before
    the existing SIGTERM time limit, then sanlock will
    escalate to SIGKILL.
    
    This allows for the following:
    
    - pids running with leases in lockspace
    - lockspace storage fails (i/o errors, host_id cannot be renewed)
    - sanlock runs killpath for each pid
    - killpath does inquire, saves state, releases leases
    - sanlock finds no more pids with leases in lockspace
    - sanlock releases lockspace
    - pids remain, but without leases
    
    later:
    
    - lockspace storage is restored
    - add_lockspace reacquires host_id
    - leases are reacquired for each pid using saved state
    - pids running with leases again
    
    This sequence is used by the following test:
    cd tests
    cp killpath /root/killpath_pause
    
    On host_id 1
    ./clientn 2 init /dev/bull/leases
    ./clientn 2 start /dev/bull/leases 1 /root/killpath_pause
    ./clientn 2 error /dev/bull/leases
    ./clientn 2 resume /dev/bull/leases 1
    
    If between error and resume, host_id 2 completes:
    ./clientn 2 start /dev/bull/leases 2 /root/killpath_pause
    
    Then, the resume on host_id 1 will fail and the sanlk_client
    pids will be killed.
    
    Python changes from:
    Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
    
    Signed-off-by: David Teigland <teigland@redhat.com>
    
        
file modified
+84 -0
file modified
+1 -0
file modified
+35 -0
file modified
+96 -0
file added
+247
file added
+45
file modified
+260 -10
file modified
+7 -0
file modified
+28 -0
file modified
+5 -0
file modified
+10 -292
file modified
+5 -0
file modified
+1 -0
file modified
+0 -9
file added
+403
file modified
+16 -6
file added
+87
file added
+77
file added
+93
file modified
+3 -1