Quit with an error status on SIGTERM during migration

This prevents the supervisor from thinking that the migration completed
successfully.

In order to do this, I've introduced a new lock around the start (and
finish) of the migration so that we avoid a race between the signal
handler in the server_accept loop and the control thread mirror startup.
Without that, we'd risk successfully starting a migration after the
SIGTERM handler fired, which would be Bad.
This commit is contained in:
Alex Young
2012-10-04 14:41:55 +01:00
parent ddc57e76d1
commit f3e0d61323
10 changed files with 226 additions and 37 deletions

View File

@@ -136,11 +136,11 @@ class ValgrindKillingExecutor
def call( err )
Process.kill( "KILL", @pid )
$stderr.puts "*"*72
$stderr.puts "* Valgrind error spotted:"
$stderr.puts err.to_s.split("\n").map{|s| " #{s}"}
$stderr.puts "*"*72
Process.kill( "KILL", @pid )
exit(1)
end
@@ -323,7 +323,8 @@ module FlexNBD
def serve( file, *acl)
run_serve_cmd( serve_cmd( file, acl ) )
cmd = serve_cmd( file, acl )
run_serve_cmd( cmd )
end
def listen(file, *acl)