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:
20
tests/acceptance/fakes/source/sigterm_after_hello.rb
Executable file
20
tests/acceptance/fakes/source/sigterm_after_hello.rb
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# Connect to the listener, wait for the hello, then sigterm the
|
||||
# listener. We expect the listener to exit with a status of 6, which
|
||||
# is enforced in the test.
|
||||
|
||||
require 'flexnbd/fake_source'
|
||||
include FlexNBD
|
||||
|
||||
addr, port, pid = *ARGV
|
||||
|
||||
client = FakeSource.new( addr, port, "Timed out connecting." )
|
||||
client.read_hello
|
||||
|
||||
Process.kill( "TERM", pid.to_i )
|
||||
|
||||
sleep(0.2)
|
||||
client.close
|
||||
|
||||
exit(0)
|
Reference in New Issue
Block a user