Bug 1315245

Summary: qemu-img unable to parse the prefix "file:" correctlly.
Product: Red Hat Enterprise Linux 7 Reporter: Ping Li <pingl>
Component: qemu-kvmAssignee: Hanna Czenczek <hreitz>
Status: CLOSED NEXTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.3CC: knoel, meyang, michen, ngu, rbalakri, shuang, virt-maint, xiagao, xutian, xuwei
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-08 19:05:40 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:

Description Ping Li 2016-03-07 11:06:29 UTC
Description of problem:
qemu-img unable to parse the prefix "file:" correctlly. Create an image using the prexif "file:", whose filename actually contains that prefix.

Version-Release number of selected component (if applicable):
qemu-kvm-1.5.3-108.el7
3.10.0-355.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.create an image with prefix 'file:'.
# qemu-img create -f qcow2 file:ip-192.168.254.185:asdf 5G


Actual results:
# qemu-img create -f qcow2 file:ip-192.168.254.185:asdf 5G
Formatting 'file:ip-192.168.254.185:asdf', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536 lazy_refcounts=off 
# ls -l
-rw-r--r-- 1 root root 197120 March   7 18:41 file:ip-192.168.254.185:asdf

Expected results:
Create an image whose name is "ip-192.168.254.185:asdf"

Additional info:
When test the issue on RHEL7.2, the case passed. 
RHEL7.2:
version of componests:
qemu-kvm-rhev-2.3.0-31.el7_2.8
3.10.0-327.13.1.el7.x86_64

# qemu-img create -f qcow2 file:ip-192.168.254.185:asdf 5G
Formatting 'file:ip-192.168.254.185:asdf', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
# ls -l
-rw-r--r-- 1 root root 197120 March   7 18:40 ip-192.168.254.185:asdf
# qemu-img info file:ip-192.168.254.185:asdf 
image: ip-192.168.254.185:asdf
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 196K
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

RHEL7.3:
version of componests:
qemu-kvm-1.5.3-108.el7
3.10.0-355.el7.x86_64

# qemu-img create -f qcow2 file:ip-192.168.254.185:asdf 5G
Formatting 'file:ip-192.168.254.185:asdf', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536 lazy_refcounts=off 
# ls -l
-rw-r--r-- 1 root root 197120 March   7 18:41 file:ip-192.168.254.185:asdf
# qemu-img info file:ip-192.168.254.185:asdf 
image: file:ip-192.168.254.185:asdf
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 196K
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false

#qemu-img create -f qcow2 ip-192.168.254.185:asdf 5G
qemu-img: ip-192.168.254.185:asdf: Unknown protocol 'ip-192.168.254.185:asdf'

Reference bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1072130

Comment 2 Ademar Reis 2016-03-08 19:05:40 UTC
From https://bugzilla.redhat.com/show_bug.cgi?id=1072130#c4:

"""
As your tests show, too, using the "file:" prefix creates an image whose filename actually contains that prefix, which is not correct. As I have said, I have sent upstream patches to fix this behavior which are however pretty difficult to backport. Therefore, my question (basically to everyone reading this bugzilla, therefore I'll leave needinfo cleared) remains:

Do we really need to fix the behavior in RHEL 6 for specifying the "file:" prefix ("file:foo:bar" should create a file named "foo:bar" instead of "file:foo:bar") or will the already working "./foo:bar" notation (which is probably more intuitive, anyway) suffice?
"""

Given the backport is not trivial, I'm closing this one in RHEL6 too. Please reopen if it's affecting customers or a layered product.