Allow proxy to pass NBD protocol errors downstream; server returns EINVAL/ENOSPC appropriately

Previously the proxy would just disconnect when it saw an NBD protocol
error, and retry the operation it was in the middle of.

Additionally, the server needs to return the correct error types when
this happens.
This commit is contained in:
Patrick J Cherry
2018-02-08 13:19:51 +00:00
parent 806de13024
commit 8beb3f0af6
4 changed files with 46 additions and 10 deletions

View File

@@ -72,6 +72,20 @@ module ProxyTests
end
end
def test_write_request_past_end_of_disc_returns_to_client
with_proxied_client do |client|
n = 1000
offset = n * 4096
client.write(offset, b * 4096)
rsp = client.read_response
assert_equal FlexNBD::REPLY_MAGIC, rsp[:magic]
assert_equal 'myhandle', rsp[:handle]
# NBD protocol say ENOSPC (28) in this situation
assert_equal 28, rsp[:error]
end
end
def make_fake_server
server = FlexNBD::FakeDest.new(@env.ip, @env.port1)
@server_up = true