qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH for-2.9] iscsi: Fix iscsi_create


From: Max Reitz
Subject: Re: [Qemu-block] [PATCH for-2.9] iscsi: Fix iscsi_create
Date: Mon, 10 Apr 2017 17:17:07 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 10.04.2017 09:54, Fam Zheng wrote:
> Since d5895fcb (iscsi: Split URL into individual options), creating
> qcow2 image on an iscsi LUN fails:
> 
>     qemu-img create -f qcow2 iscsi://$SERVER/$IQN/0 1G
>     qemu-img: iscsi://$SERVER/$IQN/0: Could not create image: Invalid
>         argument
> 
> The problem is iscsi_open now expects that transport_name, portal and
> target are already parsed into structured options by
> iscsi_parse_filename, but it is not called in iscsi_create.
> 
> Signed-off-by: Fam Zheng <address@hidden>
> ---
>  block/iscsi.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/block/iscsi.c b/block/iscsi.c
> index 716e74a..07596b5 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -2092,6 +2092,7 @@ static int iscsi_create(const char *filename, QemuOpts 
> *opts, Error **errp)
>      BlockDriverState *bs;
>      IscsiLun *iscsilun = NULL;
>      QDict *bs_options;
> +    Error *local_err = NULL;
>  
>      bs = bdrv_new();
>  
> @@ -2103,7 +2104,13 @@ static int iscsi_create(const char *filename, QemuOpts 
> *opts, Error **errp)
>  
>      bs_options = qdict_new();
>      qdict_put(bs_options, "filename", qstring_from_str(filename));

Doesn't the below change make this qdict_put() superfluous?

Max

> -    ret = iscsi_open(bs, bs_options, 0, NULL);
> +    iscsi_parse_filename(filename, bs_options, &local_err);
> +    if (local_err) {
> +        error_propagate(errp, local_err);
> +        ret = -EINVAL;
> +    } else {
> +        ret = iscsi_open(bs, bs_options, 0, NULL);
> +    }
>      QDECREF(bs_options);
>  
>      if (ret != 0) {
> 


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]