aboutsummaryrefslogtreecommitdiff
path: root/block/nbd.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2019-06-18 14:43:23 +0300
committerEric Blake <eblake@redhat.com>2019-08-15 13:22:14 -0500
commitb172ae2e0ed38a1d058babe6a788f97c402e0e51 (patch)
tree09b919293e372976e4e2f8a029212563813d1cd2 /block/nbd.c
parenta34b1e5e06de777c0faaa78694c4e0775b2bef0c (diff)
block/nbd: add cmdline and qapi parameter reconnect-delay
Reconnect will be implemented in the following commit, so for now, in semantics below, disconnect itself is a "serious error". Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20190618114328.55249-5-vsementsov@virtuozzo.com> [eblake: slipped from 4.1 to 4.2] Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block/nbd.c')
-rw-r--r--block/nbd.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/block/nbd.c b/block/nbd.c
index d03b00fc30..de2a26097b 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -1275,6 +1275,7 @@ static int nbd_client_init(BlockDriverState *bs,
QCryptoTLSCreds *tlscreds,
const char *hostname,
const char *x_dirty_bitmap,
+ uint32_t reconnect_delay,
Error **errp)
{
int ret;
@@ -1600,6 +1601,17 @@ static QemuOptsList nbd_runtime_opts = {
.help = "experimental: expose named dirty bitmap in place of "
"block status",
},
+ {
+ .name = "reconnect-delay",
+ .type = QEMU_OPT_NUMBER,
+ .help = "On an unexpected disconnect, the nbd client tries to "
+ "connect again until succeeding or encountering a serious "
+ "error. During the first @reconnect-delay seconds, all "
+ "requests are paused and will be rerun on a successful "
+ "reconnect. After that time, any delayed requests and all "
+ "future requests before a successful reconnect will "
+ "immediately fail. Default 0",
+ },
{ /* end of list */ }
},
};
@@ -1651,7 +1663,9 @@ static int nbd_open(BlockDriverState *bs, QDict *options, int flags,
/* NBD handshake */
ret = nbd_client_init(bs, s->saddr, s->export, tlscreds, hostname,
- qemu_opt_get(opts, "x-dirty-bitmap"), errp);
+ qemu_opt_get(opts, "x-dirty-bitmap"),
+ qemu_opt_get_number(opts, "reconnect-delay", 0),
+ errp);
error:
if (tlscreds) {