Bug 2217204

Summary: Protocol Driver 'iscsi' Does Not Support Image Creation
Product: Red Hat Enterprise Linux 8 Reporter: Tingting Mao <timao>
Component: qemu-kvmAssignee: Hanna Czenczek <hreitz>
qemu-kvm sub component: iSCSI QA Contact: Tingting Mao <timao>
Status: CLOSED WONTFIX Docs Contact:
Severity: medium    
Priority: medium CC: aliang, chayang, coli, jinzhao, juzhang, kwolf, virt-maint, xuwei
Version: 8.9Keywords: Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-13 12:26:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tingting Mao 2023-06-25 02:21:21 UTC
Description of problem:
Protocol driver 'iscsi' does not support image creation.


Version-Release number of selected component (if applicable):
qemu-kvm-6.2.0-35.module+el8.9.0+19166+e262ca96


How reproducible:
100%


Steps to Reproduce:
# qemu-img create -f raw iscsi:// 5G
Formatting 'iscsi://', fmt=raw size=5368709120
qemu-img: iscsi://: Protocol driver 'iscsi' does not support image creation, and opening the image failed: Failed to parse URL : iscsi://


Actual results:
As above


Expected results:
Image creationg should be supported.


Additional info:

Comment 1 Kevin Wolf 2023-06-26 11:04:39 UTC
iscsi:// alone is not a valid path, it requires a valid path to an iscsi device (like host_device requires a valid path to an existing host block device).

The error message might be a bit confusing, though. While the 'iscsi' driver doesn't implement image creation, it does support 'qemu-img create' from the user's perspective.

Anyway, Hanna, it's your code, so you get to decide whether you want to change anything or not.

Comment 2 Tingting Mao 2023-06-27 02:10:17 UTC
Thanks Kevin's explanation. I will set lower priority for the bug then.

And yes, the error message is a bit confusing, because as I tried with other protocal, like rbd, it will not prompt the protocal is not supported.

# qemu-img create -f raw rbd://xxx 1G
Formatting 'rbd://xxx', fmt=raw size=1073741824
qemu-img: rbd://xxx: error opening pool : No such file or directory

Comment 3 Kevin Wolf 2023-06-27 09:01:46 UTC
Note that a difference with rbd is that rbd can actually create new block devices, iscsi can only use existing devices.

But of course, the error message is still confusing.

Comment 4 Tingting Mao 2023-06-28 08:19:40 UTC
(In reply to Kevin Wolf from comment #3)
> Note that a difference with rbd is that rbd can actually create new block
> devices, iscsi can only use existing devices.
> 
> But of course, the error message is still confusing.

Ah, get it. Thanks for the clarification.

Comment 5 Hanna Czenczek 2023-07-03 12:15:12 UTC
I’m not sure how the error message can be improved.  As far as I understand, it is completely true that our iscsi driver does not support creating a new image, so it only allows using an existing image for “creation”.  The error message reflects this: New images cannot be created, and no existing image can be found under the given URL.

Should the error message simply not say that new images cannot be created?  I would find that confusing, too, when I try to create a new image (e.g. `qemu-img create nbd://localhost/new_image 64M`) and the error message only tells me that no such existing image can be opened, when clearly, I’m trying to create a new one.

Should it be more verbose?  E.g. "Protocol driver '$DRIVER' does not support creating new images, so an existing image must be selected as the target; however, opening the given target as an existing image failed: $REASON"?

Comment 6 Tingting Mao 2023-07-04 02:17:40 UTC
(In reply to Hanna Czenczek from comment #5)
> I’m not sure how the error message can be improved.  As far as I understand,
> it is completely true that our iscsi driver does not support creating a new
> image, so it only allows using an existing image for “creation”.  The error
> message reflects this: New images cannot be created, and no existing image
> can be found under the given URL.
> 
> Should the error message simply not say that new images cannot be created? 
> I would find that confusing, too, when I try to create a new image (e.g.
> `qemu-img create nbd://localhost/new_image 64M`) and the error message only
> tells me that no such existing image can be opened, when clearly, I’m trying
> to create a new one.
> 
> Should it be more verbose?  E.g. "Protocol driver '$DRIVER' does not support
> creating new images, so an existing image must be selected as the target;
> however, opening the given target as an existing image failed: $REASON"?

This would be clear enough for me. 

And "Protocol driver '$DRIVER' does not support new image creation, so an existing image must be specified as the target;
however, opening the given target failed: $REASON"?" would be also good for me.

Thanks.

Comment 7 Kevin Wolf 2023-07-04 14:07:44 UTC
(In reply to Hanna Czenczek from comment #5)
> Should it be more verbose?  E.g. "Protocol driver '$DRIVER' does not support
> creating new images, so an existing image must be selected as the target;
> however, opening the given target as an existing image failed: $REASON"?

Yes, I think this would be much clearer. The problem with the current message is that the command is 'qemu-img create', so "creating" is likely to be understood as "'qemu-img create' can't work for this protocol". With your change, it's clear that this is not what is meant.

Comment 8 Hanna Czenczek 2023-09-13 12:26:48 UTC
Closing this BZ: I’m not planning to (explicitly) fix this for 8.x.  To have a BZ for 9.4, we’d need to clone this one, which doesn’t make much sense now with the transition to Jira.

I’ve set the linked Jira issue’s “Fix Version/s” to 9.4.0, and I’ll continue to track progress there (https://issues.redhat.com/browse/RHELPLAN-160669).