curl: Support auto-read-only option

If read-only=off, but auto-read-only=on is given, just degrade to
read-only.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Kevin Wolf 2018-10-08 17:27:18 +02:00
parent 64107dc044
commit 6ceef36acb

View File

@ -684,10 +684,10 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
const char *protocol_delimiter;
int ret;
if (flags & BDRV_O_RDWR) {
error_setg(errp, "curl block device does not support writes");
return -EROFS;
ret = bdrv_apply_auto_read_only(bs, "curl driver does not support writes",
errp);
if (ret < 0) {
return ret;
}
if (!libcurl_initialized) {