Skip to content

Commit

Permalink
gluster: fix .bdrv_reopen_prepare when backing file is a JSON object
Browse files Browse the repository at this point in the history
When the backing_file is specified as a JSON object, the
qemu_gluster_reopen_prepare() fails with this message:
    invalid URI json:{"server.0.host": ...}

In this case, we should call qemu_gluster_init() using the QDict
'state->options' that contains the JSON parameters already parsed.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1542445
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-id: 20190715132844.506584-1-sgarzare@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
  • Loading branch information
stefano-garzarella authored and XanClic committed Jul 15, 2019
1 parent 0e4a064 commit 0b1847b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion block/gluster.c
Expand Up @@ -931,7 +931,17 @@ static int qemu_gluster_reopen_prepare(BDRVReopenState *state,
gconf->has_debug = true;
gconf->logfile = g_strdup(s->logfile);
gconf->has_logfile = true;
reop_s->glfs = qemu_gluster_init(gconf, state->bs->filename, NULL, errp);

/*
* If 'state->bs->exact_filename' is empty, 'state->options' should contain
* the JSON parameters already parsed.
*/
if (state->bs->exact_filename[0] != '\0') {
reop_s->glfs = qemu_gluster_init(gconf, state->bs->exact_filename, NULL,
errp);
} else {
reop_s->glfs = qemu_gluster_init(gconf, NULL, state->options, errp);
}
if (reop_s->glfs == NULL) {
ret = -errno;
goto exit;
Expand Down

0 comments on commit 0b1847b

Please sign in to comment.